@webex/plugin-meetings 3.12.0-llmrefactor.1 → 3.12.0-llmrefactor.11

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.
Files changed (54) hide show
  1. package/dist/aiEnableRequest/index.js +1 -1
  2. package/dist/annotation/index.js +2 -2
  3. package/dist/annotation/index.js.map +1 -1
  4. package/dist/breakouts/breakout.js +1 -1
  5. package/dist/breakouts/index.js +5 -1
  6. package/dist/breakouts/index.js.map +1 -1
  7. package/dist/hashTree/hashTreeParser.js +101 -48
  8. package/dist/hashTree/hashTreeParser.js.map +1 -1
  9. package/dist/interpretation/index.js +1 -1
  10. package/dist/interpretation/siLanguage.js +1 -1
  11. package/dist/locus-info/index.js +27 -2
  12. package/dist/locus-info/index.js.map +1 -1
  13. package/dist/locus-info/types.js +2 -1
  14. package/dist/locus-info/types.js.map +1 -1
  15. package/dist/meeting/index.js +139 -53
  16. package/dist/meeting/index.js.map +1 -1
  17. package/dist/meeting/util.js +5 -1
  18. package/dist/meeting/util.js.map +1 -1
  19. package/dist/meeting/voicea-meeting.js +2 -1
  20. package/dist/meeting/voicea-meeting.js.map +1 -1
  21. package/dist/meeting-info/meeting-info-v2.js +7 -1
  22. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  23. package/dist/meetings/index.js +44 -19
  24. package/dist/meetings/index.js.map +1 -1
  25. package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
  26. package/dist/types/locus-info/index.d.ts +6 -0
  27. package/dist/types/locus-info/types.d.ts +1 -0
  28. package/dist/types/meeting/index.d.ts +9 -0
  29. package/dist/types/meeting/util.d.ts +3 -1
  30. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  31. package/dist/webinar/index.js +42 -25
  32. package/dist/webinar/index.js.map +1 -1
  33. package/package.json +21 -21
  34. package/src/annotation/index.ts +6 -4
  35. package/src/breakouts/index.ts +2 -0
  36. package/src/hashTree/hashTreeParser.ts +67 -3
  37. package/src/locus-info/index.ts +20 -0
  38. package/src/locus-info/types.ts +1 -0
  39. package/src/meeting/index.ts +122 -36
  40. package/src/meeting/util.ts +2 -2
  41. package/src/meeting/voicea-meeting.ts +1 -1
  42. package/src/meeting-info/meeting-info-v2.ts +6 -2
  43. package/src/meetings/index.ts +23 -8
  44. package/src/webinar/index.ts +19 -6
  45. package/test/unit/spec/annotation/index.ts +1 -1
  46. package/test/unit/spec/breakouts/index.ts +34 -0
  47. package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
  48. package/test/unit/spec/locus-info/index.js +79 -0
  49. package/test/unit/spec/meeting/index.js +396 -13
  50. package/test/unit/spec/meeting/utils.js +16 -2
  51. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  52. package/test/unit/spec/meeting-info/meetinginfov2.js +57 -0
  53. package/test/unit/spec/meetings/index.js +63 -19
  54. package/test/unit/spec/webinar/index.ts +48 -2
@@ -150,6 +150,90 @@ describe('plugin-meetings', () => {
150
150
  });
151
151
 
