@webex/plugin-meetings 3.12.0-llmrefactor.1 → 3.12.0-llmrefactor.10
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/aiEnableRequest/index.js +1 -1
- package/dist/annotation/index.js +2 -2
- package/dist/annotation/index.js.map +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +5 -1
- package/dist/breakouts/index.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +101 -48
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +27 -2
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/types.js +2 -1
- package/dist/locus-info/types.js.map +1 -1
- package/dist/meeting/index.js +139 -53
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/util.js +5 -1
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +7 -1
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +44 -19
- package/dist/meetings/index.js.map +1 -1
- package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
- package/dist/types/locus-info/index.d.ts +6 -0
- package/dist/types/locus-info/types.d.ts +1 -0
- package/dist/types/meeting/index.d.ts +9 -0
- package/dist/types/meeting/util.d.ts +3 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
- package/dist/webinar/index.js +42 -25
- package/dist/webinar/index.js.map +1 -1
- package/package.json +21 -21
- package/src/annotation/index.ts +6 -4
- package/src/breakouts/index.ts +2 -0
- package/src/hashTree/hashTreeParser.ts +67 -3
- package/src/locus-info/index.ts +20 -0
- package/src/locus-info/types.ts +1 -0
- package/src/meeting/index.ts +122 -36
- package/src/meeting/util.ts +2 -2
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/meeting-info-v2.ts +6 -2
- package/src/meetings/index.ts +23 -8
- package/src/webinar/index.ts +19 -6
- package/test/unit/spec/annotation/index.ts +1 -1
- package/test/unit/spec/breakouts/index.ts +34 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
- package/test/unit/spec/locus-info/index.js +79 -0
- package/test/unit/spec/meeting/index.js +396 -13
- package/test/unit/spec/meeting/utils.js +16 -2
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +57 -0
- package/test/unit/spec/meetings/index.js +63 -19
- package/test/unit/spec/webinar/index.ts +48 -2
|
@@ -315,6 +315,7 @@ describe('plugin-meetings', () => {
|
|
|
315
315
|
deregisterEvents: sinon.stub(),
|
|
316
316
|
getIsCaptionBoxOn: sinon.stub().returns(false),
|
|
317
317
|
updateSubchannelSubscriptions: sinon.stub(),
|
|
318
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
318
319
|
}));
|
|
319
320
|
webex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
320
321
|
{},
|
|
@@ -573,6 +574,11 @@ describe('plugin-meetings', () => {
|
|
|
573
574
|
localWebex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
574
575
|
localWebex.internal.llm.on = sinon.stub();
|
|
575
576
|
localWebex.internal.voicea.announce = sinon.stub();
|
|
577
|
+
localWebex.internal.voicea.createChannel = sinon.stub().returns({
|
|
578
|
+
on: sinon.stub(),
|
|
579
|
+
off: sinon.stub(),
|
|
580
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
581
|
+
});
|
|
576
582
|
localWebex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
577
583
|
{},
|
|
578
584
|
{parent: localWebex}
|
|
@@ -1230,6 +1236,78 @@ describe('plugin-meetings', () => {
|
|
|
1230
1236
|
assert.calledWith(suspendDestroyMeetingStub.thirdCall, false);
|
|
1231
1237
|
});
|
|
1232
1238
|
|
|
1239
|
+
it('should not retry if join() fails because the Locus user capacity is full', async () => {
|
|
1240
|
+
const error = new Error('Error Joining Meeting');
|
|
1241
|
+
error.error = {
|
|
1242
|
+
statusCode: 423,
|
|
1243
|
+
body: {errorCode: 2423001},
|
|
1244
|
+
};
|
|
1245
|
+
meeting.join = sinon.stub().rejects(error);
|
|
1246
|
+
|
|
1247
|
+
const thrownError = await assert.isRejected(
|
|
1248
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1249
|
+
);
|
|
1250
|
+
|
|
1251
|
+
assert.equal(thrownError, error);
|
|
1252
|
+
assert.calledOnce(meeting.join);
|
|
1253
|
+
assert.calledOnce(generateTurnDiscoveryRequestMessageStub);
|
|
1254
|
+
assert.calledOnce(Metrics.sendBehavioralMetric);
|
|
1255
|
+
assert.calledTwice(suspendDestroyMeetingStub);
|
|
1256
|
+
assert.calledWith(suspendDestroyMeetingStub.firstCall, true);
|
|
1257
|
+
assert.calledWith(suspendDestroyMeetingStub.secondCall, false);
|
|
1258
|
+
});
|
|
1259
|
+
|
|
1260
|
+
it('should still retry if join() fails with another HTTP 423 Locus error', async () => {
|
|
1261
|
+
const error = new Error('Error Joining Meeting');
|
|
1262
|
+
error.error = {
|
|
1263
|
+
statusCode: 423,
|
|
1264
|
+
body: {errorCode: 2423028},
|
|
1265
|
+
};
|
|
1266
|
+
meeting.join = sinon.stub().rejects(error);
|
|
1267
|
+
|
|
1268
|
+
const thrownError = await assert.isRejected(
|
|
1269
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1270
|
+
);
|
|
1271
|
+
|
|
1272
|
+
assert.equal(thrownError, error);
|
|
1273
|
+
assert.calledTwice(meeting.join);
|
|
1274
|
+
assert.calledTwice(generateTurnDiscoveryRequestMessageStub);
|
|
1275
|
+
assert.calledTwice(Metrics.sendBehavioralMetric);
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
it('should throw the Locus user full error over firstError when the retry hits full capacity', async () => {
|
|
1279
|
+
const firstJoinError = new Error('first join error');
|
|
1280
|
+
const capacityError = new Error('Error Joining Meeting');
|
|
1281
|
+
capacityError.error = {
|
|
1282
|
+
statusCode: 423,
|
|
1283
|
+
body: {errorCode: 2423001},
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
meeting.join = sinon
|
|
1287
|
+
.stub()
|
|
1288
|
+
.onFirstCall()
|
|
1289
|
+
.rejects(firstJoinError)
|
|
1290
|
+
.onSecondCall()
|
|
1291
|
+
.rejects(capacityError);
|
|
1292
|
+
meeting.locusUrl = null; // join never succeeds
|
|
1293
|
+
|
|
1294
|
+
const thrownError = await assert.isRejected(
|
|
1295
|
+
meeting.joinWithMedia({joinOptions, mediaOptions})
|
|
1296
|
+
);
|
|
1297
|
+
|
|
1298
|
+
// join() runs once for the first attempt and once for the re-join
|
|
1299
|
+
assert.calledTwice(meeting.join);
|
|
1300
|
+
// the capacity error must take precedence over the stored firstError
|
|
1301
|
+
assert.equal(thrownError, capacityError);
|
|
1302
|
+
|
|
1303
|
+
assert.deepEqual(meeting.joinWithMediaRetryInfo, {
|
|
1304
|
+
retryCount: 0,
|
|
1305
|
+
prevJoinResponse: undefined,
|
|
1306
|
+
firstError: undefined,
|
|
1307
|
+
prevError: undefined,
|
|
1308
|
+
});
|
|
1309
|
+
});
|
|
1310
|
+
|
|
1233
1311
|
it('should re-join on retry when join() fails on first attempt, and throw the first error if join fails again', async () => {
|
|
1234
1312
|
const firstJoinError = new Error('first join error');
|
|
1235
1313
|
const secondJoinError = new Error('second join error');
|
|
@@ -8211,6 +8289,7 @@ describe('plugin-meetings', () => {
|
|
|
8211
8289
|
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /leave', async () => {
|
|
8212
8290
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8213
8291
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8292
|
+
meeting.areVoiceaEventsSetup = true;
|
|
8214
8293
|
|
|
8215
8294
|
// Set up llmChannel with mock off function
|
|
8216
8295
|
meeting.llmChannel = {
|
|
@@ -8247,12 +8326,16 @@ describe('plugin-meetings', () => {
|
|
|
8247
8326
|
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
8248
8327
|
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
8249
8328
|
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
8250
|
-
|
|
8329
|
+
// Transcription is reset to initial state (not undefined)
|
|
8330
|
+
assert.isDefined(meeting.transcription);
|
|
8331
|
+
assert.deepEqual(meeting.transcription.captions, []);
|
|
8332
|
+
assert.equal(meeting.transcription.isCaptioning, false);
|
|
8251
8333
|
});
|
|
8252
8334
|
|
|
8253
8335
|
it('tears down llm/mercury/transcription/annotation even when /leave rejects', async () => {
|
|
8254
8336
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8255
8337
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8338
|
+
meeting.areVoiceaEventsSetup = true;
|
|
8256
8339
|
meeting.meetingRequest.leaveMeeting = sinon
|
|
8257
8340
|
.stub()
|
|
8258
8341
|
.returns(Promise.reject(new Error('leave failed')));
|
|
@@ -9178,7 +9261,11 @@ describe('plugin-meetings', () => {
|
|
|
9178
9261
|
beforeEach(() => {
|
|
9179
9262
|
meeting.locusId = 'locus-id';
|
|
9180
9263
|
meeting.id = 'meeting-id';
|
|
9181
|
-
FAKE_OPTIONS = {
|
|
9264
|
+
FAKE_OPTIONS = {
|
|
9265
|
+
meetingId: meeting.id,
|
|
9266
|
+
sendCAevents: true,
|
|
9267
|
+
correlationId: meeting.correlationId,
|
|
9268
|
+
};
|
|
9182
9269
|
});
|
|
9183
9270
|
|
|
9184
9271
|
it('calls meetingInfoProvider with all the right parameters and parses the result', async () => {
|
|
@@ -9263,7 +9350,11 @@ describe('plugin-meetings', () => {
|
|
|
9263
9350
|
undefined,
|
|
9264
9351
|
meeting.locusId,
|
|
9265
9352
|
{},
|
|
9266
|
-
{
|
|
9353
|
+
{
|
|
9354
|
+
meetingId: meeting.id,
|
|
9355
|
+
sendCAevents: false,
|
|
9356
|
+
correlationId: meeting.correlationId,
|
|
9357
|
+
}
|
|
9267
9358
|
);
|
|
9268
9359
|
|
|
9269
9360
|
// parseMeeting info
|
|
@@ -9349,7 +9440,11 @@ describe('plugin-meetings', () => {
|
|
|
9349
9440
|
undefined,
|
|
9350
9441
|
'locus-id',
|
|
9351
9442
|
{},
|
|
9352
|
-
{
|
|
9443
|
+
{
|
|
9444
|
+
meetingId: meeting.id,
|
|
9445
|
+
sendCAevents: true,
|
|
9446
|
+
correlationId: meeting.correlationId,
|
|
9447
|
+
}
|
|
9353
9448
|
);
|
|
9354
9449
|
|
|
9355
9450
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -9385,7 +9480,11 @@ describe('plugin-meetings', () => {
|
|
|
9385
9480
|
undefined,
|
|
9386
9481
|
'locus-id',
|
|
9387
9482
|
{},
|
|
9388
|
-
{
|
|
9483
|
+
{
|
|
9484
|
+
meetingId: meeting.id,
|
|
9485
|
+
sendCAevents: true,
|
|
9486
|
+
correlationId: meeting.correlationId,
|
|
9487
|
+
}
|
|
9389
9488
|
);
|
|
9390
9489
|
|
|
9391
9490
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -9414,7 +9513,11 @@ describe('plugin-meetings', () => {
|
|
|
9414
9513
|
undefined,
|
|
9415
9514
|
'locus-id',
|
|
9416
9515
|
{},
|
|
9417
|
-
{
|
|
9516
|
+
{
|
|
9517
|
+
meetingId: meeting.id,
|
|
9518
|
+
sendCAevents: true,
|
|
9519
|
+
correlationId: meeting.correlationId,
|
|
9520
|
+
}
|
|
9418
9521
|
);
|
|
9419
9522
|
|
|
9420
9523
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -9449,7 +9552,11 @@ describe('plugin-meetings', () => {
|
|
|
9449
9552
|
undefined,
|
|
9450
9553
|
'locus-id',
|
|
9451
9554
|
{},
|
|
9452
|
-
{
|
|
9555
|
+
{
|
|
9556
|
+
meetingId: meeting.id,
|
|
9557
|
+
sendCAevents: true,
|
|
9558
|
+
correlationId: meeting.correlationId,
|
|
9559
|
+
}
|
|
9453
9560
|
);
|
|
9454
9561
|
|
|
9455
9562
|
assert.deepEqual(meeting.meetingInfo, {});
|
|
@@ -9495,7 +9602,11 @@ describe('plugin-meetings', () => {
|
|
|
9495
9602
|
undefined,
|
|
9496
9603
|
'locus-id',
|
|
9497
9604
|
{},
|
|
9498
|
-
{
|
|
9605
|
+
{
|
|
9606
|
+
meetingId: meeting.id,
|
|
9607
|
+
sendCAevents: true,
|
|
9608
|
+
correlationId: meeting.correlationId,
|
|
9609
|
+
}
|
|
9499
9610
|
);
|
|
9500
9611
|
|
|
9501
9612
|
assert.deepEqual(meeting.meetingInfo, {});
|
|
@@ -9529,7 +9640,11 @@ describe('plugin-meetings', () => {
|
|
|
9529
9640
|
undefined,
|
|
9530
9641
|
'locus-id',
|
|
9531
9642
|
{},
|
|
9532
|
-
{
|
|
9643
|
+
{
|
|
9644
|
+
meetingId: meeting.id,
|
|
9645
|
+
sendCAevents: true,
|
|
9646
|
+
correlationId: meeting.correlationId,
|
|
9647
|
+
}
|
|
9533
9648
|
);
|
|
9534
9649
|
|
|
9535
9650
|
assert.deepEqual(meeting.meetingInfo, {
|
|
@@ -9582,7 +9697,11 @@ describe('plugin-meetings', () => {
|
|
|
9582
9697
|
undefined,
|
|
9583
9698
|
'locus-id',
|
|
9584
9699
|
{},
|
|
9585
|
-
{
|
|
9700
|
+
{
|
|
9701
|
+
meetingId: meeting.id,
|
|
9702
|
+
sendCAevents: true,
|
|
9703
|
+
correlationId: meeting.correlationId,
|
|
9704
|
+
}
|
|
9586
9705
|
);
|
|
9587
9706
|
|
|
9588
9707
|
assert.deepEqual(meeting.meetingInfo, FAKE_MEETING_INFO);
|
|
@@ -9871,7 +9990,11 @@ describe('plugin-meetings', () => {
|
|
|
9871
9990
|
'fake-installed-org-id',
|
|
9872
9991
|
'locus-id',
|
|
9873
9992
|
{extraParam1: 'value1', permissionToken: FAKE_PERMISSION_TOKEN},
|
|
9874
|
-
{
|
|
9993
|
+
{
|
|
9994
|
+
meetingId: meeting.id,
|
|
9995
|
+
sendCAevents: true,
|
|
9996
|
+
correlationId: meeting.correlationId,
|
|
9997
|
+
},
|
|
9875
9998
|
null,
|
|
9876
9999
|
null,
|
|
9877
10000
|
null
|
|
@@ -9919,7 +10042,11 @@ describe('plugin-meetings', () => {
|
|
|
9919
10042
|
'fake-installed-org-id',
|
|
9920
10043
|
'locus-id',
|
|
9921
10044
|
{extraParam1: 'value1', permissionToken: FAKE_PERMISSION_TOKEN},
|
|
9922
|
-
{
|
|
10045
|
+
{
|
|
10046
|
+
meetingId: meeting.id,
|
|
10047
|
+
sendCAevents: true,
|
|
10048
|
+
correlationId: meeting.correlationId,
|
|
10049
|
+
},
|
|
9923
10050
|
null,
|
|
9924
10051
|
null,
|
|
9925
10052
|
null
|
|
@@ -9976,7 +10103,11 @@ describe('plugin-meetings', () => {
|
|
|
9976
10103
|
extraParam1: 'value1',
|
|
9977
10104
|
permissionToken: FAKE_PERMISSION_TOKEN,
|
|
9978
10105
|
},
|
|
9979
|
-
{
|
|
10106
|
+
{
|
|
10107
|
+
meetingId: meeting.id,
|
|
10108
|
+
sendCAevents: true,
|
|
10109
|
+
correlationId: meeting.correlationId,
|
|
10110
|
+
},
|
|
9980
10111
|
null,
|
|
9981
10112
|
null,
|
|
9982
10113
|
null
|
|
@@ -10317,6 +10448,7 @@ describe('plugin-meetings', () => {
|
|
|
10317
10448
|
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /end', async () => {
|
|
10318
10449
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10319
10450
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10451
|
+
meeting.areVoiceaEventsSetup = true;
|
|
10320
10452
|
|
|
10321
10453
|
// Set up llmChannel with mock off function
|
|
10322
10454
|
meeting.llmChannel = {
|
|
@@ -10358,6 +10490,7 @@ describe('plugin-meetings', () => {
|
|
|
10358
10490
|
it('tears down llm/mercury/transcription/annotation even when /end rejects', async () => {
|
|
10359
10491
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10360
10492
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10493
|
+
meeting.areVoiceaEventsSetup = true;
|
|
10361
10494
|
meeting.meetingRequest.endMeetingForAll = sinon
|
|
10362
10495
|
.stub()
|
|
10363
10496
|
.returns(Promise.reject(new Error('end failed')));
|
|
@@ -15027,11 +15160,17 @@ describe('plugin-meetings', () => {
|
|
|
15027
15160
|
deregisterEvents: sinon.stub(),
|
|
15028
15161
|
getIsCaptionBoxOn: sinon.stub().returns(false),
|
|
15029
15162
|
updateSubchannelSubscriptions: sinon.stub(),
|
|
15163
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
15164
|
+
isLLMConnected: sinon.stub().returns(true),
|
|
15165
|
+
getKeepTranscriptionSubscribed: sinon.stub().returns(false),
|
|
15030
15166
|
};
|
|
15031
15167
|
|
|
15032
15168
|
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
15033
15169
|
webex.internal.voicea.createChannel = sinon.stub().returns(mockVoiceaChannel);
|
|
15034
15170
|
|
|
15171
|
+
// voiceaChannel is created in the Meeting constructor
|
|
15172
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
15173
|
+
|
|
15035
15174
|
meeting.processRelayEvent = sinon.stub();
|
|
15036
15175
|
meeting.processLocusLLMEvent = sinon.stub();
|
|
15037
15176
|
meeting.handleLLMOnline = sinon.stub();
|
|
@@ -15155,6 +15294,7 @@ describe('plugin-meetings', () => {
|
|
|
15155
15294
|
off: sinon.stub(),
|
|
15156
15295
|
};
|
|
15157
15296
|
meeting.llmChannel = existingChannel;
|
|
15297
|
+
const originalVoiceaChannel = meeting.voiceaChannel;
|
|
15158
15298
|
|
|
15159
15299
|
meeting.locusInfo = {
|
|
15160
15300
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15175,6 +15315,9 @@ describe('plugin-meetings', () => {
|
|
|
15175
15315
|
'a datachannel url',
|
|
15176
15316
|
undefined
|
|
15177
15317
|
);
|
|
15318
|
+
// voiceaChannel should be preserved during transient reconnect
|
|
15319
|
+
assert.strictEqual(meeting.voiceaChannel, originalVoiceaChannel);
|
|
15320
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15178
15321
|
});
|
|
15179
15322
|
|
|
15180
15323
|
it('disconnects and reconnects when datachannel URL changes', async () => {
|
|
@@ -15190,6 +15333,7 @@ describe('plugin-meetings', () => {
|
|
|
15190
15333
|
off: sinon.stub(),
|
|
15191
15334
|
};
|
|
15192
15335
|
meeting.llmChannel = existingChannel;
|
|
15336
|
+
const originalVoiceaChannel = meeting.voiceaChannel;
|
|
15193
15337
|
|
|
15194
15338
|
meeting.locusInfo = {
|
|
15195
15339
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15210,6 +15354,9 @@ describe('plugin-meetings', () => {
|
|
|
15210
15354
|
'a different datachannel url',
|
|
15211
15355
|
undefined
|
|
15212
15356
|
);
|
|
15357
|
+
// voiceaChannel should be preserved during transient reconnect
|
|
15358
|
+
assert.strictEqual(meeting.voiceaChannel, originalVoiceaChannel);
|
|
15359
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15213
15360
|
});
|
|
15214
15361
|
|
|
15215
15362
|
it('disconnects when state changes to not joined', async () => {
|
|
@@ -15315,6 +15462,142 @@ describe('plugin-meetings', () => {
|
|
|
15315
15462
|
assert.calledOnce(meeting.startLLMHealthCheckTimer);
|
|
15316
15463
|
});
|
|
15317
15464
|
|
|
15465
|
+
it('reuses voiceaChannel after successful connection', async () => {
|
|
15466
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15467
|
+
meeting.locusInfo = {
|
|
15468
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15469
|
+
url: 'a url',
|
|
15470
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15471
|
+
};
|
|
15472
|
+
|
|
15473
|
+
await meeting.updateLLMConnection();
|
|
15474
|
+
|
|
15475
|
+
assert.notCalled(webex.internal.voicea.createChannel);
|
|
15476
|
+
assert.strictEqual(meeting.voiceaChannel, mockVoiceaChannel);
|
|
15477
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, mockChannel);
|
|
15478
|
+
});
|
|
15479
|
+
|
|
15480
|
+
it('creates and binds a voiceaChannel after the previous channel was cleaned up', async () => {
|
|
15481
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15482
|
+
meeting.voiceaChannel = undefined;
|
|
15483
|
+
meeting.locusInfo = {
|
|
15484
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15485
|
+
url: 'a url',
|
|
15486
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15487
|
+
};
|
|
15488
|
+
|
|
15489
|
+
await meeting.updateLLMConnection();
|
|
15490
|
+
|
|
15491
|
+
assert.calledOnceWithExactly(webex.internal.voicea.createChannel);
|
|
15492
|
+
assert.strictEqual(meeting.voiceaChannel, mockVoiceaChannel);
|
|
15493
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, mockChannel);
|
|
15494
|
+
});
|
|
15495
|
+
|
|
15496
|
+
it('skips switchLLMChannel when practice session is active', async () => {
|
|
15497
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15498
|
+
meeting.webinar.isPracticeSessionLLMChannelConnected = sinon.stub().returns(true);
|
|
15499
|
+
meeting.locusInfo = {
|
|
15500
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15501
|
+
url: 'a url',
|
|
15502
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15503
|
+
};
|
|
15504
|
+
|
|
15505
|
+
await meeting.updateLLMConnection();
|
|
15506
|
+
|
|
15507
|
+
// switchLLMChannel should NOT be called when practice session is active
|
|
15508
|
+
// because practice session manages its own voicea binding
|
|
15509
|
+
assert.notCalled(mockVoiceaChannel.switchLLMChannel);
|
|
15510
|
+
});
|
|
15511
|
+
|
|
15512
|
+
it('logs warning when switchLLMChannel fails', async () => {
|
|
15513
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15514
|
+
mockVoiceaChannel.switchLLMChannel.rejects(new Error('switch failed'));
|
|
15515
|
+
meeting.locusInfo = {
|
|
15516
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15517
|
+
url: 'a url',
|
|
15518
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15519
|
+
};
|
|
15520
|
+
|
|
15521
|
+
// Should not throw - fire-and-forget behavior
|
|
15522
|
+
const result = await meeting.updateLLMConnection();
|
|
15523
|
+
|
|
15524
|
+
assert.equal(result, 'something');
|
|
15525
|
+
});
|
|
15526
|
+
|
|
15527
|
+
it('starts transcription after LLM connects when Locus transcription is active', async () => {
|
|
15528
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15529
|
+
meeting.areVoiceaEventsSetup = false;
|
|
15530
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15531
|
+
meeting.locusInfo = {
|
|
15532
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15533
|
+
url: 'a url',
|
|
15534
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15535
|
+
controls: {transcribe: {transcribing: true}},
|
|
15536
|
+
};
|
|
15537
|
+
|
|
15538
|
+
await meeting.updateLLMConnection();
|
|
15539
|
+
await mockVoiceaChannel.switchLLMChannel.firstCall.returnValue;
|
|
15540
|
+
|
|
15541
|
+
assert.calledOnce(meeting.startTranscription);
|
|
15542
|
+
});
|
|
15543
|
+
|
|
15544
|
+
it('does not start transcription after LLM connects when Locus transcription is inactive', async () => {
|
|
15545
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15546
|
+
meeting.areVoiceaEventsSetup = false;
|
|
15547
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15548
|
+
meeting.locusInfo = {
|
|
15549
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15550
|
+
url: 'a url',
|
|
15551
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15552
|
+
controls: {transcribe: {transcribing: false}},
|
|
15553
|
+
};
|
|
15554
|
+
|
|
15555
|
+
await meeting.updateLLMConnection();
|
|
15556
|
+
|
|
15557
|
+
assert.notCalled(meeting.startTranscription);
|
|
15558
|
+
});
|
|
15559
|
+
|
|
15560
|
+
it('does not start transcription when areVoiceaEventsSetup is already true', async () => {
|
|
15561
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15562
|
+
meeting.areVoiceaEventsSetup = true;
|
|
15563
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15564
|
+
meeting.locusInfo = {
|
|
15565
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15566
|
+
url: 'a url',
|
|
15567
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15568
|
+
controls: {transcribe: {transcribing: true}},
|
|
15569
|
+
};
|
|
15570
|
+
|
|
15571
|
+
await meeting.updateLLMConnection();
|
|
15572
|
+
|
|
15573
|
+
assert.notCalled(meeting.startTranscription);
|
|
15574
|
+
});
|
|
15575
|
+
|
|
15576
|
+
forEach(
|
|
15577
|
+
[
|
|
15578
|
+
{
|
|
15579
|
+
description: 'does not start transcription when voiceaChannel is disconnected',
|
|
15580
|
+
voiceaChannel: {isLLMConnected: sinon.stub().returns(false)},
|
|
15581
|
+
},
|
|
15582
|
+
{
|
|
15583
|
+
description: 'does not start transcription when voiceaChannel is unavailable',
|
|
15584
|
+
voiceaChannel: undefined,
|
|
15585
|
+
},
|
|
15586
|
+
],
|
|
15587
|
+
({description, voiceaChannel}) => {
|
|
15588
|
+
it(description, () => {
|
|
15589
|
+
meeting.areVoiceaEventsSetup = false;
|
|
15590
|
+
meeting.locusInfo = {controls: {transcribe: {transcribing: true}}};
|
|
15591
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15592
|
+
meeting.voiceaChannel = voiceaChannel;
|
|
15593
|
+
|
|
15594
|
+
meeting.startTranscriptionIfNeeded();
|
|
15595
|
+
|
|
15596
|
+
assert.notCalled(meeting.startTranscription);
|
|
15597
|
+
});
|
|
15598
|
+
}
|
|
15599
|
+
);
|
|
15600
|
+
|
|
15318
15601
|
it('registers annotation channel when not in practice session', async () => {
|
|
15319
15602
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15320
15603
|
meeting.locusInfo = {
|
|
@@ -15423,6 +15706,106 @@ describe('plugin-meetings', () => {
|
|
|
15423
15706
|
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15424
15707
|
});
|
|
15425
15708
|
});
|
|
15709
|
+
|
|
15710
|
+
describe('#cleanupLLMConneciton', () => {
|
|
15711
|
+
let existingChannel;
|
|
15712
|
+
|
|
15713
|
+
beforeEach(() => {
|
|
15714
|
+
existingChannel = {
|
|
15715
|
+
isConnected: sinon.stub().returns(true),
|
|
15716
|
+
disconnect: sinon.stub().resolves(),
|
|
15717
|
+
off: sinon.stub(),
|
|
15718
|
+
};
|
|
15719
|
+
meeting.llmChannel = existingChannel;
|
|
15720
|
+
|
|
15721
|
+
meeting.annotation.deregisterEvents = sinon.stub();
|
|
15722
|
+
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
15723
|
+
});
|
|
15724
|
+
|
|
15725
|
+
forEach(
|
|
15726
|
+
[
|
|
15727
|
+
{
|
|
15728
|
+
description: 'destroys voiceaChannel when preserveVoiceaChannel is false (default)',
|
|
15729
|
+
llmChannelDefined: true,
|
|
15730
|
+
options: undefined,
|
|
15731
|
+
expectedVoiceaPreserved: false,
|
|
15732
|
+
},
|
|
15733
|
+
{
|
|
15734
|
+
description:
|
|
15735
|
+
'destroys voiceaChannel when preserveVoiceaChannel is explicitly false',
|
|
15736
|
+
llmChannelDefined: true,
|
|
15737
|
+
options: {preserveVoiceaChannel: false},
|
|
15738
|
+
expectedVoiceaPreserved: false,
|
|
15739
|
+
},
|
|
15740
|
+
{
|
|
15741
|
+
description: 'preserves voiceaChannel when preserveVoiceaChannel is true',
|
|
15742
|
+
llmChannelDefined: true,
|
|
15743
|
+
options: {preserveVoiceaChannel: true},
|
|
15744
|
+
expectedVoiceaPreserved: true,
|
|
15745
|
+
},
|
|
15746
|
+
{
|
|
15747
|
+
description:
|
|
15748
|
+
'cleans up voiceaChannel even when llmChannel is undefined (failed transient reconnect)',
|
|
15749
|
+
llmChannelDefined: false,
|
|
15750
|
+
options: {preserveVoiceaChannel: false},
|
|
15751
|
+
expectedVoiceaPreserved: false,
|
|
15752
|
+
},
|
|
15753
|
+
{
|
|
15754
|
+
description:
|
|
15755
|
+
'preserves voiceaChannel when llmChannel is undefined and preserveVoiceaChannel is true',
|
|
15756
|
+
llmChannelDefined: false,
|
|
15757
|
+
options: {preserveVoiceaChannel: true},
|
|
15758
|
+
expectedVoiceaPreserved: true,
|
|
15759
|
+
},
|
|
15760
|
+
],
|
|
15761
|
+
({description, llmChannelDefined, options, expectedVoiceaPreserved}) => {
|
|
15762
|
+
it(description, async () => {
|
|
15763
|
+
if (!llmChannelDefined) {
|
|
15764
|
+
meeting.llmChannel = undefined;
|
|
15765
|
+
}
|
|
15766
|
+
const originalVoiceaChannel = meeting.voiceaChannel;
|
|
15767
|
+
|
|
15768
|
+
await meeting.cleanupLLMConneciton(options);
|
|
15769
|
+
|
|
15770
|
+
if (expectedVoiceaPreserved) {
|
|
15771
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15772
|
+
assert.strictEqual(meeting.voiceaChannel, originalVoiceaChannel);
|
|
15773
|
+
} else {
|
|
15774
|
+
assert.calledOnce(mockVoiceaChannel.deregisterEvents);
|
|
15775
|
+
assert.isUndefined(meeting.voiceaChannel);
|
|
15776
|
+
}
|
|
15777
|
+
assert.isUndefined(meeting.llmChannel);
|
|
15778
|
+
});
|
|
15779
|
+
}
|
|
15780
|
+
);
|
|
15781
|
+
|
|
15782
|
+
it('passes throwOnError alongside preserveVoiceaChannel', async () => {
|
|
15783
|
+
existingChannel.disconnect.rejects(new Error('disconnect failed'));
|
|
15784
|
+
|
|
15785
|
+
// Should not throw when throwOnError is false
|
|
15786
|
+
await meeting.cleanupLLMConneciton({throwOnError: false, preserveVoiceaChannel: true});
|
|
15787
|
+
|
|
15788
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15789
|
+
assert.isDefined(meeting.voiceaChannel);
|
|
15790
|
+
});
|
|
15791
|
+
|
|
15792
|
+
it('cleans up LLM event listeners regardless of preserveVoiceaChannel', async () => {
|
|
15793
|
+
await meeting.cleanupLLMConneciton({preserveVoiceaChannel: true});
|
|
15794
|
+
|
|
15795
|
+
assert.calledWithExactly(existingChannel.off, 'online', meeting.handleLLMOnline);
|
|
15796
|
+
assert.calledWithExactly(
|
|
15797
|
+
existingChannel.off,
|
|
15798
|
+
'event:relay.event',
|
|
15799
|
+
meeting.processRelayEvent
|
|
15800
|
+
);
|
|
15801
|
+
assert.calledWithExactly(
|
|
15802
|
+
existingChannel.off,
|
|
15803
|
+
'event:locus.state_message',
|
|
15804
|
+
meeting.processLocusLLMEvent
|
|
15805
|
+
);
|
|
15806
|
+
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15807
|
+
});
|
|
15808
|
+
});
|
|
15426
15809
|
});
|
|
15427
15810
|
|
|
15428
15811
|
describe('#processLocusLLMEvent', () => {
|
|
@@ -75,7 +75,7 @@ describe('plugin-meetings', () => {
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
describe('#cleanup', () => {
|
|
78
|
-
it('
|
|
78
|
+
it('cleans up an LLM-enabled meeting while preserving Voicea by default', async () => {
|
|
79
79
|
meeting.config = {enableAutomaticLLM: true};
|
|
80
80
|
await MeetingUtil.cleanUp(meeting);
|
|
81
81
|
assert.calledOnce(meeting.cleanupLocalStreams);
|
|
@@ -87,7 +87,10 @@ describe('plugin-meetings', () => {
|
|
|
87
87
|
assert.calledOnce(meeting.unsetPeerConnections);
|
|
88
88
|
assert.calledOnce(meeting.reconnectionManager.cleanUp);
|
|
89
89
|
assert.calledOnce(meeting.stopKeepAlive);
|
|
90
|
-
assert.calledOnceWithExactly(meeting.cleanupLLMConneciton, {
|
|
90
|
+
assert.calledOnceWithExactly(meeting.cleanupLLMConneciton, {
|
|
91
|
+
throwOnError: false,
|
|
92
|
+
preserveVoiceaChannel: true,
|
|
93
|
+
});
|
|
91
94
|
assert.calledOnce(meeting.breakouts.cleanUp);
|
|
92
95
|
assert.calledOnce(meeting.simultaneousInterpretation.cleanUp);
|
|
93
96
|
assert.calledOnce(meeting.locusInfo.cleanUp);
|
|
@@ -98,6 +101,17 @@ describe('plugin-meetings', () => {
|
|
|
98
101
|
);
|
|
99
102
|
});
|
|
100
103
|
|
|
104
|
+
it('cleans up an LLM-enabled meeting without preserving Voicea when requested', async () => {
|
|
105
|
+
meeting.config = {enableAutomaticLLM: true};
|
|
106
|
+
|
|
107
|
+
await MeetingUtil.cleanUp(meeting, {preserveVoiceaChannel: false});
|
|
108
|
+
|
|
109
|
+
assert.calledOnceWithExactly(meeting.cleanupLLMConneciton, {
|
|
110
|
+
throwOnError: false,
|
|
111
|
+
preserveVoiceaChannel: false,
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
101
115
|
it('do clean up on meeting object with LLM disabled', async () => {
|
|
102
116
|
meeting.config = {enableAutomaticLLM: false};
|
|
103
117
|
await MeetingUtil.cleanUp(meeting);
|