@snapcall/stream-ui 1.41.3-beta.1 → 1.41.3
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/stream-ui.esm.js +1515 -18
- package/dist/stream-ui.js +1513 -16
- package/dist/types.d.ts +193 -1
- package/package.json +3 -3
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as mediasoupClient from "mediasoup-client";
|
|
2
2
|
import { types } from "mediasoup-client";
|
|
3
|
+
import { AIResponse as _AIResponse1 } from "streamerClient/LiveAIAgent/message";
|
|
3
4
|
import * as protooClient from "protoo-client";
|
|
4
5
|
type VideoResolution = 'qvga' | 'vga' | 'hd' | 'max';
|
|
5
6
|
type PeerId = string;
|
|
@@ -34,6 +35,7 @@ interface Flow {
|
|
|
34
35
|
name: string;
|
|
35
36
|
is_default: number;
|
|
36
37
|
config?: {
|
|
38
|
+
real_time_assistant?: boolean;
|
|
37
39
|
description?: string;
|
|
38
40
|
image_url?: string;
|
|
39
41
|
output_language?: string;
|
|
@@ -262,6 +264,188 @@ declare class AudioRenderer {
|
|
|
262
264
|
getSink(): string;
|
|
263
265
|
play(): Promise<void>;
|
|
264
266
|
}
|
|
267
|
+
interface InputText {
|
|
268
|
+
type: 'input_text';
|
|
269
|
+
text: string;
|
|
270
|
+
}
|
|
271
|
+
interface InputImage {
|
|
272
|
+
type: 'input_image';
|
|
273
|
+
image_url?: string;
|
|
274
|
+
}
|
|
275
|
+
type ContentItem = InputText | InputImage;
|
|
276
|
+
interface MessageItem {
|
|
277
|
+
id: string;
|
|
278
|
+
type: 'message';
|
|
279
|
+
status?: 'completed' | 'in_progress';
|
|
280
|
+
role: 'user' | 'assistant';
|
|
281
|
+
content: ContentItem[];
|
|
282
|
+
}
|
|
283
|
+
interface FunctionCallItem {
|
|
284
|
+
id: string;
|
|
285
|
+
type: 'function_call';
|
|
286
|
+
status: 'in_progress' | 'completed';
|
|
287
|
+
name: string;
|
|
288
|
+
call_id: string;
|
|
289
|
+
arguments: string;
|
|
290
|
+
}
|
|
291
|
+
interface FunctionCallOutputItem {
|
|
292
|
+
id: string;
|
|
293
|
+
type: 'function_call_output';
|
|
294
|
+
call_id: string;
|
|
295
|
+
output: string;
|
|
296
|
+
}
|
|
297
|
+
interface FunctionCallOutputItemCreate {
|
|
298
|
+
id: string;
|
|
299
|
+
type: 'function_call_output';
|
|
300
|
+
call_id: string;
|
|
301
|
+
output: string;
|
|
302
|
+
}
|
|
303
|
+
interface BaseEvent {
|
|
304
|
+
type: string;
|
|
305
|
+
event_id: string;
|
|
306
|
+
}
|
|
307
|
+
interface BaseSendMessage {
|
|
308
|
+
type: string;
|
|
309
|
+
event_id: string;
|
|
310
|
+
}
|
|
311
|
+
interface ResponseFunctionCallArgumentsDone extends BaseEvent {
|
|
312
|
+
type: 'response.function_call_arguments.done';
|
|
313
|
+
response_id: string;
|
|
314
|
+
item_id: string;
|
|
315
|
+
output_index: number;
|
|
316
|
+
call_id: string;
|
|
317
|
+
name: string;
|
|
318
|
+
arguments: string;
|
|
319
|
+
}
|
|
320
|
+
interface FunctionCallOutput extends BaseSendMessage {
|
|
321
|
+
item: FunctionCallOutputItem;
|
|
322
|
+
}
|
|
323
|
+
type CreateItem = MessageItem | FunctionCallItem | FunctionCallOutputItemCreate;
|
|
324
|
+
interface ConversationItemCreate extends BaseSendMessage {
|
|
325
|
+
event_id: string;
|
|
326
|
+
type: 'conversation.item.create';
|
|
327
|
+
item: CreateItem;
|
|
328
|
+
}
|
|
329
|
+
interface ResponseCreate extends BaseSendMessage {
|
|
330
|
+
event_id: string;
|
|
331
|
+
type: 'response.create';
|
|
332
|
+
response: {
|
|
333
|
+
output_modalities: string[];
|
|
334
|
+
metadata: {
|
|
335
|
+
initial_event_id: string;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
interface ResponseCancel extends BaseSendMessage {
|
|
340
|
+
event_id: string;
|
|
341
|
+
type: 'response.cancel';
|
|
342
|
+
response_id: string;
|
|
343
|
+
}
|
|
344
|
+
type SendMessage = ConversationItemCreate | ResponseCreate | ResponseCancel | FunctionCallOutputItem;
|
|
345
|
+
declare class ToolOutputMessage {
|
|
346
|
+
id: string;
|
|
347
|
+
callId: string;
|
|
348
|
+
output: string;
|
|
349
|
+
arg: string;
|
|
350
|
+
name: string;
|
|
351
|
+
answer: boolean;
|
|
352
|
+
constructor(initMessage: ResponseFunctionCallArgumentsDone);
|
|
353
|
+
setOutput(output: string): void;
|
|
354
|
+
build(): FunctionCallOutput;
|
|
355
|
+
}
|
|
356
|
+
declare class UserMessage {
|
|
357
|
+
id: string;
|
|
358
|
+
status: 'pending' | 'sent' | 'added';
|
|
359
|
+
content: Array<InputText | InputImage>;
|
|
360
|
+
addContent(text: string): void;
|
|
361
|
+
addMediaContent(type: 'microphone' | 'camera' | 'screen', state: 'active' | 'inactive'): void;
|
|
362
|
+
addAppContent(type: 'button' | 'text' | 'event', text: string): void;
|
|
363
|
+
addInstructionContent(instruction: string): void;
|
|
364
|
+
addImageContent(url: string): Promise<void>;
|
|
365
|
+
build(): ConversationItemCreate;
|
|
366
|
+
}
|
|
367
|
+
declare class CancelMessage {
|
|
368
|
+
id: string;
|
|
369
|
+
type: 'response.cancel';
|
|
370
|
+
response_id: string;
|
|
371
|
+
constructor(response_id: string);
|
|
372
|
+
build(): SendMessage & {
|
|
373
|
+
event_id: string;
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
declare class AIResponse {
|
|
377
|
+
static internalIdCounter: number;
|
|
378
|
+
initiator: 'server' | 'client';
|
|
379
|
+
id: string;
|
|
380
|
+
responseId?: string;
|
|
381
|
+
terminated: boolean;
|
|
382
|
+
canceled: boolean;
|
|
383
|
+
constructor(initiator: 'server' | 'client');
|
|
384
|
+
setResponseId(response_id: string): void;
|
|
385
|
+
setTerminated(): void;
|
|
386
|
+
cancel(): CancelMessage | undefined;
|
|
387
|
+
build(): ResponseCreate;
|
|
388
|
+
}
|
|
389
|
+
interface AIAgentListener {
|
|
390
|
+
onStart: () => void;
|
|
391
|
+
onAssistantPartialMessage: (message: string) => void;
|
|
392
|
+
onAssistantMessage: (message: string) => void;
|
|
393
|
+
onAudioAssistant: (state: 'started' | 'stopped') => void;
|
|
394
|
+
}
|
|
395
|
+
declare class AIAgent {
|
|
396
|
+
responses: Record<string, AIResponse>;
|
|
397
|
+
lastDeltaMessage: Record<string, any> | undefined;
|
|
398
|
+
lastCompleteMessage: Record<string, any> | undefined;
|
|
399
|
+
constructor(listener: AIAgentListener);
|
|
400
|
+
mute(): void;
|
|
401
|
+
unmute(): void;
|
|
402
|
+
sendUserMessage(message: UserMessage): Promise<unknown> | undefined;
|
|
403
|
+
setTrack(track: MediaStreamTrack): void;
|
|
404
|
+
init({ instructions, voice, track, }: {
|
|
405
|
+
instructions: string;
|
|
406
|
+
voice: string;
|
|
407
|
+
track?: MediaStreamTrack;
|
|
408
|
+
}): Promise<void>;
|
|
409
|
+
stopResponse(): Promise<void>;
|
|
410
|
+
startResponse(origin: string): Promise<AIResponse | undefined>;
|
|
411
|
+
sendToolOutput(toolOutput: ToolOutputMessage): Promise<FunctionCallOutput>;
|
|
412
|
+
stop(): void;
|
|
413
|
+
dumpHistory(): void;
|
|
414
|
+
}
|
|
415
|
+
type AITextEvent = CustomEvent<{
|
|
416
|
+
text: string;
|
|
417
|
+
}>;
|
|
418
|
+
interface AIEvents {
|
|
419
|
+
aiTextMessage: AITextEvent['detail'];
|
|
420
|
+
aiDisplayMessage: AITextEvent;
|
|
421
|
+
aiStarted: AITextEvent;
|
|
422
|
+
aiStopped: AITextEvent;
|
|
423
|
+
aiUserTextMessage: AITextEvent;
|
|
424
|
+
}
|
|
425
|
+
declare class LiveAIAgent implements AIAgentListener {
|
|
426
|
+
static instance: LiveAIAgent;
|
|
427
|
+
agent: AIAgent;
|
|
428
|
+
constructor();
|
|
429
|
+
init(options: {
|
|
430
|
+
language: string;
|
|
431
|
+
voice: string;
|
|
432
|
+
}, streamInfo: StreamInfo, track?: MediaStreamTrack): Promise<void>;
|
|
433
|
+
setTrack(track: MediaStreamTrack): void;
|
|
434
|
+
addScriptedMessage(script: Scripted): Promise<unknown>;
|
|
435
|
+
addVideoImage(image: string): Promise<void>;
|
|
436
|
+
analyzeVideo(): Promise<void>;
|
|
437
|
+
analyzeImageResult(image: string): Promise<void>;
|
|
438
|
+
onStart(): Promise<void>;
|
|
439
|
+
sendInitialMessage(): Promise<void>;
|
|
440
|
+
startResponse(origin: string): Promise<_AIResponse1 | undefined> | undefined;
|
|
441
|
+
onAssistantPartialMessage(text: string): void;
|
|
442
|
+
onAssistantMessage(text: string): void;
|
|
443
|
+
onAudioAssistant(state: 'started' | 'stopped'): void;
|
|
444
|
+
}
|
|
445
|
+
interface Scripted {
|
|
446
|
+
message: UserMessage;
|
|
447
|
+
response: boolean;
|
|
448
|
+
}
|
|
265
449
|
interface Media {
|
|
266
450
|
stream: MediaStream | undefined;
|
|
267
451
|
track: MediaStreamTrack | undefined;
|
|
@@ -395,6 +579,7 @@ declare global {
|
|
|
395
579
|
export namespace SnapCall {
|
|
396
580
|
export { Permissions, Permission, MediaType };
|
|
397
581
|
export { EventAnswer };
|
|
582
|
+
export { AITextEvent };
|
|
398
583
|
export type SnapcallEvent<T> = CustomEvent<T>;
|
|
399
584
|
export type PeersInfoEvent = SnapcallEvent<{
|
|
400
585
|
videoRecordStarted: boolean;
|
|
@@ -515,7 +700,7 @@ declare global {
|
|
|
515
700
|
};
|
|
516
701
|
}
|
|
517
702
|
}
|
|
518
|
-
interface StreamerEventMap {
|
|
703
|
+
interface StreamerEventMap extends AIEvents {
|
|
519
704
|
audioLevel: SnapCall.AudioLevelEvent['detail'];
|
|
520
705
|
localStartSpeak: SnapCall.BaseEvent['detail'];
|
|
521
706
|
localStopSpeak: SnapCall.BaseEvent['detail'];
|
|
@@ -582,6 +767,8 @@ declare const StreamerEventTargetType: {
|
|
|
582
767
|
prototype: StreamerEventTarget;
|
|
583
768
|
};
|
|
584
769
|
declare class StreamerClient extends StreamerEventTargetType implements AudioLevelListener, TransportMonitorListener {
|
|
770
|
+
liveAIAgent?: LiveAIAgent;
|
|
771
|
+
streamInfo?: StreamInfo;
|
|
585
772
|
tracksHandler: MediaTracksHandler;
|
|
586
773
|
peers: Map<PeerId, PeerInfo>;
|
|
587
774
|
consumers: Map<ConsumerId, ConsumerData>;
|
|
@@ -646,6 +833,10 @@ declare class StreamerClient extends StreamerEventTargetType implements AudioLev
|
|
|
646
833
|
enableMicrophone({ deviceId }?: {
|
|
647
834
|
deviceId?: string;
|
|
648
835
|
}): Promise<void>;
|
|
836
|
+
initLiveAIAgent(options: {
|
|
837
|
+
language: string;
|
|
838
|
+
voice: string;
|
|
839
|
+
}): LiveAIAgent;
|
|
649
840
|
muteMicrophone(): void;
|
|
650
841
|
unMuteMicrophone(): void;
|
|
651
842
|
toggleMute(): Promise<{
|
|
@@ -722,6 +913,7 @@ declare class StreamerClient extends StreamerEventTargetType implements AudioLev
|
|
|
722
913
|
};
|
|
723
914
|
}>): Promise<CreateEventResult>;
|
|
724
915
|
captureVideo(videoElement?: HTMLVideoElement): Promise<string>;
|
|
916
|
+
captureScreenShare(): Promise<string>;
|
|
725
917
|
requestLocalVideo(element: HTMLVideoElement): {
|
|
726
918
|
facingMode: string;
|
|
727
919
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snapcall/stream-ui",
|
|
3
|
-
"version": "1.41.3
|
|
3
|
+
"version": "1.41.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"main": "dist/stream-ui.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"bowser": "^2.11.0",
|
|
60
60
|
"i18next": "^25.5.2",
|
|
61
61
|
"inobounce": "^0.2.1",
|
|
62
|
-
"mediasoup-client": "^3.
|
|
62
|
+
"mediasoup-client": "^3.18.3",
|
|
63
63
|
"protoo-client": "^4.0.6",
|
|
64
64
|
"qrcode": "^1.5.4",
|
|
65
65
|
"react": "^19.1.1",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"classnames": "^2.5.1",
|
|
102
102
|
"inobounce": "^0.2.1",
|
|
103
103
|
"mixpanel-browser": "^2.67.0",
|
|
104
|
-
"protoo-client": "^4.0.
|
|
104
|
+
"protoo-client": "^4.0.7",
|
|
105
105
|
"qrcode": "^1.5.4",
|
|
106
106
|
"react-hook-form": "^7.59.0",
|
|
107
107
|
"react-markdown": "^10.1.0",
|