@webex/plugin-meetings 3.12.0-next.171 → 3.12.0-next.172
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 +53 -17
- package/dist/annotation/index.js.map +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +35 -9
- package/dist/breakouts/index.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +41 -59
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/meeting/index.js +327 -292
- 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/meetings/index.js +4 -1
- package/dist/meetings/index.js.map +1 -1
- package/dist/types/annotation/index.d.ts +19 -0
- package/dist/types/meeting/index.d.ts +46 -12
- package/dist/types/meeting/util.d.ts +3 -1
- package/dist/webinar/index.js +298 -255
- package/dist/webinar/index.js.map +1 -1
- package/package.json +9 -9
- package/src/annotation/index.ts +55 -25
- package/src/breakouts/index.ts +33 -11
- package/src/interceptors/dataChannelAuthToken.ts +48 -77
- package/src/meeting/index.ts +296 -289
- package/src/meeting/util.ts +2 -2
- package/src/meetings/index.ts +2 -1
- package/src/webinar/index.ts +168 -188
- package/test/unit/spec/annotation/index.ts +214 -182
- package/test/unit/spec/breakouts/index.ts +126 -25
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
- package/test/unit/spec/meeting/index.js +939 -705
- package/test/unit/spec/meeting/utils.js +16 -2
- package/test/unit/spec/meetings/index.js +5 -0
- package/test/unit/spec/webinar/index.ts +886 -718
|
@@ -35,7 +35,6 @@ import {
|
|
|
35
35
|
OFFLINE,
|
|
36
36
|
ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT,
|
|
37
37
|
LOCUS_LLM_EVENT,
|
|
38
|
-
LLM_PRACTICE_SESSION,
|
|
39
38
|
RECORDING_STATE,
|
|
40
39
|
} from '@webex/plugin-meetings/src/constants';
|
|
41
40
|
import {
|
|
@@ -287,7 +286,37 @@ describe('plugin-meetings', () => {
|
|
|
287
286
|
});
|
|
288
287
|
webex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
289
288
|
webex.internal.llm.on = sinon.stub();
|
|
289
|
+
// Factory pattern: createChannel returns a mock channel
|
|
290
|
+
webex.internal.llm.createChannel = sinon.stub().callsFake(() => ({
|
|
291
|
+
registerAndConnect: sinon.stub().resolves({}),
|
|
292
|
+
disconnect: sinon.stub().resolves(),
|
|
293
|
+
isConnected: sinon.stub().returns(false),
|
|
294
|
+
isConnecting: sinon.stub().returns(false),
|
|
295
|
+
getLocusUrl: sinon.stub().returns(undefined),
|
|
296
|
+
getDatachannelUrl: sinon.stub().returns(undefined),
|
|
297
|
+
getDatachannelToken: sinon.stub().returns(undefined),
|
|
298
|
+
setDatachannelToken: sinon.stub(),
|
|
299
|
+
getBinding: sinon.stub().returns(undefined),
|
|
300
|
+
setRefreshHandler: sinon.stub(),
|
|
301
|
+
on: sinon.stub(),
|
|
302
|
+
off: sinon.stub(),
|
|
303
|
+
}));
|
|
290
304
|
webex.internal.voicea.announce = sinon.stub();
|
|
305
|
+
// Factory pattern: createChannel returns a mock voicea channel
|
|
306
|
+
webex.internal.voicea.createChannel = sinon.stub().callsFake(() => ({
|
|
307
|
+
on: sinon.stub(),
|
|
308
|
+
off: sinon.stub(),
|
|
309
|
+
onSpokenLanguageUpdate: sinon.stub(),
|
|
310
|
+
onCaptionServiceIdUpdate: sinon.stub(),
|
|
311
|
+
requestLanguage: sinon.stub(),
|
|
312
|
+
setSpokenLanguage: sinon.stub(),
|
|
313
|
+
turnOnCaptions: sinon.stub().resolves(),
|
|
314
|
+
listenToEvents: sinon.stub(),
|
|
315
|
+
deregisterEvents: sinon.stub(),
|
|
316
|
+
getIsCaptionBoxOn: sinon.stub().returns(false),
|
|
317
|
+
updateSubchannelSubscriptions: sinon.stub(),
|
|
318
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
319
|
+
}));
|
|
291
320
|
webex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
292
321
|
{},
|
|
293
322
|
{parent: webex}
|
|
@@ -339,6 +368,27 @@ describe('plugin-meetings', () => {
|
|
|
339
368
|
});
|
|
340
369
|
|
|
341
370
|
describe('meeting index', () => {
|
|
371
|
+
/**
|
|
372
|
+
* Creates a mock LLM channel with sensible defaults that can be overridden.
|
|
373
|
+
* @param {Object} overrides - Properties to override on the mock channel
|
|
374
|
+
* @returns {Object} Mock channel object with sinon stubs
|
|
375
|
+
*/
|
|
376
|
+
const createMockLLMChannel = (overrides = {}) => ({
|
|
377
|
+
registerAndConnect: sinon.stub().resolves({}),
|
|
378
|
+
disconnect: sinon.stub().resolves(),
|
|
379
|
+
isConnected: sinon.stub().returns(false),
|
|
380
|
+
isConnecting: sinon.stub().returns(false),
|
|
381
|
+
getLocusUrl: sinon.stub().returns(undefined),
|
|
382
|
+
getDatachannelUrl: sinon.stub().returns(undefined),
|
|
383
|
+
getDatachannelToken: sinon.stub().returns(undefined),
|
|
384
|
+
setDatachannelToken: sinon.stub(),
|
|
385
|
+
getBinding: sinon.stub().returns(undefined),
|
|
386
|
+
setRefreshHandler: sinon.stub(),
|
|
387
|
+
on: sinon.stub(),
|
|
388
|
+
off: sinon.stub(),
|
|
389
|
+
...overrides,
|
|
390
|
+
});
|
|
391
|
+
|
|
342
392
|
describe('Public Api Contract', () => {
|
|
343
393
|
describe('#constructor', () => {
|
|
344
394
|
it('should have created a meeting object with public properties', () => {
|
|
@@ -524,6 +574,11 @@ describe('plugin-meetings', () => {
|
|
|
524
574
|
localWebex.internal.llm.isDataChannelTokenEnabled = sinon.stub().resolves(false);
|
|
525
575
|
localWebex.internal.llm.on = sinon.stub();
|
|
526
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
|
+
});
|
|
527
582
|
localWebex.internal.newMetrics.callDiagnosticLatencies = new CallDiagnosticLatencies(
|
|
528
583
|
{},
|
|
529
584
|
{parent: localWebex}
|
|
@@ -2252,41 +2307,53 @@ describe('plugin-meetings', () => {
|
|
|
2252
2307
|
});
|
|
2253
2308
|
|
|
2254
2309
|
describe('#update hesiod llm id', () => {
|
|
2310
|
+
let mockVoiceaChannel;
|
|
2255
2311
|
beforeEach(() => {
|
|
2256
|
-
|
|
2312
|
+
mockVoiceaChannel = {
|
|
2313
|
+
onCaptionServiceIdUpdate: sinon.stub(),
|
|
2314
|
+
on: sinon.stub(),
|
|
2315
|
+
off: sinon.stub(),
|
|
2316
|
+
};
|
|
2317
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2257
2318
|
});
|
|
2258
2319
|
afterEach(() => {
|
|
2259
2320
|
// Restore the original methods after each test
|
|
2260
2321
|
sinon.restore();
|
|
2261
2322
|
});
|
|
2262
|
-
it('should call
|
|
2323
|
+
it('should call voiceaChannel.onCaptionServiceIdUpdate when joined', async () => {
|
|
2263
2324
|
meeting.joinedWith = {state: 'JOINED'};
|
|
2264
2325
|
await meeting.locusInfo.emitScoped(
|
|
2265
2326
|
{function: 'test', file: 'test'},
|
|
2266
2327
|
LOCUSINFO.EVENTS.CONTROLS_MEETING_HESIOD_LLM_ID_UPDATED,
|
|
2267
2328
|
{hesiodLlmId: '123a-456b-789c'}
|
|
2268
2329
|
);
|
|
2269
|
-
assert.calledWith(
|
|
2330
|
+
assert.calledWith(mockVoiceaChannel.onCaptionServiceIdUpdate, '123a-456b-789c');
|
|
2270
2331
|
});
|
|
2271
2332
|
});
|
|
2272
2333
|
|
|
2273
2334
|
describe('#update spoken language', () => {
|
|
2335
|
+
let mockVoiceaChannel;
|
|
2274
2336
|
beforeEach(() => {
|
|
2275
|
-
|
|
2337
|
+
mockVoiceaChannel = {
|
|
2338
|
+
onSpokenLanguageUpdate: sinon.stub(),
|
|
2339
|
+
on: sinon.stub(),
|
|
2340
|
+
off: sinon.stub(),
|
|
2341
|
+
};
|
|
2342
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2276
2343
|
meeting.transcription = {languageOptions: {currentSpokenLanguage: 'en'}};
|
|
2277
2344
|
});
|
|
2278
2345
|
afterEach(() => {
|
|
2279
2346
|
// Restore the original methods after each test
|
|
2280
2347
|
sinon.restore();
|
|
2281
2348
|
});
|
|
2282
|
-
it('should call
|
|
2349
|
+
it('should call voiceaChannel.onSpokenLanguageUpdate when joined', async () => {
|
|
2283
2350
|
meeting.joinedWith = {state: 'JOINED'};
|
|
2284
2351
|
await meeting.locusInfo.emitScoped(
|
|
2285
2352
|
{function: 'test', file: 'test'},
|
|
2286
2353
|
LOCUSINFO.EVENTS.CONTROLS_MEETING_TRANSCRIPTION_SPOKEN_LANGUAGE_UPDATED,
|
|
2287
2354
|
{spokenLanguage: 'fr'}
|
|
2288
2355
|
);
|
|
2289
|
-
assert.calledWith(
|
|
2356
|
+
assert.calledWith(mockVoiceaChannel.onSpokenLanguageUpdate, 'fr', meeting.id);
|
|
2290
2357
|
assert.equal(meeting.transcription.languageOptions.currentSpokenLanguage, 'fr');
|
|
2291
2358
|
assert.calledWith(
|
|
2292
2359
|
TriggerProxy.trigger,
|
|
@@ -2296,24 +2363,29 @@ describe('plugin-meetings', () => {
|
|
|
2296
2363
|
);
|
|
2297
2364
|
});
|
|
2298
2365
|
|
|
2299
|
-
it('should also call
|
|
2366
|
+
it('should also call voiceaChannel.onSpokenLanguageUpdate when not joined', async () => {
|
|
2300
2367
|
meeting.joinedWith = {state: 'NOT_JOINED'};
|
|
2301
2368
|
await meeting.locusInfo.emitScoped(
|
|
2302
2369
|
{function: 'test', file: 'test'},
|
|
2303
2370
|
LOCUSINFO.EVENTS.CONTROLS_MEETING_TRANSCRIPTION_SPOKEN_LANGUAGE_UPDATED,
|
|
2304
2371
|
{spokenLanguage: 'de'}
|
|
2305
2372
|
);
|
|
2306
|
-
assert.calledWith(
|
|
2373
|
+
assert.calledWith(mockVoiceaChannel.onSpokenLanguageUpdate, 'de');
|
|
2307
2374
|
assert.equal(meeting.transcription.languageOptions.currentSpokenLanguage, 'de');
|
|
2308
2375
|
});
|
|
2309
2376
|
});
|
|
2310
2377
|
|
|
2311
2378
|
describe('#startTranscription', () => {
|
|
2379
|
+
let mockVoiceaChannel;
|
|
2380
|
+
|
|
2312
2381
|
beforeEach(() => {
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2382
|
+
mockVoiceaChannel = {
|
|
2383
|
+
on: sinon.stub(),
|
|
2384
|
+
off: sinon.stub(),
|
|
2385
|
+
listenToEvents: sinon.stub(),
|
|
2386
|
+
turnOnCaptions: sinon.stub().resolves(),
|
|
2387
|
+
};
|
|
2388
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2317
2389
|
});
|
|
2318
2390
|
|
|
2319
2391
|
it('should subscribe to events for the first time and avoid subscribing for future transcription starts', async () => {
|
|
@@ -2325,16 +2397,14 @@ describe('plugin-meetings', () => {
|
|
|
2325
2397
|
|
|
2326
2398
|
await meeting.startTranscription();
|
|
2327
2399
|
|
|
2328
|
-
assert.equal(
|
|
2400
|
+
assert.equal(mockVoiceaChannel.on.callCount, 4);
|
|
2329
2401
|
assert.equal(meeting.areVoiceaEventsSetup, true);
|
|
2330
|
-
assert.
|
|
2331
|
-
assert.called(webex.internal.voicea.turnOnCaptions);
|
|
2402
|
+
assert.calledOnce(mockVoiceaChannel.turnOnCaptions);
|
|
2332
2403
|
|
|
2333
2404
|
await meeting.startTranscription();
|
|
2334
|
-
assert.equal(
|
|
2405
|
+
assert.equal(mockVoiceaChannel.on.callCount, 4);
|
|
2335
2406
|
assert.equal(meeting.areVoiceaEventsSetup, true);
|
|
2336
|
-
assert.
|
|
2337
|
-
assert.calledTwice(webex.internal.voicea.turnOnCaptions);
|
|
2407
|
+
assert.calledTwice(mockVoiceaChannel.turnOnCaptions);
|
|
2338
2408
|
});
|
|
2339
2409
|
|
|
2340
2410
|
it('should listen to events and turnOnCaptions for all users', async () => {
|
|
@@ -2345,10 +2415,9 @@ describe('plugin-meetings', () => {
|
|
|
2345
2415
|
|
|
2346
2416
|
await meeting.startTranscription();
|
|
2347
2417
|
|
|
2348
|
-
assert.equal(
|
|
2418
|
+
assert.equal(mockVoiceaChannel.on.callCount, 4);
|
|
2349
2419
|
assert.equal(meeting.areVoiceaEventsSetup, true);
|
|
2350
|
-
assert.
|
|
2351
|
-
assert.calledOnce(webex.internal.voicea.turnOnCaptions);
|
|
2420
|
+
assert.calledOnce(mockVoiceaChannel.turnOnCaptions);
|
|
2352
2421
|
});
|
|
2353
2422
|
|
|
2354
2423
|
it("should throw error if request doesn't work", async () => {
|
|
@@ -2363,17 +2432,22 @@ describe('plugin-meetings', () => {
|
|
|
2363
2432
|
});
|
|
2364
2433
|
|
|
2365
2434
|
describe('#stopTranscription', () => {
|
|
2435
|
+
let mockVoiceaChannel;
|
|
2436
|
+
|
|
2366
2437
|
beforeEach(() => {
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2438
|
+
mockVoiceaChannel = {
|
|
2439
|
+
on: sinon.stub(),
|
|
2440
|
+
off: sinon.stub(),
|
|
2441
|
+
listenToEvents: sinon.stub(),
|
|
2442
|
+
turnOnCaptions: sinon.stub(),
|
|
2443
|
+
deregisterEvents: sinon.stub(),
|
|
2444
|
+
};
|
|
2445
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2372
2446
|
});
|
|
2373
2447
|
|
|
2374
2448
|
it('should stop listening to voicea events and also trigger a stop event', () => {
|
|
2375
2449
|
meeting.stopTranscription();
|
|
2376
|
-
assert.equal(
|
|
2450
|
+
assert.equal(mockVoiceaChannel.off.callCount, 4);
|
|
2377
2451
|
assert.equal(meeting.areVoiceaEventsSetup, false);
|
|
2378
2452
|
assert.calledWith(
|
|
2379
2453
|
TriggerProxy.trigger,
|
|
@@ -2389,7 +2463,7 @@ describe('plugin-meetings', () => {
|
|
|
2389
2463
|
it('should stop listening to voicea events even when transcription is undefined', () => {
|
|
2390
2464
|
meeting.transcription = undefined;
|
|
2391
2465
|
meeting.stopTranscription();
|
|
2392
|
-
assert.equal(
|
|
2466
|
+
assert.equal(mockVoiceaChannel.off.callCount, 4);
|
|
2393
2467
|
assert.equal(meeting.areVoiceaEventsSetup, false);
|
|
2394
2468
|
assert.calledWith(
|
|
2395
2469
|
TriggerProxy.trigger,
|
|
@@ -2404,13 +2478,18 @@ describe('plugin-meetings', () => {
|
|
|
2404
2478
|
});
|
|
2405
2479
|
|
|
2406
2480
|
describe('#setCaptionLanguage', () => {
|
|
2481
|
+
let mockVoiceaChannel;
|
|
2482
|
+
|
|
2407
2483
|
beforeEach(() => {
|
|
2408
2484
|
meeting.isTranscriptionSupported = sinon.stub();
|
|
2409
2485
|
meeting.transcription = {languageOptions: {}};
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2486
|
+
mockVoiceaChannel = {
|
|
2487
|
+
on: sinon.stub(),
|
|
2488
|
+
off: sinon.stub(),
|
|
2489
|
+
setCaptionLanguage: sinon.stub(),
|
|
2490
|
+
requestLanguage: sinon.stub(),
|
|
2491
|
+
};
|
|
2492
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2414
2493
|
});
|
|
2415
2494
|
|
|
2416
2495
|
afterEach(() => {
|
|
@@ -2432,7 +2511,7 @@ describe('plugin-meetings', () => {
|
|
|
2432
2511
|
const languageCode = 'fr';
|
|
2433
2512
|
|
|
2434
2513
|
meeting.setCaptionLanguage(languageCode).then((resolvedLanguageCode) => {
|
|
2435
|
-
assert.calledWith(
|
|
2514
|
+
assert.calledWith(mockVoiceaChannel.requestLanguage, languageCode);
|
|
2436
2515
|
assert.equal(resolvedLanguageCode, languageCode);
|
|
2437
2516
|
assert.equal(
|
|
2438
2517
|
meeting.transcription.languageOptions.currentCaptionLanguage,
|
|
@@ -2441,13 +2520,10 @@ describe('plugin-meetings', () => {
|
|
|
2441
2520
|
done();
|
|
2442
2521
|
});
|
|
2443
2522
|
|
|
2444
|
-
assert.calledOnceWithMatch(
|
|
2445
|
-
webex.internal.voicea.on,
|
|
2446
|
-
VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE
|
|
2447
|
-
);
|
|
2523
|
+
assert.calledOnceWithMatch(mockVoiceaChannel.on, VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE);
|
|
2448
2524
|
|
|
2449
2525
|
// Trigger the event
|
|
2450
|
-
const voiceaListenerLangugeUpdate =
|
|
2526
|
+
const voiceaListenerLangugeUpdate = mockVoiceaChannel.on.getCall(0).args[1];
|
|
2451
2527
|
voiceaListenerLangugeUpdate({statusCode: 200, languageCode});
|
|
2452
2528
|
});
|
|
2453
2529
|
|
|
@@ -2464,24 +2540,26 @@ describe('plugin-meetings', () => {
|
|
|
2464
2540
|
done();
|
|
2465
2541
|
});
|
|
2466
2542
|
|
|
2467
|
-
assert.calledOnceWithMatch(
|
|
2468
|
-
webex.internal.voicea.on,
|
|
2469
|
-
VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE
|
|
2470
|
-
);
|
|
2543
|
+
assert.calledOnceWithMatch(mockVoiceaChannel.on, VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE);
|
|
2471
2544
|
|
|
2472
2545
|
// Trigger the event
|
|
2473
|
-
const voiceaListenerLangugeUpdate =
|
|
2546
|
+
const voiceaListenerLangugeUpdate = mockVoiceaChannel.on.getCall(0).args[1];
|
|
2474
2547
|
voiceaListenerLangugeUpdate(rejectPayload);
|
|
2475
2548
|
});
|
|
2476
2549
|
});
|
|
2477
2550
|
|
|
2478
2551
|
describe('#setSpokenLanguage', () => {
|
|
2552
|
+
let mockVoiceaChannel;
|
|
2553
|
+
|
|
2479
2554
|
beforeEach(() => {
|
|
2480
2555
|
meeting.isTranscriptionSupported = sinon.stub();
|
|
2481
2556
|
meeting.transcription = {languageOptions: {}};
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2557
|
+
mockVoiceaChannel = {
|
|
2558
|
+
on: sinon.stub(),
|
|
2559
|
+
off: sinon.stub(),
|
|
2560
|
+
setSpokenLanguage: sinon.stub(),
|
|
2561
|
+
};
|
|
2562
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2485
2563
|
meeting.roles = ['MODERATOR'];
|
|
2486
2564
|
});
|
|
2487
2565
|
|
|
@@ -2514,16 +2592,16 @@ describe('plugin-meetings', () => {
|
|
|
2514
2592
|
const languageCode = 'fr';
|
|
2515
2593
|
|
|
2516
2594
|
meeting.setSpokenLanguage(languageCode).then((resolvedLanguageCode) => {
|
|
2517
|
-
assert.calledWith(
|
|
2595
|
+
assert.calledWith(mockVoiceaChannel.setSpokenLanguage, languageCode);
|
|
2518
2596
|
assert.equal(resolvedLanguageCode, languageCode);
|
|
2519
2597
|
assert.equal(meeting.transcription.languageOptions.currentSpokenLanguage, languageCode);
|
|
2520
2598
|
done();
|
|
2521
2599
|
});
|
|
2522
2600
|
|
|
2523
|
-
assert.calledOnceWithMatch(
|
|
2601
|
+
assert.calledOnceWithMatch(mockVoiceaChannel.on, VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE);
|
|
2524
2602
|
|
|
2525
2603
|
// Trigger the event
|
|
2526
|
-
const voiceaListenerLangugeUpdate =
|
|
2604
|
+
const voiceaListenerLangugeUpdate = mockVoiceaChannel.on.getCall(0).args[1];
|
|
2527
2605
|
voiceaListenerLangugeUpdate({languageCode});
|
|
2528
2606
|
});
|
|
2529
2607
|
|
|
@@ -2539,10 +2617,10 @@ describe('plugin-meetings', () => {
|
|
|
2539
2617
|
done();
|
|
2540
2618
|
});
|
|
2541
2619
|
|
|
2542
|
-
assert.calledOnceWithMatch(
|
|
2620
|
+
assert.calledOnceWithMatch(mockVoiceaChannel.on, VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE);
|
|
2543
2621
|
|
|
2544
2622
|
// Trigger the event
|
|
2545
|
-
const voiceaListenerLangugeUpdate =
|
|
2623
|
+
const voiceaListenerLangugeUpdate = mockVoiceaChannel.on.getCall(0).args[1];
|
|
2546
2624
|
voiceaListenerLangugeUpdate(rejectPayload);
|
|
2547
2625
|
});
|
|
2548
2626
|
});
|
|
@@ -2557,11 +2635,39 @@ describe('plugin-meetings', () => {
|
|
|
2557
2635
|
assert.calledWith(meeting.trigger, EVENT_TRIGGERS.MEETING_CAPTION_RECEIVED);
|
|
2558
2636
|
});
|
|
2559
2637
|
|
|
2560
|
-
it('should
|
|
2561
|
-
|
|
2562
|
-
|
|
2638
|
+
it('should retain and emit spoken languages for a host announcement', () => {
|
|
2639
|
+
const payload = {
|
|
2640
|
+
currentSpokenLanguage: 'en',
|
|
2641
|
+
spokenLanguages: ['en', 'fr'],
|
|
2642
|
+
};
|
|
2643
|
+
|
|
2644
|
+
sinon.stub(meeting, 'getCurUserType').returns('host');
|
|
2645
|
+
|
|
2646
|
+
meeting.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT](payload);
|
|
2647
|
+
|
|
2648
|
+
assert.deepEqual(meeting.transcription.languageOptions, payload);
|
|
2649
|
+
assert.calledWithExactly(
|
|
2650
|
+
meeting.trigger,
|
|
2651
|
+
EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION,
|
|
2652
|
+
payload
|
|
2653
|
+
);
|
|
2654
|
+
});
|
|
2655
|
+
|
|
2656
|
+
it('should emit without spoken languages for a non-host while preserving them internally', () => {
|
|
2657
|
+
const payload = {
|
|
2658
|
+
currentSpokenLanguage: 'en',
|
|
2659
|
+
spokenLanguages: ['en', 'fr'],
|
|
2660
|
+
};
|
|
2661
|
+
|
|
2662
|
+
sinon.stub(meeting, 'getCurUserType').returns('attendee');
|
|
2663
|
+
|
|
2664
|
+
meeting.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT](payload);
|
|
2665
|
+
|
|
2666
|
+
assert.deepEqual(meeting.transcription.languageOptions.spokenLanguages, ['en', 'fr']);
|
|
2667
|
+
assert.calledWithExactly(
|
|
2563
2668
|
meeting.trigger,
|
|
2564
|
-
EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION
|
|
2669
|
+
EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION,
|
|
2670
|
+
{currentSpokenLanguage: 'en'}
|
|
2565
2671
|
);
|
|
2566
2672
|
});
|
|
2567
2673
|
|
|
@@ -2811,68 +2917,111 @@ describe('plugin-meetings', () => {
|
|
|
2811
2917
|
});
|
|
2812
2918
|
|
|
2813
2919
|
[
|
|
2920
|
+
// Main session scenarios (no practice session active)
|
|
2814
2921
|
{
|
|
2815
2922
|
title:
|
|
2816
|
-
'should skip a reaction when the
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2923
|
+
'should skip a reaction when the relay route does not match the LLM binding (main session)',
|
|
2924
|
+
route: 'wrong-route',
|
|
2925
|
+
channelBinding: 'main-binding',
|
|
2926
|
+
practiceSessionConnected: false,
|
|
2927
|
+
practiceSessionBinding: undefined,
|
|
2821
2928
|
shouldProcess: false,
|
|
2822
|
-
expectedSessionLabel: 'default session',
|
|
2823
2929
|
},
|
|
2824
2930
|
{
|
|
2825
|
-
title:
|
|
2826
|
-
|
|
2827
|
-
route: '
|
|
2828
|
-
|
|
2829
|
-
|
|
2931
|
+
title:
|
|
2932
|
+
'should process a reaction when the relay route matches the LLM binding (main session)',
|
|
2933
|
+
route: 'main-binding',
|
|
2934
|
+
channelBinding: 'main-binding',
|
|
2935
|
+
practiceSessionConnected: false,
|
|
2936
|
+
practiceSessionBinding: undefined,
|
|
2830
2937
|
shouldProcess: true,
|
|
2831
2938
|
},
|
|
2832
2939
|
{
|
|
2833
|
-
title:
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2940
|
+
title: 'should process a reaction when no LLM channel exists',
|
|
2941
|
+
route: 'some-route',
|
|
2942
|
+
channelBinding: null, // No channel
|
|
2943
|
+
practiceSessionConnected: false,
|
|
2944
|
+
practiceSessionBinding: undefined,
|
|
2945
|
+
shouldProcess: true,
|
|
2946
|
+
},
|
|
2947
|
+
{
|
|
2948
|
+
title: 'should process a reaction when LLM channel has no binding',
|
|
2949
|
+
route: 'some-route',
|
|
2950
|
+
channelBinding: undefined, // Channel exists but no binding
|
|
2951
|
+
practiceSessionConnected: false,
|
|
2952
|
+
practiceSessionBinding: undefined,
|
|
2953
|
+
shouldProcess: true,
|
|
2954
|
+
},
|
|
2955
|
+
// Practice session active scenarios
|
|
2956
|
+
{
|
|
2957
|
+
title: 'should skip a reaction routed to main binding when practice session is active',
|
|
2958
|
+
route: 'main-binding',
|
|
2959
|
+
channelBinding: 'main-binding',
|
|
2960
|
+
practiceSessionConnected: true,
|
|
2961
|
+
practiceSessionBinding: 'ps-binding',
|
|
2962
|
+
shouldProcess: false,
|
|
2963
|
+
},
|
|
2964
|
+
{
|
|
2965
|
+
title: 'should process a reaction routed to PS binding when practice session is active',
|
|
2966
|
+
route: 'ps-binding',
|
|
2967
|
+
channelBinding: 'main-binding',
|
|
2968
|
+
practiceSessionConnected: true,
|
|
2969
|
+
practiceSessionBinding: 'ps-binding',
|
|
2839
2970
|
shouldProcess: true,
|
|
2840
2971
|
},
|
|
2841
2972
|
{
|
|
2842
2973
|
title:
|
|
2843
|
-
'should skip a reaction
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2974
|
+
'should skip a reaction routed to PS binding when practice session is NOT active',
|
|
2975
|
+
route: 'ps-binding',
|
|
2976
|
+
channelBinding: 'main-binding',
|
|
2977
|
+
practiceSessionConnected: false,
|
|
2978
|
+
practiceSessionBinding: 'ps-binding',
|
|
2848
2979
|
shouldProcess: false,
|
|
2849
|
-
|
|
2980
|
+
},
|
|
2981
|
+
{
|
|
2982
|
+
title:
|
|
2983
|
+
'should process a reaction routed to main binding when practice session is NOT active',
|
|
2984
|
+
route: 'main-binding',
|
|
2985
|
+
channelBinding: 'main-binding',
|
|
2986
|
+
practiceSessionConnected: false,
|
|
2987
|
+
practiceSessionBinding: 'ps-binding',
|
|
2988
|
+
shouldProcess: true,
|
|
2850
2989
|
},
|
|
2851
2990
|
].forEach(
|
|
2852
2991
|
({
|
|
2853
2992
|
title,
|
|
2854
|
-
isPracticeSessionConnected,
|
|
2855
2993
|
route,
|
|
2856
|
-
|
|
2857
|
-
|
|
2994
|
+
channelBinding,
|
|
2995
|
+
practiceSessionConnected,
|
|
2996
|
+
practiceSessionBinding,
|
|
2858
2997
|
shouldProcess,
|
|
2859
|
-
expectedSessionLabel,
|
|
2860
2998
|
}) => {
|
|
2861
2999
|
it(title, () => {
|
|
2862
3000
|
meeting.isReactionsSupported = sinon.stub().returns(true);
|
|
2863
3001
|
meeting.config.receiveReactions = true;
|
|
2864
3002
|
const fakeSendersName = 'Fake reactors name';
|
|
2865
3003
|
meeting.members.membersCollection.get = sinon.stub().returns({name: fakeSendersName});
|
|
2866
|
-
webex.internal.llm.isConnected = sinon.stub().callsFake((llmSessionId) => {
|
|
2867
|
-
return llmSessionId === LLM_PRACTICE_SESSION && isPracticeSessionConnected;
|
|
2868
|
-
});
|
|
2869
|
-
webex.internal.llm.getBinding = sinon.stub().callsFake((llmSessionId) => {
|
|
2870
|
-
if (llmSessionId === LLM_PRACTICE_SESSION) {
|
|
2871
|
-
return practiceBinding;
|
|
2872
|
-
}
|
|
2873
3004
|
|
|
2874
|
-
|
|
2875
|
-
|
|
3005
|
+
// Mock the llmChannel on the meeting
|
|
3006
|
+
if (channelBinding === null) {
|
|
3007
|
+
meeting.llmChannel = undefined;
|
|
3008
|
+
} else {
|
|
3009
|
+
meeting.llmChannel = {
|
|
3010
|
+
getBinding: sinon.stub().returns(channelBinding),
|
|
3011
|
+
};
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3014
|
+
// Mock the webinar with practice session state
|
|
3015
|
+
meeting.webinar = {
|
|
3016
|
+
_practiceSessionLLMChannel: practiceSessionConnected
|
|
3017
|
+
? {isConnected: sinon.stub().returns(true)}
|
|
3018
|
+
: undefined,
|
|
3019
|
+
isPracticeSessionLLMChannelConnected: sinon
|
|
3020
|
+
.stub()
|
|
3021
|
+
.returns(practiceSessionConnected),
|
|
3022
|
+
getPracticeSessionBinding: sinon.stub().returns(practiceSessionBinding),
|
|
3023
|
+
};
|
|
3024
|
+
|
|
2876
3025
|
const fakeReactionPayload = {
|
|
2877
3026
|
type: 'fake_type',
|
|
2878
3027
|
codepoints: 'fake_codepoints',
|
|
@@ -2920,10 +3069,15 @@ describe('plugin-meetings', () => {
|
|
|
2920
3069
|
});
|
|
2921
3070
|
|
|
2922
3071
|
describe('#handleLLMOnline', () => {
|
|
3072
|
+
let mockVoiceaChannel;
|
|
3073
|
+
|
|
2923
3074
|
beforeEach(() => {
|
|
2924
3075
|
webex.internal.llm.off = sinon.stub();
|
|
2925
|
-
|
|
2926
|
-
|
|
3076
|
+
mockVoiceaChannel = {
|
|
3077
|
+
getKeepTranscriptionSubscribed: sinon.stub().returns(false),
|
|
3078
|
+
updateSubchannelSubscriptions: sinon.stub(),
|
|
3079
|
+
};
|
|
3080
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
2927
3081
|
});
|
|
2928
3082
|
|
|
2929
3083
|
it('emits transcription connected events', () => {
|
|
@@ -2940,21 +3094,21 @@ describe('plugin-meetings', () => {
|
|
|
2940
3094
|
});
|
|
2941
3095
|
|
|
2942
3096
|
it('restores transcription subscription when caption intent is enabled', () => {
|
|
2943
|
-
|
|
3097
|
+
mockVoiceaChannel.getKeepTranscriptionSubscribed.returns(true);
|
|
2944
3098
|
|
|
2945
3099
|
meeting.handleLLMOnline();
|
|
2946
3100
|
|
|
2947
|
-
assert.calledOnceWithExactly(
|
|
3101
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.updateSubchannelSubscriptions, {
|
|
2948
3102
|
subscribe: ['transcription'],
|
|
2949
3103
|
});
|
|
2950
3104
|
});
|
|
2951
3105
|
|
|
2952
3106
|
it('does not restore transcription subscription when caption intent is disabled', () => {
|
|
2953
|
-
|
|
3107
|
+
mockVoiceaChannel.getKeepTranscriptionSubscribed.returns(false);
|
|
2954
3108
|
|
|
2955
3109
|
meeting.handleLLMOnline();
|
|
2956
3110
|
|
|
2957
|
-
assert.notCalled(
|
|
3111
|
+
assert.notCalled(mockVoiceaChannel.updateSubchannelSubscriptions);
|
|
2958
3112
|
});
|
|
2959
3113
|
|
|
2960
3114
|
it('calls syncAllHashTreeDatasets on locusInfo', () => {
|
|
@@ -3016,7 +3170,10 @@ describe('plugin-meetings', () => {
|
|
|
3016
3170
|
assert.calledOnce(MeetingUtil.joinMeeting);
|
|
3017
3171
|
assert.calledOnce(webex.internal.device.meetingStarted);
|
|
3018
3172
|
assert.equal(result, joinMeetingResult);
|
|
3019
|
-
|
|
3173
|
+
// With factory pattern, event is registered on the channel, not the plugin
|
|
3174
|
+
if (meeting.llmChannel) {
|
|
3175
|
+
assert.calledWith(meeting.llmChannel.on, 'online', meeting.handleLLMOnline);
|
|
3176
|
+
}
|
|
3020
3177
|
});
|
|
3021
3178
|
|
|
3022
3179
|
[true, false].forEach((enableMultistream) => {
|
|
@@ -3242,12 +3399,14 @@ describe('plugin-meetings', () => {
|
|
|
3242
3399
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3243
3400
|
|
|
3244
3401
|
let locusLLMEventListener;
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3402
|
+
const mockChannel = createMockLLMChannel({
|
|
3403
|
+
on: sinon.stub().callsFake((eventName, callback) => {
|
|
3404
|
+
if (eventName === 'event:locus.state_message') {
|
|
3405
|
+
locusLLMEventListener = callback;
|
|
3406
|
+
}
|
|
3407
|
+
}),
|
|
3249
3408
|
});
|
|
3250
|
-
|
|
3409
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3251
3410
|
|
|
3252
3411
|
meeting.updateLLMConnection.restore();
|
|
3253
3412
|
|
|
@@ -3270,9 +3429,9 @@ describe('plugin-meetings', () => {
|
|
|
3270
3429
|
|
|
3271
3430
|
it('UpdateLLMConnection sends a metric if not connected after timeout', async () => {
|
|
3272
3431
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3432
|
+
|
|
3433
|
+
const mockChannel = createMockLLMChannel({hasEverConnected: true});
|
|
3434
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3276
3435
|
|
|
3277
3436
|
meeting.updateLLMConnection.restore();
|
|
3278
3437
|
|
|
@@ -3346,10 +3505,10 @@ describe('plugin-meetings', () => {
|
|
|
3346
3505
|
|
|
3347
3506
|
it('does not emit failed breakout join response metric when breakout session is missing', async () => {
|
|
3348
3507
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3508
|
+
const mockChannel = createMockLLMChannel({
|
|
3509
|
+
registerAndConnect: sinon.stub().rejects(new Error('failed to connect LLM')),
|
|
3510
|
+
});
|
|
3511
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3353
3512
|
|
|
3354
3513
|
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3355
3514
|
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
@@ -3373,11 +3532,13 @@ describe('plugin-meetings', () => {
|
|
|
3373
3532
|
|
|
3374
3533
|
it('emits llm breakout join response metric after suppressing join response without llmLatency', async () => {
|
|
3375
3534
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3535
|
+
const mockChannel = createMockLLMChannel({
|
|
3536
|
+
registerAndConnect: sinon.stub().resolves({
|
|
3537
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3538
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3539
|
+
}),
|
|
3380
3540
|
});
|
|
3541
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3381
3542
|
|
|
3382
3543
|
meeting.config.enableAutomaticLLM = true;
|
|
3383
3544
|
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
@@ -3409,11 +3570,13 @@ describe('plugin-meetings', () => {
|
|
|
3409
3570
|
|
|
3410
3571
|
it('emits breakout join response metric with llmLatency when returning to main session', async () => {
|
|
3411
3572
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3573
|
+
const mockChannel = createMockLLMChannel({
|
|
3574
|
+
registerAndConnect: sinon.stub().resolves({
|
|
3575
|
+
clientLLMDatachannelResponseTime: 10,
|
|
3576
|
+
clientLLMWebSocketConnectTime: 20,
|
|
3577
|
+
}),
|
|
3416
3578
|
});
|
|
3579
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3417
3580
|
|
|
3418
3581
|
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3419
3582
|
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
@@ -3442,10 +3605,12 @@ describe('plugin-meetings', () => {
|
|
|
3442
3605
|
|
|
3443
3606
|
it('uses the partial datachannel timing from the error when the websocket connect fails', async () => {
|
|
3444
3607
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3445
|
-
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3446
3608
|
const connectError = new Error('failed to connect LLM');
|
|
3447
3609
|
connectError.timing = {clientLLMDatachannelResponseTime: 42};
|
|
3448
|
-
|
|
3610
|
+
const mockChannel = createMockLLMChannel({
|
|
3611
|
+
registerAndConnect: sinon.stub().rejects(connectError),
|
|
3612
|
+
});
|
|
3613
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3449
3614
|
|
|
3450
3615
|
meeting.meetingInfo.enableConvergedArchitecture = true;
|
|
3451
3616
|
meeting.breakouts.set('breakoutMoveId', 'move-id-1');
|
|
@@ -3479,10 +3644,12 @@ describe('plugin-meetings', () => {
|
|
|
3479
3644
|
|
|
3480
3645
|
it('reports the partial datachannel timing on client.llm.connect.response when the websocket connect fails during initial join', async () => {
|
|
3481
3646
|
sinon.stub(meeting, 'isJoined').returns(true);
|
|
3482
|
-
sinon.stub(meeting.webex.internal.llm, 'isConnected').returns(false);
|
|
3483
3647
|
const connectError = new Error('failed to connect LLM');
|
|
3484
3648
|
connectError.timing = {clientLLMDatachannelResponseTime: 42};
|
|
3485
|
-
|
|
3649
|
+
const mockChannel = createMockLLMChannel({
|
|
3650
|
+
registerAndConnect: sinon.stub().rejects(connectError),
|
|
3651
|
+
});
|
|
3652
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3486
3653
|
|
|
3487
3654
|
webex.internal.newMetrics.submitClientEvent.resetHistory();
|
|
3488
3655
|
meeting.updateLLMConnection.restore();
|
|
@@ -3507,32 +3674,32 @@ describe('plugin-meetings', () => {
|
|
|
3507
3674
|
|
|
3508
3675
|
it('clears the LLM health check timer when disconnecting LLM', async () => {
|
|
3509
3676
|
const isJoinedStub = sinon.stub(meeting, 'isJoined');
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
sinon
|
|
3514
|
-
.stub(meeting.webex.internal.llm, 'getLocusUrl')
|
|
3515
|
-
.returns('https://locus1.example.com');
|
|
3516
|
-
sinon
|
|
3517
|
-
.stub(meeting.webex.internal.llm, 'getDatachannelUrl')
|
|
3518
|
-
.returns('https://datachannel1.example.com');
|
|
3677
|
+
|
|
3678
|
+
const mockChannel = createMockLLMChannel();
|
|
3679
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
3519
3680
|
|
|
3520
3681
|
meeting.updateLLMConnection.restore();
|
|
3521
3682
|
|
|
3683
|
+
// First: join and connect
|
|
3522
3684
|
isJoinedStub.returns(true);
|
|
3523
|
-
meeting.webex.internal.llm.isConnected.returns(false);
|
|
3524
3685
|
await meeting.updateLLMConnection();
|
|
3525
3686
|
|
|
3526
3687
|
assert.exists(meeting.llmHealthCheckTimer);
|
|
3527
3688
|
|
|
3689
|
+
// Simulate existing connected channel that will be cleaned up
|
|
3690
|
+
mockChannel.isConnected.returns(true);
|
|
3691
|
+
meeting.llmChannel = mockChannel;
|
|
3692
|
+
|
|
3693
|
+
// Now leave the meeting - this should trigger cleanup
|
|
3528
3694
|
isJoinedStub.returns(false);
|
|
3529
|
-
meeting.
|
|
3695
|
+
meeting.locusInfo.url = 'some-url';
|
|
3696
|
+
meeting.locusInfo.info = {datachannelUrl: 'some-datachannel-url'};
|
|
3530
3697
|
|
|
3531
3698
|
await meeting.updateLLMConnection();
|
|
3532
3699
|
|
|
3533
|
-
|
|
3534
|
-
|
|
3700
|
+
// After cleanup (not joined), timer should be cleared
|
|
3535
3701
|
assert.isUndefined(meeting.llmHealthCheckTimer);
|
|
3702
|
+
assert.calledOnce(mockChannel.disconnect);
|
|
3536
3703
|
|
|
3537
3704
|
Metrics.sendBehavioralMetric.resetHistory();
|
|
3538
3705
|
fakeClock.tick(3 * 60 * 1000);
|
|
@@ -8185,6 +8352,13 @@ describe('plugin-meetings', () => {
|
|
|
8185
8352
|
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /leave', async () => {
|
|
8186
8353
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8187
8354
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8355
|
+
meeting.areVoiceaEventsSetup = true;
|
|
8356
|
+
|
|
8357
|
+
// Set up llmChannel with mock off function
|
|
8358
|
+
meeting.llmChannel = {
|
|
8359
|
+
off: sinon.stub(),
|
|
8360
|
+
disconnect: sinon.stub().resolves(),
|
|
8361
|
+
};
|
|
8188
8362
|
|
|
8189
8363
|
await meeting.leave();
|
|
8190
8364
|
|
|
@@ -8193,19 +8367,19 @@ describe('plugin-meetings', () => {
|
|
|
8193
8367
|
// in-flight events do not trigger unnecessary Locus syncs
|
|
8194
8368
|
// (per Locus team recommendation).
|
|
8195
8369
|
assert.callOrder(
|
|
8196
|
-
|
|
8370
|
+
meeting.llmChannel.off,
|
|
8197
8371
|
webex.internal.mercury.off,
|
|
8198
8372
|
meeting.stopTranscription,
|
|
8199
8373
|
meeting.annotation.deregisterEvents,
|
|
8200
8374
|
meeting.meetingRequest.leaveMeeting
|
|
8201
8375
|
);
|
|
8202
8376
|
assert.calledWithExactly(
|
|
8203
|
-
|
|
8377
|
+
meeting.llmChannel.off,
|
|
8204
8378
|
'event:relay.event',
|
|
8205
8379
|
meeting.processRelayEvent
|
|
8206
8380
|
);
|
|
8207
8381
|
assert.calledWithExactly(
|
|
8208
|
-
|
|
8382
|
+
meeting.llmChannel.off,
|
|
8209
8383
|
LOCUS_LLM_EVENT,
|
|
8210
8384
|
meeting.processLocusLLMEvent
|
|
8211
8385
|
);
|
|
@@ -8215,25 +8389,35 @@ describe('plugin-meetings', () => {
|
|
|
8215
8389
|
assert.isUndefined(meeting.mercuryOfflineHandler);
|
|
8216
8390
|
assert.calledOnceWithExactly(meeting.stopTranscription);
|
|
8217
8391
|
assert.calledOnceWithExactly(meeting.annotation.deregisterEvents);
|
|
8218
|
-
|
|
8392
|
+
// Transcription is reset to initial state (not undefined)
|
|
8393
|
+
assert.isDefined(meeting.transcription);
|
|
8394
|
+
assert.deepEqual(meeting.transcription.captions, []);
|
|
8395
|
+
assert.equal(meeting.transcription.isCaptioning, false);
|
|
8219
8396
|
});
|
|
8220
8397
|
|
|
8221
8398
|
it('tears down llm/mercury/transcription/annotation even when /leave rejects', async () => {
|
|
8222
8399
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
8223
8400
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
8401
|
+
meeting.areVoiceaEventsSetup = true;
|
|
8224
8402
|
meeting.meetingRequest.leaveMeeting = sinon
|
|
8225
8403
|
.stub()
|
|
8226
8404
|
.returns(Promise.reject(new Error('leave failed')));
|
|
8227
8405
|
|
|
8406
|
+
// Set up llmChannel with mock off function
|
|
8407
|
+
meeting.llmChannel = {
|
|
8408
|
+
off: sinon.stub(),
|
|
8409
|
+
disconnect: sinon.stub().resolves(),
|
|
8410
|
+
};
|
|
8411
|
+
|
|
8228
8412
|
await meeting.leave().catch(() => {});
|
|
8229
8413
|
|
|
8230
8414
|
assert.calledWithExactly(
|
|
8231
|
-
|
|
8415
|
+
meeting.llmChannel.off,
|
|
8232
8416
|
'event:relay.event',
|
|
8233
8417
|
meeting.processRelayEvent
|
|
8234
8418
|
);
|
|
8235
8419
|
assert.calledWithExactly(
|
|
8236
|
-
|
|
8420
|
+
meeting.llmChannel.off,
|
|
8237
8421
|
LOCUS_LLM_EVENT,
|
|
8238
8422
|
meeting.processLocusLLMEvent
|
|
8239
8423
|
);
|
|
@@ -10327,6 +10511,13 @@ describe('plugin-meetings', () => {
|
|
|
10327
10511
|
it('stops listening for LLM/Mercury and tears down transcription and annotation before calling Locus /end', async () => {
|
|
10328
10512
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10329
10513
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10514
|
+
meeting.areVoiceaEventsSetup = true;
|
|
10515
|
+
|
|
10516
|
+
// Set up llmChannel with mock off function
|
|
10517
|
+
meeting.llmChannel = {
|
|
10518
|
+
off: sinon.stub(),
|
|
10519
|
+
disconnect: sinon.stub().resolves(),
|
|
10520
|
+
};
|
|
10330
10521
|
|
|
10331
10522
|
await meeting.endMeetingForAll();
|
|
10332
10523
|
|
|
@@ -10335,19 +10526,19 @@ describe('plugin-meetings', () => {
|
|
|
10335
10526
|
// in-flight events do not trigger unnecessary Locus syncs
|
|
10336
10527
|
// (per Locus team recommendation).
|
|
10337
10528
|
assert.callOrder(
|
|
10338
|
-
|
|
10529
|
+
meeting.llmChannel.off,
|
|
10339
10530
|
webex.internal.mercury.off,
|
|
10340
10531
|
meeting.stopTranscription,
|
|
10341
10532
|
meeting.annotation.deregisterEvents,
|
|
10342
10533
|
meeting.meetingRequest.endMeetingForAll
|
|
10343
10534
|
);
|
|
10344
10535
|
assert.calledWithExactly(
|
|
10345
|
-
|
|
10536
|
+
meeting.llmChannel.off,
|
|
10346
10537
|
'event:relay.event',
|
|
10347
10538
|
meeting.processRelayEvent
|
|
10348
10539
|
);
|
|
10349
10540
|
assert.calledWithExactly(
|
|
10350
|
-
|
|
10541
|
+
meeting.llmChannel.off,
|
|
10351
10542
|
LOCUS_LLM_EVENT,
|
|
10352
10543
|
meeting.processLocusLLMEvent
|
|
10353
10544
|
);
|
|
@@ -10362,19 +10553,26 @@ describe('plugin-meetings', () => {
|
|
|
10362
10553
|
it('tears down llm/mercury/transcription/annotation even when /end rejects', async () => {
|
|
10363
10554
|
const onlineHandler = meeting.mercuryOnlineHandler;
|
|
10364
10555
|
const offlineHandler = meeting.mercuryOfflineHandler;
|
|
10556
|
+
meeting.areVoiceaEventsSetup = true;
|
|
10365
10557
|
meeting.meetingRequest.endMeetingForAll = sinon
|
|
10366
10558
|
.stub()
|
|
10367
10559
|
.returns(Promise.reject(new Error('end failed')));
|
|
10368
10560
|
|
|
10561
|
+
// Set up llmChannel with mock off function
|
|
10562
|
+
meeting.llmChannel = {
|
|
10563
|
+
off: sinon.stub(),
|
|
10564
|
+
disconnect: sinon.stub().resolves(),
|
|
10565
|
+
};
|
|
10566
|
+
|
|
10369
10567
|
await meeting.endMeetingForAll().catch(() => {});
|
|
10370
10568
|
|
|
10371
10569
|
assert.calledWithExactly(
|
|
10372
|
-
|
|
10570
|
+
meeting.llmChannel.off,
|
|
10373
10571
|
'event:relay.event',
|
|
10374
10572
|
meeting.processRelayEvent
|
|
10375
10573
|
);
|
|
10376
10574
|
assert.calledWithExactly(
|
|
10377
|
-
|
|
10575
|
+
meeting.llmChannel.off,
|
|
10378
10576
|
LOCUS_LLM_EVENT,
|
|
10379
10577
|
meeting.processLocusLLMEvent
|
|
10380
10578
|
);
|
|
@@ -14927,41 +15125,28 @@ describe('plugin-meetings', () => {
|
|
|
14927
15125
|
|
|
14928
15126
|
describe('#saveDataChannelToken', () => {
|
|
14929
15127
|
beforeEach(() => {
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
.stub()
|
|
14933
|
-
.returns({currentOwner: undefined, isOwner: true});
|
|
14934
|
-
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
15128
|
+
meeting._pendingDatachannelToken = undefined;
|
|
15129
|
+
meeting.webinar._pendingPracticeSessionDatachannelToken = undefined;
|
|
14935
15130
|
});
|
|
14936
15131
|
|
|
14937
|
-
it('saves datachannelToken
|
|
15132
|
+
it('saves datachannelToken to _pendingDatachannelToken', () => {
|
|
14938
15133
|
meeting.saveDataChannelToken({
|
|
14939
15134
|
locus: {
|
|
14940
15135
|
self: {datachannelToken: 'default-token'},
|
|
14941
15136
|
},
|
|
14942
15137
|
});
|
|
14943
15138
|
|
|
14944
|
-
assert.
|
|
14945
|
-
webex.internal.llm.setDatachannelToken,
|
|
14946
|
-
'default-token',
|
|
14947
|
-
'llm-default-session',
|
|
14948
|
-
meeting.id
|
|
14949
|
-
);
|
|
15139
|
+
assert.equal(meeting._pendingDatachannelToken, 'default-token');
|
|
14950
15140
|
});
|
|
14951
15141
|
|
|
14952
|
-
it('saves practiceSessionDatachannelToken
|
|
15142
|
+
it('saves practiceSessionDatachannelToken to webinar._pendingPracticeSessionDatachannelToken', () => {
|
|
14953
15143
|
meeting.saveDataChannelToken({
|
|
14954
15144
|
locus: {
|
|
14955
15145
|
self: {practiceSessionDatachannelToken: 'ps-token'},
|
|
14956
15146
|
},
|
|
14957
15147
|
});
|
|
14958
15148
|
|
|
14959
|
-
assert.
|
|
14960
|
-
webex.internal.llm.setDatachannelToken,
|
|
14961
|
-
'ps-token',
|
|
14962
|
-
'llm-practice-session',
|
|
14963
|
-
meeting.id
|
|
14964
|
-
);
|
|
15149
|
+
assert.equal(meeting.webinar._pendingPracticeSessionDatachannelToken, 'ps-token');
|
|
14965
15150
|
});
|
|
14966
15151
|
|
|
14967
15152
|
it('saves both tokens when both are present', () => {
|
|
@@ -14974,100 +15159,93 @@ describe('plugin-meetings', () => {
|
|
|
14974
15159
|
},
|
|
14975
15160
|
});
|
|
14976
15161
|
|
|
14977
|
-
assert.
|
|
14978
|
-
assert.
|
|
14979
|
-
webex.internal.llm.setDatachannelToken,
|
|
14980
|
-
'default-token',
|
|
14981
|
-
'llm-default-session',
|
|
14982
|
-
meeting.id
|
|
14983
|
-
);
|
|
14984
|
-
assert.calledWithExactly(
|
|
14985
|
-
webex.internal.llm.setDatachannelToken,
|
|
14986
|
-
'ps-token',
|
|
14987
|
-
'llm-practice-session',
|
|
14988
|
-
meeting.id
|
|
14989
|
-
);
|
|
15162
|
+
assert.equal(meeting._pendingDatachannelToken, 'default-token');
|
|
15163
|
+
assert.equal(meeting.webinar._pendingPracticeSessionDatachannelToken, 'ps-token');
|
|
14990
15164
|
});
|
|
14991
15165
|
|
|
14992
|
-
it('does not
|
|
15166
|
+
it('does not set pending tokens when no tokens are present', () => {
|
|
14993
15167
|
meeting.saveDataChannelToken({locus: {self: {}}});
|
|
14994
15168
|
|
|
14995
|
-
assert.
|
|
15169
|
+
assert.isUndefined(meeting._pendingDatachannelToken);
|
|
15170
|
+
assert.isUndefined(meeting.webinar._pendingPracticeSessionDatachannelToken);
|
|
14996
15171
|
});
|
|
14997
15172
|
|
|
14998
15173
|
it('handles undefined join gracefully', () => {
|
|
14999
15174
|
meeting.saveDataChannelToken(undefined);
|
|
15000
15175
|
|
|
15001
|
-
assert.
|
|
15176
|
+
assert.isUndefined(meeting._pendingDatachannelToken);
|
|
15177
|
+
assert.isUndefined(meeting.webinar._pendingPracticeSessionDatachannelToken);
|
|
15002
15178
|
});
|
|
15003
15179
|
|
|
15004
15180
|
it('handles missing locus.self gracefully', () => {
|
|
15005
15181
|
meeting.saveDataChannelToken({locus: {}});
|
|
15006
15182
|
|
|
15007
|
-
assert.
|
|
15183
|
+
assert.isUndefined(meeting._pendingDatachannelToken);
|
|
15184
|
+
assert.isUndefined(meeting.webinar._pendingPracticeSessionDatachannelToken);
|
|
15008
15185
|
});
|
|
15009
15186
|
|
|
15010
|
-
it('
|
|
15187
|
+
it('sets token on llmChannel if it exists', () => {
|
|
15188
|
+
const mockChannel = {
|
|
15189
|
+
setDatachannelToken: sinon.stub(),
|
|
15190
|
+
};
|
|
15191
|
+
meeting.llmChannel = mockChannel;
|
|
15192
|
+
|
|
15011
15193
|
meeting.saveDataChannelToken({
|
|
15012
15194
|
locus: {
|
|
15013
15195
|
self: {datachannelToken: 'default-token'},
|
|
15014
15196
|
},
|
|
15015
15197
|
});
|
|
15016
15198
|
|
|
15017
|
-
assert.calledOnceWithExactly(
|
|
15018
|
-
webex.internal.llm.setDatachannelToken,
|
|
15019
|
-
'default-token',
|
|
15020
|
-
'llm-default-session',
|
|
15021
|
-
meeting.id
|
|
15022
|
-
);
|
|
15199
|
+
assert.calledOnceWithExactly(mockChannel.setDatachannelToken, 'default-token');
|
|
15023
15200
|
});
|
|
15024
15201
|
});
|
|
15025
15202
|
|
|
15026
|
-
describe('#
|
|
15203
|
+
describe('#updateLLMConnection', () => {
|
|
15204
|
+
let mockChannel;
|
|
15205
|
+
let mockVoiceaChannel;
|
|
15206
|
+
|
|
15027
15207
|
beforeEach(() => {
|
|
15028
|
-
|
|
15029
|
-
|
|
15208
|
+
// Create a mock channel that createChannel will return
|
|
15209
|
+
mockChannel = createMockLLMChannel({
|
|
15210
|
+
registerAndConnect: sinon.stub().resolves('something'),
|
|
15211
|
+
});
|
|
15030
15212
|
|
|
15031
|
-
|
|
15032
|
-
|
|
15213
|
+
// Create a mock voicea channel
|
|
15214
|
+
mockVoiceaChannel = {
|
|
15215
|
+
on: sinon.stub(),
|
|
15216
|
+
off: sinon.stub(),
|
|
15217
|
+
onSpokenLanguageUpdate: sinon.stub(),
|
|
15218
|
+
onCaptionServiceIdUpdate: sinon.stub(),
|
|
15219
|
+
requestLanguage: sinon.stub(),
|
|
15220
|
+
setSpokenLanguage: sinon.stub(),
|
|
15221
|
+
turnOnCaptions: sinon.stub().resolves(),
|
|
15222
|
+
listenToEvents: sinon.stub(),
|
|
15223
|
+
deregisterEvents: sinon.stub(),
|
|
15224
|
+
getIsCaptionBoxOn: sinon.stub().returns(false),
|
|
15225
|
+
updateSubchannelSubscriptions: sinon.stub(),
|
|
15226
|
+
switchLLMChannel: sinon.stub().resolves(),
|
|
15227
|
+
isLLMConnected: sinon.stub().returns(true),
|
|
15228
|
+
getKeepTranscriptionSubscribed: sinon.stub().returns(false),
|
|
15229
|
+
};
|
|
15033
15230
|
|
|
15034
|
-
|
|
15035
|
-
|
|
15036
|
-
'llm-default-session',
|
|
15037
|
-
meeting.id
|
|
15038
|
-
);
|
|
15039
|
-
assert.calledWithExactly(
|
|
15040
|
-
webex.internal.llm.clearDatachannelToken,
|
|
15041
|
-
'llm-practice-session',
|
|
15042
|
-
meeting.id
|
|
15043
|
-
);
|
|
15044
|
-
assert.callCount(webex.internal.llm.clearDatachannelToken, 2);
|
|
15045
|
-
});
|
|
15046
|
-
});
|
|
15231
|
+
webex.internal.llm.createChannel = sinon.stub().returns(mockChannel);
|
|
15232
|
+
webex.internal.voicea.createChannel = sinon.stub().returns(mockVoiceaChannel);
|
|
15047
15233
|
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
webex.internal.llm.isConnected = sinon.stub().returns(false);
|
|
15051
|
-
webex.internal.llm.getLocusUrl = sinon.stub();
|
|
15052
|
-
webex.internal.llm.getDatachannelUrl = sinon.stub();
|
|
15053
|
-
webex.internal.llm.registerAndConnect = sinon.stub().resolves('something');
|
|
15054
|
-
webex.internal.llm.setRefreshHandler = sinon.stub();
|
|
15055
|
-
webex.internal.llm.disconnectLLM = sinon.stub().resolves();
|
|
15056
|
-
webex.internal.llm.on = sinon.stub();
|
|
15057
|
-
webex.internal.llm.off = sinon.stub();
|
|
15058
|
-
webex.internal.llm.getDatachannelToken = sinon.stub().returns(undefined);
|
|
15059
|
-
webex.internal.llm.setDatachannelToken = sinon.stub();
|
|
15234
|
+
// voiceaChannel is created in the Meeting constructor
|
|
15235
|
+
meeting.voiceaChannel = mockVoiceaChannel;
|
|
15060
15236
|
|
|
15061
15237
|
meeting.processRelayEvent = sinon.stub();
|
|
15062
15238
|
meeting.processLocusLLMEvent = sinon.stub();
|
|
15239
|
+
meeting.handleLLMOnline = sinon.stub();
|
|
15063
15240
|
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
15064
15241
|
meeting.startLLMHealthCheckTimer = sinon.stub();
|
|
15242
|
+
meeting.annotation.registerChannel = sinon.stub();
|
|
15065
15243
|
|
|
15066
15244
|
meeting.webinar.isJoinPracticeSessionDataChannel = sinon.stub().returns(false);
|
|
15067
15245
|
});
|
|
15246
|
+
|
|
15068
15247
|
it('does not connect if the call is not joined yet', async () => {
|
|
15069
15248
|
meeting.joinedWith = {state: 'any other state'};
|
|
15070
|
-
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15071
15249
|
|
|
15072
15250
|
meeting.locusInfo = {
|
|
15073
15251
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15077,12 +15255,11 @@ describe('plugin-meetings', () => {
|
|
|
15077
15255
|
|
|
15078
15256
|
const result = await meeting.updateLLMConnection();
|
|
15079
15257
|
|
|
15080
|
-
assert.notCalled(webex.internal.llm.
|
|
15081
|
-
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15258
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
15082
15259
|
assert.equal(result, undefined);
|
|
15083
|
-
assert.notCalled(meeting.webex.internal.llm.on);
|
|
15084
15260
|
});
|
|
15085
|
-
|
|
15261
|
+
|
|
15262
|
+
it('creates a channel and connects when joined', async () => {
|
|
15086
15263
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15087
15264
|
meeting.locusInfo = {
|
|
15088
15265
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15091,36 +15268,60 @@ describe('plugin-meetings', () => {
|
|
|
15091
15268
|
};
|
|
15092
15269
|
|
|
15093
15270
|
const result = await meeting.updateLLMConnection();
|
|
15094
|
-
|
|
15271
|
+
|
|
15272
|
+
assert.calledOnce(webex.internal.llm.createChannel);
|
|
15095
15273
|
assert.calledWithExactly(
|
|
15096
|
-
|
|
15274
|
+
mockChannel.registerAndConnect,
|
|
15097
15275
|
'a url',
|
|
15098
15276
|
'a datachannel url',
|
|
15099
15277
|
undefined
|
|
15100
15278
|
);
|
|
15101
15279
|
assert.equal(result, 'something');
|
|
15280
|
+
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
15281
|
+
});
|
|
15282
|
+
|
|
15283
|
+
it('sets up event listeners on the channel after connection', async () => {
|
|
15284
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15285
|
+
meeting.locusInfo = {
|
|
15286
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15287
|
+
url: 'a url',
|
|
15288
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15289
|
+
};
|
|
15290
|
+
|
|
15291
|
+
await meeting.updateLLMConnection();
|
|
15292
|
+
|
|
15293
|
+
assert.calledWithExactly(mockChannel.off, 'event:relay.event', meeting.processRelayEvent);
|
|
15294
|
+
assert.calledWithExactly(mockChannel.on, 'event:relay.event', meeting.processRelayEvent);
|
|
15102
15295
|
assert.calledWithExactly(
|
|
15103
|
-
|
|
15104
|
-
'event:relay.event',
|
|
15105
|
-
meeting.processRelayEvent
|
|
15106
|
-
);
|
|
15107
|
-
assert.calledWithExactly(
|
|
15108
|
-
meeting.webex.internal.llm.off,
|
|
15296
|
+
mockChannel.off,
|
|
15109
15297
|
'event:locus.state_message',
|
|
15110
15298
|
meeting.processLocusLLMEvent
|
|
15111
15299
|
);
|
|
15112
15300
|
assert.calledWithExactly(
|
|
15113
|
-
|
|
15114
|
-
'event:relay.event',
|
|
15115
|
-
meeting.processRelayEvent
|
|
15116
|
-
);
|
|
15117
|
-
assert.calledWithExactly(
|
|
15118
|
-
meeting.webex.internal.llm.on,
|
|
15301
|
+
mockChannel.on,
|
|
15119
15302
|
'event:locus.state_message',
|
|
15120
15303
|
meeting.processLocusLLMEvent
|
|
15121
15304
|
);
|
|
15305
|
+
assert.calledWithExactly(mockChannel.off, 'online', meeting.handleLLMOnline);
|
|
15306
|
+
assert.calledWithExactly(mockChannel.on, 'online', meeting.handleLLMOnline);
|
|
15307
|
+
});
|
|
15308
|
+
|
|
15309
|
+
it('sets refresh handler before registration', async () => {
|
|
15310
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15311
|
+
meeting.locusInfo = {
|
|
15312
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15313
|
+
url: 'a url',
|
|
15314
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15315
|
+
};
|
|
15316
|
+
|
|
15317
|
+
await meeting.updateLLMConnection();
|
|
15318
|
+
|
|
15319
|
+
assert.calledOnceWithExactly(mockChannel.setRefreshHandler, sinon.match.func);
|
|
15320
|
+
// Verify setRefreshHandler was called before registerAndConnect
|
|
15321
|
+
assert.isTrue(mockChannel.setRefreshHandler.calledBefore(mockChannel.registerAndConnect));
|
|
15122
15322
|
});
|
|
15123
|
-
|
|
15323
|
+
|
|
15324
|
+
it('skips reconnect when already connected to same URLs', async () => {
|
|
15124
15325
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15125
15326
|
meeting.locusInfo = {
|
|
15126
15327
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15128,146 +15329,112 @@ describe('plugin-meetings', () => {
|
|
|
15128
15329
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15129
15330
|
};
|
|
15130
15331
|
|
|
15332
|
+
// Set up existing channel with matching URLs
|
|
15333
|
+
const existingChannel = {
|
|
15334
|
+
isConnected: sinon.stub().returns(true),
|
|
15335
|
+
isConnecting: sinon.stub().returns(false),
|
|
15336
|
+
getLocusUrl: sinon.stub().returns('a url'),
|
|
15337
|
+
getDatachannelUrl: sinon.stub().returns('a datachannel url'),
|
|
15338
|
+
};
|
|
15339
|
+
meeting.llmChannel = existingChannel;
|
|
15340
|
+
|
|
15131
15341
|
const result = await meeting.updateLLMConnection();
|
|
15132
15342
|
|
|
15133
|
-
assert.notCalled(webex.internal.llm.
|
|
15134
|
-
assert.
|
|
15135
|
-
webex.internal.llm.registerAndConnect,
|
|
15136
|
-
'a url',
|
|
15137
|
-
'a datachannel url',
|
|
15138
|
-
undefined
|
|
15139
|
-
);
|
|
15140
|
-
assert.calledOnceWithExactly(
|
|
15141
|
-
webex.internal.llm.setRefreshHandler,
|
|
15142
|
-
sinon.match.func,
|
|
15143
|
-
'llm-default-session',
|
|
15144
|
-
meeting.id
|
|
15145
|
-
);
|
|
15146
|
-
assert.equal(result, 'something');
|
|
15147
|
-
assert.calledOnceWithExactly(meeting.locusInfo.syncAllHashTreeDatasets, {onlyLLM: true});
|
|
15343
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
15344
|
+
assert.equal(result, undefined);
|
|
15148
15345
|
});
|
|
15149
|
-
|
|
15346
|
+
|
|
15347
|
+
it('disconnects and reconnects when locus URL changes', async () => {
|
|
15150
15348
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15151
15349
|
|
|
15152
|
-
|
|
15153
|
-
|
|
15350
|
+
// Set up existing channel with different URL
|
|
15351
|
+
const existingChannel = {
|
|
15352
|
+
isConnected: sinon.stub().returns(true),
|
|
15353
|
+
isConnecting: sinon.stub().returns(false),
|
|
15354
|
+
getLocusUrl: sinon.stub().returns('old url'),
|
|
15355
|
+
getDatachannelUrl: sinon.stub().returns('a datachannel url'),
|
|
15356
|
+
disconnect: sinon.stub().resolves(),
|
|
15357
|
+
off: sinon.stub(),
|
|
15358
|
+
};
|
|
15359
|
+
meeting.llmChannel = existingChannel;
|
|
15360
|
+
const originalVoiceaChannel = meeting.voiceaChannel;
|
|
15154
15361
|
|
|
15155
15362
|
meeting.locusInfo = {
|
|
15156
15363
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15157
15364
|
url: 'a different url',
|
|
15158
15365
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15159
|
-
self: {},
|
|
15160
15366
|
};
|
|
15161
15367
|
|
|
15162
15368
|
const result = await meeting.updateLLMConnection();
|
|
15163
15369
|
|
|
15370
|
+
// Should disconnect old channel
|
|
15371
|
+
assert.calledOnce(existingChannel.disconnect);
|
|
15372
|
+
// Should create new channel
|
|
15373
|
+
assert.calledOnce(webex.internal.llm.createChannel);
|
|
15374
|
+
// Should connect with new URL
|
|
15164
15375
|
assert.calledWithExactly(
|
|
15165
|
-
|
|
15166
|
-
{
|
|
15167
|
-
code: 3050,
|
|
15168
|
-
reason: 'done (permanent)',
|
|
15169
|
-
},
|
|
15170
|
-
'llm-default-session',
|
|
15171
|
-
meeting.id
|
|
15172
|
-
);
|
|
15173
|
-
|
|
15174
|
-
assert.calledWithExactly(
|
|
15175
|
-
webex.internal.llm.registerAndConnect,
|
|
15376
|
+
mockChannel.registerAndConnect,
|
|
15176
15377
|
'a different url',
|
|
15177
15378
|
'a datachannel url',
|
|
15178
15379
|
undefined
|
|
15179
15380
|
);
|
|
15180
|
-
|
|
15181
|
-
assert.
|
|
15182
|
-
|
|
15183
|
-
assert.calledWithExactly(
|
|
15184
|
-
meeting.webex.internal.llm.off,
|
|
15185
|
-
'event:relay.event',
|
|
15186
|
-
meeting.processRelayEvent
|
|
15187
|
-
);
|
|
15188
|
-
assert.calledWithExactly(
|
|
15189
|
-
meeting.webex.internal.llm.off,
|
|
15190
|
-
'event:locus.state_message',
|
|
15191
|
-
meeting.processLocusLLMEvent
|
|
15192
|
-
);
|
|
15193
|
-
assert.callCount(meeting.webex.internal.llm.off, 4);
|
|
15194
|
-
|
|
15195
|
-
assert.calledWithExactly(
|
|
15196
|
-
meeting.webex.internal.llm.on,
|
|
15197
|
-
'event:relay.event',
|
|
15198
|
-
meeting.processRelayEvent
|
|
15199
|
-
);
|
|
15200
|
-
assert.calledWithExactly(
|
|
15201
|
-
meeting.webex.internal.llm.on,
|
|
15202
|
-
'event:locus.state_message',
|
|
15203
|
-
meeting.processLocusLLMEvent
|
|
15204
|
-
);
|
|
15205
|
-
assert.isFalse(
|
|
15206
|
-
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15207
|
-
);
|
|
15381
|
+
// voiceaChannel should be preserved during transient reconnect
|
|
15382
|
+
assert.strictEqual(meeting.voiceaChannel, originalVoiceaChannel);
|
|
15383
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15208
15384
|
});
|
|
15209
|
-
|
|
15385
|
+
|
|
15386
|
+
it('disconnects and reconnects when datachannel URL changes', async () => {
|
|
15210
15387
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15211
|
-
|
|
15212
|
-
|
|
15388
|
+
|
|
15389
|
+
// Set up existing channel with different datachannel URL
|
|
15390
|
+
const existingChannel = {
|
|
15391
|
+
isConnected: sinon.stub().returns(true),
|
|
15392
|
+
isConnecting: sinon.stub().returns(false),
|
|
15393
|
+
getLocusUrl: sinon.stub().returns('a url'),
|
|
15394
|
+
getDatachannelUrl: sinon.stub().returns('old datachannel url'),
|
|
15395
|
+
disconnect: sinon.stub().resolves(),
|
|
15396
|
+
off: sinon.stub(),
|
|
15397
|
+
};
|
|
15398
|
+
meeting.llmChannel = existingChannel;
|
|
15399
|
+
const originalVoiceaChannel = meeting.voiceaChannel;
|
|
15213
15400
|
|
|
15214
15401
|
meeting.locusInfo = {
|
|
15215
15402
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15216
15403
|
url: 'a url',
|
|
15217
15404
|
info: {datachannelUrl: 'a different datachannel url'},
|
|
15218
|
-
self: {},
|
|
15219
15405
|
};
|
|
15220
15406
|
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
assert.calledWithExactly(
|
|
15224
|
-
webex.internal.llm.disconnectLLM,
|
|
15225
|
-
{
|
|
15226
|
-
code: 3050,
|
|
15227
|
-
reason: 'done (permanent)',
|
|
15228
|
-
},
|
|
15229
|
-
'llm-default-session',
|
|
15230
|
-
meeting.id
|
|
15231
|
-
);
|
|
15407
|
+
await meeting.updateLLMConnection();
|
|
15232
15408
|
|
|
15409
|
+
// Should disconnect old channel
|
|
15410
|
+
assert.calledOnce(existingChannel.disconnect);
|
|
15411
|
+
// Should create new channel
|
|
15412
|
+
assert.calledOnce(webex.internal.llm.createChannel);
|
|
15413
|
+
// Should connect with new datachannel URL
|
|
15233
15414
|
assert.calledWithExactly(
|
|
15234
|
-
|
|
15415
|
+
mockChannel.registerAndConnect,
|
|
15235
15416
|
'a url',
|
|
15236
15417
|
'a different datachannel url',
|
|
15237
15418
|
undefined
|
|
15238
15419
|
);
|
|
15239
|
-
|
|
15240
|
-
assert.
|
|
15241
|
-
|
|
15242
|
-
assert.calledWithExactly(
|
|
15243
|
-
meeting.webex.internal.llm.off,
|
|
15244
|
-
'event:relay.event',
|
|
15245
|
-
meeting.processRelayEvent
|
|
15246
|
-
);
|
|
15247
|
-
assert.calledWithExactly(
|
|
15248
|
-
meeting.webex.internal.llm.off,
|
|
15249
|
-
'event:locus.state_message',
|
|
15250
|
-
meeting.processLocusLLMEvent
|
|
15251
|
-
);
|
|
15252
|
-
|
|
15253
|
-
assert.calledWithExactly(
|
|
15254
|
-
meeting.webex.internal.llm.on,
|
|
15255
|
-
'event:relay.event',
|
|
15256
|
-
meeting.processRelayEvent
|
|
15257
|
-
);
|
|
15258
|
-
assert.calledWithExactly(
|
|
15259
|
-
meeting.webex.internal.llm.on,
|
|
15260
|
-
'event:locus.state_message',
|
|
15261
|
-
meeting.processLocusLLMEvent
|
|
15262
|
-
);
|
|
15263
|
-
assert.isFalse(
|
|
15264
|
-
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15265
|
-
);
|
|
15420
|
+
// voiceaChannel should be preserved during transient reconnect
|
|
15421
|
+
assert.strictEqual(meeting.voiceaChannel, originalVoiceaChannel);
|
|
15422
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15266
15423
|
});
|
|
15267
|
-
|
|
15424
|
+
|
|
15425
|
+
it('disconnects when state changes to not joined', async () => {
|
|
15268
15426
|
meeting.joinedWith = {state: 'any other state'};
|
|
15269
|
-
|
|
15270
|
-
|
|
15427
|
+
|
|
15428
|
+
// Set up existing connected channel
|
|
15429
|
+
const existingChannel = {
|
|
15430
|
+
isConnected: sinon.stub().returns(true),
|
|
15431
|
+
isConnecting: sinon.stub().returns(false),
|
|
15432
|
+
getLocusUrl: sinon.stub().returns('a url'),
|
|
15433
|
+
getDatachannelUrl: sinon.stub().returns('a datachannel url'),
|
|
15434
|
+
disconnect: sinon.stub().resolves(),
|
|
15435
|
+
off: sinon.stub(),
|
|
15436
|
+
};
|
|
15437
|
+
meeting.llmChannel = existingChannel;
|
|
15271
15438
|
|
|
15272
15439
|
meeting.locusInfo = {
|
|
15273
15440
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15277,81 +15444,57 @@ describe('plugin-meetings', () => {
|
|
|
15277
15444
|
|
|
15278
15445
|
const result = await meeting.updateLLMConnection();
|
|
15279
15446
|
|
|
15280
|
-
assert.
|
|
15281
|
-
|
|
15282
|
-
{
|
|
15283
|
-
code: 3050,
|
|
15284
|
-
reason: 'done (permanent)',
|
|
15285
|
-
},
|
|
15286
|
-
'llm-default-session',
|
|
15287
|
-
meeting.id
|
|
15288
|
-
);
|
|
15289
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15447
|
+
assert.calledOnce(existingChannel.disconnect);
|
|
15448
|
+
assert.notCalled(webex.internal.llm.createChannel);
|
|
15290
15449
|
assert.equal(result, undefined);
|
|
15291
|
-
assert.isFalse(
|
|
15292
|
-
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15293
|
-
);
|
|
15294
15450
|
});
|
|
15295
|
-
it('rethrows disconnect errors during reconnect cleanup after removing relay listeners and timer', async () => {
|
|
15296
|
-
const disconnectError = new Error('disconnect failed');
|
|
15297
15451
|
|
|
15452
|
+
it('passes pending datachannel token to registerAndConnect', async () => {
|
|
15298
15453
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15299
|
-
|
|
15300
|
-
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15301
|
-
webex.internal.llm.disconnectLLM.rejects(disconnectError);
|
|
15302
|
-
|
|
15454
|
+
meeting._pendingDatachannelToken = 'pending-token';
|
|
15303
15455
|
meeting.locusInfo = {
|
|
15304
15456
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15305
|
-
url: 'a
|
|
15457
|
+
url: 'a url',
|
|
15306
15458
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15307
|
-
self: {},
|
|
15308
15459
|
};
|
|
15309
15460
|
|
|
15310
|
-
|
|
15311
|
-
await meeting.updateLLMConnection();
|
|
15312
|
-
assert.fail('Expected updateLLMConnection to reject when disconnectLLM fails');
|
|
15313
|
-
} catch (error) {
|
|
15314
|
-
assert.equal(error, disconnectError);
|
|
15315
|
-
}
|
|
15461
|
+
await meeting.updateLLMConnection();
|
|
15316
15462
|
|
|
15317
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15318
|
-
assert.calledWithExactly(
|
|
15319
|
-
meeting.webex.internal.llm.off,
|
|
15320
|
-
'event:relay.event',
|
|
15321
|
-
meeting.processRelayEvent
|
|
15322
|
-
);
|
|
15323
15463
|
assert.calledWithExactly(
|
|
15324
|
-
|
|
15325
|
-
'
|
|
15326
|
-
|
|
15327
|
-
|
|
15328
|
-
assert.isFalse(
|
|
15329
|
-
meeting.webex.internal.llm.off.calledWithExactly('online', meeting.handleLLMOnline)
|
|
15464
|
+
mockChannel.registerAndConnect,
|
|
15465
|
+
'a url',
|
|
15466
|
+
'a datachannel url',
|
|
15467
|
+
'pending-token'
|
|
15330
15468
|
);
|
|
15331
|
-
|
|
15469
|
+
// Pending token should be set on channel
|
|
15470
|
+
assert.calledWithExactly(mockChannel.setDatachannelToken, 'pending-token');
|
|
15471
|
+
// Pending token should be cleared
|
|
15472
|
+
assert.isUndefined(meeting._pendingDatachannelToken);
|
|
15332
15473
|
});
|
|
15333
|
-
|
|
15474
|
+
|
|
15475
|
+
it('uses channel token if no pending token', async () => {
|
|
15334
15476
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15477
|
+
mockChannel.getDatachannelToken.returns('channel-token');
|
|
15335
15478
|
meeting.locusInfo = {
|
|
15336
15479
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15337
15480
|
url: 'a url',
|
|
15338
|
-
info: {
|
|
15339
|
-
datachannelUrl: 'a datachannel url',
|
|
15340
|
-
practiceSessionDatachannelUrl: 'ps-url',
|
|
15341
|
-
},
|
|
15481
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15342
15482
|
};
|
|
15343
|
-
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
15344
15483
|
|
|
15345
15484
|
await meeting.updateLLMConnection();
|
|
15346
15485
|
|
|
15347
15486
|
assert.calledWithExactly(
|
|
15348
|
-
|
|
15487
|
+
mockChannel.registerAndConnect,
|
|
15349
15488
|
'a url',
|
|
15350
15489
|
'a datachannel url',
|
|
15351
|
-
|
|
15490
|
+
'channel-token'
|
|
15352
15491
|
);
|
|
15353
15492
|
});
|
|
15354
|
-
|
|
15493
|
+
|
|
15494
|
+
it('clears llmChannel on registration failure', async () => {
|
|
15495
|
+
const registerError = new Error('registration failed');
|
|
15496
|
+
mockChannel.registerAndConnect.rejects(registerError);
|
|
15497
|
+
|
|
15355
15498
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15356
15499
|
meeting.locusInfo = {
|
|
15357
15500
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15359,21 +15502,30 @@ describe('plugin-meetings', () => {
|
|
|
15359
15502
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15360
15503
|
};
|
|
15361
15504
|
|
|
15362
|
-
|
|
15363
|
-
|
|
15364
|
-
.
|
|
15505
|
+
try {
|
|
15506
|
+
await meeting.updateLLMConnection();
|
|
15507
|
+
assert.fail('Expected updateLLMConnection to reject');
|
|
15508
|
+
} catch (error) {
|
|
15509
|
+
assert.equal(error, registerError);
|
|
15510
|
+
}
|
|
15511
|
+
|
|
15512
|
+
assert.isUndefined(meeting.llmChannel);
|
|
15513
|
+
});
|
|
15514
|
+
|
|
15515
|
+
it('starts LLM health check timer after successful connection', async () => {
|
|
15516
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15517
|
+
meeting.locusInfo = {
|
|
15518
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15519
|
+
url: 'a url',
|
|
15520
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15521
|
+
};
|
|
15365
15522
|
|
|
15366
15523
|
await meeting.updateLLMConnection();
|
|
15367
15524
|
|
|
15368
|
-
assert.
|
|
15369
|
-
webex.internal.llm.registerAndConnect,
|
|
15370
|
-
'a url',
|
|
15371
|
-
'a datachannel url',
|
|
15372
|
-
'token-123'
|
|
15373
|
-
);
|
|
15374
|
-
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
15525
|
+
assert.calledOnce(meeting.startLLMHealthCheckTimer);
|
|
15375
15526
|
});
|
|
15376
|
-
|
|
15527
|
+
|
|
15528
|
+
it('reuses voiceaChannel after successful connection', async () => {
|
|
15377
15529
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15378
15530
|
meeting.locusInfo = {
|
|
15379
15531
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
@@ -15381,375 +15533,340 @@ describe('plugin-meetings', () => {
|
|
|
15381
15533
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15382
15534
|
};
|
|
15383
15535
|
|
|
15384
|
-
|
|
15536
|
+
await meeting.updateLLMConnection();
|
|
15537
|
+
|
|
15538
|
+
assert.notCalled(webex.internal.voicea.createChannel);
|
|
15539
|
+
assert.strictEqual(meeting.voiceaChannel, mockVoiceaChannel);
|
|
15540
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, mockChannel);
|
|
15541
|
+
});
|
|
15542
|
+
|
|
15543
|
+
it('creates and binds a voiceaChannel after the previous channel was cleaned up', async () => {
|
|
15544
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15545
|
+
meeting.voiceaChannel = undefined;
|
|
15546
|
+
meeting.locusInfo = {
|
|
15547
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15548
|
+
url: 'a url',
|
|
15549
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15550
|
+
};
|
|
15385
15551
|
|
|
15386
15552
|
await meeting.updateLLMConnection();
|
|
15387
15553
|
|
|
15388
|
-
assert.
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
|
|
15392
|
-
|
|
15393
|
-
|
|
15554
|
+
assert.calledOnceWithExactly(webex.internal.voicea.createChannel);
|
|
15555
|
+
assert.strictEqual(meeting.voiceaChannel, mockVoiceaChannel);
|
|
15556
|
+
assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, mockChannel);
|
|
15557
|
+
});
|
|
15558
|
+
|
|
15559
|
+
it('skips switchLLMChannel when practice session is active', async () => {
|
|
15560
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15561
|
+
meeting.webinar.isPracticeSessionLLMChannelConnected = sinon.stub().returns(true);
|
|
15562
|
+
meeting.locusInfo = {
|
|
15563
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15564
|
+
url: 'a url',
|
|
15565
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15566
|
+
};
|
|
15567
|
+
|
|
15568
|
+
await meeting.updateLLMConnection();
|
|
15569
|
+
|
|
15570
|
+
// switchLLMChannel should NOT be called when practice session is active
|
|
15571
|
+
// because practice session manages its own voicea binding
|
|
15572
|
+
assert.notCalled(mockVoiceaChannel.switchLLMChannel);
|
|
15573
|
+
});
|
|
15574
|
+
|
|
15575
|
+
it('logs warning when switchLLMChannel fails', async () => {
|
|
15576
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15577
|
+
mockVoiceaChannel.switchLLMChannel.rejects(new Error('switch failed'));
|
|
15578
|
+
meeting.locusInfo = {
|
|
15579
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15580
|
+
url: 'a url',
|
|
15581
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15582
|
+
};
|
|
15583
|
+
|
|
15584
|
+
// Should not throw - fire-and-forget behavior
|
|
15585
|
+
const result = await meeting.updateLLMConnection();
|
|
15394
15586
|
|
|
15395
|
-
assert.
|
|
15587
|
+
assert.equal(result, 'something');
|
|
15396
15588
|
});
|
|
15397
15589
|
|
|
15398
|
-
it('
|
|
15590
|
+
it('starts transcription after LLM connects when Locus transcription is active', async () => {
|
|
15399
15591
|
meeting.joinedWith = {state: 'JOINED'};
|
|
15592
|
+
meeting.areVoiceaEventsSetup = false;
|
|
15593
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15400
15594
|
meeting.locusInfo = {
|
|
15401
15595
|
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15402
15596
|
url: 'a url',
|
|
15403
15597
|
info: {datachannelUrl: 'a datachannel url'},
|
|
15598
|
+
controls: {transcribe: {transcribing: true}},
|
|
15404
15599
|
};
|
|
15405
15600
|
|
|
15406
|
-
|
|
15407
|
-
|
|
15601
|
+
await meeting.updateLLMConnection();
|
|
15602
|
+
await mockVoiceaChannel.switchLLMChannel.firstCall.returnValue;
|
|
15603
|
+
|
|
15604
|
+
assert.calledOnce(meeting.startTranscription);
|
|
15605
|
+
});
|
|
15606
|
+
|
|
15607
|
+
it('does not start transcription after LLM connects when Locus transcription is inactive', async () => {
|
|
15608
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15609
|
+
meeting.areVoiceaEventsSetup = false;
|
|
15610
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15611
|
+
meeting.locusInfo = {
|
|
15612
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15613
|
+
url: 'a url',
|
|
15614
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15615
|
+
controls: {transcribe: {transcribing: false}},
|
|
15616
|
+
};
|
|
15408
15617
|
|
|
15409
15618
|
await meeting.updateLLMConnection();
|
|
15410
15619
|
|
|
15411
|
-
assert.
|
|
15412
|
-
webex.internal.llm.registerAndConnect,
|
|
15413
|
-
'a url',
|
|
15414
|
-
'a datachannel url',
|
|
15415
|
-
undefined
|
|
15416
|
-
);
|
|
15417
|
-
assert.notCalled(webex.internal.llm.setDatachannelToken);
|
|
15620
|
+
assert.notCalled(meeting.startTranscription);
|
|
15418
15621
|
});
|
|
15419
15622
|
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
});
|
|
15623
|
+
it('does not start transcription when areVoiceaEventsSetup is already true', async () => {
|
|
15624
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15625
|
+
meeting.areVoiceaEventsSetup = true;
|
|
15626
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15627
|
+
meeting.locusInfo = {
|
|
15628
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15629
|
+
url: 'a url',
|
|
15630
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15631
|
+
controls: {transcribe: {transcribing: true}},
|
|
15632
|
+
};
|
|
15431
15633
|
|
|
15432
|
-
|
|
15433
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15434
|
-
webex.internal.llm.isConnected.returns(true);
|
|
15435
|
-
webex.internal.llm.getOwnerMeetingId.returns('some-other-meeting-id');
|
|
15436
|
-
// Locus/datachannel URL mismatch is the *normal* case when
|
|
15437
|
-
// another meeting owns the live socket -- each meeting has its
|
|
15438
|
-
// own locus URL. URL mismatch must NOT trigger a reclaim,
|
|
15439
|
-
// because doing so would tear down the owning meeting's healthy
|
|
15440
|
-
// LLM socket and break its data channel.
|
|
15441
|
-
webex.internal.llm.getLocusUrl.returns('owner-locus-url');
|
|
15442
|
-
webex.internal.llm.getDatachannelUrl.returns('owner-dc-url');
|
|
15443
|
-
meeting.locusInfo = {
|
|
15444
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15445
|
-
url: 'a different url',
|
|
15446
|
-
info: {datachannelUrl: 'a different datachannel url'},
|
|
15447
|
-
self: {},
|
|
15448
|
-
};
|
|
15634
|
+
await meeting.updateLLMConnection();
|
|
15449
15635
|
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
assert.equal(result, undefined);
|
|
15453
|
-
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15454
|
-
assert.notCalled(webex.internal.llm.registerAndConnect);
|
|
15455
|
-
assert.notCalled(webex.internal.llm.setOwnerMeetingId);
|
|
15456
|
-
assert.notCalled(meeting.startLLMHealthCheckTimer);
|
|
15457
|
-
});
|
|
15458
|
-
|
|
15459
|
-
it('clears stale owner tag in cleanup finally block even when disconnectLLM rejects', async () => {
|
|
15460
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15461
|
-
webex.internal.llm.isConnected.returns(true);
|
|
15462
|
-
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15463
|
-
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15464
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15465
|
-
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
15466
|
-
meeting.locusInfo = {
|
|
15467
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15468
|
-
url: 'a different url',
|
|
15469
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15470
|
-
self: {},
|
|
15471
|
-
};
|
|
15636
|
+
assert.notCalled(meeting.startTranscription);
|
|
15637
|
+
});
|
|
15472
15638
|
|
|
15473
|
-
|
|
15474
|
-
|
|
15475
|
-
|
|
15476
|
-
|
|
15477
|
-
|
|
15639
|
+
forEach(
|
|
15640
|
+
[
|
|
15641
|
+
{
|
|
15642
|
+
description: 'does not start transcription when voiceaChannel is disconnected',
|
|
15643
|
+
voiceaChannel: {isLLMConnected: sinon.stub().returns(false)},
|
|
15644
|
+
},
|
|
15645
|
+
{
|
|
15646
|
+
description: 'does not start transcription when voiceaChannel is unavailable',
|
|
15647
|
+
voiceaChannel: undefined,
|
|
15648
|
+
},
|
|
15649
|
+
],
|
|
15650
|
+
({description, voiceaChannel}) => {
|
|
15651
|
+
it(description, () => {
|
|
15652
|
+
meeting.areVoiceaEventsSetup = false;
|
|
15653
|
+
meeting.locusInfo = {controls: {transcribe: {transcribing: true}}};
|
|
15654
|
+
meeting.startTranscription = sinon.stub().resolves();
|
|
15655
|
+
meeting.voiceaChannel = voiceaChannel;
|
|
15478
15656
|
|
|
15479
|
-
|
|
15480
|
-
// subsequent reconnect attempt from any meeting is not blocked.
|
|
15481
|
-
assert.calledWith(webex.internal.llm.setOwnerMeetingId, undefined);
|
|
15482
|
-
});
|
|
15657
|
+
meeting.startTranscriptionIfNeeded();
|
|
15483
15658
|
|
|
15484
|
-
|
|
15485
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15486
|
-
webex.internal.llm.isConnected.returns(true);
|
|
15487
|
-
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15488
|
-
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15489
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15490
|
-
webex.internal.llm.disconnectLLM.callsFake(async () => {
|
|
15491
|
-
webex.internal.llm.getOwnerMeetingId.returns('new-owner-id');
|
|
15492
|
-
throw new Error('disconnect failed');
|
|
15659
|
+
assert.notCalled(meeting.startTranscription);
|
|
15493
15660
|
});
|
|
15494
|
-
|
|
15495
|
-
|
|
15496
|
-
url: 'a different url',
|
|
15497
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15498
|
-
self: {},
|
|
15499
|
-
};
|
|
15661
|
+
}
|
|
15662
|
+
);
|
|
15500
15663
|
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
|
|
15504
|
-
|
|
15505
|
-
|
|
15664
|
+
it('registers annotation channel when not in practice session', async () => {
|
|
15665
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15666
|
+
meeting.locusInfo = {
|
|
15667
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15668
|
+
url: 'a url',
|
|
15669
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15670
|
+
};
|
|
15671
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(false);
|
|
15506
15672
|
|
|
15507
|
-
|
|
15508
|
-
assert.equal(webex.internal.llm.getOwnerMeetingId(), 'new-owner-id');
|
|
15509
|
-
});
|
|
15510
|
-
|
|
15511
|
-
it('proceeds normally when LLM is connected and owned by this meeting with URL change', async () => {
|
|
15512
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15513
|
-
webex.internal.llm.isConnected.returns(true);
|
|
15514
|
-
webex.internal.llm.getOwnerMeetingId.returns(meeting.id);
|
|
15515
|
-
webex.internal.llm.getLocusUrl.returns('a url');
|
|
15516
|
-
webex.internal.llm.getDatachannelUrl.returns('a datachannel url');
|
|
15517
|
-
meeting.locusInfo = {
|
|
15518
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15519
|
-
url: 'a different url',
|
|
15520
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15521
|
-
self: {},
|
|
15522
|
-
};
|
|
15673
|
+
await meeting.updateLLMConnection();
|
|
15523
15674
|
|
|
15524
|
-
|
|
15675
|
+
assert.calledOnceWithExactly(meeting.annotation.registerChannel, mockChannel);
|
|
15676
|
+
});
|
|
15525
15677
|
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
);
|
|
15535
|
-
assert.calledWithExactly(
|
|
15536
|
-
webex.internal.llm.registerAndConnect,
|
|
15537
|
-
'a different url',
|
|
15538
|
-
'a datachannel url',
|
|
15539
|
-
undefined
|
|
15540
|
-
);
|
|
15541
|
-
// setOwnerMeetingId is called twice: first with undefined in
|
|
15542
|
-
// cleanupLLMConneciton's finally block (so a failed disconnect
|
|
15543
|
-
// cannot leave a stale owner), then with this meeting's id
|
|
15544
|
-
// after registerAndConnect resolves.
|
|
15545
|
-
assert.calledTwice(webex.internal.llm.setOwnerMeetingId);
|
|
15546
|
-
assert.calledWith(webex.internal.llm.setOwnerMeetingId.firstCall, undefined);
|
|
15547
|
-
assert.calledWith(webex.internal.llm.setOwnerMeetingId.lastCall, meeting.id);
|
|
15548
|
-
});
|
|
15549
|
-
|
|
15550
|
-
it('claims ownership after successful registerAndConnect on initial connect', async () => {
|
|
15551
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15552
|
-
webex.internal.llm.isConnected.returns(false);
|
|
15553
|
-
webex.internal.llm.getOwnerMeetingId.returns(undefined);
|
|
15554
|
-
meeting.locusInfo = {
|
|
15555
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15556
|
-
url: 'a url',
|
|
15557
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15558
|
-
};
|
|
15678
|
+
it('does not register annotation channel when in practice session', async () => {
|
|
15679
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15680
|
+
meeting.locusInfo = {
|
|
15681
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15682
|
+
url: 'a url',
|
|
15683
|
+
info: {datachannelUrl: 'a datachannel url'},
|
|
15684
|
+
};
|
|
15685
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
15559
15686
|
|
|
15560
|
-
|
|
15687
|
+
await meeting.updateLLMConnection();
|
|
15561
15688
|
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
webex.internal.llm.setRefreshHandler,
|
|
15565
|
-
sinon.match.func,
|
|
15566
|
-
'llm-default-session',
|
|
15567
|
-
meeting.id
|
|
15568
|
-
);
|
|
15569
|
-
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15570
|
-
});
|
|
15571
|
-
|
|
15572
|
-
it('proceeds to connect when LLM is not connected even if another ownerId lingers', async () => {
|
|
15573
|
-
// Defensive path: if the LLM reports not-connected but an old
|
|
15574
|
-
// ownerId is still present (e.g. race before a successful
|
|
15575
|
-
// connections.delete), this meeting can still claim a fresh
|
|
15576
|
-
// connection.
|
|
15577
|
-
meeting.joinedWith = {state: 'JOINED'};
|
|
15578
|
-
webex.internal.llm.isConnected.returns(false);
|
|
15579
|
-
webex.internal.llm.getOwnerMeetingId.returns('stale-owner-id');
|
|
15580
|
-
webex.internal.llm.getDatachannelToken.onFirstCall().returns(undefined);
|
|
15581
|
-
webex.internal.llm.getDatachannelToken.onSecondCall().returns('recovered-token');
|
|
15582
|
-
meeting.locusInfo = {
|
|
15583
|
-
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15584
|
-
url: 'a url',
|
|
15585
|
-
info: {datachannelUrl: 'a datachannel url'},
|
|
15586
|
-
};
|
|
15689
|
+
assert.notCalled(meeting.annotation.registerChannel);
|
|
15690
|
+
});
|
|
15587
15691
|
|
|
15588
|
-
|
|
15692
|
+
it('still need connect main session data channel when PS started', async () => {
|
|
15693
|
+
meeting.joinedWith = {state: 'JOINED'};
|
|
15694
|
+
meeting.locusInfo = {
|
|
15695
|
+
syncAllHashTreeDatasets: sinon.stub().resolves(),
|
|
15696
|
+
url: 'a url',
|
|
15697
|
+
info: {
|
|
15698
|
+
datachannelUrl: 'a datachannel url',
|
|
15699
|
+
practiceSessionDatachannelUrl: 'ps-url',
|
|
15700
|
+
},
|
|
15701
|
+
};
|
|
15702
|
+
meeting.webinar.isJoinPracticeSessionDataChannel.returns(true);
|
|
15589
15703
|
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15596
|
-
|
|
15597
|
-
|
|
15598
|
-
'llm-default-session'
|
|
15599
|
-
);
|
|
15600
|
-
assert.calledOnceWithExactly(
|
|
15601
|
-
webex.internal.llm.registerAndConnect,
|
|
15602
|
-
'a url',
|
|
15603
|
-
'a datachannel url',
|
|
15604
|
-
'recovered-token'
|
|
15605
|
-
);
|
|
15606
|
-
assert.calledWithExactly(
|
|
15607
|
-
webex.internal.llm.setRefreshHandler.firstCall,
|
|
15608
|
-
sinon.match.func,
|
|
15609
|
-
'llm-default-session',
|
|
15610
|
-
undefined
|
|
15611
|
-
);
|
|
15612
|
-
assert.calledTwice(webex.internal.llm.setRefreshHandler);
|
|
15613
|
-
assert.calledWithExactly(
|
|
15614
|
-
webex.internal.llm.setRefreshHandler.secondCall,
|
|
15615
|
-
sinon.match.func,
|
|
15616
|
-
'llm-default-session',
|
|
15617
|
-
meeting.id
|
|
15618
|
-
);
|
|
15619
|
-
assert.calledOnceWithExactly(webex.internal.llm.setOwnerMeetingId, meeting.id);
|
|
15620
|
-
});
|
|
15704
|
+
await meeting.updateLLMConnection();
|
|
15705
|
+
|
|
15706
|
+
assert.calledWithExactly(
|
|
15707
|
+
mockChannel.registerAndConnect,
|
|
15708
|
+
'a url',
|
|
15709
|
+
'a datachannel url',
|
|
15710
|
+
undefined
|
|
15711
|
+
);
|
|
15621
15712
|
});
|
|
15622
15713
|
|
|
15623
15714
|
describe('#clearMeetingData', () => {
|
|
15715
|
+
let existingChannel;
|
|
15716
|
+
|
|
15624
15717
|
beforeEach(() => {
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15718
|
+
existingChannel = {
|
|
15719
|
+
isConnected: sinon.stub().returns(true),
|
|
15720
|
+
disconnect: sinon.stub().resolves(),
|
|
15721
|
+
off: sinon.stub(),
|
|
15722
|
+
};
|
|
15723
|
+
meeting.llmChannel = existingChannel;
|
|
15724
|
+
|
|
15628
15725
|
meeting.annotation.deregisterEvents = sinon.stub();
|
|
15629
15726
|
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
15630
15727
|
meeting.stopTranscription = sinon.stub();
|
|
15631
|
-
meeting.clearDataChannelToken = sinon.stub();
|
|
15632
15728
|
meeting.shareStatus = 'no-share';
|
|
15633
15729
|
});
|
|
15634
15730
|
|
|
15635
|
-
it('disconnects llm and removes
|
|
15731
|
+
it('disconnects llm channel and removes listeners during meeting data cleanup', async () => {
|
|
15636
15732
|
await meeting.clearMeetingData();
|
|
15637
15733
|
|
|
15638
|
-
assert.
|
|
15639
|
-
|
|
15640
|
-
{
|
|
15641
|
-
code: 3050,
|
|
15642
|
-
reason: 'done (permanent)',
|
|
15643
|
-
},
|
|
15644
|
-
'llm-default-session',
|
|
15645
|
-
meeting.id
|
|
15646
|
-
);
|
|
15647
|
-
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15734
|
+
assert.calledOnce(existingChannel.disconnect);
|
|
15735
|
+
assert.calledWithExactly(existingChannel.off, 'online', meeting.handleLLMOnline);
|
|
15648
15736
|
assert.calledWithExactly(
|
|
15649
|
-
|
|
15737
|
+
existingChannel.off,
|
|
15650
15738
|
'event:relay.event',
|
|
15651
15739
|
meeting.processRelayEvent
|
|
15652
15740
|
);
|
|
15653
15741
|
assert.calledWithExactly(
|
|
15654
|
-
|
|
15742
|
+
existingChannel.off,
|
|
15655
15743
|
'event:locus.state_message',
|
|
15656
15744
|
meeting.processLocusLLMEvent
|
|
15657
15745
|
);
|
|
15658
|
-
assert.
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
// MEETING_STOPPED_RECEIVING_TRANSCRIPTION.
|
|
15664
|
-
assert.notCalled(meeting.stopTranscription);
|
|
15665
|
-
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
15666
|
-
});
|
|
15667
|
-
it('continues cleanup when disconnectLLM fails during meeting data cleanup', async () => {
|
|
15668
|
-
webex.internal.llm.disconnectLLM.rejects(new Error('disconnect failed'));
|
|
15746
|
+
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15747
|
+
});
|
|
15748
|
+
|
|
15749
|
+
it('continues cleanup when disconnect fails', async () => {
|
|
15750
|
+
existingChannel.disconnect.rejects(new Error('disconnect failed'));
|
|
15669
15751
|
|
|
15670
15752
|
await meeting.clearMeetingData();
|
|
15671
15753
|
|
|
15672
|
-
assert.calledWithExactly(
|
|
15754
|
+
assert.calledWithExactly(existingChannel.off, 'online', meeting.handleLLMOnline);
|
|
15673
15755
|
assert.calledWithExactly(
|
|
15674
|
-
|
|
15756
|
+
existingChannel.off,
|
|
15675
15757
|
'event:relay.event',
|
|
15676
15758
|
meeting.processRelayEvent
|
|
15677
15759
|
);
|
|
15678
|
-
assert.
|
|
15679
|
-
webex.internal.llm.off,
|
|
15680
|
-
'event:locus.state_message',
|
|
15681
|
-
meeting.processLocusLLMEvent
|
|
15682
|
-
);
|
|
15683
|
-
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15684
|
-
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15685
|
-
assert.notCalled(meeting.stopTranscription);
|
|
15686
|
-
assert.notCalled(meeting.annotation.deregisterEvents);
|
|
15760
|
+
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15687
15761
|
});
|
|
15688
15762
|
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
webex.internal.llm.getOwnerMeetingId = sinon.stub();
|
|
15692
|
-
});
|
|
15763
|
+
it('handles cleanup when no llmChannel exists', async () => {
|
|
15764
|
+
meeting.llmChannel = undefined;
|
|
15693
15765
|
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
await meeting.clearMeetingData();
|
|
15698
|
-
|
|
15699
|
-
assert.notCalled(webex.internal.llm.disconnectLLM);
|
|
15700
|
-
// clearDataChannelToken is always delegated; llm enforces
|
|
15701
|
-
// ownership and no-ops for non-owners internally.
|
|
15702
|
-
assert.calledOnce(meeting.clearDataChannelToken);
|
|
15703
|
-
// Listeners owned by *this* Meeting instance must still be
|
|
15704
|
-
// removed so a leaving subordinate meeting stops receiving
|
|
15705
|
-
// relay/locus events from the shared singleton.
|
|
15706
|
-
assert.calledWithExactly(webex.internal.llm.off, 'online', meeting.handleLLMOnline);
|
|
15707
|
-
assert.calledWithExactly(
|
|
15708
|
-
webex.internal.llm.off,
|
|
15709
|
-
'event:relay.event',
|
|
15710
|
-
meeting.processRelayEvent
|
|
15711
|
-
);
|
|
15712
|
-
assert.calledWithExactly(
|
|
15713
|
-
webex.internal.llm.off,
|
|
15714
|
-
'event:locus.state_message',
|
|
15715
|
-
meeting.processLocusLLMEvent
|
|
15716
|
-
);
|
|
15717
|
-
assert.calledOnce(meeting.clearLLMHealthCheckTimer);
|
|
15718
|
-
});
|
|
15766
|
+
// Should not throw
|
|
15767
|
+
await meeting.clearMeetingData();
|
|
15719
15768
|
|
|
15720
|
-
|
|
15721
|
-
|
|
15769
|
+
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15770
|
+
});
|
|
15771
|
+
});
|
|
15722
15772
|
|
|
15723
|
-
|
|
15773
|
+
describe('#cleanupLLMConneciton', () => {
|
|
15774
|
+
let existingChannel;
|
|
15724
15775
|
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15776
|
+
beforeEach(() => {
|
|
15777
|
+
existingChannel = {
|
|
15778
|
+
isConnected: sinon.stub().returns(true),
|
|
15779
|
+
disconnect: sinon.stub().resolves(),
|
|
15780
|
+
off: sinon.stub(),
|
|
15781
|
+
};
|
|
15782
|
+
meeting.llmChannel = existingChannel;
|
|
15783
|
+
|
|
15784
|
+
meeting.annotation.deregisterEvents = sinon.stub();
|
|
15785
|
+
meeting.clearLLMHealthCheckTimer = sinon.stub();
|
|
15786
|
+
});
|
|
15736
15787
|
|
|
15737
|
-
|
|
15738
|
-
|
|
15788
|
+
forEach(
|
|
15789
|
+
[
|
|
15790
|
+
{
|
|
15791
|
+
description: 'destroys voiceaChannel when preserveVoiceaChannel is false (default)',
|
|
15792
|
+
llmChannelDefined: true,
|
|
15793
|
+
options: undefined,
|
|
15794
|
+
expectedVoiceaPreserved: false,
|
|
15795
|
+
},
|
|
15796
|
+
{
|
|
15797
|
+
description:
|
|
15798
|
+
'destroys voiceaChannel when preserveVoiceaChannel is explicitly false',
|
|
15799
|
+
llmChannelDefined: true,
|
|
15800
|
+
options: {preserveVoiceaChannel: false},
|
|
15801
|
+
expectedVoiceaPreserved: false,
|
|
15802
|
+
},
|
|
15803
|
+
{
|
|
15804
|
+
description: 'preserves voiceaChannel when preserveVoiceaChannel is true',
|
|
15805
|
+
llmChannelDefined: true,
|
|
15806
|
+
options: {preserveVoiceaChannel: true},
|
|
15807
|
+
expectedVoiceaPreserved: true,
|
|
15808
|
+
},
|
|
15809
|
+
{
|
|
15810
|
+
description:
|
|
15811
|
+
'cleans up voiceaChannel even when llmChannel is undefined (failed transient reconnect)',
|
|
15812
|
+
llmChannelDefined: false,
|
|
15813
|
+
options: {preserveVoiceaChannel: false},
|
|
15814
|
+
expectedVoiceaPreserved: false,
|
|
15815
|
+
},
|
|
15816
|
+
{
|
|
15817
|
+
description:
|
|
15818
|
+
'preserves voiceaChannel when llmChannel is undefined and preserveVoiceaChannel is true',
|
|
15819
|
+
llmChannelDefined: false,
|
|
15820
|
+
options: {preserveVoiceaChannel: true},
|
|
15821
|
+
expectedVoiceaPreserved: true,
|
|
15822
|
+
},
|
|
15823
|
+
],
|
|
15824
|
+
({description, llmChannelDefined, options, expectedVoiceaPreserved}) => {
|
|
15825
|
+
it(description, async () => {
|
|
15826
|
+
if (!llmChannelDefined) {
|
|
15827
|
+
meeting.llmChannel = undefined;
|
|
15828
|
+
}
|
|
15829
|
+
const originalVoiceaChannel = meeting.voiceaChannel;
|
|
15739
15830
|
|
|
15740
|
-
|
|
15831
|
+
await meeting.cleanupLLMConneciton(options);
|
|
15741
15832
|
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
meeting.
|
|
15750
|
-
);
|
|
15751
|
-
|
|
15752
|
-
|
|
15833
|
+
if (expectedVoiceaPreserved) {
|
|
15834
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15835
|
+
assert.strictEqual(meeting.voiceaChannel, originalVoiceaChannel);
|
|
15836
|
+
} else {
|
|
15837
|
+
assert.calledOnce(mockVoiceaChannel.deregisterEvents);
|
|
15838
|
+
assert.isUndefined(meeting.voiceaChannel);
|
|
15839
|
+
}
|
|
15840
|
+
assert.isUndefined(meeting.llmChannel);
|
|
15841
|
+
});
|
|
15842
|
+
}
|
|
15843
|
+
);
|
|
15844
|
+
|
|
15845
|
+
it('passes throwOnError alongside preserveVoiceaChannel', async () => {
|
|
15846
|
+
existingChannel.disconnect.rejects(new Error('disconnect failed'));
|
|
15847
|
+
|
|
15848
|
+
// Should not throw when throwOnError is false
|
|
15849
|
+
await meeting.cleanupLLMConneciton({throwOnError: false, preserveVoiceaChannel: true});
|
|
15850
|
+
|
|
15851
|
+
assert.notCalled(mockVoiceaChannel.deregisterEvents);
|
|
15852
|
+
assert.isDefined(meeting.voiceaChannel);
|
|
15853
|
+
});
|
|
15854
|
+
|
|
15855
|
+
it('cleans up LLM event listeners regardless of preserveVoiceaChannel', async () => {
|
|
15856
|
+
await meeting.cleanupLLMConneciton({preserveVoiceaChannel: true});
|
|
15857
|
+
|
|
15858
|
+
assert.calledWithExactly(existingChannel.off, 'online', meeting.handleLLMOnline);
|
|
15859
|
+
assert.calledWithExactly(
|
|
15860
|
+
existingChannel.off,
|
|
15861
|
+
'event:relay.event',
|
|
15862
|
+
meeting.processRelayEvent
|
|
15863
|
+
);
|
|
15864
|
+
assert.calledWithExactly(
|
|
15865
|
+
existingChannel.off,
|
|
15866
|
+
'event:locus.state_message',
|
|
15867
|
+
meeting.processLocusLLMEvent
|
|
15868
|
+
);
|
|
15869
|
+
assert.called(meeting.clearLLMHealthCheckTimer);
|
|
15753
15870
|
});
|
|
15754
15871
|
});
|
|
15755
15872
|
});
|
|
@@ -17586,6 +17703,123 @@ describe('plugin-meetings', () => {
|
|
|
17586
17703
|
});
|
|
17587
17704
|
});
|
|
17588
17705
|
});
|
|
17706
|
+
describe('#isLLMConnected', () => {
|
|
17707
|
+
it('returns true when main LLM channel is connected and not in practice session', () => {
|
|
17708
|
+
meeting.webinar = {
|
|
17709
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17710
|
+
};
|
|
17711
|
+
meeting.llmChannel = {
|
|
17712
|
+
isConnected: sinon.stub().returns(true),
|
|
17713
|
+
};
|
|
17714
|
+
|
|
17715
|
+
const result = meeting.isLLMConnected();
|
|
17716
|
+
|
|
17717
|
+
expect(result).to.equal(true);
|
|
17718
|
+
});
|
|
17719
|
+
|
|
17720
|
+
it('returns false when main LLM channel is not connected and not in practice session', () => {
|
|
17721
|
+
meeting.webinar = {
|
|
17722
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17723
|
+
};
|
|
17724
|
+
meeting.llmChannel = {
|
|
17725
|
+
isConnected: sinon.stub().returns(false),
|
|
17726
|
+
};
|
|
17727
|
+
|
|
17728
|
+
const result = meeting.isLLMConnected();
|
|
17729
|
+
|
|
17730
|
+
expect(result).to.equal(false);
|
|
17731
|
+
});
|
|
17732
|
+
|
|
17733
|
+
it('returns false when no LLM channel exists and not in practice session', () => {
|
|
17734
|
+
meeting.webinar = {
|
|
17735
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17736
|
+
};
|
|
17737
|
+
meeting.llmChannel = undefined;
|
|
17738
|
+
|
|
17739
|
+
const result = meeting.isLLMConnected();
|
|
17740
|
+
|
|
17741
|
+
expect(result).to.equal(false);
|
|
17742
|
+
});
|
|
17743
|
+
|
|
17744
|
+
it('returns practice session LLM channel status when in practice session', () => {
|
|
17745
|
+
meeting.webinar = {
|
|
17746
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(true),
|
|
17747
|
+
isPracticeSessionLLMChannelConnected: sinon.stub().returns(true),
|
|
17748
|
+
};
|
|
17749
|
+
meeting.llmChannel = {
|
|
17750
|
+
isConnected: sinon.stub().returns(false),
|
|
17751
|
+
};
|
|
17752
|
+
|
|
17753
|
+
const result = meeting.isLLMConnected();
|
|
17754
|
+
|
|
17755
|
+
expect(result).to.equal(true);
|
|
17756
|
+
sinon.assert.calledOnce(meeting.webinar.isPracticeSessionLLMChannelConnected);
|
|
17757
|
+
sinon.assert.notCalled(meeting.llmChannel.isConnected);
|
|
17758
|
+
});
|
|
17759
|
+
|
|
17760
|
+
it('returns false when webinar is undefined', () => {
|
|
17761
|
+
meeting.webinar = undefined;
|
|
17762
|
+
meeting.llmChannel = {
|
|
17763
|
+
isConnected: sinon.stub().returns(true),
|
|
17764
|
+
};
|
|
17765
|
+
|
|
17766
|
+
const result = meeting.isLLMConnected();
|
|
17767
|
+
|
|
17768
|
+
expect(result).to.equal(true);
|
|
17769
|
+
});
|
|
17770
|
+
});
|
|
17771
|
+
describe('#getLLMLocusUrl', () => {
|
|
17772
|
+
it('returns locus URL from main LLM channel when not in practice session', () => {
|
|
17773
|
+
meeting.webinar = {
|
|
17774
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17775
|
+
};
|
|
17776
|
+
meeting.llmChannel = {
|
|
17777
|
+
getLocusUrl: sinon.stub().returns('https://locus.example.com/main'),
|
|
17778
|
+
};
|
|
17779
|
+
|
|
17780
|
+
const result = meeting.getLLMLocusUrl();
|
|
17781
|
+
|
|
17782
|
+
expect(result).to.equal('https://locus.example.com/main');
|
|
17783
|
+
});
|
|
17784
|
+
|
|
17785
|
+
it('returns undefined when no LLM channel exists and not in practice session', () => {
|
|
17786
|
+
meeting.webinar = {
|
|
17787
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(false),
|
|
17788
|
+
};
|
|
17789
|
+
meeting.llmChannel = undefined;
|
|
17790
|
+
|
|
17791
|
+
const result = meeting.getLLMLocusUrl();
|
|
17792
|
+
|
|
17793
|
+
expect(result).to.be.undefined;
|
|
17794
|
+
});
|
|
17795
|
+
|
|
17796
|
+
it('returns practice session locus URL when in practice session', () => {
|
|
17797
|
+
meeting.webinar = {
|
|
17798
|
+
isJoinPracticeSessionDataChannel: sinon.stub().returns(true),
|
|
17799
|
+
getPracticeSessionLocusUrl: sinon.stub().returns('https://locus.example.com/practice'),
|
|
17800
|
+
};
|
|
17801
|
+
meeting.llmChannel = {
|
|
17802
|
+
getLocusUrl: sinon.stub().returns('https://locus.example.com/main'),
|
|
17803
|
+
};
|
|
17804
|
+
|
|
17805
|
+
const result = meeting.getLLMLocusUrl();
|
|
17806
|
+
|
|
17807
|
+
expect(result).to.equal('https://locus.example.com/practice');
|
|
17808
|
+
sinon.assert.calledOnce(meeting.webinar.getPracticeSessionLocusUrl);
|
|
17809
|
+
sinon.assert.notCalled(meeting.llmChannel.getLocusUrl);
|
|
17810
|
+
});
|
|
17811
|
+
|
|
17812
|
+
it('returns main channel locus URL when webinar is undefined', () => {
|
|
17813
|
+
meeting.webinar = undefined;
|
|
17814
|
+
meeting.llmChannel = {
|
|
17815
|
+
getLocusUrl: sinon.stub().returns('https://locus.example.com/main'),
|
|
17816
|
+
};
|
|
17817
|
+
|
|
17818
|
+
const result = meeting.getLLMLocusUrl();
|
|
17819
|
+
|
|
17820
|
+
expect(result).to.equal('https://locus.example.com/main');
|
|
17821
|
+
});
|
|
17822
|
+
});
|
|
17589
17823
|
describe('#getDataChannelTokenType', () => {
|
|
17590
17824
|
it('returns PracticeSession when webinar is in practice session mode', () => {
|
|
17591
17825
|
meeting.webinar = {
|