@talqing/sdk 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;AAkFb,4DAyCC;AAkBD,8CAiBC;AAED,wDAeC;AAED,oDASC;AAED,gDAgBC;AAED,gDAoBC;AAED,gDAeC;AA+CD,sDAMC;AAOD,sDAsBC;AAOD,kDAUC;AAWD,4CA+FC;AAED,0CAMC;AAED,gDAOC;AA2CD,sDAmBC;AAED,sDAgCC;AAED,8CAeC;AAED,sDAiDC;AAED,wDAiCC;AAED,8DAWC;;AAnqBD,iCAAiF;AACjF,mDAWwB;AACxB,gEAemC;AAoCnC,MAAa,eAAgB,SAAQ,KAAK;IAIxC,YAAY,IAAY,EAAE,OAAe,EAAE,IAAa;QACtD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAVD,0CAUC;AAMD,SAAgB,wBAAwB,CACtC,MAAqB,EACrB,OAAsB,EACtB,UAA8B,EAAE,EAChC,cAAqD;IAErD,4EAA4E;IAC5E,8EAA8E;IAC9E,+BAA+B;IAC/B,EAAE;IACF,4EAA4E;IAC5E,6EAA6E;IAC7E,8EAA8E;IAC9E,yEAAyE;IACzE,6EAA6E;IAC7E,8EAA8E;IAC9E,EAAE;IACF,2EAA2E;IAC3E,0EAA0E;IAC1E,6EAA6E;IAC7E,wCAAwC;IACxC,IAAI,MAAM,GAAoE,IAAI,CAAC;IAEnF,OAAO,4BAAW,CAAC,OAAO,CAAC,GAAG,EAAE;QAC9B,0EAA0E;QAC1E,2DAA2D;QAC3D,MAAM,KAAN,MAAM,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-1,158 +0,0 @@
1
- import React from "react";
2
- import { Room, type RoomOptions } from "livekit-client";
3
- import { type ReceivedMessage, type TrackReference, type UseSessionReturn } from "@livekit/components-react";
4
- import type { JsonObject, JsonValue, TalqingClient } from "./client.js";
5
- import type { ScreenShareCaptureOptions, TrackPublishOptions } from "livekit-client";
6
- import type { CallTokenResponse, TokenRequest } from "./gen/types.gen.js";
7
- /** Everything about one web call except which agent runs it. Wire-shaped, like
8
- * every other request type in this SDK. */
9
- export type TalqingCallOptions = Omit<TokenRequest, "agent_id">;
10
- export interface TalqingBrowserSessionOptions {
11
- client: TalqingClient;
12
- agentId: string | null;
13
- roomOptions?: RoomOptions;
14
- callOptions?: TalqingCallOptions;
15
- onTokenDetails?: (details: CallTokenResponse) => void;
16
- }
17
- export interface TalqingRpcInvocation {
18
- payload: string;
19
- responseTimeout?: number;
20
- callerIdentity?: string;
21
- }
22
- export type TalqingRpcHandler = (data: TalqingRpcInvocation) => string | Promise<string>;
23
- export type TalqingRpcHandlers = Record<string, TalqingRpcHandler>;
24
- export interface TalqingFrontendRpcEnvelope {
25
- method: string;
26
- payload?: JsonValue;
27
- }
28
- export declare class TalqingRpcError extends Error {
29
- readonly code: number;
30
- readonly data?: string;
31
- constructor(code: number, message: string, data?: string);
32
- }
33
- export type TalqingSession = UseSessionReturn;
34
- export type TalqingMessage = ReceivedMessage;
35
- export type TalqingVideoTrackRef = TrackReference;
36
- export declare function createTalqingTokenSource(client: TalqingClient, agentId: string | null, options?: TalqingCallOptions, onTokenDetails?: (details: CallTokenResponse) => void): import("livekit-client").TokenSourceLiteral;
37
- export declare const TALQING_AUDIO_CAPTURE_DEFAULTS: {
38
- readonly echoCancellation: true;
39
- readonly noiseSuppression: true;
40
- readonly autoGainControl: true;
41
- };
42
- /** One session, one call — `start()` it when this mounts and `end()` it on the
43
- * way out, the lifecycle LiveKit's own session docs describe. A second call is
44
- * a second mount, so give the component holding this a `key` that changes per
45
- * call. Starting a finished session again would rejoin the room the last call
46
- * used, which the API refuses. */
47
- export declare function useTalqingSession({ client, agentId, roomOptions, callOptions, onTokenDetails, }: TalqingBrowserSessionOptions): TalqingSession;
48
- export declare function TalqingSessionProvider({ session, children, audio, }: {
49
- session: TalqingSession;
50
- children: React.ReactNode;
51
- audio?: boolean;
52
- }): React.JSX.Element;
53
- export declare function useTalqingConnection(): {
54
- isConnected: boolean;
55
- connectionState: import("livekit-client").ConnectionState;
56
- room: Room;
57
- start: (options?: import("@livekit/components-react").SessionConnectOptions) => Promise<void>;
58
- end: () => Promise<void>;
59
- };
60
- export declare function setTalqingUserdata(room: Room, patch: JsonObject, responseTimeout?: number): Promise<{
61
- ok: boolean;
62
- error?: string;
63
- }>;
64
- export declare function getTalqingUserdata(room: Room, keys?: string[], responseTimeout?: number): Promise<JsonObject>;
65
- export declare function useTalqingUserdata(): {
66
- get: (keys?: string[], responseTimeout?: number) => Promise<JsonObject>;
67
- set: (patch: JsonObject, responseTimeout?: number) => Promise<{
68
- ok: boolean;
69
- error?: string;
70
- }>;
71
- };
72
- export declare const TALQING_IMAGE_TOPIC = "talqing.images";
73
- /** Decoded size the server refuses above. The downscale below keeps a phone
74
- * photo far under it; this is the belt for a file that is not a photo. */
75
- export declare const TALQING_IMAGE_MAX_BYTES: number;
76
- /** Longest side the server stores. Downscaling to it before sending is a
77
- * courtesy to the data channel, which is ordered and reliable and will
78
- * happily spend a minute pushing 10 MB past a call's audio. */
79
- export declare const TALQING_IMAGE_MAX_EDGE_PX = 1568;
80
- export type TalqingImageStatus = "sending" | "sent" | "failed" | "unknown";
81
- export interface TalqingSentImage {
82
- /** The stream id `sendFile` returned, which the ack comes back under. */
83
- streamId: string;
84
- name: string;
85
- /** An object URL for the downscaled image, for rendering the thumbnail.
86
- * Revoked when the hook unmounts. */
87
- previewUrl: string;
88
- status: TalqingImageStatus;
89
- /** Set when `status` is "failed" or "unknown" — a sentence, shown as-is. */
90
- error?: string;
91
- }
92
- /** Refuse what the browser can see is wrong, instantly and with no round trip.
93
- * Returns the sentence to show, or null when the file is fine. The server
94
- * re-validates everything regardless — this exists so the common mistakes cost
95
- * nothing to catch. */
96
- export declare function talqingImageRejection(file: File): string | null;
97
- /** Downscale to the longest edge the server keeps, re-encoding as JPEG or PNG.
98
- *
99
- * Also what normalizes whatever the OS handed the file input — this is how a
100
- * Safari HEIC becomes a JPEG. Throws if the image cannot be decoded, which is
101
- * the third dropzone check. */
102
- export declare function talqingDownscaleImage(file: File): Promise<Blob>;
103
- /** Validate and downscale a file into the `data:` URL a text message carries.
104
- *
105
- * `createTextMessage` takes `images: [{data_url, filename}]`; this produces the
106
- * `data_url`. It doubles as the thumbnail's `src`, so there is no object URL to
107
- * create and revoke. Throws the sentence to show if the file is refused. */
108
- export declare function talqingImageDataUrl(file: File): Promise<string>;
109
- /** Send images to the agent on this call, and follow what became of each.
110
- *
111
- * `send` resolves once the bytes are on their way; the outcome arrives on the
112
- * returned list, which is what a thumbnail should render.
113
- *
114
- * Takes the `Room` rather than reading it from the session context: a byte
115
- * stream and an RPC handler are room-level things, and passing the room keeps
116
- * this usable from a surface that manages its own connection —
117
- * `useTalqingConnection().room` inside a provider, or the Room you built. */
118
- export declare function useTalqingImages(room: Room | null | undefined): {
119
- send: (file: File) => Promise<TalqingSentImage>;
120
- sent: TalqingSentImage[];
121
- clear: () => void;
122
- };
123
- export declare function useTalqingAgent(): {
124
- state: "failed" | "idle" | "connecting" | "disconnected" | "listening" | "thinking" | "speaking" | "pre-connect-buffering" | "initializing";
125
- isFinished: boolean;
126
- };
127
- export declare function useTalqingMessages(): {
128
- messages: ReceivedMessage[];
129
- send: (message: string, options?: import("livekit-client").SendTextOptions) => Promise<import("@livekit/components-react").ReceivedChatMessage>;
130
- isSending: boolean;
131
- };
132
- export declare const TALQING_SCREEN_SHARE_CAPTURE: ScreenShareCaptureOptions;
133
- export declare const TALQING_SCREEN_SHARE_PUBLISH: TrackPublishOptions;
134
- export declare function useTalqingScreenShare(): {
135
- /** Whether a screen is being shared right now. */
136
- enabled: boolean;
137
- /** True while the browser picker is open or the track is publishing. */
138
- pending: boolean;
139
- /** Opens the browser's share picker. Must be called from a user gesture. */
140
- start: () => Promise<void> | Promise<boolean | undefined>;
141
- /** Stops sharing. The agent is told it can no longer see on the next turn. */
142
- stop: () => Promise<void> | Promise<boolean | undefined>;
143
- };
144
- export declare function useTalqingAvatarTrack(): TalqingVideoTrackRef | undefined;
145
- export declare function TalqingVideoTrack({ track, className, }: {
146
- track: TalqingVideoTrackRef;
147
- className?: string;
148
- }): React.JSX.Element;
149
- export declare function useTalqingRpcHandlers(handlers: TalqingRpcHandlers, enabled?: boolean): void;
150
- export declare function useTalqingFrontendRpcs(enabled?: boolean): {
151
- actions: Record<string, {
152
- payload?: JsonValue;
153
- at: number;
154
- }>;
155
- clear: () => void;
156
- };
157
- export declare function setTalqingBrowserLogLevel(level: "debug" | "info" | "warn" | "error" | "silent"): void;
158
- //# sourceMappingURL=browser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAEL,IAAI,EAMJ,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAYL,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE1E;4CAC4C;AAC5C,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AAEhE,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,aA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xs } from "react/jsx-runtime";
3
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
- import { ParticipantKind, Room, RpcError, TokenSource, Track, setLogLevel, LogLevel, } from "livekit-client";
5
- import { RoomAudioRenderer, SessionProvider, VideoTrack, useAgent, useParticipantTracks, useRemoteParticipants, useSession, useSessionContext, useSessionMessages, useTrackToggle, useVoiceAssistant, } from "@livekit/components-react";
6
- export class TalqingRpcError extends Error {
7
- constructor(code, message, data) {
8
- super(message);
9
- this.name = "TalqingRpcError";
10
- this.code = code;
11
- this.data = data;
12
- }
13
- }
14
- export function createTalqingTokenSource(client, agentId, options = {}, onTokenDetails) {
15
- // One source is one call, and it mints once. LiveKit sources normally cache
16
- // for themselves; `TokenSource.literal` is the variant that leaves caching to
17
- // us, and this is us doing it.
18
- //
19
- // It has to be done, because minting is not free here: POST /v1/calls/token
20
- // files the session row the call is later read back from. The framework asks
21
- // three times per call — to warm the connection, to connect, and once more as
22
- // the call ends to drop what it assumes is a cached token — and only the
23
- // middle one is a call anybody placed. Minting for the third filed a session
24
- // nobody ever joined, which sat in the tenant's call list as queued for good.
25
- //
26
- // Freshness comes from a new source per call, never from re-minting inside
27
- // one: the token names the room, and this call has exactly one. Mount the
28
- // session per call and end it on unmount, as LiveKit's own session lifecycle
29
- // does, and that holds by construction.
30
- let minted = null;
31
- return TokenSource.literal(() => {
32
- // A mint that failed is not this call's token, and the surface will offer
33
- // the call again — so keep the rejection out of the cache.
34
- minted ?? (minted = (async () => {
35
- const details = await client.calls.token({
36
- tokenRequest: { ...options, agent_id: agentId, contact_key: options.contact_key ?? null },
37
- });
38
- onTokenDetails?.(details);
39
- return {
40
- serverUrl: details.server_url,
41
- participantToken: details.participant_token,
42
- };
43
- })().catch((err) => {
44
- minted = null;
45
- throw err;
46
- }));
47
- return minted;
48
- });
49
- }
50
- /* Echo cancellation is what stops the agent hearing its own speech through the
51
- * caller's microphone and interrupting itself. It is a default rather than
52
- * something each app remembers, because a call without it is broken in a way
53
- * that sounds like a bad model. Pass `roomOptions.audioCaptureDefaults` to
54
- * override. */
55
- export const TALQING_AUDIO_CAPTURE_DEFAULTS = {
56
- echoCancellation: true,
57
- noiseSuppression: true,
58
- autoGainControl: true,
59
- };
60
- /** One session, one call — `start()` it when this mounts and `end()` it on the
61
- * way out, the lifecycle LiveKit's own session docs describe. A second call is
62
- * a second mount, so give the component holding this a `key` that changes per
63
- * call. Starting a finished session again would rejoin the room the last call
64
- * used, which the API refuses. */
65
- export function useTalqingSession({ client, agentId, roomOptions, callOptions, onTokenDetails, }) {
66
- const tokenSource = useMemo(() => createTalqingTokenSource(client, agentId, callOptions, onTokenDetails), [client, agentId, callOptions, onTokenDetails]);
67
- const room = useMemo(() => new Room({ audioCaptureDefaults: TALQING_AUDIO_CAPTURE_DEFAULTS, ...roomOptions }), [roomOptions]);
68
- return useSession(tokenSource, { room });
69
- }
70
- export function TalqingSessionProvider({ session, children, audio = true, }) {
71
- return (_jsxs(SessionProvider, { session: session, children: [children, audio ? _jsx(RoomAudioRenderer, {}) : null] }));
72
- }
73
- export function useTalqingConnection() {
74
- const ctx = useSessionContext();
75
- return {
76
- isConnected: ctx.isConnected,
77
- connectionState: ctx.connectionState,
78
- room: ctx.room,
79
- start: ctx.start,
80
- end: ctx.end,
81
- };
82
- }
83
- export async function setTalqingUserdata(room, patch, responseTimeout = 3) {
84
- const agent = [...room.remoteParticipants.values()].find((participant) => participant.kind === ParticipantKind.AGENT);
85
- if (!agent)
86
- return { ok: false, error: "agent participant is not connected" };
87
- const response = await room.localParticipant.performRpc({
88
- destinationIdentity: agent.identity,
89
- method: "talqing.client.userdata_set",
90
- payload: JSON.stringify(patch),
91
- responseTimeout,
92
- });
93
- return JSON.parse(response || "{}");
94
- }
95
- export async function getTalqingUserdata(room, keys, responseTimeout = 3) {
96
- const agent = [...room.remoteParticipants.values()].find((participant) => participant.kind === ParticipantKind.AGENT);
97
- if (!agent)
98
- throw new Error("agent participant is not connected");
99
- const response = await room.localParticipant.performRpc({
100
- destinationIdentity: agent.identity,
101
- method: "talqing.client.userdata_get",
102
- payload: JSON.stringify(keys ? { keys } : {}),
103
- responseTimeout,
104
- });
105
- const parsed = JSON.parse(response || "{}");
106
- if (parsed.ok === false) {
107
- throw new Error(String(parsed.error || "userdata RPC failed"));
108
- }
109
- return parsed;
110
- }
111
- export function useTalqingUserdata() {
112
- const { room } = useTalqingConnection();
113
- return useMemo(() => ({
114
- get: (keys, responseTimeout) => {
115
- if (!room)
116
- throw new Error("room is not connected");
117
- return getTalqingUserdata(room, keys, responseTimeout);
118
- },
119
- set: (patch, responseTimeout) => {
120
- if (!room)
121
- throw new Error("room is not connected");
122
- return setTalqingUserdata(room, patch, responseTimeout);
123
- },
124
- }), [room]);
125
- }
126
- /* ── images ───────────────────────────────────────────────────────────────
127
- *
128
- * A caller attaches a photo on a web voice or video call and the agent sees
129
- * it. The bytes go over a LiveKit byte stream on the `talqing.images` topic,
130
- * addressed to the agent; the agent answers on an RPC back, and the id
131
- * `sendFile` returns is the id that ack carries, so there is nothing to
132
- * correlate by hand.
133
- *
134
- * The agent deliberately does NOT speak when a photo lands — the caller is
135
- * mid-conversation and about to say what it is for. The image is in the
136
- * model's view for their next turn.
137
- */
138
- export const TALQING_IMAGE_TOPIC = "talqing.images";
139
- /** Decoded size the server refuses above. The downscale below keeps a phone
140
- * photo far under it; this is the belt for a file that is not a photo. */
141
- export const TALQING_IMAGE_MAX_BYTES = 10 * 1024 * 1024;
142
- /** Longest side the server stores. Downscaling to it before sending is a
143
- * courtesy to the data channel, which is ordered and reliable and will
144
- * happily spend a minute pushing 10 MB past a call's audio. */
145
- export const TALQING_IMAGE_MAX_EDGE_PX = 1568;
146
- const TALQING_IMAGE_TYPES = ["image/jpeg", "image/png", "image/webp"];
147
- /** How long to wait for the agent's ack before saying we do not know. Without
148
- * it a thumbnail sits on "sending" for the rest of the call when the worker
149
- * dies mid-upload. */
150
- const TALQING_IMAGE_ACK_TIMEOUT_MS = 30000;
151
- /** Refuse what the browser can see is wrong, instantly and with no round trip.
152
- * Returns the sentence to show, or null when the file is fine. The server
153
- * re-validates everything regardless — this exists so the common mistakes cost
154
- * nothing to catch. */
155
- export function talqingImageRejection(file) {
156
- if (!TALQING_IMAGE_TYPES.includes(file.type)) {
157
- return "that file is not a JPEG, PNG or WebP";
158
- }
159
- if (file.size > TALQING_IMAGE_MAX_BYTES)
160
- return "images are 10 MB or smaller";
161
- return null;
162
- }
163
- /** Downscale to the longest edge the server keeps, re-encoding as JPEG or PNG.
164
- *
165
- * Also what normalizes whatever the OS handed the file input — this is how a
166
- * Safari HEIC becomes a JPEG. Throws if the image cannot be decoded, which is
167
- * the third dropzone check. */
168
- export async function talqingDownscaleImage(file) {
169
- const bitmap = await createImageBitmap(file);
170
- try {
171
- const longest = Math.max(bitmap.width, bitmap.height);
172
- const scale = longest > TALQING_IMAGE_MAX_EDGE_PX ? TALQING_IMAGE_MAX_EDGE_PX / longest : 1;
173
- const canvas = document.createElement("canvas");
174
- canvas.width = Math.max(1, Math.round(bitmap.width * scale));
175
- canvas.height = Math.max(1, Math.round(bitmap.height * scale));
176
- const context = canvas.getContext("2d");
177
- if (!context)
178
- throw new Error("this browser cannot resize images");
179
- context.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
180
- // PNG keeps transparency; everything else becomes a JPEG, including the
181
- // HEIC the OS decoded for us.
182
- const type = file.type === "image/png" ? "image/png" : "image/jpeg";
183
- const blob = await new Promise((resolve) => canvas.toBlob(resolve, type, 0.85));
184
- if (!blob)
185
- throw new Error("that image could not be read");
186
- return blob;
187
- }
188
- finally {
189
- bitmap.close();
190
- }
191
- }
192
- /** Validate and downscale a file into the `data:` URL a text message carries.
193
- *
194
- * `createTextMessage` takes `images: [{data_url, filename}]`; this produces the
195
- * `data_url`. It doubles as the thumbnail's `src`, so there is no object URL to
196
- * create and revoke. Throws the sentence to show if the file is refused. */
197
- export async function talqingImageDataUrl(file) {
198
- const rejection = talqingImageRejection(file);
199
- if (rejection)
200
- throw new Error(rejection);
201
- const blob = await talqingDownscaleImage(file);
202
- return await new Promise((resolve, reject) => {
203
- const reader = new FileReader();
204
- reader.onerror = () => reject(new Error("that image could not be read"));
205
- reader.onload = () => resolve(String(reader.result));
206
- reader.readAsDataURL(blob);
207
- });
208
- }
209
- /** Send images to the agent on this call, and follow what became of each.
210
- *
211
- * `send` resolves once the bytes are on their way; the outcome arrives on the
212
- * returned list, which is what a thumbnail should render.
213
- *
214
- * Takes the `Room` rather than reading it from the session context: a byte
215
- * stream and an RPC handler are room-level things, and passing the room keeps
216
- * this usable from a surface that manages its own connection —
217
- * `useTalqingConnection().room` inside a provider, or the Room you built. */
218
- export function useTalqingImages(room) {
219
- const [sent, setSent] = useState([]);
220
- const timers = useRef(new Map());
221
- const settle = useCallback((streamId, patch) => {
222
- const timer = timers.current.get(streamId);
223
- if (timer) {
224
- clearTimeout(timer);
225
- timers.current.delete(streamId);
226
- }
227
- setSent((images) => images.map((image) => (image.streamId === streamId ? { ...image, ...patch } : image)));
228
- }, []);
229
- useEffect(() => {
230
- if (!room)
231
- return;
232
- room.registerRpcMethod("talqing.image_result", async (data) => {
233
- const { stream_id, ok, error } = JSON.parse(data.payload || "{}");
234
- settle(stream_id, {
235
- status: ok ? "sent" : "failed",
236
- error: ok ? undefined : error || "that image was not accepted",
237
- });
238
- return "{}";
239
- });
240
- return () => room.unregisterRpcMethod("talqing.image_result");
241
- }, [room, settle]);
242
- const pending = timers.current;
243
- useEffect(() => () => {
244
- pending.forEach(clearTimeout);
245
- pending.clear();
246
- }, [pending]);
247
- const send = useCallback(async (file) => {
248
- if (!room)
249
- throw new Error("the call is not connected");
250
- const agent = [...room.remoteParticipants.values()].find((participant) => participant.kind === ParticipantKind.AGENT);
251
- if (!agent)
252
- throw new Error("agent participant is not connected");
253
- const rejection = talqingImageRejection(file);
254
- if (rejection)
255
- throw new Error(rejection);
256
- const blob = await talqingDownscaleImage(file);
257
- // Addressed to the agent, never broadcast: on video the avatar worker is
258
- // a participant too, and a broadcast sends the bytes twice.
259
- const { id } = await room.localParticipant.sendFile(new File([blob], file.name, { type: blob.type }), {
260
- topic: TALQING_IMAGE_TOPIC,
261
- mimeType: blob.type,
262
- destinationIdentities: [agent.identity],
263
- });
264
- const image = {
265
- streamId: id,
266
- name: file.name,
267
- previewUrl: URL.createObjectURL(blob),
268
- status: "sending",
269
- };
270
- setSent((images) => [...images, image]);
271
- timers.current.set(id, setTimeout(() => settle(id, {
272
- status: "unknown",
273
- // Four states, not two: the one people forget is the agent going
274
- // away mid-upload, where no ack is ever coming.
275
- error: "we did not hear back — the agent may not have received it",
276
- }), TALQING_IMAGE_ACK_TIMEOUT_MS));
277
- return image;
278
- }, [room, settle]);
279
- const clear = useCallback(() => {
280
- setSent((images) => {
281
- images.forEach((image) => URL.revokeObjectURL(image.previewUrl));
282
- return [];
283
- });
284
- }, []);
285
- return { send, sent, clear };
286
- }
287
- export function useTalqingAgent() {
288
- const agent = useAgent();
289
- return {
290
- state: agent.state,
291
- isFinished: agent.isFinished,
292
- };
293
- }
294
- export function useTalqingMessages() {
295
- const messages = useSessionMessages();
296
- return {
297
- messages: messages.messages,
298
- send: messages.send,
299
- isSending: messages.isSending,
300
- };
301
- }
302
- /* Screen share, with the four settings that decide whether the agent can read
303
- * what is on it.
304
- *
305
- * Only the first is obvious, and every one of them is upstream of anything we
306
- * could do on our side:
307
- *
308
- * - `contentHint: "text"` tells the encoder to preserve spatial detail. The
309
- * default for a screen share on an SVC codec is `motion`, which trades
310
- * exactly that away — the wrong trade for reading code, and no JPEG quality
311
- * setting downstream recovers it.
312
- * - `videoCodec: "h264"` is what keeps that hint. `livekit-client` forces
313
- * `contentHint = "motion"` on screen shares published as vp9 or av1,
314
- * together with `scalabilityMode: "L1T3"`. **Publishing on an SVC codec will
315
- * cost you legibility**, and it is the first thing to check if the agent
316
- * starts misreading identifiers.
317
- * - `screenShareEncoding.maxFramerate: 1` is the frame-rate cap that actually
318
- * binds. `resolution.frameRate` reaches `getDisplayMedia` as a bare number,
319
- * which WebRTC reads as `ideal` — a wish, not a limit. The default publish
320
- * ceiling is 15 fps, and every delivered frame is copied into the agent's
321
- * process before it can be dropped, so this is the single biggest lever on
322
- * what a call costs the worker. One frame a second is ample: the agent is
323
- * handed the newest frame at the end of each turn, and turns are seconds
324
- * apart.
325
- * - `resolution` is set explicitly rather than inherited. The default is 1080p
326
- * by `ideal`, which is a strong hint and not a guarantee.
327
- *
328
- * The picker cannot be opened for the person — `getDisplayMedia` requires a
329
- * transient user activation — so `start()` must be called from a click. The
330
- * agent asking out loud is what prompts it; there is no version of this where
331
- * the agent turns sharing on.
332
- */
333
- export const TALQING_SCREEN_SHARE_CAPTURE = {
334
- resolution: { width: 1920, height: 1080, frameRate: 1 },
335
- contentHint: "text",
336
- };
337
- export const TALQING_SCREEN_SHARE_PUBLISH = {
338
- videoCodec: "h264",
339
- screenShareEncoding: { maxBitrate: 1000000, maxFramerate: 1 },
340
- };
341
- export function useTalqingScreenShare() {
342
- const { toggle, enabled, pending } = useTrackToggle({
343
- source: Track.Source.ScreenShare,
344
- captureOptions: TALQING_SCREEN_SHARE_CAPTURE,
345
- publishOptions: TALQING_SCREEN_SHARE_PUBLISH,
346
- });
347
- return useMemo(() => ({
348
- /** Whether a screen is being shared right now. */
349
- enabled,
350
- /** True while the browser picker is open or the track is publishing. */
351
- pending,
352
- /** Opens the browser's share picker. Must be called from a user gesture. */
353
- start: () => toggle(true),
354
- /** Stops sharing. The agent is told it can no longer see on the next turn. */
355
- stop: () => toggle(false),
356
- }), [enabled, pending, toggle]);
357
- }
358
- export function useTalqingAvatarTrack() {
359
- const { agent } = useVoiceAssistant();
360
- const remoteParticipants = useRemoteParticipants();
361
- const worker = remoteParticipants.find((participant) => participant.kind === ParticipantKind.AGENT &&
362
- participant.attributes["lk.publish_on_behalf"] === agent?.identity);
363
- const agentTracks = useParticipantTracks([Track.Source.Camera, Track.Source.ScreenShare], agent?.identity);
364
- const workerTracks = useParticipantTracks([Track.Source.Camera, Track.Source.ScreenShare], worker?.identity);
365
- return (workerTracks.find((track) => track.source === Track.Source.Camera) ??
366
- workerTracks.find((track) => track.source === Track.Source.ScreenShare) ??
367
- agentTracks.find((track) => track.source === Track.Source.Camera) ??
368
- agentTracks.find((track) => track.source === Track.Source.ScreenShare));
369
- }
370
- export function TalqingVideoTrack({ track, className, }) {
371
- return (_jsx(VideoTrack, { trackRef: track, width: track.publication.dimensions?.width ?? 0, height: track.publication.dimensions?.height ?? 0, className: className }));
372
- }
373
- export function useTalqingRpcHandlers(handlers, enabled = true) {
374
- const { room, isConnected } = useTalqingConnection();
375
- useEffect(() => {
376
- if (!enabled || !room || !isConnected)
377
- return;
378
- room.registerRpcMethod("talqing.frontend_rpc", async (data) => {
379
- try {
380
- const envelope = JSON.parse(data.payload || "{}");
381
- const isWildcard = handlers[envelope.method] === undefined;
382
- const handler = handlers[envelope.method] ?? handlers["*"];
383
- if (!handler) {
384
- throw new TalqingRpcError(1404, `No frontend RPC handler registered for ${envelope.method}`);
385
- }
386
- return await handler({
387
- payload: isWildcard
388
- ? JSON.stringify(envelope)
389
- : envelope.payload === undefined
390
- ? "{}"
391
- : JSON.stringify(envelope.payload),
392
- responseTimeout: data.responseTimeout,
393
- callerIdentity: data.callerIdentity,
394
- });
395
- }
396
- catch (error) {
397
- if (error instanceof TalqingRpcError) {
398
- throw new RpcError(error.code, error.message, error.data);
399
- }
400
- throw new RpcError(1500, error instanceof Error ? error.message : "RPC handler failed");
401
- }
402
- });
403
- return () => {
404
- room.unregisterRpcMethod("talqing.frontend_rpc");
405
- };
406
- }, [enabled, handlers, isConnected, room]);
407
- }
408
- export function useTalqingFrontendRpcs(enabled = true) {
409
- const [actions, setActions] = useState({});
410
- const handlers = useMemo(() => ({
411
- "*": async (data) => {
412
- const payload = JSON.parse(data.payload || "{}");
413
- const method = String(payload.method || "");
414
- if (method) {
415
- setActions((current) => ({
416
- ...current,
417
- [method]: {
418
- payload: payload.payload,
419
- at: Date.now(),
420
- },
421
- }));
422
- }
423
- return "ok";
424
- },
425
- }), []);
426
- useTalqingRpcHandlers(handlers, enabled);
427
- return {
428
- actions,
429
- clear: () => setActions({}),
430
- };
431
- }
432
- export function setTalqingBrowserLogLevel(level) {
433
- const levels = {
434
- debug: LogLevel.debug,
435
- info: LogLevel.info,
436
- warn: LogLevel.warn,
437
- error: LogLevel.error,
438
- silent: LogLevel.silent,
439
- };
440
- setLogLevel(levels[level]);
441
- }
442
- //# sourceMappingURL=browser.js.map