152
152
  describe('processNewCaptions', () => {
153
+ const processCaptions = () => processNewCaptions({
154
+ data: fakeVoiceaPayload,
155
+ meeting: fakeMeeting
156
+ });
157
+
158
+ it('should process a final-only caption without an existing interim caption', () => {
159
+ const transcriptData = fakeMeeting.transcription;
160
+ const transcriptId = fakeVoiceaPayload.transcriptId;
161
+
162
+ delete transcriptData.interimCaptions[transcriptId];
163
+
164
+ assert.doesNotThrow(processCaptions);
165
+
166
+ const finalCaption = transcriptData.captions.find(caption => caption.id === transcriptId);
167
+
168
+ assert.exists(finalCaption);
169
+ assert.deepEqual(transcriptData.interimCaptions[transcriptId], []);
170
+ });
171
+
172
+ it('should process an interim caption received after a final caption', () => {
173
+ const transcriptData = fakeMeeting.transcription;
174
+ const transcriptId = fakeVoiceaPayload.transcriptId;
175
+
176
+ delete transcriptData.interimCaptions[transcriptId];
177
+
178
+ assert.doesNotThrow(processCaptions);
179
+
180
+ fakeVoiceaPayload.isFinal = false;
181
+
182
+ assert.doesNotThrow(processCaptions);
183
+
184
+ const speakerId = fakeMeeting.members.membersCollection.members[fakeMemberId].participant.person.id;
185
+ const interimId = `${transcriptId}_${speakerId}`;
186
+
187
+ assert.exists(transcriptData.captions.find(caption => caption.id === transcriptId));
188
+ assert.exists(transcriptData.captions.find(caption => caption.id === interimId));
189
+ assert.deepEqual(transcriptData.interimCaptions[transcriptId], [interimId]);
190
+ });
191
+
192
+ it('should process repeated final captions without throwing', () => {
193
+ const transcriptData = fakeMeeting.transcription;
194
+ const transcriptId = fakeVoiceaPayload.transcriptId;
195
+
196
+ delete transcriptData.interimCaptions[transcriptId];
197
+
198
+ assert.doesNotThrow(() => {
199
+ processCaptions();
200
+ processCaptions();
201
+ });
202
+
203
+ assert.exists(transcriptData.captions.find(caption => caption.id === transcriptId));
204
+ });
205
+
206
+ it('should process a final payload containing transcript entries for multiple CSIs without throwing', () => {
207
+ const transcriptData = fakeMeeting.transcription;
208
+ const transcriptId = fakeVoiceaPayload.transcriptId;
209
+ const firstCsi = 1234867712;
210
+ const secondCsi = 1234867713;
211
+ const secondCaptionText = 'Caption from a second CSI';
212
+
213
+ fakeVoiceaPayload.transcripts = [
214
+ {
215
+ ...fakeVoiceaPayload.transcripts[0],
216
+ csis: [firstCsi]
217
+ },
218
+ {
219
+ text: secondCaptionText,
220
+ csis: [secondCsi],
221
+ transcript_language_code: 'en'
222
+ }
223
+ ];
224
+
225
+ assert.doesNotThrow(processCaptions);
226
+
227
+ const finalCaptionTexts = transcriptData.captions
228
+ .filter(caption => caption.id === transcriptId)
229
+ .map(caption => caption.text);
230
+
231
+ assert.deepEqual(finalCaptionTexts, [
232
+ fakeVoiceaPayload.transcripts[0].text,
233
+ secondCaptionText
234
+ ]);
235
+ });
236
+
153
237
  it('should process new final captions correctly', () => {
154
238
  let transcriptData = fakeMeeting.transcription;
155
239
  let transcriptId = fakeVoiceaPayload.transcriptId;
@@ -254,4 +338,4 @@ describe('plugin-meetings', () => {
254
338
  });
255
339
  });
256
340
  });
257
- });
341
+ });
@@ -900,6 +900,63 @@ describe('plugin-meetings', () => {
900
900
  }
901
901
  );
902
902
 
