@whereby.com/assistant-sdk 0.0.0-canary-20250908163456 → 0.0.0-canary-20250912102624
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/index.cjs +28 -8
- package/dist/index.d.cts +7 -7
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +9 -8
- package/dist/legacy-esm.js +9 -8
- package/dist/polyfills.cjs +22 -17
- package/package.json +5 -2
package/dist/index.cjs
CHANGED
|
@@ -9,6 +9,26 @@ var express = require('express');
|
|
|
9
9
|
var assert = require('assert');
|
|
10
10
|
var bodyParser = require('body-parser');
|
|
11
11
|
var os = require('os');
|
|
12
|
+
var dotenv = require('dotenv');
|
|
13
|
+
|
|
14
|
+
function _interopNamespaceDefault(e) {
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n.default = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var dotenv__namespace = /*#__PURE__*/_interopNamespaceDefault(dotenv);
|
|
12
32
|
|
|
13
33
|
const ASSISTANT_JOIN_SUCCESS = "ASSISTANT_JOIN_SUCCESS";
|
|
14
34
|
|
|
@@ -404,10 +424,7 @@ class AudioMixer extends EventEmitter.EventEmitter {
|
|
|
404
424
|
}
|
|
405
425
|
|
|
406
426
|
class Assistant extends EventEmitter {
|
|
407
|
-
constructor({ assistantKey, startCombinedAudioStream, startLocalMedia }
|
|
408
|
-
startCombinedAudioStream: false,
|
|
409
|
-
startLocalMedia: false,
|
|
410
|
-
}) {
|
|
427
|
+
constructor({ assistantKey, startCombinedAudioStream = false, startLocalMedia = false }) {
|
|
411
428
|
super();
|
|
412
429
|
this.mediaStream = null;
|
|
413
430
|
this.audioSource = null;
|
|
@@ -451,7 +468,6 @@ class Assistant extends EventEmitter {
|
|
|
451
468
|
roomUrl,
|
|
452
469
|
isNodeSdk: true,
|
|
453
470
|
assistantKey: this.assistantKey,
|
|
454
|
-
isAssistant: true,
|
|
455
471
|
});
|
|
456
472
|
this.roomConnection.joinRoom();
|
|
457
473
|
});
|
|
@@ -525,10 +541,14 @@ class Assistant extends EventEmitter {
|
|
|
525
541
|
}
|
|
526
542
|
}
|
|
527
543
|
|
|
528
|
-
|
|
544
|
+
dotenv__namespace.config();
|
|
545
|
+
const { IS_LOCAL = "false", BIND_INTERFACE = "en0" } = process.env;
|
|
529
546
|
function buildRoomUrl(roomPath, wherebySubdomain, baseDomain = "whereby.com") {
|
|
530
547
|
let wherebyDomain;
|
|
531
|
-
{
|
|
548
|
+
if (!IS_LOCAL) {
|
|
549
|
+
wherebyDomain = `${wherebySubdomain}.${baseDomain}`;
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
532
552
|
const ifaceAddrs = os.networkInterfaces()[BIND_INTERFACE];
|
|
533
553
|
if (!ifaceAddrs) {
|
|
534
554
|
throw new Error(`Unknown interface ${BIND_INTERFACE}`);
|
|
@@ -566,7 +586,7 @@ const webhookRouter = (webhookTriggers, emitter, assistantKey, startCombinedAudi
|
|
|
566
586
|
return router;
|
|
567
587
|
};
|
|
568
588
|
class Trigger extends EventEmitter.EventEmitter {
|
|
569
|
-
constructor({ webhookTriggers = {}, port =
|
|
589
|
+
constructor({ webhookTriggers = {}, port = 8080, assistantKey, startCombinedAudioStream, startLocalMedia, }) {
|
|
570
590
|
super();
|
|
571
591
|
this.webhookTriggers = webhookTriggers;
|
|
572
592
|
this.port = port;
|
package/dist/index.d.cts
CHANGED
|
@@ -13,19 +13,19 @@ type AssistantEvents = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
type AssistantOptions = {
|
|
16
|
-
assistantKey
|
|
17
|
-
startCombinedAudioStream
|
|
16
|
+
assistantKey: string;
|
|
17
|
+
startCombinedAudioStream?: boolean;
|
|
18
18
|
startLocalMedia?: boolean;
|
|
19
19
|
};
|
|
20
20
|
declare class Assistant extends EventEmitter<AssistantEvents> {
|
|
21
|
-
private assistantKey
|
|
21
|
+
private assistantKey;
|
|
22
22
|
private client;
|
|
23
23
|
private roomConnection;
|
|
24
24
|
private localMedia;
|
|
25
25
|
private mediaStream;
|
|
26
26
|
private audioSource;
|
|
27
27
|
private combinedStream;
|
|
28
|
-
constructor({ assistantKey, startCombinedAudioStream, startLocalMedia }
|
|
28
|
+
constructor({ assistantKey, startCombinedAudioStream, startLocalMedia }: AssistantOptions);
|
|
29
29
|
joinRoom(roomUrl: string): Promise<void>;
|
|
30
30
|
startLocalMedia(): void;
|
|
31
31
|
getLocalMediaStream(): MediaStream | null;
|
|
@@ -66,7 +66,7 @@ interface WherebyWebhookDataClient {
|
|
|
66
66
|
metadata: string | null;
|
|
67
67
|
externalId: string | null;
|
|
68
68
|
}
|
|
69
|
-
type WherebyRoleName = "owner" | "member" | "host" | "visitor" | "granted_visitor" | "viewer" | "granted_viewer" | "recorder" | "streamer" | "captioner";
|
|
69
|
+
type WherebyRoleName = "owner" | "member" | "host" | "visitor" | "granted_visitor" | "viewer" | "granted_viewer" | "recorder" | "streamer" | "captioner" | "assistant";
|
|
70
70
|
interface WherebyWebhookDataClientJoinLeave {
|
|
71
71
|
roleName: WherebyRoleName;
|
|
72
72
|
numClients: number;
|
|
@@ -105,14 +105,14 @@ type WherebyWebhookTriggers = Partial<{
|
|
|
105
105
|
interface TriggerOptions {
|
|
106
106
|
webhookTriggers: WherebyWebhookTriggers;
|
|
107
107
|
port?: number;
|
|
108
|
-
assistantKey
|
|
108
|
+
assistantKey: string;
|
|
109
109
|
startCombinedAudioStream?: boolean;
|
|
110
110
|
startLocalMedia?: boolean;
|
|
111
111
|
}
|
|
112
112
|
declare class Trigger extends EventEmitter$1<TriggerEvents> {
|
|
113
113
|
private webhookTriggers;
|
|
114
114
|
private port;
|
|
115
|
-
private assistantKey
|
|
115
|
+
private assistantKey;
|
|
116
116
|
private startCombinedAudioStream;
|
|
117
117
|
private startLocalMedia;
|
|
118
118
|
constructor({ webhookTriggers, port, assistantKey, startCombinedAudioStream, startLocalMedia, }: TriggerOptions);
|
package/dist/index.d.mts
CHANGED
|
@@ -13,19 +13,19 @@ type AssistantEvents = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
type AssistantOptions = {
|
|
16
|
-
assistantKey
|
|
17
|
-
startCombinedAudioStream
|
|
16
|
+
assistantKey: string;
|
|
17
|
+
startCombinedAudioStream?: boolean;
|
|
18
18
|
startLocalMedia?: boolean;
|
|
19
19
|
};
|
|
20
20
|
declare class Assistant extends EventEmitter<AssistantEvents> {
|
|
21
|
-
private assistantKey
|
|
21
|
+
private assistantKey;
|
|
22
22
|
private client;
|
|
23
23
|
private roomConnection;
|
|
24
24
|
private localMedia;
|
|
25
25
|
private mediaStream;
|
|
26
26
|
private audioSource;
|
|
27
27
|
private combinedStream;
|
|
28
|
-
constructor({ assistantKey, startCombinedAudioStream, startLocalMedia }
|
|
28
|
+
constructor({ assistantKey, startCombinedAudioStream, startLocalMedia }: AssistantOptions);
|
|
29
29
|
joinRoom(roomUrl: string): Promise<void>;
|
|
30
30
|
startLocalMedia(): void;
|
|
31
31
|
getLocalMediaStream(): MediaStream | null;
|
|
@@ -66,7 +66,7 @@ interface WherebyWebhookDataClient {
|
|
|
66
66
|
metadata: string | null;
|
|
67
67
|
externalId: string | null;
|
|
68
68
|
}
|
|
69
|
-
type WherebyRoleName = "owner" | "member" | "host" | "visitor" | "granted_visitor" | "viewer" | "granted_viewer" | "recorder" | "streamer" | "captioner";
|
|
69
|
+
type WherebyRoleName = "owner" | "member" | "host" | "visitor" | "granted_visitor" | "viewer" | "granted_viewer" | "recorder" | "streamer" | "captioner" | "assistant";
|
|
70
70
|
interface WherebyWebhookDataClientJoinLeave {
|
|
71
71
|
roleName: WherebyRoleName;
|
|
72
72
|
numClients: number;
|
|
@@ -105,14 +105,14 @@ type WherebyWebhookTriggers = Partial<{
|
|
|
105
105
|
interface TriggerOptions {
|
|
106
106
|
webhookTriggers: WherebyWebhookTriggers;
|
|
107
107
|
port?: number;
|
|
108
|
-
assistantKey
|
|
108
|
+
assistantKey: string;
|
|
109
109
|
startCombinedAudioStream?: boolean;
|
|
110
110
|
startLocalMedia?: boolean;
|
|
111
111
|
}
|
|
112
112
|
declare class Trigger extends EventEmitter$1<TriggerEvents> {
|
|
113
113
|
private webhookTriggers;
|
|
114
114
|
private port;
|
|
115
|
-
private assistantKey
|
|
115
|
+
private assistantKey;
|
|
116
116
|
private startCombinedAudioStream;
|
|
117
117
|
private startLocalMedia;
|
|
118
118
|
constructor({ webhookTriggers, port, assistantKey, startCombinedAudioStream, startLocalMedia, }: TriggerOptions);
|
package/dist/index.d.ts
CHANGED
|
@@ -13,19 +13,19 @@ type AssistantEvents = {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
type AssistantOptions = {
|
|
16
|
-
assistantKey
|
|
17
|
-
startCombinedAudioStream
|
|
16
|
+
assistantKey: string;
|
|
17
|
+
startCombinedAudioStream?: boolean;
|
|
18
18
|
startLocalMedia?: boolean;
|
|
19
19
|
};
|
|
20
20
|
declare class Assistant extends EventEmitter<AssistantEvents> {
|
|
21
|
-
private assistantKey
|
|
21
|
+
private assistantKey;
|
|
22
22
|
private client;
|
|
23
23
|
private roomConnection;
|
|
24
24
|
private localMedia;
|
|
25
25
|
private mediaStream;
|
|
26
26
|
private audioSource;
|
|
27
27
|
private combinedStream;
|
|
28
|
-
constructor({ assistantKey, startCombinedAudioStream, startLocalMedia }
|
|
28
|
+
constructor({ assistantKey, startCombinedAudioStream, startLocalMedia }: AssistantOptions);
|
|
29
29
|
joinRoom(roomUrl: string): Promise<void>;
|
|
30
30
|
startLocalMedia(): void;
|
|
31
31
|
getLocalMediaStream(): MediaStream | null;
|
|
@@ -66,7 +66,7 @@ interface WherebyWebhookDataClient {
|
|
|
66
66
|
metadata: string | null;
|
|
67
67
|
externalId: string | null;
|
|
68
68
|
}
|
|
69
|
-
type WherebyRoleName = "owner" | "member" | "host" | "visitor" | "granted_visitor" | "viewer" | "granted_viewer" | "recorder" | "streamer" | "captioner";
|
|
69
|
+
type WherebyRoleName = "owner" | "member" | "host" | "visitor" | "granted_visitor" | "viewer" | "granted_viewer" | "recorder" | "streamer" | "captioner" | "assistant";
|
|
70
70
|
interface WherebyWebhookDataClientJoinLeave {
|
|
71
71
|
roleName: WherebyRoleName;
|
|
72
72
|
numClients: number;
|
|
@@ -105,14 +105,14 @@ type WherebyWebhookTriggers = Partial<{
|
|
|
105
105
|
interface TriggerOptions {
|
|
106
106
|
webhookTriggers: WherebyWebhookTriggers;
|
|
107
107
|
port?: number;
|
|
108
|
-
assistantKey
|
|
108
|
+
assistantKey: string;
|
|
109
109
|
startCombinedAudioStream?: boolean;
|
|
110
110
|
startLocalMedia?: boolean;
|
|
111
111
|
}
|
|
112
112
|
declare class Trigger extends EventEmitter$1<TriggerEvents> {
|
|
113
113
|
private webhookTriggers;
|
|
114
114
|
private port;
|
|
115
|
-
private assistantKey
|
|
115
|
+
private assistantKey;
|
|
116
116
|
private startCombinedAudioStream;
|
|
117
117
|
private startLocalMedia;
|
|
118
118
|
constructor({ webhookTriggers, port, assistantKey, startCombinedAudioStream, startLocalMedia, }: TriggerOptions);
|
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import express from 'express';
|
|
|
7
7
|
import assert from 'assert';
|
|
8
8
|
import bodyParser from 'body-parser';
|
|
9
9
|
import { networkInterfaces } from 'os';
|
|
10
|
+
import * as dotenv from 'dotenv';
|
|
10
11
|
|
|
11
12
|
const ASSISTANT_JOIN_SUCCESS = "ASSISTANT_JOIN_SUCCESS";
|
|
12
13
|
|
|
@@ -402,10 +403,7 @@ class AudioMixer extends EventEmitter {
|
|
|
402
403
|
}
|
|
403
404
|
|
|
404
405
|
class Assistant extends EventEmitter$1 {
|
|
405
|
-
constructor({ assistantKey, startCombinedAudioStream, startLocalMedia }
|
|
406
|
-
startCombinedAudioStream: false,
|
|
407
|
-
startLocalMedia: false,
|
|
408
|
-
}) {
|
|
406
|
+
constructor({ assistantKey, startCombinedAudioStream = false, startLocalMedia = false }) {
|
|
409
407
|
super();
|
|
410
408
|
this.mediaStream = null;
|
|
411
409
|
this.audioSource = null;
|
|
@@ -449,7 +447,6 @@ class Assistant extends EventEmitter$1 {
|
|
|
449
447
|
roomUrl,
|
|
450
448
|
isNodeSdk: true,
|
|
451
449
|
assistantKey: this.assistantKey,
|
|
452
|
-
isAssistant: true,
|
|
453
450
|
});
|
|
454
451
|
this.roomConnection.joinRoom();
|
|
455
452
|
});
|
|
@@ -523,10 +520,14 @@ class Assistant extends EventEmitter$1 {
|
|
|
523
520
|
}
|
|
524
521
|
}
|
|
525
522
|
|
|
526
|
-
|
|
523
|
+
dotenv.config();
|
|
524
|
+
const { IS_LOCAL = "false", BIND_INTERFACE = "en0" } = process.env;
|
|
527
525
|
function buildRoomUrl(roomPath, wherebySubdomain, baseDomain = "whereby.com") {
|
|
528
526
|
let wherebyDomain;
|
|
529
|
-
{
|
|
527
|
+
if (!IS_LOCAL) {
|
|
528
|
+
wherebyDomain = `${wherebySubdomain}.${baseDomain}`;
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
530
531
|
const ifaceAddrs = networkInterfaces()[BIND_INTERFACE];
|
|
531
532
|
if (!ifaceAddrs) {
|
|
532
533
|
throw new Error(`Unknown interface ${BIND_INTERFACE}`);
|
|
@@ -564,7 +565,7 @@ const webhookRouter = (webhookTriggers, emitter, assistantKey, startCombinedAudi
|
|
|
564
565
|
return router;
|
|
565
566
|
};
|
|
566
567
|
class Trigger extends EventEmitter {
|
|
567
|
-
constructor({ webhookTriggers = {}, port =
|
|
568
|
+
constructor({ webhookTriggers = {}, port = 8080, assistantKey, startCombinedAudioStream, startLocalMedia, }) {
|
|
568
569
|
super();
|
|
569
570
|
this.webhookTriggers = webhookTriggers;
|
|
570
571
|
this.port = port;
|
package/dist/legacy-esm.js
CHANGED
|
@@ -7,6 +7,7 @@ import express from 'express';
|
|
|
7
7
|
import assert from 'assert';
|
|
8
8
|
import bodyParser from 'body-parser';
|
|
9
9
|
import { networkInterfaces } from 'os';
|
|
10
|
+
import * as dotenv from 'dotenv';
|
|
10
11
|
|
|
11
12
|
const ASSISTANT_JOIN_SUCCESS = "ASSISTANT_JOIN_SUCCESS";
|
|
12
13
|
|
|
@@ -402,10 +403,7 @@ class AudioMixer extends EventEmitter {
|
|
|
402
403
|
}
|
|
403
404
|
|
|
404
405
|
class Assistant extends EventEmitter$1 {
|
|
405
|
-
constructor({ assistantKey, startCombinedAudioStream, startLocalMedia }
|
|
406
|
-
startCombinedAudioStream: false,
|
|
407
|
-
startLocalMedia: false,
|
|
408
|
-
}) {
|
|
406
|
+
constructor({ assistantKey, startCombinedAudioStream = false, startLocalMedia = false }) {
|
|
409
407
|
super();
|
|
410
408
|
this.mediaStream = null;
|
|
411
409
|
this.audioSource = null;
|
|
@@ -449,7 +447,6 @@ class Assistant extends EventEmitter$1 {
|
|
|
449
447
|
roomUrl,
|
|
450
448
|
isNodeSdk: true,
|
|
451
449
|
assistantKey: this.assistantKey,
|
|
452
|
-
isAssistant: true,
|
|
453
450
|
});
|
|
454
451
|
this.roomConnection.joinRoom();
|
|
455
452
|
});
|
|
@@ -523,10 +520,14 @@ class Assistant extends EventEmitter$1 {
|
|
|
523
520
|
}
|
|
524
521
|
}
|
|
525
522
|
|
|
526
|
-
|
|
523
|
+
dotenv.config();
|
|
524
|
+
const { IS_LOCAL = "false", BIND_INTERFACE = "en0" } = process.env;
|
|
527
525
|
function buildRoomUrl(roomPath, wherebySubdomain, baseDomain = "whereby.com") {
|
|
528
526
|
let wherebyDomain;
|
|
529
|
-
{
|
|
527
|
+
if (!IS_LOCAL) {
|
|
528
|
+
wherebyDomain = `${wherebySubdomain}.${baseDomain}`;
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
530
531
|
const ifaceAddrs = networkInterfaces()[BIND_INTERFACE];
|
|
531
532
|
if (!ifaceAddrs) {
|
|
532
533
|
throw new Error(`Unknown interface ${BIND_INTERFACE}`);
|
|
@@ -564,7 +565,7 @@ const webhookRouter = (webhookTriggers, emitter, assistantKey, startCombinedAudi
|
|
|
564
565
|
return router;
|
|
565
566
|
};
|
|
566
567
|
class Trigger extends EventEmitter {
|
|
567
|
-
constructor({ webhookTriggers = {}, port =
|
|
568
|
+
constructor({ webhookTriggers = {}, port = 8080, assistantKey, startCombinedAudioStream, startLocalMedia, }) {
|
|
568
569
|
super();
|
|
569
570
|
this.webhookTriggers = webhookTriggers;
|
|
570
571
|
this.port = port;
|
package/dist/polyfills.cjs
CHANGED
|
@@ -55,24 +55,29 @@ function setWebsocketOrigin(roomUrl) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
const wrtcMediaDevices = wrtc.mediaDevices;
|
|
58
|
-
global
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
58
|
+
Object.defineProperty(global, "navigator", {
|
|
59
|
+
value: {
|
|
60
|
+
userAgent: "Node.js/20",
|
|
61
|
+
mediaDevices: {
|
|
62
|
+
getUserMedia: wrtc.getUserMedia,
|
|
63
|
+
addEventListener: wrtcMediaDevices.addEventListener,
|
|
64
|
+
removeEventListener: wrtcMediaDevices.removeEventListener,
|
|
65
|
+
enumerateDevices: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
return new Promise((resolve) => resolve([
|
|
67
|
+
{
|
|
68
|
+
deviceId: "default",
|
|
69
|
+
groupId: uuid.v4(),
|
|
70
|
+
kind: "audioinput",
|
|
71
|
+
label: "Dummy audio device",
|
|
72
|
+
},
|
|
73
|
+
]));
|
|
74
|
+
}),
|
|
75
|
+
},
|
|
74
76
|
},
|
|
75
|
-
|
|
77
|
+
writable: false,
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
});
|
|
76
81
|
class DOMException {
|
|
77
82
|
constructor(...args) {
|
|
78
83
|
console.error("DOMException", args);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@whereby.com/assistant-sdk",
|
|
3
3
|
"description": "Assistant SDK for whereby.com",
|
|
4
4
|
"author": "Whereby AS",
|
|
5
|
-
"version": "0.0.0-canary-
|
|
5
|
+
"version": "0.0.0-canary-20250912102624",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
@@ -47,6 +47,8 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
+
"body-parser": "2.2.0",
|
|
51
|
+
"express": "5.1.0",
|
|
50
52
|
"eslint": "^9.29.0",
|
|
51
53
|
"prettier": "^3.5.3",
|
|
52
54
|
"typescript": "^5.8.3",
|
|
@@ -58,9 +60,10 @@
|
|
|
58
60
|
},
|
|
59
61
|
"dependencies": {
|
|
60
62
|
"@roamhq/wrtc": "github:whereby/node-webrtc#patch/rtc_audio_source",
|
|
63
|
+
"dotenv": "^16.4.5",
|
|
61
64
|
"uuid": "^11.0.3",
|
|
62
65
|
"ws": "^8.18.0",
|
|
63
|
-
"@whereby.com/core": "0.0.0-canary-
|
|
66
|
+
"@whereby.com/core": "0.0.0-canary-20250912102624"
|
|
64
67
|
},
|
|
65
68
|
"prettier": "@whereby.com/prettier-config",
|
|
66
69
|
"scripts": {
|