@whereby.com/assistant-sdk 0.0.0-canary-20250903113745

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.
@@ -0,0 +1,131 @@
1
+ import { RoomConnectionClient, RemoteParticipantState } from '@whereby.com/core';
2
+ export { RemoteParticipantState } from '@whereby.com/core';
3
+ import wrtc from '@roamhq/wrtc';
4
+ import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
5
+ import { PassThrough } from 'stream';
6
+
7
+ declare const AUDIO_STREAM_READY = "AUDIO_STREAM_READY";
8
+ type AssistantEvents = {
9
+ [AUDIO_STREAM_READY]: [{
10
+ stream: MediaStream;
11
+ track: MediaStreamTrack;
12
+ }];
13
+ };
14
+
15
+ type AssistantOptions = {
16
+ assistantKey?: string;
17
+ startCombinedAudioStream: boolean;
18
+ };
19
+ declare class Assistant extends EventEmitter<AssistantEvents> {
20
+ private assistantKey?;
21
+ private client;
22
+ private roomConnection;
23
+ private localMedia;
24
+ private mediaStream;
25
+ private audioSource;
26
+ private combinedStream;
27
+ constructor({ assistantKey, startCombinedAudioStream }?: AssistantOptions);
28
+ joinRoom(roomUrl: string): Promise<void>;
29
+ getLocalMediaStream(): MediaStream | null;
30
+ getLocalAudioSource(): wrtc.nonstandard.RTCAudioSource | null;
31
+ getRoomConnection(): RoomConnectionClient;
32
+ getCombinedAudioStream(): MediaStream | null;
33
+ getRemoteParticipants(): RemoteParticipantState[];
34
+ startCloudRecording(): void;
35
+ stopCloudRecording(): void;
36
+ sendChatMessage(message: string): void;
37
+ spotlightParticipant(participantId: string): void;
38
+ removeSpotlight(participantId: string): void;
39
+ requestAudioEnable(participantId: string, enable: boolean): void;
40
+ requestVideoEnable(participantId: string, enable: boolean): void;
41
+ acceptWaitingParticipant(participantId: string): void;
42
+ rejectWaitingParticipant(participantId: string): void;
43
+ subscribeToRemoteParticipants(callback: (participants: RemoteParticipantState[]) => void): () => void;
44
+ }
45
+
46
+ type WebhookType = "room.client.joined" | "room.client.left" | "room.session.started" | "room.session.ended";
47
+ declare const ASSISTANT_JOIN_SUCCESS = "ASSISTANT_JOIN_SUCCESS";
48
+ interface WherebyWebhookBase {
49
+ type: WebhookType;
50
+ apiVersion: "1.0";
51
+ id: string;
52
+ createdAt: string;
53
+ }
54
+ interface WherebyWebhookInRoom {
55
+ meetingId: string;
56
+ roomName: string;
57
+ roomSessionId: string | null;
58
+ }
59
+ interface WherebyWebhookDataClient {
60
+ displayName: string;
61
+ participantId: string;
62
+ metadata: string | null;
63
+ externalId: string | null;
64
+ }
65
+ type WherebyRoleName = "owner" | "member" | "host" | "visitor" | "granted_visitor" | "viewer" | "granted_viewer" | "recorder" | "streamer" | "captioner";
66
+ interface WherebyWebhookDataClientJoinLeave {
67
+ roleName: WherebyRoleName;
68
+ numClients: number;
69
+ numClientsByRoleName: Record<WherebyRoleName, number>;
70
+ }
71
+ interface WherebyWebhookRoomClientJoined extends WherebyWebhookBase {
72
+ data: WherebyWebhookInRoom & WherebyWebhookDataClientJoinLeave & WherebyWebhookDataClient;
73
+ }
74
+ interface WherebyWebhookRoomClientLeft extends WherebyWebhookBase {
75
+ data: WherebyWebhookInRoom & WherebyWebhookDataClientJoinLeave & WherebyWebhookDataClient;
76
+ }
77
+ interface WherebyWebhookRoomSessionStarted extends WherebyWebhookBase {
78
+ data: WherebyWebhookInRoom;
79
+ }
80
+ interface WherebyWebhookRoomSessionEnded extends WherebyWebhookBase {
81
+ data: WherebyWebhookInRoom;
82
+ }
83
+ type TriggerEvents = {
84
+ [ASSISTANT_JOIN_SUCCESS]: [{
85
+ roomUrl: string;
86
+ triggerWebhook: WherebyWebhookType;
87
+ assistant: Assistant;
88
+ }];
89
+ };
90
+ type WherebyWebhookType = WherebyWebhookRoomClientJoined | WherebyWebhookRoomClientLeft | WherebyWebhookRoomSessionStarted | WherebyWebhookRoomSessionEnded;
91
+ type WherebyWebhookTriggerTypes = {
92
+ "room.client.joined": WherebyWebhookBase;
93
+ "room.client.left": WherebyWebhookBase;
94
+ "room.session.started": WherebyWebhookRoomSessionStarted;
95
+ "room.session.ended": WherebyWebhookBase;
96
+ };
97
+ type WherebyWebhookTriggers = Partial<{
98
+ [Type in keyof WherebyWebhookTriggerTypes]: (data: WherebyWebhookTriggerTypes[Type]) => boolean;
99
+ }>;
100
+
101
+ interface TriggerOptions {
102
+ webhookTriggers: WherebyWebhookTriggers;
103
+ subdomain: string;
104
+ port?: number;
105
+ assistantKey?: string;
106
+ }
107
+ declare class Trigger extends EventEmitter$1<TriggerEvents> {
108
+ private webhookTriggers;
109
+ private subdomain;
110
+ private port;
111
+ private assistantKey?;
112
+ constructor({ webhookTriggers, subdomain, port, assistantKey }: TriggerOptions);
113
+ start(): void;
114
+ }
115
+
116
+ declare class AudioSource extends PassThrough {
117
+ constructor();
118
+ }
119
+ declare class AudioSink extends wrtc.nonstandard.RTCAudioSink {
120
+ private _sink;
121
+ constructor(track: MediaStreamTrack);
122
+ subscribe(cb: (d: {
123
+ samples: Int16Array;
124
+ sampleRate: number;
125
+ channelCount: number;
126
+ bitsPerSample: number;
127
+ numberOfFrames?: number;
128
+ }) => void): () => void;
129
+ }
130
+
131
+ export { ASSISTANT_JOIN_SUCCESS, AUDIO_STREAM_READY, Assistant, AudioSink, AudioSource, Trigger };
@@ -0,0 +1,131 @@
1
+ import { RoomConnectionClient, RemoteParticipantState } from '@whereby.com/core';
2
+ export { RemoteParticipantState } from '@whereby.com/core';
3
+ import wrtc from '@roamhq/wrtc';
4
+ import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
5
+ import { PassThrough } from 'stream';
6
+
7
+ declare const AUDIO_STREAM_READY = "AUDIO_STREAM_READY";
8
+ type AssistantEvents = {
9
+ [AUDIO_STREAM_READY]: [{
10
+ stream: MediaStream;
11
+ track: MediaStreamTrack;
12
+ }];
13
+ };
14
+
15
+ type AssistantOptions = {
16
+ assistantKey?: string;
17
+ startCombinedAudioStream: boolean;
18
+ };
19
+ declare class Assistant extends EventEmitter<AssistantEvents> {
20
+ private assistantKey?;
21
+ private client;
22
+ private roomConnection;
23
+ private localMedia;
24
+ private mediaStream;
25
+ private audioSource;
26
+ private combinedStream;
27
+ constructor({ assistantKey, startCombinedAudioStream }?: AssistantOptions);
28
+ joinRoom(roomUrl: string): Promise<void>;
29
+ getLocalMediaStream(): MediaStream | null;
30
+ getLocalAudioSource(): wrtc.nonstandard.RTCAudioSource | null;
31
+ getRoomConnection(): RoomConnectionClient;
32
+ getCombinedAudioStream(): MediaStream | null;
33
+ getRemoteParticipants(): RemoteParticipantState[];
34
+ startCloudRecording(): void;
35
+ stopCloudRecording(): void;
36
+ sendChatMessage(message: string): void;
37
+ spotlightParticipant(participantId: string): void;
38
+ removeSpotlight(participantId: string): void;
39
+ requestAudioEnable(participantId: string, enable: boolean): void;
40
+ requestVideoEnable(participantId: string, enable: boolean): void;
41
+ acceptWaitingParticipant(participantId: string): void;
42
+ rejectWaitingParticipant(participantId: string): void;
43
+ subscribeToRemoteParticipants(callback: (participants: RemoteParticipantState[]) => void): () => void;
44
+ }
45
+
46
+ type WebhookType = "room.client.joined" | "room.client.left" | "room.session.started" | "room.session.ended";
47
+ declare const ASSISTANT_JOIN_SUCCESS = "ASSISTANT_JOIN_SUCCESS";
48
+ interface WherebyWebhookBase {
49
+ type: WebhookType;
50
+ apiVersion: "1.0";
51
+ id: string;
52
+ createdAt: string;
53
+ }
54
+ interface WherebyWebhookInRoom {
55
+ meetingId: string;
56
+ roomName: string;
57
+ roomSessionId: string | null;
58
+ }
59
+ interface WherebyWebhookDataClient {
60
+ displayName: string;
61
+ participantId: string;
62
+ metadata: string | null;
63
+ externalId: string | null;
64
+ }
65
+ type WherebyRoleName = "owner" | "member" | "host" | "visitor" | "granted_visitor" | "viewer" | "granted_viewer" | "recorder" | "streamer" | "captioner";
66
+ interface WherebyWebhookDataClientJoinLeave {
67
+ roleName: WherebyRoleName;
68
+ numClients: number;
69
+ numClientsByRoleName: Record<WherebyRoleName, number>;
70
+ }
71
+ interface WherebyWebhookRoomClientJoined extends WherebyWebhookBase {
72
+ data: WherebyWebhookInRoom & WherebyWebhookDataClientJoinLeave & WherebyWebhookDataClient;
73
+ }
74
+ interface WherebyWebhookRoomClientLeft extends WherebyWebhookBase {
75
+ data: WherebyWebhookInRoom & WherebyWebhookDataClientJoinLeave & WherebyWebhookDataClient;
76
+ }
77
+ interface WherebyWebhookRoomSessionStarted extends WherebyWebhookBase {
78
+ data: WherebyWebhookInRoom;
79
+ }
80
+ interface WherebyWebhookRoomSessionEnded extends WherebyWebhookBase {
81
+ data: WherebyWebhookInRoom;
82
+ }
83
+ type TriggerEvents = {
84
+ [ASSISTANT_JOIN_SUCCESS]: [{
85
+ roomUrl: string;
86
+ triggerWebhook: WherebyWebhookType;
87
+ assistant: Assistant;
88
+ }];
89
+ };
90
+ type WherebyWebhookType = WherebyWebhookRoomClientJoined | WherebyWebhookRoomClientLeft | WherebyWebhookRoomSessionStarted | WherebyWebhookRoomSessionEnded;
91
+ type WherebyWebhookTriggerTypes = {
92
+ "room.client.joined": WherebyWebhookBase;
93
+ "room.client.left": WherebyWebhookBase;
94
+ "room.session.started": WherebyWebhookRoomSessionStarted;
95
+ "room.session.ended": WherebyWebhookBase;
96
+ };
97
+ type WherebyWebhookTriggers = Partial<{
98
+ [Type in keyof WherebyWebhookTriggerTypes]: (data: WherebyWebhookTriggerTypes[Type]) => boolean;
99
+ }>;
100
+
101
+ interface TriggerOptions {
102
+ webhookTriggers: WherebyWebhookTriggers;
103
+ subdomain: string;
104
+ port?: number;
105
+ assistantKey?: string;
106
+ }
107
+ declare class Trigger extends EventEmitter$1<TriggerEvents> {
108
+ private webhookTriggers;
109
+ private subdomain;
110
+ private port;
111
+ private assistantKey?;
112
+ constructor({ webhookTriggers, subdomain, port, assistantKey }: TriggerOptions);
113
+ start(): void;
114
+ }
115
+
116
+ declare class AudioSource extends PassThrough {
117
+ constructor();
118
+ }
119
+ declare class AudioSink extends wrtc.nonstandard.RTCAudioSink {
120
+ private _sink;
121
+ constructor(track: MediaStreamTrack);
122
+ subscribe(cb: (d: {
123
+ samples: Int16Array;
124
+ sampleRate: number;
125
+ channelCount: number;
126
+ bitsPerSample: number;
127
+ numberOfFrames?: number;
128
+ }) => void): () => void;
129
+ }
130
+
131
+ export { ASSISTANT_JOIN_SUCCESS, AUDIO_STREAM_READY, Assistant, AudioSink, AudioSource, Trigger };
@@ -0,0 +1,131 @@
1
+ import { RoomConnectionClient, RemoteParticipantState } from '@whereby.com/core';
2
+ export { RemoteParticipantState } from '@whereby.com/core';
3
+ import wrtc from '@roamhq/wrtc';
4
+ import EventEmitter, { EventEmitter as EventEmitter$1 } from 'events';
5
+ import { PassThrough } from 'stream';
6
+
7
+ declare const AUDIO_STREAM_READY = "AUDIO_STREAM_READY";
8
+ type AssistantEvents = {
9
+ [AUDIO_STREAM_READY]: [{
10
+ stream: MediaStream;
11
+ track: MediaStreamTrack;
12
+ }];
13
+ };
14
+
15
+ type AssistantOptions = {
16
+ assistantKey?: string;
17
+ startCombinedAudioStream: boolean;
18
+ };
19
+ declare class Assistant extends EventEmitter<AssistantEvents> {
20
+ private assistantKey?;
21
+ private client;
22
+ private roomConnection;
23
+ private localMedia;
24
+ private mediaStream;
25
+ private audioSource;
26
+ private combinedStream;
27
+ constructor({ assistantKey, startCombinedAudioStream }?: AssistantOptions);
28
+ joinRoom(roomUrl: string): Promise<void>;
29
+ getLocalMediaStream(): MediaStream | null;
30
+ getLocalAudioSource(): wrtc.nonstandard.RTCAudioSource | null;
31
+ getRoomConnection(): RoomConnectionClient;
32
+ getCombinedAudioStream(): MediaStream | null;
33
+ getRemoteParticipants(): RemoteParticipantState[];
34
+ startCloudRecording(): void;
35
+ stopCloudRecording(): void;
36
+ sendChatMessage(message: string): void;
37
+ spotlightParticipant(participantId: string): void;
38
+ removeSpotlight(participantId: string): void;
39
+ requestAudioEnable(participantId: string, enable: boolean): void;
40
+ requestVideoEnable(participantId: string, enable: boolean): void;
41
+ acceptWaitingParticipant(participantId: string): void;
42
+ rejectWaitingParticipant(participantId: string): void;
43
+ subscribeToRemoteParticipants(callback: (participants: RemoteParticipantState[]) => void): () => void;
44
+ }
45
+
46
+ type WebhookType = "room.client.joined" | "room.client.left" | "room.session.started" | "room.session.ended";
47
+ declare const ASSISTANT_JOIN_SUCCESS = "ASSISTANT_JOIN_SUCCESS";
48
+ interface WherebyWebhookBase {
49
+ type: WebhookType;
50
+ apiVersion: "1.0";
51
+ id: string;
52
+ createdAt: string;
53
+ }
54
+ interface WherebyWebhookInRoom {
55
+ meetingId: string;
56
+ roomName: string;
57
+ roomSessionId: string | null;
58
+ }
59
+ interface WherebyWebhookDataClient {
60
+ displayName: string;
61
+ participantId: string;
62
+ metadata: string | null;
63
+ externalId: string | null;
64
+ }
65
+ type WherebyRoleName = "owner" | "member" | "host" | "visitor" | "granted_visitor" | "viewer" | "granted_viewer" | "recorder" | "streamer" | "captioner";
66
+ interface WherebyWebhookDataClientJoinLeave {
67
+ roleName: WherebyRoleName;
68
+ numClients: number;
69
+ numClientsByRoleName: Record<WherebyRoleName, number>;
70
+ }
71
+ interface WherebyWebhookRoomClientJoined extends WherebyWebhookBase {
72
+ data: WherebyWebhookInRoom & WherebyWebhookDataClientJoinLeave & WherebyWebhookDataClient;
73
+ }
74
+ interface WherebyWebhookRoomClientLeft extends WherebyWebhookBase {
75
+ data: WherebyWebhookInRoom & WherebyWebhookDataClientJoinLeave & WherebyWebhookDataClient;
76
+ }
77
+ interface WherebyWebhookRoomSessionStarted extends WherebyWebhookBase {
78
+ data: WherebyWebhookInRoom;
79
+ }
80
+ interface WherebyWebhookRoomSessionEnded extends WherebyWebhookBase {
81
+ data: WherebyWebhookInRoom;
82
+ }
83
+ type TriggerEvents = {
84
+ [ASSISTANT_JOIN_SUCCESS]: [{
85
+ roomUrl: string;
86
+ triggerWebhook: WherebyWebhookType;
87
+ assistant: Assistant;
88
+ }];
89
+ };
90
+ type WherebyWebhookType = WherebyWebhookRoomClientJoined | WherebyWebhookRoomClientLeft | WherebyWebhookRoomSessionStarted | WherebyWebhookRoomSessionEnded;
91
+ type WherebyWebhookTriggerTypes = {
92
+ "room.client.joined": WherebyWebhookBase;
93
+ "room.client.left": WherebyWebhookBase;
94
+ "room.session.started": WherebyWebhookRoomSessionStarted;
95
+ "room.session.ended": WherebyWebhookBase;
96
+ };
97
+ type WherebyWebhookTriggers = Partial<{
98
+ [Type in keyof WherebyWebhookTriggerTypes]: (data: WherebyWebhookTriggerTypes[Type]) => boolean;
99
+ }>;
100
+
101
+ interface TriggerOptions {
102
+ webhookTriggers: WherebyWebhookTriggers;
103
+ subdomain: string;
104
+ port?: number;
105
+ assistantKey?: string;
106
+ }
107
+ declare class Trigger extends EventEmitter$1<TriggerEvents> {
108
+ private webhookTriggers;
109
+ private subdomain;
110
+ private port;
111
+ private assistantKey?;
112
+ constructor({ webhookTriggers, subdomain, port, assistantKey }: TriggerOptions);
113
+ start(): void;
114
+ }
115
+
116
+ declare class AudioSource extends PassThrough {
117
+ constructor();
118
+ }
119
+ declare class AudioSink extends wrtc.nonstandard.RTCAudioSink {
120
+ private _sink;
121
+ constructor(track: MediaStreamTrack);
122
+ subscribe(cb: (d: {
123
+ samples: Int16Array;
124
+ sampleRate: number;
125
+ channelCount: number;
126
+ bitsPerSample: number;
127
+ numberOfFrames?: number;
128
+ }) => void): () => void;
129
+ }
130
+
131
+ export { ASSISTANT_JOIN_SUCCESS, AUDIO_STREAM_READY, Assistant, AudioSink, AudioSource, Trigger };