903
+ forEach(
904
+ [
905
+ {
906
+ meetingId: 'meeting-id',
907
+ sendCAevents: true,
908
+ correlationId: 'correlation-id',
909
+ shouldSendCorrelationId: true,
910
+ condition: 'when CA events are enabled for the meeting',
911
+ },
912
+ {
913
+ sendCAevents: true,
914
+ correlationId: 'correlation-id',
915
+ shouldSendCorrelationId: false,
916
+ condition: 'without a meetingId',
917
+ },
918
+ {
919
+ meetingId: 'meeting-id',
920
+ sendCAevents: false,
921
+ correlationId: 'correlation-id',
922
+ shouldSendCorrelationId: false,
923
+ condition: 'when CA events are disabled',
924
+ },
925
+ {
926
+ meetingId: 'meeting-id',
927
+ sendCAevents: true,
928
+ shouldSendCorrelationId: false,
929
+ condition: 'without a correlationId',
930
+ },
931
+ ],
932
+ ({meetingId, sendCAevents, correlationId, shouldSendCorrelationId, condition}) => {
933
+ it(`should ${
934
+ shouldSendCorrelationId ? '' : 'not '
935
+ }send the correlationId header ${condition}`, async () => {
936
+ webex.request.resolves({statusCode: 200, body: {meetingKey: '1234323'}});
937
+
938
+ await meetingInfo.fetchMeetingInfo(
939
+ '1234323',
940
+ DESTINATION_TYPE.MEETING_ID,
941
+ null,
942
+ null,
943
+ null,
944
+ null,
945
+ undefined,
946
+ {meetingId, sendCAevents, correlationId}
947
+ );
948
+
949
+ const requestOptions = webex.request.firstCall.args[0];
950
+
951
+ if (shouldSendCorrelationId) {
952
+ assert.deepEqual(requestOptions.headers, {correlationId});
953
+ } else {
954
+ assert.notProperty(requestOptions, 'headers');
955
+ }
956
+ });
957
+ }
958
+ );
959
+
903
960
  it('should send CA metric if meetingId is provided and send CA events is authorized', async () => {
904
961
  const requestResponse = {
905
962
  statusCode: 200,
@@ -142,6 +142,7 @@ describe('plugin-meetings', () => {
142
142
 
143
143
  Object.assign(webex.internal, {
144
144
  llm: {on: sinon.stub()},
145
+ voicea: {createChannel: sinon.stub().returns({})},
145
146
  device: {
146
147
  deviceType: 'FAKE_DEVICE',
147
148
  register: sinon.stub().returns(Promise.resolve()),
@@ -239,6 +240,10 @@ describe('plugin-meetings', () => {
239
240
 
240
241
  webex.meetings.destroy(meeting, test1);
241
242
 
243
+ assert.calledOnceWithExactly(MeetingUtil.cleanUp, meeting, {
244
+ preserveVoiceaChannel: false,
245
+ });
246
+
242
247
  // and it should still return the information after the meeting is destroyed
243
248
  assert.equal(
244
249
  webex.meetings.getBasicMeetingInformation(meetingIds.meetingId).id,
@@ -1879,12 +1884,27 @@ describe('plugin-meetings', () => {
1879
1884
  });
1880
1885
 
1881
1886
  describe('wasm runtime performance telemetry', () => {
1887
+ const correlationId = 'wasm-corr-id';
1888
+ const benchmarkMeasurements = {
1889
+ divRatio: 1.888,
1890
+ sqrtRatio: 3.474,
1891
+ addNsPerOp: 2.006,
1892
+ addMedianMs: 32.1,
1893
+ divMedianMs: 60.6,
1894
+ sqrtMedianMs: 111.5,
1895
+ };
1882
1896
  const probeResult = {
1883
1897
  status: 'slow',
1884
1898
  capability: 'not capable',
1885
- ratio: 0.25,
1886
- wasmMs: 25,
1887
- jsMs: 100,
1899
+ reason: null,
1900
+ measurements: benchmarkMeasurements,
1901
+ };
1902
+ const expectedMetricFields = {
1903
+ status: probeResult.status,
1904
+ capability: probeResult.capability,
1905
+ reason: probeResult.reason,
1906
+ ...benchmarkMeasurements,
1907
+ correlation_id: correlationId,
1888
1908
  };
1889
1909
  let metricsSpy;
1890
1910
  let probeCheckStub;
@@ -1893,7 +1913,7 @@ describe('plugin-meetings', () => {
1893
1913
  webex.meetings.meetingInfo.fetchInfoOptions = sinon.stub().resolves({});
1894
1914
  webex.meetings.createMeeting = sinon
1895
1915
  .stub()
1896
- .returns(Promise.resolve({on: () => true, correlationId: 'wasm-corr-id'}));
1916
+ .returns(Promise.resolve({on: () => true, correlationId}));
1897
1917
  probeCheckStub = sinon.stub(WasmRuntimeProbe, 'check').resolves(probeResult);
1898
1918
  metricsSpy = sinon.stub(Metrics, 'sendBehavioralMetric');
1899
1919
  });
@@ -1908,13 +1928,11 @@ describe('plugin-meetings', () => {
1908
1928
  await testUtils.flushPromises();
1909
1929
 
1910
1930
  assert.calledOnceWithExactly(probeCheckStub);
1911
- assert.calledOnceWithExactly(metricsSpy, 'js_sdk_wasm_runtime_performance', {
1912
- status: 'slow',
1913
- ratio: 0.25,
1914
- wasmMs: 25,
1915
- jsMs: 100,
1916
- correlation_id: 'wasm-corr-id',
1917
- });
1931
+ assert.calledOnceWithExactly(
1932
+ metricsSpy,
1933
+ 'js_sdk_wasm_runtime_performance',
1934
+ expectedMetricFields
1935
+ );
1918
1936
  });
1919
1937
 
1920
1938
  it('logs the WASM runtime status after a meeting is created', async () => {
@@ -1939,12 +1957,35 @@ describe('plugin-meetings', () => {
1939
1957
  await testUtils.flushPromises();
1940
1958
 
1941
1959
  assert.calledOnceWithExactly(probeCheckStub);
1960
+ assert.calledOnceWithExactly(
1961
+ metricsSpy,
1962
+ 'js_sdk_wasm_runtime_performance',
1963
+ expectedMetricFields
1964
+ );
1965
+ });
1966
+
1967
+ it('emits the reason with null measurement fields when no measurements are available', async () => {
1968
+ probeCheckStub.resolves({
1969
+ status: 'unknown',
1970
+ capability: 'unknown',
1971
+ reason: 'worker_timeout',
1972
+ measurements: null,
1973
+ });
1974
+
1975
+ await webex.meetings.create(test1, test2);
1976
+ await testUtils.flushPromises();
1977
+
1942
1978
  assert.calledOnceWithExactly(metricsSpy, 'js_sdk_wasm_runtime_performance', {
1943
- status: 'slow',
1944
- ratio: 0.25,
1945
- wasmMs: 25,
1946
- jsMs: 100,
1947
- correlation_id: 'wasm-corr-id',
1979
+ status: 'unknown',
1980
+ capability: 'unknown',
1981
+ reason: 'worker_timeout',
1982
+ divRatio: null,
1983
+ sqrtRatio: null,
1984
+ addNsPerOp: null,
1985
+ addMedianMs: null,
1986
+ divMedianMs: null,
1987
+ sqrtMedianMs: null,
1988
+ correlation_id: correlationId,
1948
1989
  });
1949
1990
  });
1950
1991
 
@@ -1955,8 +1996,7 @@ describe('plugin-meetings', () => {
1955
1996
  const created = await webex.meetings.create(test1, test2);
1956
1997
  await testUtils.flushPromises();
1957
1998
 
1958
- // create() resolved normally with the meeting, i.e. the failed probe did not break it.
1959
- assert.equal(created.correlationId, 'wasm-corr-id');
1999
+ assert.equal(created.correlationId, correlationId);
1960
2000
  assert.notCalled(metricsSpy);
1961
2001
  assert.calledOnceWithExactly(
1962
2002
  loggerErrorStub,
@@ -2680,7 +2720,11 @@ describe('plugin-meetings', () => {
2680
2720
  undefined,
2681
2721
  undefined,
2682
2722
  extraParams,
2683
- {meetingId: meeting.id, sendCAevents}
2723
+ {
2724
+ meetingId: meeting.id,
2725
+ sendCAevents,
2726
+ correlationId: meeting.correlationId,
2727
+ }
2684
2728
  );
2685
2729
  }
2686
2730
 
@@ -438,6 +438,7 @@ describe('plugin-meetings', () => {
438
438
  webinar._practiceSessionLLMChannel = mockPSChannel;
439
439
  mockVoiceaChannel = {
440
440
  switchLLMChannel: sinon.stub().resolves(),
441
+ getKeepTranscriptionSubscribed: sinon.stub().returns(false),
441
442
  };
442
443
  meeting = {
443
444
  id: 'meeting-id',
@@ -447,8 +448,10 @@ describe('plugin-meetings', () => {
447
448
  handleLLMOnline: sinon.stub(),
448
449
  llmChannel: createMockLLMChannel(),
449
450
  voiceaChannel: mockVoiceaChannel,
451
+ startTranscriptionIfNeeded: sinon.stub(),
450
452
  annotation: {registerChannel: sinon.stub()},
451
453
  trigger: sinon.stub(),
454
+ transcription: {captions: []},
452
455
  };
453
456
  webex.meetings.getMeetingByType = sinon.stub().returns(meeting);
454
457
  });
@@ -520,14 +523,53 @@ describe('plugin-meetings', () => {
520
523
 
521
524
  await webinar.cleanupPSDataChannel();
522
525
 
523
- // Should not throw and should complete successfully
524
526
  assert.notCalled(mockPSChannel.disconnect);
527
+ assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, meeting.llmChannel);
528
+ assert.calledOnceWithExactly(meeting.startTranscriptionIfNeeded);
525
529
  });
526
530
 
527
- it('switches voicea channel back to main meeting LLM channel', async () => {
531
+ it('switches voicea channel back to main meeting LLM channel when main channel is connected', async () => {
532
+ meeting.llmChannel.isConnected.returns(true);
533
+
528
534
  await webinar.cleanupPSDataChannel();
529
535
 
530
536
  assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, meeting.llmChannel);
537
+ assert.calledOnceWithExactly(meeting.startTranscriptionIfNeeded);
538
+ });
539
+
540
+ it('switches voicea to main channel even when not connected (defers caption restoration)', async () => {
541
+ meeting.llmChannel.isConnected.returns(false);
542
+
543
+ await webinar.cleanupPSDataChannel();
544
+
545
+ // Should still switch voicea to main channel - switchLLMChannel handles
546
+ // the deferred case by registering an 'online' listener
547
+ assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, meeting.llmChannel);
548
+ // Should still disconnect the practice session channel
549
+ assert.calledOnce(mockPSChannel.disconnect);
550
+ });
551
+
552
+ it('switches voicea to final main channel after disconnect when main channel was replaced during practice disconnect', async () => {
553
+ // Main channel connected initially
554
+ meeting.llmChannel.isConnected.returns(true);
555
+
556
+ const newLLMChannel = {
557
+ isConnected: sinon.stub().returns(true),
558
+ on: sinon.stub(),
559
+ off: sinon.stub(),
560
+ };
561
+
562
+ // Simulate main channel being replaced during practice disconnect
563
+ mockPSChannel.disconnect.callsFake(async () => {
564
+ meeting.llmChannel = newLLMChannel;
565
+ });
566
+
567
+ await webinar.cleanupPSDataChannel();
568
+
569
+ // With reconciler pattern: single switch point after disconnect picks up the new channel
570
+ // (reconciler handles the actual rebinding internally)
571
+ assert.calledOnce(mockVoiceaChannel.switchLLMChannel);
572
+ assert.calledWith(mockVoiceaChannel.switchLLMChannel, newLLMChannel);
531
573
  });
532
574
 
533
575
  it('does not switch voicea channel when meeting has no voiceaChannel', async () => {
@@ -558,6 +600,7 @@ describe('plugin-meetings', () => {
558
600
  });
559
601
  mockVoiceaChannel = {
560
602
  switchLLMChannel: sinon.stub().resolves(),
603
+ getKeepTranscriptionSubscribed: sinon.stub().returns(false),
561
604
  };
562
605
 
563
606
  // Default session channel on the meeting
@@ -572,6 +615,7 @@ describe('plugin-meetings', () => {
572
615
  processRelayEvent: sinon.stub(),
573
616
  processLocusLLMEvent: sinon.stub(),
574
617
  handleLLMOnline: sinon.stub(),
618
+ startTranscriptionIfNeeded: sinon.stub(),
575
619
  llmChannel: mockDefaultChannel,
576
620
  voiceaChannel: mockVoiceaChannel,
577
621
  annotation: {registerChannel: sinon.stub()},
@@ -587,6 +631,7 @@ describe('plugin-meetings', () => {
587
631
  }),
588
632
  voiceaListenerCallbacks: {},
589
633
  trigger: sinon.stub(),
634
+ transcription: {captions: []},
590
635
  };
591
636
 
592
637
  webex.meetings.getMeetingByType = sinon.stub().returns(meeting);
@@ -743,6 +788,7 @@ describe('plugin-meetings', () => {
743
788
  await webinar.updatePSDataChannel();
744
789
 
745
790
  assert.calledOnceWithExactly(mockVoiceaChannel.switchLLMChannel, mockPSChannel);
791
+ assert.calledOnceWithExactly(meeting.startTranscriptionIfNeeded);
746
792
  });
747
793
 
748
794
  it('does not call switchLLMChannel when meeting has no voiceaChannel', async () => {