realtime-avatar 0.27.5 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -2
- package/dist/{chunk-IJHM44YT.js → chunk-K3VC6BF7.js} +2 -1
- package/dist/{chunk-6E3SZH35.js → chunk-V7A4NRKC.js} +177 -62
- package/dist/express.d.ts +2 -2
- package/dist/express.js +2 -2
- package/dist/hono.d.ts +2 -2
- package/dist/hono.js +2 -2
- package/dist/index.d.ts +36 -6
- package/dist/index.js +1 -1
- package/dist/nextjs.d.ts +2 -2
- package/dist/nextjs.js +2 -2
- package/dist/{proxy-client-B7BAxMyL.d.ts → proxy-client-WjGIwL-t.d.ts} +44 -1
- package/dist/react-native.d.ts +2 -2
- package/dist/react-native.js +50 -4
- package/dist/react.d.ts +12 -3
- package/dist/react.js +54 -6
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/tanstack-start.d.ts +2 -2
- package/dist/tanstack-start.js +2 -2
- package/dist/{types-B1IR4EaJ.d.ts → types-Bli1UeP0.d.ts} +1 -1
- package/dist/{types-C8X50QT9.d.ts → types-yiemDkm0.d.ts} +274 -5
- package/package.json +1 -1
|
@@ -19,6 +19,23 @@ declare function useAvatarCamera({ allowed, active }: {
|
|
|
19
19
|
participant: livekit_client.LocalParticipant;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
declare const voiceErrorFrameSchema: z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"voice_error">;
|
|
24
|
+
code: z.ZodEnum<{
|
|
25
|
+
voice_webhook_url_not_allowed: "voice_webhook_url_not_allowed";
|
|
26
|
+
voice_webhook_unauthorized: "voice_webhook_unauthorized";
|
|
27
|
+
voice_webhook_unreachable: "voice_webhook_unreachable";
|
|
28
|
+
voice_webhook_timeout: "voice_webhook_timeout";
|
|
29
|
+
voice_webhook_http_error: "voice_webhook_http_error";
|
|
30
|
+
voice_webhook_unsupported_audio: "voice_webhook_unsupported_audio";
|
|
31
|
+
voice_webhook_empty_audio: "voice_webhook_empty_audio";
|
|
32
|
+
}>;
|
|
33
|
+
message: z.ZodString;
|
|
34
|
+
status: z.ZodOptional<z.ZodInt>;
|
|
35
|
+
fatal: z.ZodBoolean;
|
|
36
|
+
request_id: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
|
|
22
39
|
/**
|
|
23
40
|
* Wire schemas for the public Realtime Avatar API.
|
|
24
41
|
*
|
|
@@ -482,6 +499,8 @@ declare const approachingEndReasonSchema: z.ZodEnum<{
|
|
|
482
499
|
type ApproachingEndReason = z.infer<typeof approachingEndReasonSchema>;
|
|
483
500
|
declare const knownBehaviorStates: readonly ["idle", "listening", "thinking", "speaking"];
|
|
484
501
|
type KnownBehaviorState = (typeof knownBehaviorStates)[number];
|
|
502
|
+
/** Why the caller's voice webhook failed. Codes this SDK predates arrive as plain strings. */
|
|
503
|
+
type VoiceErrorCode = z.infer<typeof voiceErrorFrameSchema>["code"] | (string & {});
|
|
485
504
|
declare const capacityBusyResponseSchema: z.ZodObject<{
|
|
486
505
|
message: z.ZodString;
|
|
487
506
|
capacity: z.ZodObject<{
|
|
@@ -1818,6 +1837,22 @@ type ClipResult = {
|
|
|
1818
1837
|
accepted: boolean;
|
|
1819
1838
|
reason: string;
|
|
1820
1839
|
};
|
|
1840
|
+
|
|
1841
|
+
/**
|
|
1842
|
+
* Your voice webhook failed (a call minted with `voiceWebhook`), so the rest of that reply is not
|
|
1843
|
+
* spoken: the sentences after the failed one are not POSTed, and the next reply tries again.
|
|
1844
|
+
* `message` is one developer-facing sentence, never your URL, secret or response body. `status` is
|
|
1845
|
+
* the HTTP status when your endpoint answered. `fatal` means the call is ending: a 401 or 403, a
|
|
1846
|
+
* URL the worker refuses to call, or repeated failures, which end it with the last failure's code,
|
|
1847
|
+
* whatever that code is. `onEnded` follows with reason `failed`.
|
|
1848
|
+
*/
|
|
1849
|
+
type VoiceError = {
|
|
1850
|
+
code: VoiceErrorCode;
|
|
1851
|
+
message: string;
|
|
1852
|
+
status?: number;
|
|
1853
|
+
fatal: boolean;
|
|
1854
|
+
requestId?: string;
|
|
1855
|
+
};
|
|
1821
1856
|
/**
|
|
1822
1857
|
* The `useRealtimeSession` input. ADDITIVE over {@link UseSessionLifecycleInput}
|
|
1823
1858
|
* (whose `client`/`session`/`active`/`idleSeconds`/`idleWarnLeadSeconds`/reconnect
|
|
@@ -1869,6 +1904,8 @@ type UseRealtimeSessionInput<T extends LLMProvider = LLMProvider> = UseSessionLi
|
|
|
1869
1904
|
onBehaviorChange?: (b: BehaviorSnapshot) => void;
|
|
1870
1905
|
/** A clip request was answered (also resolved on the performAction promise). */
|
|
1871
1906
|
onClipResult?: (r: ClipResult) => void;
|
|
1907
|
+
/** Your voice webhook failed for a sentence; see {@link VoiceError}. Fires once per frame the worker sends. */
|
|
1908
|
+
onVoiceError?: (error: VoiceError) => void;
|
|
1872
1909
|
};
|
|
1873
1910
|
/**
|
|
1874
1911
|
* The composed realtime-session surface. `phase` is the {@link SessionLifecyclePhase}
|
|
@@ -1947,6 +1984,12 @@ type RealtimeSessionApi = SessionLifecycleApi & {
|
|
|
1947
1984
|
end: (reason?: EndReason) => void;
|
|
1948
1985
|
/** The avatar's live nonverbal behavior, or null pre-choreo (see {@link BehaviorSnapshot}). */
|
|
1949
1986
|
behavior: BehaviorSnapshot | null;
|
|
1987
|
+
/**
|
|
1988
|
+
* The last {@link VoiceError} of this call, or null. It outlives the call it ended; the next call
|
|
1989
|
+
* starts at null, whether it starts by deactivating and reactivating, a new avatar or mode, a
|
|
1990
|
+
* redial, or `reset()`.
|
|
1991
|
+
*/
|
|
1992
|
+
voiceError: VoiceError | null;
|
|
1950
1993
|
/** Request a declared semantic action; acceptance schedules it and does not prove playback. */
|
|
1951
1994
|
performAction: (actionId: string, opts?: {
|
|
1952
1995
|
timeoutMs?: number;
|
|
@@ -2084,4 +2127,4 @@ interface ProxyClientOptions {
|
|
|
2084
2127
|
}
|
|
2085
2128
|
declare function createProxyClient(options: ProxyClientOptions): AvatarSessionClient;
|
|
2086
2129
|
|
|
2087
|
-
export { MAX_SESSION_INSTRUCTIONS_CHARS as $, type AvatarVideoFit as A, type BehaviorSnapshot as B, type CallTranscript as C, DEFAULT_APPROACHING_END_LEAD_SECONDS as D, type EndReason as E, type FishTtsModel as F, type Governor as G, type GovernorConfig as H, type GovernorSignal as I, type GovernorState as J, type GraceWindowClosedEvent as K, type LiveKitSessionGrant as L, type GraceWindowOpenEvent as M, type GraceWindowState as N, type IdleWarningEvent as O, type InboundRtpCursor as P, type InboundRtpReading as Q, type KnownBehaviorState as R, type LLMProvider as S, type LLMSelection as T, type LiveKitAvatarGrantState as U, type LiveKitAvatarGrantStatus as V, type LiveKitCapacityState as W, type LiveKitConnectionStatus as X, type LiveKitSessionRequest as Y, type LiveKitSessionStartResult as Z, MAX_RECONNECT_ATTEMPTS as _, AdaptivePlayoutController as a, type
|
|
2130
|
+
export { MAX_SESSION_INSTRUCTIONS_CHARS as $, type AvatarVideoFit as A, type BehaviorSnapshot as B, type CallTranscript as C, DEFAULT_APPROACHING_END_LEAD_SECONDS as D, type EndReason as E, type FishTtsModel as F, type Governor as G, type GovernorConfig as H, type GovernorSignal as I, type GovernorState as J, type GraceWindowClosedEvent as K, type LiveKitSessionGrant as L, type GraceWindowOpenEvent as M, type GraceWindowState as N, type IdleWarningEvent as O, type InboundRtpCursor as P, type InboundRtpReading as Q, type KnownBehaviorState as R, type LLMProvider as S, type LLMSelection as T, type LiveKitAvatarGrantState as U, type LiveKitAvatarGrantStatus as V, type LiveKitCapacityState as W, type LiveKitConnectionStatus as X, type LiveKitSessionRequest as Y, type LiveKitSessionStartResult as Z, MAX_RECONNECT_ATTEMPTS as _, AdaptivePlayoutController as a, type MicLease as a$, type ProxyClientOptions as a0, type QualityCap as a1, RECONNECT_BACKOFF_MS as a2, type RealtimeAvatarRequestOptions as a3, type RealtimeSessionApi as a4, type RealtimeSessionMedia as a5, type RealtimeSessionRoomSinks as a6, type ReconnectPolicy as a7, type ReconnectingEvent as a8, type RecoveryState as a9, capacityStateFromGrant as aA, createProxyClient as aB, isNativeLiveTrackSubscribed as aC, knownBehaviorStates as aD, mapTurnState as aE, readInboundRtp as aF, sessionBehaviorSchema as aG, sessionClipSchema as aH, splitCallTranscript as aI, useAvatarAdaptivePlayoutDelay as aJ, useAvatarCamera as aK, useAvatarPlayoutDelay as aL, useAvatarQualityGovernor as aM, useCallTranscript as aN, useLiveKitAvatarGrant as aO, useLiveTrackProducing as aP, useMicLease as aQ, useRealtimeSession as aR, useReleaseMicLeaseOnTrackEnded as aS, useSessionLifecycle as aT, type CallMicrophone as aU, type CallAudioPlayback as aV, type CallMicrophoneProblem as aW, AvatarVideoSurface as aX, type AvatarVideoSurfaceProps as aY, type LivePlaybackKeeper as aZ, MIC_LEASE_ENDED_TIMEOUT_MS as a_, type RetryStep as aa, type SendTurnOptions as ab, type SessionBehavior as ac, type SessionClip as ad, type SessionClocks as ae, type SessionEndReason as af, type SessionLifecycleApi as ag, type SessionLifecyclePhase as ah, type SessionLifecyclePhaseKind as ai, SessionLifecycleRoomBridge as aj, type SessionLifecycleRoomBridgeProps as ak, type SessionReadinessFailure as al, type SurfaceLayers as am, type TranscriptSender as an, type TranscriptSenderOptions as ao, type TurnState as ap, type TurnTimeoutEvent as aq, type UseAvatarQualityGovernorInput as ar, type UseLiveKitAvatarGrantInput as as, type UseRealtimeSessionInput as at, type UseSessionLifecycleInput as au, type VoiceError as av, type VoiceErrorCode as aw, type VoiceSpec as ax, type VoiceSpecInput as ay, capacityErrorFromBusy as az, type AdaptivePlayoutDecision as b, NETWORK_QUALITY_POLICY as b0, type NetworkQualityStatus as b1, type PlayableVideoElement as b2, RealtimeAvatarCapacityError as b3, RealtimeAvatarLiveKitRoom as b4, type RealtimeAvatarLiveKitRoomProps as b5, shouldReplayPendingTurn as b6, type AdaptivePlayoutOptions as c, type AdaptivePlayoutSample as d, type ApproachingEndEvent as e, type ApproachingEndReason as f, type AvatarConnectionDetails as g, type AvatarSessionClient as h, type CallTranscriptSegment as i, type CartesiaTtsModel as j, type ClipResult as k, type ClosingTurnResult as l, type CreditsLowEvent as m, DEFAULT_CREDITS_LOW_LEAD_SECONDS as n, DEFAULT_GOVERNOR_CONFIG as o, DEFAULT_GRACE_CEILING_SECONDS as p, DEFAULT_GRACE_WINDOW_LEAD_SECONDS as q, DEFAULT_IDLE_SECONDS as r, DEFAULT_IDLE_WARN_LEAD_SECONDS as s, DEFAULT_READY_TIMEOUT_SECONDS as t, DEFAULT_TURN_TIMEOUT_SECONDS as u, type DeclaredInputSource as v, type EndedEvent as w, type ExtendResult as x, type FreezeReadingFn as y, type GovernorAction as z };
|
package/dist/react-native.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LiveKitRoomProps } from '@livekit/react-native';
|
|
2
2
|
export { AudioSession, VideoTrack, VideoTrackProps, registerGlobals } from '@livekit/react-native';
|
|
3
|
-
import { L as LiveKitSessionGrant, A as AvatarVideoFit } from './proxy-client-
|
|
4
|
-
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason, g as AvatarConnectionDetails, h as AvatarSessionClient, B as BehaviorSnapshot, C as CallTranscript, i as CallTranscriptSegment, j as CartesiaTtsModel, k as ClipResult, l as ClosingTurnResult, m as CreditsLowEvent, D as DEFAULT_APPROACHING_END_LEAD_SECONDS, n as DEFAULT_CREDITS_LOW_LEAD_SECONDS, o as DEFAULT_GOVERNOR_CONFIG, p as DEFAULT_GRACE_CEILING_SECONDS, q as DEFAULT_GRACE_WINDOW_LEAD_SECONDS, r as DEFAULT_IDLE_SECONDS, s as DEFAULT_IDLE_WARN_LEAD_SECONDS, t as DEFAULT_READY_TIMEOUT_SECONDS, u as DEFAULT_TURN_TIMEOUT_SECONDS, v as DeclaredInputSource, E as EndReason, w as EndedEvent, x as ExtendResult, F as FishTtsModel, y as FreezeReadingFn, G as Governor, z as GovernorAction, H as GovernorConfig, I as GovernorSignal, J as GovernorState, K as GraceWindowClosedEvent, M as GraceWindowOpenEvent, N as GraceWindowState, O as IdleWarningEvent, P as InboundRtpCursor, Q as InboundRtpReading, R as KnownBehaviorState, S as LLMProvider, T as LLMSelection, U as LiveKitAvatarGrantState, V as LiveKitAvatarGrantStatus, W as LiveKitCapacityState, X as LiveKitConnectionStatus, Y as LiveKitSessionRequest, Z as LiveKitSessionStartResult, _ as MAX_RECONNECT_ATTEMPTS, $ as MAX_SESSION_INSTRUCTIONS_CHARS, a0 as ProxyClientOptions, a1 as QualityCap, a2 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 SendTurnOptions, ac as SessionBehavior, ad as SessionClip, ae as SessionClocks, af as SessionEndReason, ag as SessionLifecycleApi, ah as SessionLifecyclePhase, ai as SessionLifecyclePhaseKind, aj as SessionLifecycleRoomBridge, ak as SessionLifecycleRoomBridgeProps, al as SessionReadinessFailure, am as SurfaceLayers, an as TranscriptSender, ao as TranscriptSenderOptions, ap as TurnState, aq as TurnTimeoutEvent, ar as UseAvatarQualityGovernorInput, as as UseLiveKitAvatarGrantInput, at as UseRealtimeSessionInput, au as UseSessionLifecycleInput, av as
|
|
3
|
+
import { L as LiveKitSessionGrant, A as AvatarVideoFit } from './proxy-client-WjGIwL-t.js';
|
|
4
|
+
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason, g as AvatarConnectionDetails, h as AvatarSessionClient, B as BehaviorSnapshot, C as CallTranscript, i as CallTranscriptSegment, j as CartesiaTtsModel, k as ClipResult, l as ClosingTurnResult, m as CreditsLowEvent, D as DEFAULT_APPROACHING_END_LEAD_SECONDS, n as DEFAULT_CREDITS_LOW_LEAD_SECONDS, o as DEFAULT_GOVERNOR_CONFIG, p as DEFAULT_GRACE_CEILING_SECONDS, q as DEFAULT_GRACE_WINDOW_LEAD_SECONDS, r as DEFAULT_IDLE_SECONDS, s as DEFAULT_IDLE_WARN_LEAD_SECONDS, t as DEFAULT_READY_TIMEOUT_SECONDS, u as DEFAULT_TURN_TIMEOUT_SECONDS, v as DeclaredInputSource, E as EndReason, w as EndedEvent, x as ExtendResult, F as FishTtsModel, y as FreezeReadingFn, G as Governor, z as GovernorAction, H as GovernorConfig, I as GovernorSignal, J as GovernorState, K as GraceWindowClosedEvent, M as GraceWindowOpenEvent, N as GraceWindowState, O as IdleWarningEvent, P as InboundRtpCursor, Q as InboundRtpReading, R as KnownBehaviorState, S as LLMProvider, T as LLMSelection, U as LiveKitAvatarGrantState, V as LiveKitAvatarGrantStatus, W as LiveKitCapacityState, X as LiveKitConnectionStatus, Y as LiveKitSessionRequest, Z as LiveKitSessionStartResult, _ as MAX_RECONNECT_ATTEMPTS, $ as MAX_SESSION_INSTRUCTIONS_CHARS, a0 as ProxyClientOptions, a1 as QualityCap, a2 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 SendTurnOptions, ac as SessionBehavior, ad as SessionClip, ae as SessionClocks, af as SessionEndReason, ag as SessionLifecycleApi, ah as SessionLifecyclePhase, ai as SessionLifecyclePhaseKind, aj as SessionLifecycleRoomBridge, ak as SessionLifecycleRoomBridgeProps, al as SessionReadinessFailure, am as SurfaceLayers, an as TranscriptSender, ao as TranscriptSenderOptions, ap as TurnState, aq as TurnTimeoutEvent, ar as UseAvatarQualityGovernorInput, as as UseLiveKitAvatarGrantInput, at as UseRealtimeSessionInput, au as UseSessionLifecycleInput, av as VoiceError, aw as VoiceErrorCode, ax as VoiceSpec, ay as VoiceSpecInput, az as capacityErrorFromBusy, aA as capacityStateFromGrant, aB as createProxyClient, aC as isNativeLiveTrackSubscribed, aD as knownBehaviorStates, aE as mapTurnState, aF as readInboundRtp, aG as sessionBehaviorSchema, aH as sessionClipSchema, aI as splitCallTranscript, aJ as useAvatarAdaptivePlayoutDelay, aK as useAvatarCamera, aL as useAvatarPlayoutDelay, aM as useAvatarQualityGovernor, aN as useCallTranscript, aO as useLiveKitAvatarGrant, aP as useLiveTrackProducing, aQ as useMicLease, aR as useRealtimeSession, aS as useReleaseMicLeaseOnTrackEnded, aT as useSessionLifecycle } from './proxy-client-WjGIwL-t.js';
|
|
5
5
|
import { ReactNode, ReactElement } from 'react';
|
|
6
6
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
7
7
|
export { useChat, useConnectionState, useLocalParticipant, useRoomContext, useTrackToggle, useTranscriptions, useVoiceAssistant } from '@livekit/components-react';
|
package/dist/react-native.js
CHANGED
|
@@ -324,6 +324,7 @@ var ERROR_SEMANTICS = {
|
|
|
324
324
|
"service_warming": { statuses: [503], message: "Realtime Avatar is warming up. Try again in a moment.", retryable: true },
|
|
325
325
|
"avatar_not_ready": { statuses: [409], message: "This avatar is still being built \u2014 it is usually ready within a minute. Try again then.", retryable: true },
|
|
326
326
|
"clip_library_not_ready": { statuses: [409], message: "This avatar's motion clips are still rendering. Try again in a minute.", retryable: true },
|
|
327
|
+
"avatar_not_callable": { statuses: [409], message: "This avatar only hosts a live stream and cannot take calls. Choose another avatar.", retryable: false },
|
|
327
328
|
"recording_unsupported": { statuses: [501], message: "Session recording is not enabled for this deployment.", retryable: false },
|
|
328
329
|
"recording_requires_new_room": { statuses: [422], message: "Recording requires a new session room. Start a fresh session to record it.", retryable: false },
|
|
329
330
|
"recording_unavailable": { statuses: [503], message: "Session recording is temporarily unavailable. Try again in a moment.", retryable: true }
|
|
@@ -1725,6 +1726,20 @@ var transcriptionOptionsSchema = z.object({
|
|
|
1725
1726
|
}).strict();
|
|
1726
1727
|
var schema02 = z.enum(["minor-sexual-content-v1", "safe-content-v1"]);
|
|
1727
1728
|
var contentPolicySchema = schema02;
|
|
1729
|
+
var schema03 = z.literal("voice_error");
|
|
1730
|
+
var schema12 = 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"]);
|
|
1731
|
+
var schema22 = z.string();
|
|
1732
|
+
var schema32 = z.int().min(-9007199254740991).max(9007199254740991);
|
|
1733
|
+
var schema42 = z.boolean();
|
|
1734
|
+
var schema5 = z.object({
|
|
1735
|
+
"kind": schema03,
|
|
1736
|
+
"code": schema12,
|
|
1737
|
+
"message": schema22,
|
|
1738
|
+
"status": schema32.optional(),
|
|
1739
|
+
"fatal": schema42,
|
|
1740
|
+
"request_id": schema22.optional()
|
|
1741
|
+
});
|
|
1742
|
+
var voiceErrorFrameSchema = schema5;
|
|
1728
1743
|
|
|
1729
1744
|
// ../client/src/wire.ts
|
|
1730
1745
|
var DEFAULT_AVATAR_ID = "maria";
|
|
@@ -2026,13 +2041,15 @@ var clipAckFrameSchema = z.object({
|
|
|
2026
2041
|
accepted: z.boolean(),
|
|
2027
2042
|
reason: z.string().max(64)
|
|
2028
2043
|
}).strip();
|
|
2044
|
+
var voiceErrorFrameSchema2 = voiceErrorFrameSchema.extend({ code: z.string().min(1) });
|
|
2029
2045
|
var lifecycleServerFrameSchema = z.discriminatedUnion("kind", [
|
|
2030
2046
|
sessionClockFrameSchema,
|
|
2031
2047
|
endingFrameSchema,
|
|
2032
2048
|
closingTurnDoneFrameSchema,
|
|
2033
2049
|
endedFrameSchema,
|
|
2034
2050
|
behaviorStateFrameSchema,
|
|
2035
|
-
clipAckFrameSchema
|
|
2051
|
+
clipAckFrameSchema,
|
|
2052
|
+
voiceErrorFrameSchema2
|
|
2036
2053
|
]);
|
|
2037
2054
|
var liveKitCapacitySnapshotSchema = z.object({
|
|
2038
2055
|
// Placement identity + per-worker session ceiling. These are always present on the
|
|
@@ -3294,6 +3311,7 @@ function useRealtimeSession(input) {
|
|
|
3294
3311
|
onEnded,
|
|
3295
3312
|
onBehaviorChange,
|
|
3296
3313
|
onClipResult,
|
|
3314
|
+
onVoiceError,
|
|
3297
3315
|
// everything else (client/active/idleSeconds/idleWarnLeadSeconds/reconnect/requestOptions…)
|
|
3298
3316
|
// flows straight into the inner SSOT hook.
|
|
3299
3317
|
...inner
|
|
@@ -3309,6 +3327,7 @@ function useRealtimeSession(input) {
|
|
|
3309
3327
|
const [turn, setTurn] = useState("quiet");
|
|
3310
3328
|
const [media, setMediaState] = useState({ video: "connecting", audio: "silent" });
|
|
3311
3329
|
const [behavior, setBehavior] = useState(null);
|
|
3330
|
+
const [voiceError, setVoiceError] = useState(null);
|
|
3312
3331
|
const [microphoneFacts2, setMicrophoneFactsState] = useState({
|
|
3313
3332
|
wanted: false,
|
|
3314
3333
|
connected: false,
|
|
@@ -3322,8 +3341,8 @@ function useRealtimeSession(input) {
|
|
|
3322
3341
|
const lastBehaviorRef = useRef(null);
|
|
3323
3342
|
const lastLabeledEndReasonRef = useRef(null);
|
|
3324
3343
|
const pendingClipsRef = useRef(/* @__PURE__ */ new Map());
|
|
3325
|
-
const cbRef = useRef({ onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult });
|
|
3326
|
-
cbRef.current = { onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult };
|
|
3344
|
+
const cbRef = useRef({ onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult, onVoiceError });
|
|
3345
|
+
cbRef.current = { onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult, onVoiceError };
|
|
3327
3346
|
const approachingEndLeadMs = positive(approachingEndLeadSeconds, DEFAULT_APPROACHING_END_LEAD_SECONDS) * 1e3;
|
|
3328
3347
|
const graceWindowLeadMs = positive(graceWindowLeadSeconds, DEFAULT_GRACE_WINDOW_LEAD_SECONDS) * 1e3;
|
|
3329
3348
|
const graceCeilingMs = positive(graceCeilingSeconds, DEFAULT_GRACE_CEILING_SECONDS) * 1e3;
|
|
@@ -3411,6 +3430,18 @@ function useRealtimeSession(input) {
|
|
|
3411
3430
|
cbRef.current.onClipResult?.(result);
|
|
3412
3431
|
break;
|
|
3413
3432
|
}
|
|
3433
|
+
case "voice_error": {
|
|
3434
|
+
const error = {
|
|
3435
|
+
code: f.code,
|
|
3436
|
+
message: f.message,
|
|
3437
|
+
...f.status === void 0 ? {} : { status: f.status },
|
|
3438
|
+
fatal: f.fatal,
|
|
3439
|
+
...f.request_id === void 0 ? {} : { requestId: f.request_id }
|
|
3440
|
+
};
|
|
3441
|
+
setVoiceError(error);
|
|
3442
|
+
cbRef.current.onVoiceError?.(error);
|
|
3443
|
+
break;
|
|
3444
|
+
}
|
|
3414
3445
|
}
|
|
3415
3446
|
}, []);
|
|
3416
3447
|
const registerDataPublisher = useCallback((publish) => {
|
|
@@ -3605,10 +3636,22 @@ function useRealtimeSession(input) {
|
|
|
3605
3636
|
if (active) return;
|
|
3606
3637
|
lastLabeledEndReasonRef.current = null;
|
|
3607
3638
|
setMicrophoneMuted(false);
|
|
3639
|
+
setVoiceError(null);
|
|
3608
3640
|
}, [active]);
|
|
3641
|
+
const grantSessionId = lifecycle.grant?.session_id ?? null;
|
|
3642
|
+
const voiceErrorGrantRef = useRef(null);
|
|
3643
|
+
useEffect(() => {
|
|
3644
|
+
if (phaseKind === "requesting") setVoiceError(null);
|
|
3645
|
+
if (grantSessionId === null) return;
|
|
3646
|
+
if (voiceErrorGrantRef.current !== null && voiceErrorGrantRef.current !== grantSessionId) setVoiceError(null);
|
|
3647
|
+
voiceErrorGrantRef.current = grantSessionId;
|
|
3648
|
+
}, [phaseKind, grantSessionId]);
|
|
3609
3649
|
const innerReconnect = lifecycle.reconnect;
|
|
3610
3650
|
const reconnect = useCallback(() => {
|
|
3611
|
-
if (phaseKind === "ended")
|
|
3651
|
+
if (phaseKind === "ended") {
|
|
3652
|
+
lastLabeledEndReasonRef.current = null;
|
|
3653
|
+
setVoiceError(null);
|
|
3654
|
+
}
|
|
3612
3655
|
innerReconnect();
|
|
3613
3656
|
}, [innerReconnect, phaseKind]);
|
|
3614
3657
|
const performAction = useCallback(
|
|
@@ -3657,6 +3700,7 @@ function useRealtimeSession(input) {
|
|
|
3657
3700
|
creditsLowFiredRef.current = false;
|
|
3658
3701
|
lastTurnRef.current = null;
|
|
3659
3702
|
setMicrophoneMuted(false);
|
|
3703
|
+
setVoiceError(null);
|
|
3660
3704
|
lifecycle.reset();
|
|
3661
3705
|
}, [lifecycle]);
|
|
3662
3706
|
return useMemo(
|
|
@@ -3685,6 +3729,7 @@ function useRealtimeSession(input) {
|
|
|
3685
3729
|
retryTurn,
|
|
3686
3730
|
end,
|
|
3687
3731
|
behavior,
|
|
3732
|
+
voiceError,
|
|
3688
3733
|
performAction,
|
|
3689
3734
|
onLifecycleData,
|
|
3690
3735
|
registerDataPublisher,
|
|
@@ -3717,6 +3762,7 @@ function useRealtimeSession(input) {
|
|
|
3717
3762
|
retryTurn,
|
|
3718
3763
|
end,
|
|
3719
3764
|
behavior,
|
|
3765
|
+
voiceError,
|
|
3720
3766
|
performAction,
|
|
3721
3767
|
onLifecycleData,
|
|
3722
3768
|
registerDataPublisher,
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ToolRegistration, RegisteredTool } from './tools.js';
|
|
2
|
-
import { ak as SessionLifecycleRoomBridgeProps, h as AvatarSessionClient, A as AvatarVideoFit,
|
|
3
|
-
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason, g as AvatarConnectionDetails,
|
|
2
|
+
import { ak as SessionLifecycleRoomBridgeProps, h as AvatarSessionClient, A as AvatarVideoFit, aU as CallMicrophone, aV as CallAudioPlayback, av as VoiceError, aW as CallMicrophoneProblem } from './proxy-client-WjGIwL-t.js';
|
|
3
|
+
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason, g as AvatarConnectionDetails, aX as AvatarVideoSurface, aY as AvatarVideoSurfaceProps, B as BehaviorSnapshot, C as CallTranscript, i as CallTranscriptSegment, j as CartesiaTtsModel, k as ClipResult, l as ClosingTurnResult, m as CreditsLowEvent, D as DEFAULT_APPROACHING_END_LEAD_SECONDS, n as DEFAULT_CREDITS_LOW_LEAD_SECONDS, o as DEFAULT_GOVERNOR_CONFIG, p as DEFAULT_GRACE_CEILING_SECONDS, q as DEFAULT_GRACE_WINDOW_LEAD_SECONDS, r as DEFAULT_IDLE_SECONDS, s as DEFAULT_IDLE_WARN_LEAD_SECONDS, t as DEFAULT_READY_TIMEOUT_SECONDS, u as DEFAULT_TURN_TIMEOUT_SECONDS, v as DeclaredInputSource, E as EndReason, w as EndedEvent, x as ExtendResult, F as FishTtsModel, y as FreezeReadingFn, G as Governor, z as GovernorAction, H as GovernorConfig, I as GovernorSignal, J as GovernorState, K as GraceWindowClosedEvent, M as GraceWindowOpenEvent, N as GraceWindowState, O as IdleWarningEvent, P as InboundRtpCursor, Q as InboundRtpReading, R as KnownBehaviorState, S as LLMProvider, T as LLMSelection, U as LiveKitAvatarGrantState, V as LiveKitAvatarGrantStatus, W as LiveKitCapacityState, X as LiveKitConnectionStatus, Y as LiveKitSessionRequest, Z as LiveKitSessionStartResult, aZ as LivePlaybackKeeper, _ as MAX_RECONNECT_ATTEMPTS, $ as MAX_SESSION_INSTRUCTIONS_CHARS, a_ as MIC_LEASE_ENDED_TIMEOUT_MS, a$ as MicLease, b0 as NETWORK_QUALITY_POLICY, b1 as NetworkQualityStatus, b2 as PlayableVideoElement, a0 as ProxyClientOptions, a1 as QualityCap, a2 as RECONNECT_BACKOFF_MS, b3 as RealtimeAvatarCapacityError, b4 as RealtimeAvatarLiveKitRoom, b5 as RealtimeAvatarLiveKitRoomProps, 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 SendTurnOptions, ac as SessionBehavior, ad as SessionClip, ae as SessionClocks, af as SessionEndReason, ag as SessionLifecycleApi, ah as SessionLifecyclePhase, ai as SessionLifecyclePhaseKind, aj as SessionLifecycleRoomBridge, al as SessionReadinessFailure, am as SurfaceLayers, an as TranscriptSender, ao as TranscriptSenderOptions, ap as TurnState, aq as TurnTimeoutEvent, ar as UseAvatarQualityGovernorInput, as as UseLiveKitAvatarGrantInput, at as UseRealtimeSessionInput, au as UseSessionLifecycleInput, aw as VoiceErrorCode, ax as VoiceSpec, ay as VoiceSpecInput, az as capacityErrorFromBusy, aA as capacityStateFromGrant, aB as createProxyClient, aD as knownBehaviorStates, aE as mapTurnState, aF as readInboundRtp, aG as sessionBehaviorSchema, aH as sessionClipSchema, b6 as shouldReplayPendingTurn, aI as splitCallTranscript, aJ as useAvatarAdaptivePlayoutDelay, aK as useAvatarCamera, aL as useAvatarPlayoutDelay, aM as useAvatarQualityGovernor, aN as useCallTranscript, aO as useLiveKitAvatarGrant, aQ as useMicLease, aR as useRealtimeSession, aS as useReleaseMicLeaseOnTrackEnded, aT as useSessionLifecycle } from './proxy-client-WjGIwL-t.js';
|
|
4
4
|
import { CSSProperties, ReactNode } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { R as RecordingArtifact } from './recording-ydFVySSd.js';
|
|
@@ -120,6 +120,8 @@ type AvatarCallHandle = {
|
|
|
120
120
|
keepAlive: () => void;
|
|
121
121
|
/** End now. */
|
|
122
122
|
end: () => void;
|
|
123
|
+
/** The last voice webhook failure of this call, or null. Only a call minted with `voiceWebhook` has one. */
|
|
124
|
+
voiceError: VoiceError | null;
|
|
123
125
|
};
|
|
124
126
|
type AvatarCallProps = Pick<SessionLifecycleRoomBridgeProps, "onConnectionDetailsChange"> & {
|
|
125
127
|
client: AvatarSessionClient;
|
|
@@ -171,6 +173,13 @@ type AvatarCallProps = Pick<SessionLifecycleRoomBridgeProps, "onConnectionDetail
|
|
|
171
173
|
* is live. Fires once per distinct problem. Show `hint`, then offer `retryMicrophone()`.
|
|
172
174
|
*/
|
|
173
175
|
onMicrophoneProblem?: (problem: AvatarCallMicrophoneProblem) => void;
|
|
176
|
+
/**
|
|
177
|
+
* Your voice webhook failed, so the rest of that reply is not spoken; the next reply tries again.
|
|
178
|
+
* Fires once per error the worker reports (it rate-limits them). When `fatal` (a 401 or 403, a
|
|
179
|
+
* refused URL, or repeated failures, carrying the last failure's code), the call is ending and
|
|
180
|
+
* `onEnded` follows with `failed`.
|
|
181
|
+
*/
|
|
182
|
+
onVoiceError?: (error: VoiceError) => void;
|
|
174
183
|
/**
|
|
175
184
|
* What to show while `audio` is `blocked` (the browser is muting her until a gesture):
|
|
176
185
|
* - `true` (default): a "Tap to turn on sound" button, top-centre over the video.
|
|
@@ -207,4 +216,4 @@ declare function RecordingPlayer({ assets, className }: {
|
|
|
207
216
|
className?: string;
|
|
208
217
|
}): react_jsx_runtime.JSX.Element;
|
|
209
218
|
|
|
210
|
-
export { AvatarCall, type AvatarCallAudio, type AvatarCallEndReason, type AvatarCallHandle, type AvatarCallMicrophone, type AvatarCallMicrophoneProblem, type AvatarCallProps, type AvatarCallStatus, AvatarSessionClient, AvatarVideoFit, type CharacterToolsState, DEFAULT_AVATAR_UNSTABLE_STALL_MS, type RecordingPlaybackAsset, RecordingPlayer, SessionLifecycleRoomBridgeProps, useAvatarCall, useCharacterTools };
|
|
219
|
+
export { AvatarCall, type AvatarCallAudio, type AvatarCallEndReason, type AvatarCallHandle, type AvatarCallMicrophone, type AvatarCallMicrophoneProblem, type AvatarCallProps, type AvatarCallStatus, AvatarSessionClient, AvatarVideoFit, type CharacterToolsState, DEFAULT_AVATAR_UNSTABLE_STALL_MS, type RecordingPlaybackAsset, RecordingPlayer, SessionLifecycleRoomBridgeProps, VoiceError, useAvatarCall, useCharacterTools };
|
package/dist/react.js
CHANGED
|
@@ -530,6 +530,7 @@ var ERROR_SEMANTICS = {
|
|
|
530
530
|
"service_warming": { statuses: [503], message: "Realtime Avatar is warming up. Try again in a moment.", retryable: true },
|
|
531
531
|
"avatar_not_ready": { statuses: [409], message: "This avatar is still being built \u2014 it is usually ready within a minute. Try again then.", retryable: true },
|
|
532
532
|
"clip_library_not_ready": { statuses: [409], message: "This avatar's motion clips are still rendering. Try again in a minute.", retryable: true },
|
|
533
|
+
"avatar_not_callable": { statuses: [409], message: "This avatar only hosts a live stream and cannot take calls. Choose another avatar.", retryable: false },
|
|
533
534
|
"recording_unsupported": { statuses: [501], message: "Session recording is not enabled for this deployment.", retryable: false },
|
|
534
535
|
"recording_requires_new_room": { statuses: [422], message: "Recording requires a new session room. Start a fresh session to record it.", retryable: false },
|
|
535
536
|
"recording_unavailable": { statuses: [503], message: "Session recording is temporarily unavailable. Try again in a moment.", retryable: true }
|
|
@@ -2344,6 +2345,20 @@ var transcriptionOptionsSchema = z.object({
|
|
|
2344
2345
|
}).strict();
|
|
2345
2346
|
var schema02 = z.enum(["minor-sexual-content-v1", "safe-content-v1"]);
|
|
2346
2347
|
var contentPolicySchema = schema02;
|
|
2348
|
+
var schema03 = z.literal("voice_error");
|
|
2349
|
+
var schema12 = 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"]);
|
|
2350
|
+
var schema22 = z.string();
|
|
2351
|
+
var schema32 = z.int().min(-9007199254740991).max(9007199254740991);
|
|
2352
|
+
var schema42 = z.boolean();
|
|
2353
|
+
var schema5 = z.object({
|
|
2354
|
+
"kind": schema03,
|
|
2355
|
+
"code": schema12,
|
|
2356
|
+
"message": schema22,
|
|
2357
|
+
"status": schema32.optional(),
|
|
2358
|
+
"fatal": schema42,
|
|
2359
|
+
"request_id": schema22.optional()
|
|
2360
|
+
});
|
|
2361
|
+
var voiceErrorFrameSchema = schema5;
|
|
2347
2362
|
|
|
2348
2363
|
// ../client/src/wire.ts
|
|
2349
2364
|
var DEFAULT_AVATAR_ID = "maria";
|
|
@@ -2645,13 +2660,15 @@ var clipAckFrameSchema = z.object({
|
|
|
2645
2660
|
accepted: z.boolean(),
|
|
2646
2661
|
reason: z.string().max(64)
|
|
2647
2662
|
}).strip();
|
|
2663
|
+
var voiceErrorFrameSchema2 = voiceErrorFrameSchema.extend({ code: z.string().min(1) });
|
|
2648
2664
|
var lifecycleServerFrameSchema = z.discriminatedUnion("kind", [
|
|
2649
2665
|
sessionClockFrameSchema,
|
|
2650
2666
|
endingFrameSchema,
|
|
2651
2667
|
closingTurnDoneFrameSchema,
|
|
2652
2668
|
endedFrameSchema,
|
|
2653
2669
|
behaviorStateFrameSchema,
|
|
2654
|
-
clipAckFrameSchema
|
|
2670
|
+
clipAckFrameSchema,
|
|
2671
|
+
voiceErrorFrameSchema2
|
|
2655
2672
|
]);
|
|
2656
2673
|
var liveKitCapacitySnapshotSchema = z.object({
|
|
2657
2674
|
// Placement identity + per-worker session ceiling. These are always present on the
|
|
@@ -3918,6 +3935,7 @@ function useRealtimeSession(input) {
|
|
|
3918
3935
|
onEnded,
|
|
3919
3936
|
onBehaviorChange,
|
|
3920
3937
|
onClipResult,
|
|
3938
|
+
onVoiceError,
|
|
3921
3939
|
// everything else (client/active/idleSeconds/idleWarnLeadSeconds/reconnect/requestOptions…)
|
|
3922
3940
|
// flows straight into the inner SSOT hook.
|
|
3923
3941
|
...inner
|
|
@@ -3933,6 +3951,7 @@ function useRealtimeSession(input) {
|
|
|
3933
3951
|
const [turn, setTurn] = useState("quiet");
|
|
3934
3952
|
const [media, setMediaState] = useState({ video: "connecting", audio: "silent" });
|
|
3935
3953
|
const [behavior, setBehavior] = useState(null);
|
|
3954
|
+
const [voiceError, setVoiceError] = useState(null);
|
|
3936
3955
|
const [microphoneFacts2, setMicrophoneFactsState] = useState({
|
|
3937
3956
|
wanted: false,
|
|
3938
3957
|
connected: false,
|
|
@@ -3946,8 +3965,8 @@ function useRealtimeSession(input) {
|
|
|
3946
3965
|
const lastBehaviorRef = useRef(null);
|
|
3947
3966
|
const lastLabeledEndReasonRef = useRef(null);
|
|
3948
3967
|
const pendingClipsRef = useRef(/* @__PURE__ */ new Map());
|
|
3949
|
-
const cbRef = useRef({ onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult });
|
|
3950
|
-
cbRef.current = { onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult };
|
|
3968
|
+
const cbRef = useRef({ onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult, onVoiceError });
|
|
3969
|
+
cbRef.current = { onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult, onVoiceError };
|
|
3951
3970
|
const approachingEndLeadMs = positive(approachingEndLeadSeconds, DEFAULT_APPROACHING_END_LEAD_SECONDS) * 1e3;
|
|
3952
3971
|
const graceWindowLeadMs = positive(graceWindowLeadSeconds, DEFAULT_GRACE_WINDOW_LEAD_SECONDS) * 1e3;
|
|
3953
3972
|
const graceCeilingMs = positive(graceCeilingSeconds, DEFAULT_GRACE_CEILING_SECONDS) * 1e3;
|
|
@@ -4035,6 +4054,18 @@ function useRealtimeSession(input) {
|
|
|
4035
4054
|
cbRef.current.onClipResult?.(result);
|
|
4036
4055
|
break;
|
|
4037
4056
|
}
|
|
4057
|
+
case "voice_error": {
|
|
4058
|
+
const error = {
|
|
4059
|
+
code: f.code,
|
|
4060
|
+
message: f.message,
|
|
4061
|
+
...f.status === void 0 ? {} : { status: f.status },
|
|
4062
|
+
fatal: f.fatal,
|
|
4063
|
+
...f.request_id === void 0 ? {} : { requestId: f.request_id }
|
|
4064
|
+
};
|
|
4065
|
+
setVoiceError(error);
|
|
4066
|
+
cbRef.current.onVoiceError?.(error);
|
|
4067
|
+
break;
|
|
4068
|
+
}
|
|
4038
4069
|
}
|
|
4039
4070
|
}, []);
|
|
4040
4071
|
const registerDataPublisher = useCallback((publish) => {
|
|
@@ -4229,10 +4260,22 @@ function useRealtimeSession(input) {
|
|
|
4229
4260
|
if (active) return;
|
|
4230
4261
|
lastLabeledEndReasonRef.current = null;
|
|
4231
4262
|
setMicrophoneMuted(false);
|
|
4263
|
+
setVoiceError(null);
|
|
4232
4264
|
}, [active]);
|
|
4265
|
+
const grantSessionId = lifecycle.grant?.session_id ?? null;
|
|
4266
|
+
const voiceErrorGrantRef = useRef(null);
|
|
4267
|
+
useEffect(() => {
|
|
4268
|
+
if (phaseKind === "requesting") setVoiceError(null);
|
|
4269
|
+
if (grantSessionId === null) return;
|
|
4270
|
+
if (voiceErrorGrantRef.current !== null && voiceErrorGrantRef.current !== grantSessionId) setVoiceError(null);
|
|
4271
|
+
voiceErrorGrantRef.current = grantSessionId;
|
|
4272
|
+
}, [phaseKind, grantSessionId]);
|
|
4233
4273
|
const innerReconnect = lifecycle.reconnect;
|
|
4234
4274
|
const reconnect = useCallback(() => {
|
|
4235
|
-
if (phaseKind === "ended")
|
|
4275
|
+
if (phaseKind === "ended") {
|
|
4276
|
+
lastLabeledEndReasonRef.current = null;
|
|
4277
|
+
setVoiceError(null);
|
|
4278
|
+
}
|
|
4236
4279
|
innerReconnect();
|
|
4237
4280
|
}, [innerReconnect, phaseKind]);
|
|
4238
4281
|
const performAction = useCallback(
|
|
@@ -4281,6 +4324,7 @@ function useRealtimeSession(input) {
|
|
|
4281
4324
|
creditsLowFiredRef.current = false;
|
|
4282
4325
|
lastTurnRef.current = null;
|
|
4283
4326
|
setMicrophoneMuted(false);
|
|
4327
|
+
setVoiceError(null);
|
|
4284
4328
|
lifecycle.reset();
|
|
4285
4329
|
}, [lifecycle]);
|
|
4286
4330
|
return useMemo(
|
|
@@ -4309,6 +4353,7 @@ function useRealtimeSession(input) {
|
|
|
4309
4353
|
retryTurn,
|
|
4310
4354
|
end,
|
|
4311
4355
|
behavior,
|
|
4356
|
+
voiceError,
|
|
4312
4357
|
performAction,
|
|
4313
4358
|
onLifecycleData,
|
|
4314
4359
|
registerDataPublisher,
|
|
@@ -4341,6 +4386,7 @@ function useRealtimeSession(input) {
|
|
|
4341
4386
|
retryTurn,
|
|
4342
4387
|
end,
|
|
4343
4388
|
behavior,
|
|
4389
|
+
voiceError,
|
|
4344
4390
|
performAction,
|
|
4345
4391
|
onLifecycleData,
|
|
4346
4392
|
registerDataPublisher,
|
|
@@ -4387,7 +4433,8 @@ function handleFor(session) {
|
|
|
4387
4433
|
audio: session.audioPlayback,
|
|
4388
4434
|
startAudio: session.startAudio,
|
|
4389
4435
|
setMicrophoneEnabled: session.setMicrophoneEnabled,
|
|
4390
|
-
retryMicrophone: () => session.setMicrophoneEnabled(true)
|
|
4436
|
+
retryMicrophone: () => session.setMicrophoneEnabled(true),
|
|
4437
|
+
voiceError: session.voiceError
|
|
4391
4438
|
};
|
|
4392
4439
|
}
|
|
4393
4440
|
var UNLOCK_REGION = {
|
|
@@ -4419,7 +4466,8 @@ function useAvatarCall(props) {
|
|
|
4419
4466
|
} : void 0,
|
|
4420
4467
|
onIdleWarning: props.onQuiet ? ({ secondsLeft }) => props.onQuiet?.({ secondsLeft }) : void 0,
|
|
4421
4468
|
onCreditsLow: props.onLowBalance ? ({ secondsLeft }) => props.onLowBalance?.({ secondsLeft }) : void 0,
|
|
4422
|
-
onEnded: props.onEnded ? ({ reason }) => props.onEnded?.({ reason }) : void 0
|
|
4469
|
+
onEnded: props.onEnded ? ({ reason }) => props.onEnded?.({ reason }) : void 0,
|
|
4470
|
+
onVoiceError: props.onVoiceError ? (error) => props.onVoiceError?.(error) : void 0
|
|
4423
4471
|
});
|
|
4424
4472
|
sessionRef.current = session;
|
|
4425
4473
|
const call = handleFor(session);
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarOptions, StartCallOptions, clipLibraryDeclarationSchema, verifyTranscript } from './index.js';
|
|
2
|
-
export { h as Asset, g as AssetKind, A as Avatar, o as AvatarClip, c as AvatarSourceSwap, b as AvatarUpdate, p as CallConnection, C as CallMode, a as CallPolicy, q as CallQueued, r as ClipDeclaration, f as ClipLibrary, d as ClipLibraryDeclaration, s as ClipLibraryPlan, e as ClipLibraryUpdate, t as ClipSource, u as ContextMessage, n as CreditBalance, E as EndCallOptions, v as EndCallReason, w as ExternalLlm, k as ListRecordingsQuery, l as ListRecordingsResponse, i as ListSessionsOptions, L as LoopRedirect, m as RecordingAccessResponse, R as RecordingArtifact, x as RecordingArtifactStatus, y as RecordingMode, S as StartCallResult, T as TranscriptPayload, j as UsageSession, U as UsageSessionPage,
|
|
1
|
+
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarOptions, RealtimeAvatarWebhookError, StartCallOptions, WebhookVerificationErrorCode, clipLibraryDeclarationSchema, verifyTranscript, verifyVoiceWebhook } from './index.js';
|
|
2
|
+
export { h as Asset, g as AssetKind, A as Avatar, o as AvatarClip, c as AvatarSourceSwap, b as AvatarUpdate, p as CallConnection, C as CallMode, a as CallPolicy, q as CallQueued, r as ClipDeclaration, f as ClipLibrary, d as ClipLibraryDeclaration, s as ClipLibraryPlan, e as ClipLibraryUpdate, t as ClipSource, u as ContextMessage, n as CreditBalance, E as EndCallOptions, v as EndCallReason, w as ExternalLlm, k as ListRecordingsQuery, l as ListRecordingsResponse, i as ListSessionsOptions, L as LoopRedirect, m as RecordingAccessResponse, R as RecordingArtifact, x as RecordingArtifactStatus, y as RecordingMode, S as StartCallResult, T as TranscriptPayload, j as UsageSession, U as UsageSessionPage, z as VideoPolicy, B as VoiceWebhook, D as VoiceWebhookErrorCode, V as VoiceWebhookRequest, F as isQueued, G as listRecordingsResponseSchema, H as recordingAccessResponseSchema, I as recordingArtifactSchema, J as recordingModeSchema } from './types-yiemDkm0.js';
|
|
3
3
|
import './connection-history.js';
|
|
4
4
|
import 'zod';
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, clipLibraryDeclarationSchema, isQueued, listRecordingsResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, verifyTranscript } from './chunk-
|
|
1
|
+
export { RealtimeAvatar, RealtimeAvatarError, RealtimeAvatarHttpError, RealtimeAvatarWebhookError, clipLibraryDeclarationSchema, isQueued, listRecordingsResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, verifyTranscript, verifyVoiceWebhook } from './chunk-V7A4NRKC.js';
|
|
2
2
|
import './chunk-MCIXU6XP.js';
|
package/dist/tanstack-start.d.ts
CHANGED
package/dist/tanstack-start.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CallMode, a as CallPolicy } from './types-
|
|
1
|
+
import { C as CallMode, a as CallPolicy } from './types-yiemDkm0.js';
|
|
2
2
|
|
|
3
3
|
/** The three things a caller can ask the proxy to do. Gate on these, not on URLs. */
|
|
4
4
|
type ProxyOperation = "connect" | "end" | "avatars" | "credits";
|