realtime-avatar 0.27.4 → 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 +93 -4
- package/dist/{chunk-NNX2ZSA3.js → chunk-K3VC6BF7.js} +5 -1
- package/dist/{chunk-VVQIYWKT.js → chunk-V7A4NRKC.js} +238 -37
- 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 +40 -6
- package/dist/index.js +1 -1
- package/dist/nextjs.d.ts +2 -2
- package/dist/nextjs.js +2 -2
- package/dist/{proxy-client-e4ingu8g.d.ts → proxy-client-WjGIwL-t.d.ts} +45 -2
- package/dist/react-native.d.ts +2 -2
- package/dist/react-native.js +53 -4
- package/dist/react.d.ts +12 -3
- package/dist/react.js +57 -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-dqrXXrhz.d.ts → types-Bli1UeP0.d.ts} +1 -1
- package/dist/{types-BKv6pxzd.d.ts → types-yiemDkm0.d.ts} +2009 -256
- package/package.json +1 -1
package/dist/nextjs.js
CHANGED
|
@@ -11,7 +11,7 @@ declare function useAvatarCamera({ allowed, active }: {
|
|
|
11
11
|
}): {
|
|
12
12
|
enabled: boolean;
|
|
13
13
|
pending: boolean;
|
|
14
|
-
error: "
|
|
14
|
+
error: "unavailable" | "permission_denied" | null;
|
|
15
15
|
available: boolean;
|
|
16
16
|
toggle: () => Promise<void>;
|
|
17
17
|
setEnabled: (enabled: boolean) => Promise<void>;
|
|
@@ -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
|
@@ -293,6 +293,9 @@ function playoutDelayTarget(track) {
|
|
|
293
293
|
|
|
294
294
|
// ../http-client/src/generated/error-semantics.ts
|
|
295
295
|
var ERROR_SEMANTICS = {
|
|
296
|
+
"capacity_full": { statuses: [429], message: "All session seats are busy. Keep your queue ticket and retry shortly.", retryable: true },
|
|
297
|
+
"capacity_no_workers": { statuses: [429], message: "No session workers are available. Keep your queue ticket and retry shortly.", retryable: true },
|
|
298
|
+
"capacity_draining": { statuses: [429], message: "Session workers are restarting or draining. Keep your queue ticket and retry shortly.", retryable: true },
|
|
296
299
|
"bad_request": { statuses: [400], message: "Check the request and try again.", retryable: false },
|
|
297
300
|
"unauthorized": { statuses: [401], message: "Authentication is required to use Realtime Avatar.", retryable: false },
|
|
298
301
|
"payment_required": { statuses: [402], message: "Add credits to continue using realtime avatars.", retryable: false },
|
|
@@ -321,6 +324,7 @@ var ERROR_SEMANTICS = {
|
|
|
321
324
|
"service_warming": { statuses: [503], message: "Realtime Avatar is warming up. Try again in a moment.", retryable: true },
|
|
322
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 },
|
|
323
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 },
|
|
324
328
|
"recording_unsupported": { statuses: [501], message: "Session recording is not enabled for this deployment.", retryable: false },
|
|
325
329
|
"recording_requires_new_room": { statuses: [422], message: "Recording requires a new session room. Start a fresh session to record it.", retryable: false },
|
|
326
330
|
"recording_unavailable": { statuses: [503], message: "Session recording is temporarily unavailable. Try again in a moment.", retryable: true }
|
|
@@ -1722,6 +1726,20 @@ var transcriptionOptionsSchema = z.object({
|
|
|
1722
1726
|
}).strict();
|
|
1723
1727
|
var schema02 = z.enum(["minor-sexual-content-v1", "safe-content-v1"]);
|
|
1724
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;
|
|
1725
1743
|
|
|
1726
1744
|
// ../client/src/wire.ts
|
|
1727
1745
|
var DEFAULT_AVATAR_ID = "maria";
|
|
@@ -2023,13 +2041,15 @@ var clipAckFrameSchema = z.object({
|
|
|
2023
2041
|
accepted: z.boolean(),
|
|
2024
2042
|
reason: z.string().max(64)
|
|
2025
2043
|
}).strip();
|
|
2044
|
+
var voiceErrorFrameSchema2 = voiceErrorFrameSchema.extend({ code: z.string().min(1) });
|
|
2026
2045
|
var lifecycleServerFrameSchema = z.discriminatedUnion("kind", [
|
|
2027
2046
|
sessionClockFrameSchema,
|
|
2028
2047
|
endingFrameSchema,
|
|
2029
2048
|
closingTurnDoneFrameSchema,
|
|
2030
2049
|
endedFrameSchema,
|
|
2031
2050
|
behaviorStateFrameSchema,
|
|
2032
|
-
clipAckFrameSchema
|
|
2051
|
+
clipAckFrameSchema,
|
|
2052
|
+
voiceErrorFrameSchema2
|
|
2033
2053
|
]);
|
|
2034
2054
|
var liveKitCapacitySnapshotSchema = z.object({
|
|
2035
2055
|
// Placement identity + per-worker session ceiling. These are always present on the
|
|
@@ -3291,6 +3311,7 @@ function useRealtimeSession(input) {
|
|
|
3291
3311
|
onEnded,
|
|
3292
3312
|
onBehaviorChange,
|
|
3293
3313
|
onClipResult,
|
|
3314
|
+
onVoiceError,
|
|
3294
3315
|
// everything else (client/active/idleSeconds/idleWarnLeadSeconds/reconnect/requestOptions…)
|
|
3295
3316
|
// flows straight into the inner SSOT hook.
|
|
3296
3317
|
...inner
|
|
@@ -3306,6 +3327,7 @@ function useRealtimeSession(input) {
|
|
|
3306
3327
|
const [turn, setTurn] = useState("quiet");
|
|
3307
3328
|
const [media, setMediaState] = useState({ video: "connecting", audio: "silent" });
|
|
3308
3329
|
const [behavior, setBehavior] = useState(null);
|
|
3330
|
+
const [voiceError, setVoiceError] = useState(null);
|
|
3309
3331
|
const [microphoneFacts2, setMicrophoneFactsState] = useState({
|
|
3310
3332
|
wanted: false,
|
|
3311
3333
|
connected: false,
|
|
@@ -3319,8 +3341,8 @@ function useRealtimeSession(input) {
|
|
|
3319
3341
|
const lastBehaviorRef = useRef(null);
|
|
3320
3342
|
const lastLabeledEndReasonRef = useRef(null);
|
|
3321
3343
|
const pendingClipsRef = useRef(/* @__PURE__ */ new Map());
|
|
3322
|
-
const cbRef = useRef({ onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult });
|
|
3323
|
-
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 };
|
|
3324
3346
|
const approachingEndLeadMs = positive(approachingEndLeadSeconds, DEFAULT_APPROACHING_END_LEAD_SECONDS) * 1e3;
|
|
3325
3347
|
const graceWindowLeadMs = positive(graceWindowLeadSeconds, DEFAULT_GRACE_WINDOW_LEAD_SECONDS) * 1e3;
|
|
3326
3348
|
const graceCeilingMs = positive(graceCeilingSeconds, DEFAULT_GRACE_CEILING_SECONDS) * 1e3;
|
|
@@ -3408,6 +3430,18 @@ function useRealtimeSession(input) {
|
|
|
3408
3430
|
cbRef.current.onClipResult?.(result);
|
|
3409
3431
|
break;
|
|
3410
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
|
+
}
|
|
3411
3445
|
}
|
|
3412
3446
|
}, []);
|
|
3413
3447
|
const registerDataPublisher = useCallback((publish) => {
|
|
@@ -3602,10 +3636,22 @@ function useRealtimeSession(input) {
|
|
|
3602
3636
|
if (active) return;
|
|
3603
3637
|
lastLabeledEndReasonRef.current = null;
|
|
3604
3638
|
setMicrophoneMuted(false);
|
|
3639
|
+
setVoiceError(null);
|
|
3605
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]);
|
|
3606
3649
|
const innerReconnect = lifecycle.reconnect;
|
|
3607
3650
|
const reconnect = useCallback(() => {
|
|
3608
|
-
if (phaseKind === "ended")
|
|
3651
|
+
if (phaseKind === "ended") {
|
|
3652
|
+
lastLabeledEndReasonRef.current = null;
|
|
3653
|
+
setVoiceError(null);
|
|
3654
|
+
}
|
|
3609
3655
|
innerReconnect();
|
|
3610
3656
|
}, [innerReconnect, phaseKind]);
|
|
3611
3657
|
const performAction = useCallback(
|
|
@@ -3654,6 +3700,7 @@ function useRealtimeSession(input) {
|
|
|
3654
3700
|
creditsLowFiredRef.current = false;
|
|
3655
3701
|
lastTurnRef.current = null;
|
|
3656
3702
|
setMicrophoneMuted(false);
|
|
3703
|
+
setVoiceError(null);
|
|
3657
3704
|
lifecycle.reset();
|
|
3658
3705
|
}, [lifecycle]);
|
|
3659
3706
|
return useMemo(
|
|
@@ -3682,6 +3729,7 @@ function useRealtimeSession(input) {
|
|
|
3682
3729
|
retryTurn,
|
|
3683
3730
|
end,
|
|
3684
3731
|
behavior,
|
|
3732
|
+
voiceError,
|
|
3685
3733
|
performAction,
|
|
3686
3734
|
onLifecycleData,
|
|
3687
3735
|
registerDataPublisher,
|
|
@@ -3714,6 +3762,7 @@ function useRealtimeSession(input) {
|
|
|
3714
3762
|
retryTurn,
|
|
3715
3763
|
end,
|
|
3716
3764
|
behavior,
|
|
3765
|
+
voiceError,
|
|
3717
3766
|
performAction,
|
|
3718
3767
|
onLifecycleData,
|
|
3719
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
|
@@ -499,6 +499,9 @@ function playoutDelayTarget(track) {
|
|
|
499
499
|
|
|
500
500
|
// ../http-client/src/generated/error-semantics.ts
|
|
501
501
|
var ERROR_SEMANTICS = {
|
|
502
|
+
"capacity_full": { statuses: [429], message: "All session seats are busy. Keep your queue ticket and retry shortly.", retryable: true },
|
|
503
|
+
"capacity_no_workers": { statuses: [429], message: "No session workers are available. Keep your queue ticket and retry shortly.", retryable: true },
|
|
504
|
+
"capacity_draining": { statuses: [429], message: "Session workers are restarting or draining. Keep your queue ticket and retry shortly.", retryable: true },
|
|
502
505
|
"bad_request": { statuses: [400], message: "Check the request and try again.", retryable: false },
|
|
503
506
|
"unauthorized": { statuses: [401], message: "Authentication is required to use Realtime Avatar.", retryable: false },
|
|
504
507
|
"payment_required": { statuses: [402], message: "Add credits to continue using realtime avatars.", retryable: false },
|
|
@@ -527,6 +530,7 @@ var ERROR_SEMANTICS = {
|
|
|
527
530
|
"service_warming": { statuses: [503], message: "Realtime Avatar is warming up. Try again in a moment.", retryable: true },
|
|
528
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 },
|
|
529
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 },
|
|
530
534
|
"recording_unsupported": { statuses: [501], message: "Session recording is not enabled for this deployment.", retryable: false },
|
|
531
535
|
"recording_requires_new_room": { statuses: [422], message: "Recording requires a new session room. Start a fresh session to record it.", retryable: false },
|
|
532
536
|
"recording_unavailable": { statuses: [503], message: "Session recording is temporarily unavailable. Try again in a moment.", retryable: true }
|
|
@@ -2341,6 +2345,20 @@ var transcriptionOptionsSchema = z.object({
|
|
|
2341
2345
|
}).strict();
|
|
2342
2346
|
var schema02 = z.enum(["minor-sexual-content-v1", "safe-content-v1"]);
|
|
2343
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;
|
|
2344
2362
|
|
|
2345
2363
|
// ../client/src/wire.ts
|
|
2346
2364
|
var DEFAULT_AVATAR_ID = "maria";
|
|
@@ -2642,13 +2660,15 @@ var clipAckFrameSchema = z.object({
|
|
|
2642
2660
|
accepted: z.boolean(),
|
|
2643
2661
|
reason: z.string().max(64)
|
|
2644
2662
|
}).strip();
|
|
2663
|
+
var voiceErrorFrameSchema2 = voiceErrorFrameSchema.extend({ code: z.string().min(1) });
|
|
2645
2664
|
var lifecycleServerFrameSchema = z.discriminatedUnion("kind", [
|
|
2646
2665
|
sessionClockFrameSchema,
|
|
2647
2666
|
endingFrameSchema,
|
|
2648
2667
|
closingTurnDoneFrameSchema,
|
|
2649
2668
|
endedFrameSchema,
|
|
2650
2669
|
behaviorStateFrameSchema,
|
|
2651
|
-
clipAckFrameSchema
|
|
2670
|
+
clipAckFrameSchema,
|
|
2671
|
+
voiceErrorFrameSchema2
|
|
2652
2672
|
]);
|
|
2653
2673
|
var liveKitCapacitySnapshotSchema = z.object({
|
|
2654
2674
|
// Placement identity + per-worker session ceiling. These are always present on the
|
|
@@ -3915,6 +3935,7 @@ function useRealtimeSession(input) {
|
|
|
3915
3935
|
onEnded,
|
|
3916
3936
|
onBehaviorChange,
|
|
3917
3937
|
onClipResult,
|
|
3938
|
+
onVoiceError,
|
|
3918
3939
|
// everything else (client/active/idleSeconds/idleWarnLeadSeconds/reconnect/requestOptions…)
|
|
3919
3940
|
// flows straight into the inner SSOT hook.
|
|
3920
3941
|
...inner
|
|
@@ -3930,6 +3951,7 @@ function useRealtimeSession(input) {
|
|
|
3930
3951
|
const [turn, setTurn] = useState("quiet");
|
|
3931
3952
|
const [media, setMediaState] = useState({ video: "connecting", audio: "silent" });
|
|
3932
3953
|
const [behavior, setBehavior] = useState(null);
|
|
3954
|
+
const [voiceError, setVoiceError] = useState(null);
|
|
3933
3955
|
const [microphoneFacts2, setMicrophoneFactsState] = useState({
|
|
3934
3956
|
wanted: false,
|
|
3935
3957
|
connected: false,
|
|
@@ -3943,8 +3965,8 @@ function useRealtimeSession(input) {
|
|
|
3943
3965
|
const lastBehaviorRef = useRef(null);
|
|
3944
3966
|
const lastLabeledEndReasonRef = useRef(null);
|
|
3945
3967
|
const pendingClipsRef = useRef(/* @__PURE__ */ new Map());
|
|
3946
|
-
const cbRef = useRef({ onApproachingEnd, onGraceWindowOpen, onGraceWindowClosed, onIdleWarning, onCreditsLow, onTurnTimeout, onReconnecting, onReconnected, onEnded, onBehaviorChange, onClipResult });
|
|
3947
|
-
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 };
|
|
3948
3970
|
const approachingEndLeadMs = positive(approachingEndLeadSeconds, DEFAULT_APPROACHING_END_LEAD_SECONDS) * 1e3;
|
|
3949
3971
|
const graceWindowLeadMs = positive(graceWindowLeadSeconds, DEFAULT_GRACE_WINDOW_LEAD_SECONDS) * 1e3;
|
|
3950
3972
|
const graceCeilingMs = positive(graceCeilingSeconds, DEFAULT_GRACE_CEILING_SECONDS) * 1e3;
|
|
@@ -4032,6 +4054,18 @@ function useRealtimeSession(input) {
|
|
|
4032
4054
|
cbRef.current.onClipResult?.(result);
|
|
4033
4055
|
break;
|
|
4034
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
|
+
}
|
|
4035
4069
|
}
|
|
4036
4070
|
}, []);
|
|
4037
4071
|
const registerDataPublisher = useCallback((publish) => {
|
|
@@ -4226,10 +4260,22 @@ function useRealtimeSession(input) {
|
|
|
4226
4260
|
if (active) return;
|
|
4227
4261
|
lastLabeledEndReasonRef.current = null;
|
|
4228
4262
|
setMicrophoneMuted(false);
|
|
4263
|
+
setVoiceError(null);
|
|
4229
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]);
|
|
4230
4273
|
const innerReconnect = lifecycle.reconnect;
|
|
4231
4274
|
const reconnect = useCallback(() => {
|
|
4232
|
-
if (phaseKind === "ended")
|
|
4275
|
+
if (phaseKind === "ended") {
|
|
4276
|
+
lastLabeledEndReasonRef.current = null;
|
|
4277
|
+
setVoiceError(null);
|
|
4278
|
+
}
|
|
4233
4279
|
innerReconnect();
|
|
4234
4280
|
}, [innerReconnect, phaseKind]);
|
|
4235
4281
|
const performAction = useCallback(
|
|
@@ -4278,6 +4324,7 @@ function useRealtimeSession(input) {
|
|
|
4278
4324
|
creditsLowFiredRef.current = false;
|
|
4279
4325
|
lastTurnRef.current = null;
|
|
4280
4326
|
setMicrophoneMuted(false);
|
|
4327
|
+
setVoiceError(null);
|
|
4281
4328
|
lifecycle.reset();
|
|
4282
4329
|
}, [lifecycle]);
|
|
4283
4330
|
return useMemo(
|
|
@@ -4306,6 +4353,7 @@ function useRealtimeSession(input) {
|
|
|
4306
4353
|
retryTurn,
|
|
4307
4354
|
end,
|
|
4308
4355
|
behavior,
|
|
4356
|
+
voiceError,
|
|
4309
4357
|
performAction,
|
|
4310
4358
|
onLifecycleData,
|
|
4311
4359
|
registerDataPublisher,
|
|
@@ -4338,6 +4386,7 @@ function useRealtimeSession(input) {
|
|
|
4338
4386
|
retryTurn,
|
|
4339
4387
|
end,
|
|
4340
4388
|
behavior,
|
|
4389
|
+
voiceError,
|
|
4341
4390
|
performAction,
|
|
4342
4391
|
onLifecycleData,
|
|
4343
4392
|
registerDataPublisher,
|
|
@@ -4384,7 +4433,8 @@ function handleFor(session) {
|
|
|
4384
4433
|
audio: session.audioPlayback,
|
|
4385
4434
|
startAudio: session.startAudio,
|
|
4386
4435
|
setMicrophoneEnabled: session.setMicrophoneEnabled,
|
|
4387
|
-
retryMicrophone: () => session.setMicrophoneEnabled(true)
|
|
4436
|
+
retryMicrophone: () => session.setMicrophoneEnabled(true),
|
|
4437
|
+
voiceError: session.voiceError
|
|
4388
4438
|
};
|
|
4389
4439
|
}
|
|
4390
4440
|
var UNLOCK_REGION = {
|
|
@@ -4416,7 +4466,8 @@ function useAvatarCall(props) {
|
|
|
4416
4466
|
} : void 0,
|
|
4417
4467
|
onIdleWarning: props.onQuiet ? ({ secondsLeft }) => props.onQuiet?.({ secondsLeft }) : void 0,
|
|
4418
4468
|
onCreditsLow: props.onLowBalance ? ({ secondsLeft }) => props.onLowBalance?.({ secondsLeft }) : void 0,
|
|
4419
|
-
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
|
|
4420
4471
|
});
|
|
4421
4472
|
sessionRef.current = session;
|
|
4422
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";
|