realtime-avatar 0.20.0 → 0.22.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/dist/{chunk-PKOWNCDT.js → chunk-N76M4MEU.js} +26 -1
- package/dist/{chunk-QT5UTARL.js → chunk-T3RZSVRI.js} +1 -1
- 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 +2 -2
- package/dist/index.js +1 -1
- package/dist/nextjs.d.ts +2 -2
- package/dist/nextjs.js +2 -2
- package/dist/{proxy-client-DpMcj6fI.d.ts → proxy-client-6ndCkiio.d.ts} +12 -2
- package/dist/react-native.d.ts +2 -2
- package/dist/react-native.js +48 -1
- package/dist/react.d.ts +2 -2
- package/dist/react.js +48 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/tanstack-start.d.ts +2 -2
- package/dist/tanstack-start.js +2 -2
- package/dist/{types-D76SpA3g.d.ts → types-Cmto2uGs.d.ts} +15 -2
- package/dist/{types-TaQCvMPh.d.ts → types-k6pW-wKA.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -290,6 +290,28 @@ function isTransient(cause) {
|
|
|
290
290
|
const name = cause?.name;
|
|
291
291
|
return name === "TimeoutError" || name === "TypeError" || name === "FetchError";
|
|
292
292
|
}
|
|
293
|
+
var schema02 = z.string().min(2).max(64);
|
|
294
|
+
var schema110 = z.array(schema02);
|
|
295
|
+
var schema27 = z.string().regex(new RegExp("\\S")).min(1).max(160);
|
|
296
|
+
var schema32 = z.array(schema27).max(1e3);
|
|
297
|
+
var schema42 = z.strictObject({
|
|
298
|
+
"language_codes": schema110.optional(),
|
|
299
|
+
"custom_vocabulary": schema32.optional()
|
|
300
|
+
});
|
|
301
|
+
var transcriptionWireSchema = schema42;
|
|
302
|
+
var transcriptionOptionsSchema = z.object({
|
|
303
|
+
languageCodes: transcriptionWireSchema.shape.language_codes,
|
|
304
|
+
customVocabulary: transcriptionWireSchema.shape.custom_vocabulary
|
|
305
|
+
}).strict();
|
|
306
|
+
function transcriptionToWire(input) {
|
|
307
|
+
const options = transcriptionOptionsSchema.parse(input);
|
|
308
|
+
return {
|
|
309
|
+
...options.languageCodes !== void 0 ? { language_codes: options.languageCodes } : {},
|
|
310
|
+
...options.customVocabulary !== void 0 ? { custom_vocabulary: options.customVocabulary } : {}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// ../client/src/wire.ts
|
|
293
315
|
var DEFAULT_AVATAR_ID = "maria";
|
|
294
316
|
var DEFAULT_BACKGROUND_ID = "plain_white";
|
|
295
317
|
var sessionModeSchema = z.enum(["avatar", "voice"]);
|
|
@@ -437,6 +459,7 @@ z.object({
|
|
|
437
459
|
source_kind: avatarSourceKindSchema.default("portrait"),
|
|
438
460
|
source_video_url: nullableUrlSchema.optional(),
|
|
439
461
|
stt_mode: liveKitSttModeSchema.default("server"),
|
|
462
|
+
transcription: transcriptionWireSchema.optional(),
|
|
440
463
|
camera: z.boolean().optional(),
|
|
441
464
|
video_cache_id: z.string().min(1).max(240).nullable().optional(),
|
|
442
465
|
voice: voiceSpecSchema.nullable().optional(),
|
|
@@ -510,6 +533,7 @@ z.object({
|
|
|
510
533
|
queueTicketId: z.string().min(1).max(160).optional(),
|
|
511
534
|
roomName: z.string().min(1).max(160).optional(),
|
|
512
535
|
sttMode: liveKitSttModeSchema.default("server"),
|
|
536
|
+
transcription: transcriptionOptionsSchema.optional(),
|
|
513
537
|
camera: z.boolean().optional(),
|
|
514
538
|
voice: voiceSpecSchema.nullable().optional(),
|
|
515
539
|
voiceId: z.string().min(1).max(240).nullable().optional(),
|
|
@@ -621,7 +645,7 @@ z.enum([
|
|
|
621
645
|
|
|
622
646
|
// ../http-client/src/client.ts
|
|
623
647
|
var DEFAULT_BASE_URL = "https://realtimeavatar.ai/api/v1";
|
|
624
|
-
var SDK_VERSION = "0.
|
|
648
|
+
var SDK_VERSION = "0.22.0";
|
|
625
649
|
var RealtimeAvatar = class {
|
|
626
650
|
#apiKey;
|
|
627
651
|
#baseUrl;
|
|
@@ -661,6 +685,7 @@ var RealtimeAvatar = class {
|
|
|
661
685
|
};
|
|
662
686
|
if (options.instructions !== void 0) body.instructions = options.instructions;
|
|
663
687
|
if (options.camera !== void 0) body.camera = options.camera;
|
|
688
|
+
if (options.transcription !== void 0) body.transcription = transcriptionToWire(options.transcription);
|
|
664
689
|
if (options.context !== void 0) {
|
|
665
690
|
body.initial_context = options.context.map((m) => ({ role: m.role, content: m.content }));
|
|
666
691
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RealtimeAvatar, isQueued, RealtimeAvatarHttpError } from './chunk-
|
|
1
|
+
import { RealtimeAvatar, isQueued, RealtimeAvatarHttpError } from './chunk-N76M4MEU.js';
|
|
2
2
|
|
|
3
3
|
// ../proxy/src/config.ts
|
|
4
4
|
var json = (body, status = 200) => new Response(JSON.stringify(body), {
|
package/dist/express.d.ts
CHANGED
package/dist/express.js
CHANGED
package/dist/hono.d.ts
CHANGED
package/dist/hono.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as AvatarUpdate, c as AvatarSourceSwap, d as ClipLibraryDeclaration, e as ClipLibraryUpdate, L as LoopRedirect, f as ClipLibrary, g as AssetKind, h as Asset, i as ListSessionsOptions, U as UsageSessionPage, j as UsageSession, k as ListRecordingsQuery, l as ListRecordingsResponse, R as RecordingArtifact, m as RecordingAccessResponse, n as CreditBalance, T as TranscriptPayload } from './types-
|
|
2
|
-
export { o as AvatarClip, p as CallConnection, q as CallQueued, r as ClipDeclaration, s as ClipLibraryPlan, t as ClipSource, u as ContextMessage, v as EndCallReason, w as RecordingArtifactStatus, x as RecordingMode, V as VideoPolicy, y as isQueued, z as listRecordingsResponseSchema, B as recordingAccessResponseSchema, D as recordingArtifactSchema, F as recordingModeSchema } from './types-
|
|
1
|
+
import { a as CallPolicy, C as CallMode, S as StartCallResult, E as EndCallOptions, A as Avatar, b as AvatarUpdate, c as AvatarSourceSwap, d as ClipLibraryDeclaration, e as ClipLibraryUpdate, L as LoopRedirect, f as ClipLibrary, g as AssetKind, h as Asset, i as ListSessionsOptions, U as UsageSessionPage, j as UsageSession, k as ListRecordingsQuery, l as ListRecordingsResponse, R as RecordingArtifact, m as RecordingAccessResponse, n as CreditBalance, T as TranscriptPayload } from './types-Cmto2uGs.js';
|
|
2
|
+
export { o as AvatarClip, p as CallConnection, q as CallQueued, r as ClipDeclaration, s as ClipLibraryPlan, t as ClipSource, u as ContextMessage, v as EndCallReason, w as RecordingArtifactStatus, x as RecordingMode, V as VideoPolicy, y as isQueued, z as listRecordingsResponseSchema, B as recordingAccessResponseSchema, D as recordingArtifactSchema, F as recordingModeSchema } from './types-Cmto2uGs.js';
|
|
3
3
|
import { ConnectionHistoryResponse } from './connection-history.js';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
package/dist/index.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, clipLibraryDeclarationSchema, isQueued, listRecordingsResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, verifyTranscript } from './chunk-N76M4MEU.js';
|
|
2
2
|
import './chunk-MCIXU6XP.js';
|
package/dist/nextjs.d.ts
CHANGED
package/dist/nextjs.js
CHANGED
|
@@ -159,6 +159,10 @@ declare const liveKitSessionRequestSchema: z.ZodObject<{
|
|
|
159
159
|
off: "off";
|
|
160
160
|
server: "server";
|
|
161
161
|
}>>;
|
|
162
|
+
transcription: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
languageCodes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
164
|
+
customVocabulary: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
165
|
+
}, z.core.$strict>>;
|
|
162
166
|
camera: z.ZodOptional<z.ZodBoolean>;
|
|
163
167
|
voice: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
164
168
|
provider: z.ZodLiteral<"cartesia">;
|
|
@@ -226,8 +230,8 @@ declare const liveKitSessionRequestSchema: z.ZodObject<{
|
|
|
226
230
|
rules: z.ZodString;
|
|
227
231
|
cooldown_seconds: z.ZodOptional<z.ZodNumber>;
|
|
228
232
|
renderer: z.ZodOptional<z.ZodEnum<{
|
|
229
|
-
editor: "editor";
|
|
230
233
|
generative: "generative";
|
|
234
|
+
editor: "editor";
|
|
231
235
|
}>>;
|
|
232
236
|
}, z.core.$strict>>;
|
|
233
237
|
}, z.core.$strict>>;
|
|
@@ -1375,6 +1379,12 @@ type AvatarConnectionDetails = Readonly<{
|
|
|
1375
1379
|
video: PublisherConnectionDetails | null;
|
|
1376
1380
|
}>;
|
|
1377
1381
|
type SessionLifecycleRoomBridgeProps = {
|
|
1382
|
+
/**
|
|
1383
|
+
* Authoritative agent output, not the requested mode or a missing-track heuristic.
|
|
1384
|
+
* Null means unknown (older worker / retired binding). Changing presentation must
|
|
1385
|
+
* not re-mint the session. Shared by web and native; late joins read stored state.
|
|
1386
|
+
*/
|
|
1387
|
+
onMediaModeChange?: (mode: "avatar" | "voice" | null) => void;
|
|
1378
1388
|
/**
|
|
1379
1389
|
* Opt in to an initial snapshot and changed facts. Null clears a retired binding.
|
|
1380
1390
|
* Callback failures never affect the call; no stats polling or uploads are added.
|
|
@@ -1399,7 +1409,7 @@ type SessionLifecycleRoomBridgeProps = {
|
|
|
1399
1409
|
*
|
|
1400
1410
|
* Renders nothing. Mount it once inside RealtimeAvatarLiveKitRoom.
|
|
1401
1411
|
*/
|
|
1402
|
-
declare function SessionLifecycleRoomBridge({ lifecycle, onConnectionDetailsChange, }: SessionLifecycleRoomBridgeProps): null;
|
|
1412
|
+
declare function SessionLifecycleRoomBridge({ lifecycle, onConnectionDetailsChange, onMediaModeChange, }: SessionLifecycleRoomBridgeProps): null;
|
|
1403
1413
|
|
|
1404
1414
|
/**
|
|
1405
1415
|
* The terminal, LABELED end reason surfaced to the app via `onEnded`. This is the
|
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_TURN_TIMEOUT_SECONDS, E as EndReason, u as EndedEvent, v as ExtendResult, F as FishTtsModel, w as FreezeReadingFn, G as Governor, x as GovernorAction, y as GovernorConfig, z as GovernorSignal, H as GovernorState, I as GraceWindowClosedEvent, J as GraceWindowOpenEvent, K as GraceWindowState, M as IdleWarningEvent, N as InboundRtpCursor, O as InboundRtpReading, P as KnownBehaviorState, Q as LLMProvider, R as LLMSelection, S as LiveKitAvatarGrantState, T as LiveKitAvatarGrantStatus, U as LiveKitCapacityState, V as LiveKitConnectionStatus, W as LiveKitSessionRequest, X as LiveKitSessionStartResult, Y as MAX_RECONNECT_ATTEMPTS, Z as MAX_SESSION_INSTRUCTIONS_CHARS, _ as ProxyClientOptions, $ as QualityCap, a0 as RECONNECT_BACKOFF_MS, a1 as RealtimeAvatarRequestOptions, a2 as RealtimeSessionApi, a3 as RealtimeSessionMedia, a4 as RealtimeSessionRoomSinks, a5 as ReconnectPolicy, a6 as ReconnectingEvent, a7 as RecoveryState, a8 as RetryStep, a9 as SessionBehavior, aa as SessionClip, ab as SessionClocks, ac as SessionEndReason, ad as SessionLifecycleApi, ae as SessionLifecyclePhase, af as SessionLifecyclePhaseKind, ag as SessionLifecycleRoomBridge, ah as SessionLifecycleRoomBridgeProps, ai as SurfaceLayers, aj as TurnState, ak as TurnTimeoutEvent, al as UseAvatarQualityGovernorInput, am as UseLiveKitAvatarGrantInput, an as UseRealtimeSessionInput, ao as UseSessionLifecycleInput, ap as VoiceSpec, aq as VoiceSpecInput, ar as capacityErrorFromBusy, as as capacityStateFromGrant, at as createProxyClient, au as isNativeLiveTrackSubscribed, av as knownBehaviorStates, aw as mapTurnState, ax as readInboundRtp, ay as sessionBehaviorSchema, az as sessionClipSchema, aA as splitCallTranscript, aB as useAvatarAdaptivePlayoutDelay, aC as useAvatarCamera, aD as useAvatarPlayoutDelay, aE as useAvatarQualityGovernor, aF as useCallTranscript, aG as useLiveKitAvatarGrant, aH as useLiveTrackProducing, aI as useMicLease, aJ as useRealtimeSession, aK as useReleaseMicLeaseOnTrackEnded, aL as useSessionLifecycle } from './proxy-client-
|
|
3
|
+
import { L as LiveKitSessionGrant, A as AvatarVideoFit } from './proxy-client-6ndCkiio.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_TURN_TIMEOUT_SECONDS, E as EndReason, u as EndedEvent, v as ExtendResult, F as FishTtsModel, w as FreezeReadingFn, G as Governor, x as GovernorAction, y as GovernorConfig, z as GovernorSignal, H as GovernorState, I as GraceWindowClosedEvent, J as GraceWindowOpenEvent, K as GraceWindowState, M as IdleWarningEvent, N as InboundRtpCursor, O as InboundRtpReading, P as KnownBehaviorState, Q as LLMProvider, R as LLMSelection, S as LiveKitAvatarGrantState, T as LiveKitAvatarGrantStatus, U as LiveKitCapacityState, V as LiveKitConnectionStatus, W as LiveKitSessionRequest, X as LiveKitSessionStartResult, Y as MAX_RECONNECT_ATTEMPTS, Z as MAX_SESSION_INSTRUCTIONS_CHARS, _ as ProxyClientOptions, $ as QualityCap, a0 as RECONNECT_BACKOFF_MS, a1 as RealtimeAvatarRequestOptions, a2 as RealtimeSessionApi, a3 as RealtimeSessionMedia, a4 as RealtimeSessionRoomSinks, a5 as ReconnectPolicy, a6 as ReconnectingEvent, a7 as RecoveryState, a8 as RetryStep, a9 as SessionBehavior, aa as SessionClip, ab as SessionClocks, ac as SessionEndReason, ad as SessionLifecycleApi, ae as SessionLifecyclePhase, af as SessionLifecyclePhaseKind, ag as SessionLifecycleRoomBridge, ah as SessionLifecycleRoomBridgeProps, ai as SurfaceLayers, aj as TurnState, ak as TurnTimeoutEvent, al as UseAvatarQualityGovernorInput, am as UseLiveKitAvatarGrantInput, an as UseRealtimeSessionInput, ao as UseSessionLifecycleInput, ap as VoiceSpec, aq as VoiceSpecInput, ar as capacityErrorFromBusy, as as capacityStateFromGrant, at as createProxyClient, au as isNativeLiveTrackSubscribed, av as knownBehaviorStates, aw as mapTurnState, ax as readInboundRtp, ay as sessionBehaviorSchema, az as sessionClipSchema, aA as splitCallTranscript, aB as useAvatarAdaptivePlayoutDelay, aC as useAvatarCamera, aD as useAvatarPlayoutDelay, aE as useAvatarQualityGovernor, aF as useCallTranscript, aG as useLiveKitAvatarGrant, aH as useLiveTrackProducing, aI as useMicLease, aJ as useRealtimeSession, aK as useReleaseMicLeaseOnTrackEnded, aL as useSessionLifecycle } from './proxy-client-6ndCkiio.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
|
@@ -1649,6 +1649,19 @@ z.object({
|
|
|
1649
1649
|
sessionId: z.string().min(1).max(200),
|
|
1650
1650
|
observations: z.array(connectionHistoryObservationSchema).max(MAX_CONNECTION_HISTORY_OBSERVATIONS)
|
|
1651
1651
|
}).strict();
|
|
1652
|
+
var schema0 = z.string().min(2).max(64);
|
|
1653
|
+
var schema1 = z.array(schema0);
|
|
1654
|
+
var schema2 = z.string().regex(new RegExp("\\S")).min(1).max(160);
|
|
1655
|
+
var schema3 = z.array(schema2).max(1e3);
|
|
1656
|
+
var schema4 = z.strictObject({
|
|
1657
|
+
"language_codes": schema1.optional(),
|
|
1658
|
+
"custom_vocabulary": schema3.optional()
|
|
1659
|
+
});
|
|
1660
|
+
var transcriptionWireSchema = schema4;
|
|
1661
|
+
var transcriptionOptionsSchema = z.object({
|
|
1662
|
+
languageCodes: transcriptionWireSchema.shape.language_codes,
|
|
1663
|
+
customVocabulary: transcriptionWireSchema.shape.custom_vocabulary
|
|
1664
|
+
}).strict();
|
|
1652
1665
|
|
|
1653
1666
|
// ../client/src/wire.ts
|
|
1654
1667
|
var DEFAULT_AVATAR_ID = "maria";
|
|
@@ -1798,6 +1811,7 @@ z.object({
|
|
|
1798
1811
|
source_kind: avatarSourceKindSchema.default("portrait"),
|
|
1799
1812
|
source_video_url: nullableUrlSchema.optional(),
|
|
1800
1813
|
stt_mode: liveKitSttModeSchema.default("server"),
|
|
1814
|
+
transcription: transcriptionWireSchema.optional(),
|
|
1801
1815
|
camera: z.boolean().optional(),
|
|
1802
1816
|
video_cache_id: z.string().min(1).max(240).nullable().optional(),
|
|
1803
1817
|
voice: voiceSpecSchema.nullable().optional(),
|
|
@@ -1871,6 +1885,7 @@ z.object({
|
|
|
1871
1885
|
queueTicketId: z.string().min(1).max(160).optional(),
|
|
1872
1886
|
roomName: z.string().min(1).max(160).optional(),
|
|
1873
1887
|
sttMode: liveKitSttModeSchema.default("server"),
|
|
1888
|
+
transcription: transcriptionOptionsSchema.optional(),
|
|
1874
1889
|
camera: z.boolean().optional(),
|
|
1875
1890
|
voice: voiceSpecSchema.nullable().optional(),
|
|
1876
1891
|
voiceId: z.string().min(1).max(240).nullable().optional(),
|
|
@@ -2536,7 +2551,8 @@ function useSessionLifecycle(input) {
|
|
|
2536
2551
|
}
|
|
2537
2552
|
function SessionLifecycleRoomBridge({
|
|
2538
2553
|
lifecycle,
|
|
2539
|
-
onConnectionDetailsChange
|
|
2554
|
+
onConnectionDetailsChange,
|
|
2555
|
+
onMediaModeChange
|
|
2540
2556
|
}) {
|
|
2541
2557
|
const {
|
|
2542
2558
|
onConnectionStateChange,
|
|
@@ -2553,6 +2569,37 @@ function SessionLifecycleRoomBridge({
|
|
|
2553
2569
|
const assistant = useVoiceAssistant();
|
|
2554
2570
|
const transcriptions = useTranscriptions();
|
|
2555
2571
|
const room = useRoomContext();
|
|
2572
|
+
const mediaModeCallbackRef = useRef(onMediaModeChange);
|
|
2573
|
+
mediaModeCallbackRef.current = onMediaModeChange;
|
|
2574
|
+
const mediaModeEnabled = onMediaModeChange !== void 0 && lifecycle.grant !== null;
|
|
2575
|
+
const mediaModeSessionId = lifecycle.grant?.session_id;
|
|
2576
|
+
useEffect(() => {
|
|
2577
|
+
if (!mediaModeEnabled) return;
|
|
2578
|
+
const agent = assistant.agent;
|
|
2579
|
+
let previous;
|
|
2580
|
+
const deliver = (mode) => {
|
|
2581
|
+
if (mode === previous) return;
|
|
2582
|
+
previous = mode;
|
|
2583
|
+
try {
|
|
2584
|
+
void Promise.resolve(mediaModeCallbackRef.current?.(mode)).catch(() => {
|
|
2585
|
+
});
|
|
2586
|
+
} catch {
|
|
2587
|
+
}
|
|
2588
|
+
};
|
|
2589
|
+
const read = () => {
|
|
2590
|
+
const value = agent?.attributes?.["rta.media_mode"];
|
|
2591
|
+
deliver(value === "video" ? "avatar" : value === "voice" ? "voice" : null);
|
|
2592
|
+
};
|
|
2593
|
+
const changed = (_attributes, participant) => {
|
|
2594
|
+
if (participant === agent) read();
|
|
2595
|
+
};
|
|
2596
|
+
room.on(RoomEvent.ParticipantAttributesChanged, changed);
|
|
2597
|
+
read();
|
|
2598
|
+
return () => {
|
|
2599
|
+
room.off(RoomEvent.ParticipantAttributesChanged, changed);
|
|
2600
|
+
deliver(null);
|
|
2601
|
+
};
|
|
2602
|
+
}, [room, assistant.agent, mediaModeEnabled, mediaModeSessionId]);
|
|
2556
2603
|
const { send } = useChat();
|
|
2557
2604
|
const agentPresent = Boolean(assistant.agent);
|
|
2558
2605
|
const assistantState = assistant.state;
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RegisteredTool, ToolRegistration } from './tools.js';
|
|
2
|
-
import { ah as SessionLifecycleRoomBridgeProps, h as AvatarSessionClient, A as AvatarVideoFit } from './proxy-client-
|
|
3
|
-
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason, g as AvatarConnectionDetails, aM as AvatarVideoSurface, aN 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_TURN_TIMEOUT_SECONDS, E as EndReason, u as EndedEvent, v as ExtendResult, F as FishTtsModel, w as FreezeReadingFn, G as Governor, x as GovernorAction, y as GovernorConfig, z as GovernorSignal, H as GovernorState, I as GraceWindowClosedEvent, J as GraceWindowOpenEvent, K as GraceWindowState, M as IdleWarningEvent, N as InboundRtpCursor, O as InboundRtpReading, P as KnownBehaviorState, Q as LLMProvider, R as LLMSelection, S as LiveKitAvatarGrantState, T as LiveKitAvatarGrantStatus, U as LiveKitCapacityState, V as LiveKitConnectionStatus, W as LiveKitSessionRequest, X as LiveKitSessionStartResult, aO as LivePlaybackKeeper, Y as MAX_RECONNECT_ATTEMPTS, Z as MAX_SESSION_INSTRUCTIONS_CHARS, aP as MIC_LEASE_ENDED_TIMEOUT_MS, aQ as MicLease, aR as NETWORK_QUALITY_POLICY, aS as NetworkQualityStatus, aT as PlayableVideoElement, _ as ProxyClientOptions, $ as QualityCap, a0 as RECONNECT_BACKOFF_MS, aU as RealtimeAvatarCapacityError, aV as RealtimeAvatarLiveKitRoom, aW as RealtimeAvatarLiveKitRoomProps, a1 as RealtimeAvatarRequestOptions, a2 as RealtimeSessionApi, a3 as RealtimeSessionMedia, a4 as RealtimeSessionRoomSinks, a5 as ReconnectPolicy, a6 as ReconnectingEvent, a7 as RecoveryState, a8 as RetryStep, a9 as SessionBehavior, aa as SessionClip, ab as SessionClocks, ac as SessionEndReason, ad as SessionLifecycleApi, ae as SessionLifecyclePhase, af as SessionLifecyclePhaseKind, ag as SessionLifecycleRoomBridge, ai as SurfaceLayers, aj as TurnState, ak as TurnTimeoutEvent, al as UseAvatarQualityGovernorInput, am as UseLiveKitAvatarGrantInput, an as UseRealtimeSessionInput, ao as UseSessionLifecycleInput, ap as VoiceSpec, aq as VoiceSpecInput, ar as capacityErrorFromBusy, as as capacityStateFromGrant, at as createProxyClient, av as knownBehaviorStates, aw as mapTurnState, ax as readInboundRtp, ay as sessionBehaviorSchema, az as sessionClipSchema, aX as shouldReplayPendingTurn, aA as splitCallTranscript, aB as useAvatarAdaptivePlayoutDelay, aC as useAvatarCamera, aD as useAvatarPlayoutDelay, aE as useAvatarQualityGovernor, aF as useCallTranscript, aG as useLiveKitAvatarGrant, aI as useMicLease, aJ as useRealtimeSession, aK as useReleaseMicLeaseOnTrackEnded, aL as useSessionLifecycle } from './proxy-client-
|
|
2
|
+
import { ah as SessionLifecycleRoomBridgeProps, h as AvatarSessionClient, A as AvatarVideoFit } from './proxy-client-6ndCkiio.js';
|
|
3
|
+
export { a as AdaptivePlayoutController, b as AdaptivePlayoutDecision, c as AdaptivePlayoutOptions, d as AdaptivePlayoutSample, e as ApproachingEndEvent, f as ApproachingEndReason, g as AvatarConnectionDetails, aM as AvatarVideoSurface, aN 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_TURN_TIMEOUT_SECONDS, E as EndReason, u as EndedEvent, v as ExtendResult, F as FishTtsModel, w as FreezeReadingFn, G as Governor, x as GovernorAction, y as GovernorConfig, z as GovernorSignal, H as GovernorState, I as GraceWindowClosedEvent, J as GraceWindowOpenEvent, K as GraceWindowState, M as IdleWarningEvent, N as InboundRtpCursor, O as InboundRtpReading, P as KnownBehaviorState, Q as LLMProvider, R as LLMSelection, S as LiveKitAvatarGrantState, T as LiveKitAvatarGrantStatus, U as LiveKitCapacityState, V as LiveKitConnectionStatus, W as LiveKitSessionRequest, X as LiveKitSessionStartResult, aO as LivePlaybackKeeper, Y as MAX_RECONNECT_ATTEMPTS, Z as MAX_SESSION_INSTRUCTIONS_CHARS, aP as MIC_LEASE_ENDED_TIMEOUT_MS, aQ as MicLease, aR as NETWORK_QUALITY_POLICY, aS as NetworkQualityStatus, aT as PlayableVideoElement, _ as ProxyClientOptions, $ as QualityCap, a0 as RECONNECT_BACKOFF_MS, aU as RealtimeAvatarCapacityError, aV as RealtimeAvatarLiveKitRoom, aW as RealtimeAvatarLiveKitRoomProps, a1 as RealtimeAvatarRequestOptions, a2 as RealtimeSessionApi, a3 as RealtimeSessionMedia, a4 as RealtimeSessionRoomSinks, a5 as ReconnectPolicy, a6 as ReconnectingEvent, a7 as RecoveryState, a8 as RetryStep, a9 as SessionBehavior, aa as SessionClip, ab as SessionClocks, ac as SessionEndReason, ad as SessionLifecycleApi, ae as SessionLifecyclePhase, af as SessionLifecyclePhaseKind, ag as SessionLifecycleRoomBridge, ai as SurfaceLayers, aj as TurnState, ak as TurnTimeoutEvent, al as UseAvatarQualityGovernorInput, am as UseLiveKitAvatarGrantInput, an as UseRealtimeSessionInput, ao as UseSessionLifecycleInput, ap as VoiceSpec, aq as VoiceSpecInput, ar as capacityErrorFromBusy, as as capacityStateFromGrant, at as createProxyClient, av as knownBehaviorStates, aw as mapTurnState, ax as readInboundRtp, ay as sessionBehaviorSchema, az as sessionClipSchema, aX as shouldReplayPendingTurn, aA as splitCallTranscript, aB as useAvatarAdaptivePlayoutDelay, aC as useAvatarCamera, aD as useAvatarPlayoutDelay, aE as useAvatarQualityGovernor, aF as useCallTranscript, aG as useLiveKitAvatarGrant, aI as useMicLease, aJ as useRealtimeSession, aK as useReleaseMicLeaseOnTrackEnded, aL as useSessionLifecycle } from './proxy-client-6ndCkiio.js';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
export { D as DEFAULT_AVATAR_PLAYOUT_DELAY_SECONDS } from './playout-delay-DWOc8iCl.js';
|
|
6
6
|
import 'zod';
|
package/dist/react.js
CHANGED
|
@@ -2183,6 +2183,19 @@ z.object({
|
|
|
2183
2183
|
sessionId: z.string().min(1).max(200),
|
|
2184
2184
|
observations: z.array(connectionHistoryObservationSchema).max(MAX_CONNECTION_HISTORY_OBSERVATIONS)
|
|
2185
2185
|
}).strict();
|
|
2186
|
+
var schema0 = z.string().min(2).max(64);
|
|
2187
|
+
var schema1 = z.array(schema0);
|
|
2188
|
+
var schema2 = z.string().regex(new RegExp("\\S")).min(1).max(160);
|
|
2189
|
+
var schema3 = z.array(schema2).max(1e3);
|
|
2190
|
+
var schema4 = z.strictObject({
|
|
2191
|
+
"language_codes": schema1.optional(),
|
|
2192
|
+
"custom_vocabulary": schema3.optional()
|
|
2193
|
+
});
|
|
2194
|
+
var transcriptionWireSchema = schema4;
|
|
2195
|
+
var transcriptionOptionsSchema = z.object({
|
|
2196
|
+
languageCodes: transcriptionWireSchema.shape.language_codes,
|
|
2197
|
+
customVocabulary: transcriptionWireSchema.shape.custom_vocabulary
|
|
2198
|
+
}).strict();
|
|
2186
2199
|
|
|
2187
2200
|
// ../client/src/wire.ts
|
|
2188
2201
|
var DEFAULT_AVATAR_ID = "maria";
|
|
@@ -2332,6 +2345,7 @@ z.object({
|
|
|
2332
2345
|
source_kind: avatarSourceKindSchema.default("portrait"),
|
|
2333
2346
|
source_video_url: nullableUrlSchema.optional(),
|
|
2334
2347
|
stt_mode: liveKitSttModeSchema.default("server"),
|
|
2348
|
+
transcription: transcriptionWireSchema.optional(),
|
|
2335
2349
|
camera: z.boolean().optional(),
|
|
2336
2350
|
video_cache_id: z.string().min(1).max(240).nullable().optional(),
|
|
2337
2351
|
voice: voiceSpecSchema.nullable().optional(),
|
|
@@ -2405,6 +2419,7 @@ z.object({
|
|
|
2405
2419
|
queueTicketId: z.string().min(1).max(160).optional(),
|
|
2406
2420
|
roomName: z.string().min(1).max(160).optional(),
|
|
2407
2421
|
sttMode: liveKitSttModeSchema.default("server"),
|
|
2422
|
+
transcription: transcriptionOptionsSchema.optional(),
|
|
2408
2423
|
camera: z.boolean().optional(),
|
|
2409
2424
|
voice: voiceSpecSchema.nullable().optional(),
|
|
2410
2425
|
voiceId: z.string().min(1).max(240).nullable().optional(),
|
|
@@ -3075,7 +3090,8 @@ function useSessionLifecycle(input) {
|
|
|
3075
3090
|
}
|
|
3076
3091
|
function SessionLifecycleRoomBridge({
|
|
3077
3092
|
lifecycle,
|
|
3078
|
-
onConnectionDetailsChange
|
|
3093
|
+
onConnectionDetailsChange,
|
|
3094
|
+
onMediaModeChange
|
|
3079
3095
|
}) {
|
|
3080
3096
|
const {
|
|
3081
3097
|
onConnectionStateChange,
|
|
@@ -3092,6 +3108,37 @@ function SessionLifecycleRoomBridge({
|
|
|
3092
3108
|
const assistant = useVoiceAssistant();
|
|
3093
3109
|
const transcriptions = useTranscriptions();
|
|
3094
3110
|
const room = useRoomContext();
|
|
3111
|
+
const mediaModeCallbackRef = useRef(onMediaModeChange);
|
|
3112
|
+
mediaModeCallbackRef.current = onMediaModeChange;
|
|
3113
|
+
const mediaModeEnabled = onMediaModeChange !== void 0 && lifecycle.grant !== null;
|
|
3114
|
+
const mediaModeSessionId = lifecycle.grant?.session_id;
|
|
3115
|
+
useEffect(() => {
|
|
3116
|
+
if (!mediaModeEnabled) return;
|
|
3117
|
+
const agent = assistant.agent;
|
|
3118
|
+
let previous;
|
|
3119
|
+
const deliver = (mode) => {
|
|
3120
|
+
if (mode === previous) return;
|
|
3121
|
+
previous = mode;
|
|
3122
|
+
try {
|
|
3123
|
+
void Promise.resolve(mediaModeCallbackRef.current?.(mode)).catch(() => {
|
|
3124
|
+
});
|
|
3125
|
+
} catch {
|
|
3126
|
+
}
|
|
3127
|
+
};
|
|
3128
|
+
const read = () => {
|
|
3129
|
+
const value = agent?.attributes?.["rta.media_mode"];
|
|
3130
|
+
deliver(value === "video" ? "avatar" : value === "voice" ? "voice" : null);
|
|
3131
|
+
};
|
|
3132
|
+
const changed = (_attributes, participant) => {
|
|
3133
|
+
if (participant === agent) read();
|
|
3134
|
+
};
|
|
3135
|
+
room.on(RoomEvent.ParticipantAttributesChanged, changed);
|
|
3136
|
+
read();
|
|
3137
|
+
return () => {
|
|
3138
|
+
room.off(RoomEvent.ParticipantAttributesChanged, changed);
|
|
3139
|
+
deliver(null);
|
|
3140
|
+
};
|
|
3141
|
+
}, [room, assistant.agent, mediaModeEnabled, mediaModeSessionId]);
|
|
3095
3142
|
const { send } = useChat();
|
|
3096
3143
|
const agentPresent = Boolean(assistant.agent);
|
|
3097
3144
|
const assistantState = assistant.state;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
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, k as ListRecordingsQuery, l as ListRecordingsResponse, i as ListSessionsOptions, L as LoopRedirect, m as RecordingAccessResponse, R as RecordingArtifact, w as RecordingArtifactStatus, x as RecordingMode, S as StartCallResult, T as TranscriptPayload, j as UsageSession, U as UsageSessionPage, V as VideoPolicy, y as isQueued, z as listRecordingsResponseSchema, B as recordingAccessResponseSchema, D as recordingArtifactSchema, F as recordingModeSchema } from './types-
|
|
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, k as ListRecordingsQuery, l as ListRecordingsResponse, i as ListSessionsOptions, L as LoopRedirect, m as RecordingAccessResponse, R as RecordingArtifact, w as RecordingArtifactStatus, x as RecordingMode, S as StartCallResult, T as TranscriptPayload, j as UsageSession, U as UsageSessionPage, V as VideoPolicy, y as isQueued, z as listRecordingsResponseSchema, B as recordingAccessResponseSchema, D as recordingArtifactSchema, F as recordingModeSchema } from './types-Cmto2uGs.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, clipLibraryDeclarationSchema, isQueued, listRecordingsResponseSchema, recordingAccessResponseSchema, recordingArtifactSchema, recordingModeSchema, verifyTranscript } from './chunk-N76M4MEU.js';
|
|
2
2
|
import './chunk-MCIXU6XP.js';
|
package/dist/tanstack-start.d.ts
CHANGED
package/dist/tanstack-start.js
CHANGED
|
@@ -50,6 +50,12 @@ interface components {
|
|
|
50
50
|
* @enum {string}
|
|
51
51
|
*/
|
|
52
52
|
stt_mode: "server" | "off";
|
|
53
|
+
/** @description Optional speech recognition hints. Omit language_codes or send [] for automatic multilingual detection. Custom vocabulary biases recognition; at most 100 relevant terms is recommended. It is not a character instruction or a guarantee of recognition accuracy or latency. */
|
|
54
|
+
transcription?: {
|
|
55
|
+
language_codes?: string[];
|
|
56
|
+
custom_vocabulary?: string[];
|
|
57
|
+
};
|
|
58
|
+
camera?: boolean;
|
|
53
59
|
video_cache_id?: string | null;
|
|
54
60
|
voice?: ({
|
|
55
61
|
/** @constant */
|
|
@@ -173,9 +179,10 @@ interface components {
|
|
|
173
179
|
/** @description DEPRECATED, no-op. Accepted and ignored. The faster hesitation ceiling this requested is now the default for every session, so sending it changes nothing. Safe to stop sending; the field is retained only so existing callers do not break. */
|
|
174
180
|
fast_endpointing?: boolean;
|
|
175
181
|
require_ready_clip_library?: boolean;
|
|
176
|
-
camera?: boolean;
|
|
177
182
|
};
|
|
178
183
|
LiveKitSessionGrant: {
|
|
184
|
+
/** @description Returned only for X-RTA-Observability: identity-v1 after successful platform billing attachment. The authoritative billing hold tenant ID; never client metadata or provider identity. Omitted by default and on failed or queued responses. Older servers may omit it. */
|
|
185
|
+
readonly usage_account_id?: string;
|
|
179
186
|
/** @description Returned only for X-RTA-Release-Evidence: 1. Omitted by default for strict SDK compatibility. Missing deployment or worker evidence remains null. */
|
|
180
187
|
readonly releaseIdentity?: {
|
|
181
188
|
deploymentId: string | null;
|
|
@@ -209,6 +216,7 @@ interface components {
|
|
|
209
216
|
* @enum {string}
|
|
210
217
|
*/
|
|
211
218
|
stt_mode: "server" | "off";
|
|
219
|
+
camera?: boolean;
|
|
212
220
|
/** @default false */
|
|
213
221
|
room_created: boolean;
|
|
214
222
|
/** @default false */
|
|
@@ -266,7 +274,6 @@ interface components {
|
|
|
266
274
|
/** Format: date-time */
|
|
267
275
|
expiresAt: string;
|
|
268
276
|
};
|
|
269
|
-
camera?: boolean;
|
|
270
277
|
};
|
|
271
278
|
LiveKitCapacitySnapshot: {
|
|
272
279
|
capacity_pool: string;
|
|
@@ -1165,6 +1172,12 @@ interface CallPolicy {
|
|
|
1165
1172
|
/** Speech recognition. `server` for a spoken conversation, `off` if you drive turns. */
|
|
1166
1173
|
listen?: boolean;
|
|
1167
1174
|
camera?: Wire["LiveKitSessionRequest"]["camera"];
|
|
1175
|
+
/** Optional language and vocabulary hints for speech recognition. Omit languages for automatic detection. */
|
|
1176
|
+
transcription?: {
|
|
1177
|
+
languageCodes?: NonNullable<Wire["LiveKitSessionRequest"]["transcription"]>["language_codes"];
|
|
1178
|
+
/** Prefer at most 100 relevant names or terms; these are recognition hints, not instructions. */
|
|
1179
|
+
customVocabulary?: NonNullable<Wire["LiveKitSessionRequest"]["transcription"]>["custom_vocabulary"];
|
|
1180
|
+
};
|
|
1168
1181
|
/** How she is rendered. */
|
|
1169
1182
|
video?: VideoPolicy;
|
|
1170
1183
|
/** Voice override for this call; omit to use the avatar's default. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CallMode, a as CallPolicy } from './types-
|
|
1
|
+
import { C as CallMode, a as CallPolicy } from './types-Cmto2uGs.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";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "realtime-avatar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Realtime Avatar SDK. `realtime-avatar` and the route adapters hold your API key and are server-only; `realtime-avatar/react`, `/browser` and `/tools` never can — importing a server entry into a browser build throws at bundle time.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "The Influence Company",
|