@webex/plugin-meetings 3.12.0-next.102 → 3.12.0-next.104

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 (42) hide show
  1. package/dist/aiEnableRequest/index.js +1 -1
  2. package/dist/breakouts/breakout.js +1 -1
  3. package/dist/breakouts/events.js +29 -14
  4. package/dist/breakouts/events.js.map +1 -1
  5. package/dist/breakouts/index.js +65 -2
  6. package/dist/breakouts/index.js.map +1 -1
  7. package/dist/constants.js +2 -1
  8. package/dist/constants.js.map +1 -1
  9. package/dist/hashTree/hashTreeParser.js +147 -19
  10. package/dist/hashTree/hashTreeParser.js.map +1 -1
  11. package/dist/interpretation/index.js +1 -1
  12. package/dist/interpretation/siLanguage.js +1 -1
  13. package/dist/locus-info/index.js +56 -33
  14. package/dist/locus-info/index.js.map +1 -1
  15. package/dist/meeting/index.js +284 -37
  16. package/dist/meeting/index.js.map +1 -1
  17. package/dist/meetings/index.js +25 -0
  18. package/dist/meetings/index.js.map +1 -1
  19. package/dist/metrics/constants.js +2 -1
  20. package/dist/metrics/constants.js.map +1 -1
  21. package/dist/types/constants.d.ts +1 -0
  22. package/dist/types/hashTree/hashTreeParser.d.ts +40 -3
  23. package/dist/types/locus-info/index.d.ts +10 -4
  24. package/dist/types/meeting/index.d.ts +54 -1
  25. package/dist/types/meetings/index.d.ts +8 -0
  26. package/dist/types/metrics/constants.d.ts +1 -0
  27. package/dist/webinar/index.js +1 -1
  28. package/package.json +14 -14
  29. package/src/breakouts/events.ts +33 -11
  30. package/src/breakouts/index.ts +79 -1
  31. package/src/constants.ts +1 -0
  32. package/src/hashTree/hashTreeParser.ts +209 -17
  33. package/src/locus-info/index.ts +45 -18
  34. package/src/meeting/index.ts +246 -4
  35. package/src/meetings/index.ts +35 -1
  36. package/src/metrics/constants.ts +1 -0
  37. package/test/unit/spec/breakouts/events.ts +120 -2
  38. package/test/unit/spec/breakouts/index.ts +142 -2
  39. package/test/unit/spec/hashTree/hashTreeParser.ts +440 -3
  40. package/test/unit/spec/locus-info/index.js +45 -5
  41. package/test/unit/spec/meeting/index.js +389 -0
  42. package/test/unit/spec/meetings/index.js +104 -0
@@ -33,7 +33,7 @@ import {
33
33
  MediaCodecMimeType,
34
34
  } from '@webex/internal-media-core';
35
35
 
36
- import {DataChannelTokenType} from '@webex/internal-plugin-llm';
36
+ import {DataChannelTokenType, type RegisterAndConnectTiming} from '@webex/internal-plugin-llm';
37
37
 
38
38
  import {
39
39
  LocalStream,
@@ -742,6 +742,7 @@ export default class Meeting extends StatelessWebexPlugin {
742
742
  isMoveToInProgress = false;
743
743
  registrationIdStatus: string;
744
744
  brbState: BrbState;
745
+ private emittedBreakoutJoinResponseMoveIds: Set<string> = new Set();
745
746
  private promisesWaitingForPropUpdate: Record<string, Defer> = {};
746
747
 
747
748
  voiceaListenerCallbacks: object = {
@@ -1394,7 +1395,48 @@ export default class Meeting extends StatelessWebexPlugin {
1394
1395
  * @memberof Meeting
1395
1396
  */
1396
1397
  // @ts-ignore - Fix type
1397
- this.locusInfo = new LocusInfo(this.updateMeetingObject.bind(this), this.webex, this.id);
1398
+ this.locusInfo = new LocusInfo(
1399
+ {
1400
+ updateMeeting: this.updateMeetingObject.bind(this),
1401
+ syncLatencyTracker: {
1402
+ // Compute/store latency timestamps live on CallDiagnosticLatencies, while
1403
+ // submitting the client.locus.sync.complete CA event is owned by the metrics
1404
+ // facade. Wire each method to the layer that owns that responsibility.
1405
+ saveLatency: (...args) =>
1406
+ // @ts-ignore
1407
+ this.webex.internal.newMetrics.callDiagnosticLatencies.saveLatency(...args),
1408
+ saveTimestamp: (saveTimestampOptions: {
1409
+ key: string;
1410
+ value?: number;
1411
+ options: {meetingId: string; dataSetName: string; trackingId?: string};
1412
+ }) => {
1413
+ // @ts-ignore
1414
+ this.webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp(
1415
+ saveTimestampOptions
1416
+ );
1417
+
1418
+ // The /sync response is one of the two milestones (the other is the LLM message) that
1419
+ // complete client.locus.sync.complete. Try to complete now: the metric is emitted only
1420
+ // once both the LLM message and the /sync response have arrived (either can come first).
1421
+ if (
1422
+ saveTimestampOptions.key === 'internal.client.locus.sync.response' &&
1423
+ saveTimestampOptions.options?.trackingId
1424
+ ) {
1425
+ this.tryCompleteLocusSyncLatency(
1426
+ saveTimestampOptions.options.meetingId,
1427
+ saveTimestampOptions.options.trackingId
1428
+ );
1429
+ }
1430
+ },
1431
+ clearLocusSyncLatency: (...args) =>
1432
+ // @ts-ignore
1433
+ this.webex.internal.newMetrics.callDiagnosticLatencies.clearLocusSyncLatency(...args),
1434
+ },
1435
+ },
1436
+ // @ts-ignore
1437
+ this.webex,
1438
+ this.id
1439
+ );
1398
1440
 
1399
1441
  // We had to add listeners first before setting up the locus instance
1400
1442
  /**
@@ -2380,6 +2422,89 @@ export default class Meeting extends StatelessWebexPlugin {
2380
2422
  });
2381
2423
  }
2382
2424
 
2425
+ /**
2426
+ * Handles the LLM state-update message that resulted from a Locus /sync. Records the LLM arrival
2427
+ * time (the milestone that gates client.locus.sync.complete - the metric is emitted only for LLM
2428
+ * flows) and then tries to complete the metric.
2429
+ * @param {string} meetingId meeting id
2430
+ * @param {string} trackingId sync tracking id echoed back on the LLM message
2431
+ * @returns {void}
2432
+ * @private
2433
+ * @memberof Meeting
2434
+ */
2435
+ private onLocusSyncLlmMessage(meetingId: string, trackingId: string) {
2436
+ // @ts-ignore
2437
+ this.webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived(
2438
+ meetingId,
2439
+ trackingId
2440
+ );
2441
+
2442
+ this.tryCompleteLocusSyncLatency(meetingId, trackingId);
2443
+ }
2444
+
2445
+ /**
2446
+ * Attempts to complete the Locus sync latency metric and emit client.locus.sync.complete. The
2447
+ * metric is emitted only once BOTH the /sync response and the resulting LLM message have arrived
2448
+ * (in either order); until then the record is kept so the missing milestone can still land. Both
2449
+ * trigger points (the LLM message handler and the /sync response timestamp) call this, so the
2450
+ * metric fires as soon as the second milestone is in.
2451
+ * @param {string} meetingId meeting id
2452
+ * @param {string} trackingId sync tracking id used to match the pending record
2453
+ * @returns {void}
2454
+ * @private
2455
+ * @memberof Meeting
2456
+ */
2457
+ private tryCompleteLocusSyncLatency(meetingId: string, trackingId: string) {
2458
+ const completed =
2459
+ // @ts-ignore
2460
+ this.webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency(
2461
+ meetingId,
2462
+ trackingId
2463
+ );
2464
+
2465
+ if (completed) {
2466
+ this.emitLocusSyncCompleteMetric(meetingId, completed);
2467
+ }
2468
+ }
2469
+
2470
+ /**
2471
+ * Submits the client.locus.sync.complete Call Analyzer event for a completed Locus sync latency
2472
+ * measurement.
2473
+ * @param {string} meetingId meeting id
2474
+ * @param {object} completed completed sync latency payload from the metrics plugin
2475
+ * @returns {void}
2476
+ * @private
2477
+ * @memberof Meeting
2478
+ */
2479
+ private emitLocusSyncCompleteMetric(
2480
+ meetingId: string,
2481
+ completed: {dataSet: string; syncLatency: object}
2482
+ ) {
2483
+ // @ts-ignore
2484
+ const llmWebsocketUrl = this.webex.internal.llm?.getWebSocketUrl?.() || undefined;
2485
+
2486
+ // Per the LLM sync-latency spec, the event carries the LLM websocket url identifier,
2487
+ // the llmInfo.dataSet (main, atd-active or atd-unmuted) and the syncLatency block.
2488
+ const clientEvent = {
2489
+ name: 'client.locus.sync.complete',
2490
+ payload: {
2491
+ identifiers: {
2492
+ llmWebsocketUrl,
2493
+ },
2494
+ llmInfo: {
2495
+ dataSet: completed.dataSet,
2496
+ },
2497
+ syncLatency: completed.syncLatency,
2498
+ },
2499
+ options: {
2500
+ meetingId,
2501
+ },
2502
+ };
2503
+
2504
+ // @ts-ignore
2505
+ this.webex.internal.newMetrics.submitClientEvent(clientEvent);
2506
+ }
2507
+
2383
2508
  /**
2384
2509
  * Proxy function for all the listener set ups
2385
2510
  * @returns {undefined}
@@ -6049,7 +6174,18 @@ export default class Meeting extends StatelessWebexPlugin {
6049
6174
  storeEventForDebugging('llm', event.data);
6050
6175
  }
6051
6176
 
6177
+ const {trackingId} = event;
6178
+
6052
6179
  this.locusInfo.parse(this, event.data);
6180
+
6181
+ // Only the client whose /sync request tracking id matches the tracking id echoed back on this
6182
+ // LLM message should emit client.locus.sync.complete. The tracking id lives at the top level
6183
+ // of the received LLM event envelope. When it is absent there is nothing to correlate, so
6184
+ // skip. onLocusSyncLlmMessage records the LLM arrival time and is a no-op unless a stored
6185
+ // record for this meeting matches the tracking id.
6186
+ if (trackingId) {
6187
+ this.onLocusSyncLlmMessage(this.id, trackingId);
6188
+ }
6053
6189
  } else {
6054
6190
  LoggerProxy.logger.warn(
6055
6191
  `Meeting:index#processLocusLLMEvent --> Unknown event type: ${event.data.eventType}`
@@ -6458,7 +6594,7 @@ export default class Meeting extends StatelessWebexPlugin {
6458
6594
  this.webex.internal.llm.off('online', this.handleLLMOnline);
6459
6595
  // @ts-ignore
6460
6596
  this.webex.internal.llm.on('online', this.handleLLMOnline);
6461
- this.updateLLMConnection()
6597
+ this.updateLLMConnection({isInitialJoinPhase: true})
6462
6598
  .catch((error) => {
6463
6599
  LoggerProxy.logger.error(
6464
6600
  'Meeting:index#join --> Transcription Socket Connection Failed',
@@ -6729,9 +6865,11 @@ export default class Meeting extends StatelessWebexPlugin {
6729
6865
  /**
6730
6866
  * Connects to low latency mercury and reconnects if the address has changed
6731
6867
  * It will also disconnect if called when the meeting has ended
6868
+ * @param {Object} [options]
6869
+ * @param {boolean} [options.isInitialJoinPhase] true when called from initial join flow
6732
6870
  * @returns {Promise}
6733
6871
  */
6734
- async updateLLMConnection() {
6872
+ async updateLLMConnection({isInitialJoinPhase = false}: {isInitialJoinPhase?: boolean} = {}) {
6735
6873
  // @ts-ignore - Fix type
6736
6874
  const {url = undefined, info: {datachannelUrl = undefined} = {}} = this.locusInfo || {};
6737
6875
 
@@ -6869,10 +7007,114 @@ export default class Meeting extends StatelessWebexPlugin {
6869
7007
 
6870
7008
  this.startLLMHealthCheckTimer();
6871
7009
 
7010
+ if (registerAndConnectResult) {
7011
+ if (isInitialJoinPhase) {
7012
+ this.sendLLMConnectMetric(registerAndConnectResult);
7013
+ }
7014
+
7015
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7016
+ meeting: this,
7017
+ llmLatency: registerAndConnectResult,
7018
+ });
7019
+ }
7020
+
6872
7021
  return Promise.resolve(registerAndConnectResult);
7022
+ })
7023
+ .catch((error) => {
7024
+ // Prefer the partial timing registerAndConnect attaches when register succeeded but the
7025
+ // websocket connect() failed, so a ws failure isn't misreported as register never completing.
7026
+ const llmLatency = {
7027
+ clientLLMDatachannelResponseTime: error?.timing?.clientLLMDatachannelResponseTime ?? 0,
7028
+ clientLLMWebSocketConnectTime: 0,
7029
+ };
7030
+
7031
+ if (isInitialJoinPhase) {
7032
+ this.sendLLMConnectMetric(llmLatency, error);
7033
+ }
7034
+
7035
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7036
+ meeting: this,
7037
+ llmLatency,
7038
+ error,
7039
+ });
7040
+
7041
+ return Promise.reject(error);
6873
7042
  });
6874
7043
  }
6875
7044
 
7045
+ /**
7046
+ * Ensures breakout join response metric with LLM latency is emitted only once per breakout move id.
7047
+ * @param {string | undefined} breakoutMoveId
7048
+ * @param {boolean} [hasLLMLatency=false]
7049
+ * @returns {boolean}
7050
+ */
7051
+ private shouldEmitBreakoutJoinResponseMetric(
7052
+ breakoutMoveId?: string,
7053
+ hasLLMLatency = false
7054
+ ): boolean {
7055
+ if (!breakoutMoveId) {
7056
+ return false;
7057
+ }
7058
+
7059
+ if (!hasLLMLatency) {
7060
+ // When automatic LLM is enabled, updateLLMConnection will emit this same breakout join
7061
+ // response after the LLM connection finishes, including llmLatency and llmWebsocketUrl.
7062
+ // Suppress the earlier non-LLM event to avoid sending two events for the same move id,
7063
+ // where the first one would be missing the LLM-specific fields we want to validate.
7064
+ // @ts-ignore - config coming from registerPlugin
7065
+ return !this.config.enableAutomaticLLM;
7066
+ }
7067
+
7068
+ if (this.emittedBreakoutJoinResponseMoveIds.has(breakoutMoveId)) {
7069
+ return false;
7070
+ }
7071
+
7072
+ this.emittedBreakoutJoinResponseMoveIds.add(breakoutMoveId);
7073
+
7074
+ return true;
7075
+ }
7076
+
7077
+ /**
7078
+ * Sends LLM connect latencies for initial join flow.
7079
+ * @param {RegisterAndConnectTiming} timings
7080
+ * @param {any} [error]
7081
+ * @returns {void}
7082
+ */
7083
+ private sendLLMConnectMetric(timings: RegisterAndConnectTiming, error?: any) {
7084
+ // @ts-ignore
7085
+ const llmWebsocketUrl = this.webex.internal.llm.getWebSocketUrl?.() || undefined;
7086
+ const {clientLLMDatachannelResponseTime = 0, clientLLMWebSocketConnectTime} = timings || {};
7087
+
7088
+ const llmLatency: any = {
7089
+ clientLLMDatachannelResponseTime,
7090
+ };
7091
+
7092
+ if (clientLLMWebSocketConnectTime !== undefined) {
7093
+ llmLatency.clientLLMWebSocketConnectTime = clientLLMWebSocketConnectTime;
7094
+ }
7095
+
7096
+ const payload: any = {
7097
+ identifiers: {
7098
+ llmWebsocketUrl,
7099
+ },
7100
+ llmLatency,
7101
+ };
7102
+
7103
+ const options: any = {
7104
+ meetingId: this.id,
7105
+ ...(error && {rawError: error}),
7106
+ };
7107
+
7108
+ const metricEvent = {
7109
+ name: 'client.llm.connect.response',
7110
+ payload,
7111
+ options,
7112
+ };
7113
+
7114
+ // @ts-ignore
7115
+ this.webex.internal.newMetrics.submitClientEvent(metricEvent);
7116
+ }
7117
+
6876
7118
  /**
6877
7119
  * Use phone for meeting audio
6878
7120
  * @param {String} phoneNumber If provided, it will dial-out using this number. If not provided, dial-in will be used
@@ -1,5 +1,6 @@
1
1
  /* eslint no-shadow: ["error", { "allow": ["eventType"] }] */
2
- import {cloneDeep, clone, set} from 'lodash';
2
+ import {cloneDeep, clone, set, once} from 'lodash';
3
+ import {WasmRuntimeProbe} from '@webex/web-capabilities';
3
4
  import '@webex/internal-plugin-mercury';
4
5
  import '@webex/internal-plugin-conversation';
5
6
  import '@webex/internal-plugin-metrics';
@@ -210,6 +211,37 @@ export default class Meetings extends WebexPlugin {
210
211
  namespace = MEETINGS;
211
212
  registrationStatus: MeetingRegistrationStatus;
212
213
 
214
+ /**
215
+ * Emits a metric describing how well this browser runs WebAssembly, used to spot browsers
216
+ * where real-time WASM effects (e.g. background noise removal) run poorly.
217
+ *
218
+ * @param {string} correlationId - correlation id to report the result against
219
+ * @returns {void}
220
+ */
221
+ private emitWasmRuntimePerformance = once((correlationId: string): void => {
222
+ // This check is designed to swallow any probe/metrics failure so it can never break meeting
223
+ // creation, while still reporting the status so we can track browsers with WASM issues.
224
+ WasmRuntimeProbe.check()
225
+ .then((result) => {
226
+ LoggerProxy.logger.log(
227
+ `Meetings:index#emitWasmRuntimePerformance --> WASM runtime performance status: ${result.status}, ratio: ${result.ratio}, wasmMs: ${result.wasmMs}, jsMs: ${result.jsMs}`
228
+ );
229
+
230
+ return Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.WASM_RUNTIME_PERFORMANCE, {
231
+ status: result.status,
232
+ ratio: result.ratio,
233
+ wasmMs: result.wasmMs,
234
+ jsMs: result.jsMs,
235
+ correlation_id: correlationId,
236
+ });
237
+ })
238
+ .catch((error) => {
239
+ LoggerProxy.logger.error(
240
+ `Meetings:index#emitWasmRuntimePerformance --> ERROR, failed to probe or report WASM runtime performance: ${error.message}`
241
+ );
242
+ });
243
+ });
244
+
213
245
  /**
214
246
  * Initializes the Meetings Plugin
215
247
  * @constructor
@@ -1635,6 +1667,8 @@ export default class Meetings extends WebexPlugin {
1635
1667
  });
1636
1668
  }
1637
1669
  });
1670
+
1671
+ this.emitWasmRuntimePerformance(createdMeeting.correlationId);
1638
1672
  } else {
1639
1673
  LoggerProxy.logger.error(
1640
1674
  `Meetings:index#create --> ERROR, meeting does not have on method, will not be destroyed, meeting cleanup impossible for meeting: ${meeting}`
@@ -101,6 +101,7 @@ const BEHAVIORAL_METRICS = {
101
101
  HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED: 'js_sdk_hash_tree_heartbeat_watchdog_expired',
102
102
  HASH_TREE_EMPTY_LOCUS_STATE_ELEMENTS: 'js_sdk_hash_tree_empty_locus_state_elements',
103
103
  DESTROY_MEETING_WHILE_SUSPENDED: 'js_sdk_destroy_meeting_while_suspended',
104
+ WASM_RUNTIME_PERFORMANCE: 'js_sdk_wasm_runtime_performance',
104
105
  };
105
106
 
106
107
  export {BEHAVIORAL_METRICS as default};
@@ -5,6 +5,7 @@ import breakoutEvent from "../../../../src/breakouts/events";
5
5
 
6
6
  describe('plugin-meetings', () => {
7
7
  describe('breakoutEvent', () => {
8
+ const originalPostMoveCallAnalyzer = breakoutEvent.postMoveCallAnalyzer;
8
9
  let webex;
9
10
  let mockMeeting = {};
10
11
  let breakoutMoveId;
@@ -24,20 +25,35 @@ describe('plugin-meetings', () => {
24
25
  groupId: "groupId",
25
26
  };
26
27
  breakoutMoveId = 'breakoutMoveId';
28
+ breakoutEvent.postMoveCallAnalyzer = originalPostMoveCallAnalyzer;
27
29
 
28
30
  });
29
31
  describe('postMoveCallAnalyzer', () => {
30
32
  it('send metric as expected', () => {
31
33
  const submitClientEvent = sinon.stub();
32
- const eventInfo = {currentSession: newSession, meeting: mockMeeting, breakoutMoveId};
34
+ const eventInfo = {
35
+ currentSession: newSession,
36
+ meeting: mockMeeting,
37
+ breakoutMoveId,
38
+ llmLatency: {
39
+ clientLLMDatachannelResponseTime: 10,
40
+ clientLLMWebSocketConnectTime: 20,
41
+ },
42
+ llmWebsocketUrl: 'wss://example.com/ws',
43
+ };
33
44
  breakoutEvent.postMoveCallAnalyzer('client.breakout-session.join.response', eventInfo, submitClientEvent);
34
45
  assert.calledWithMatch(submitClientEvent, {
35
46
  name: 'client.breakout-session.join.response',
36
47
  payload: {
48
+ llmLatency: {
49
+ clientLLMDatachannelResponseTime: 10,
50
+ clientLLMWebSocketConnectTime: 20,
51
+ },
37
52
  identifiers: {
38
53
  breakoutMoveId: 'breakoutMoveId',
39
54
  breakoutSessionId: 'sessionId',
40
55
  breakoutGroupId: 'groupId',
56
+ llmWebsocketUrl: 'wss://example.com/ws',
41
57
  },
42
58
  },
43
59
  options: {meetingId: 'activeMeetingId'},
@@ -79,10 +95,112 @@ describe('plugin-meetings', () => {
79
95
  sinon.stub(submitClientEvent, 'bind').returns(webex.internal.newMetrics.submitClientEvent);
80
96
 
81
97
  breakoutEvent.postMoveCallAnalyzer = sinon.stub();
82
- const eventInfo = {newSession, mockMeeting, breakoutMoveId};
98
+ const eventInfo = {
99
+ newSession,
100
+ mockMeeting,
101
+ breakoutMoveId,
102
+ llmLatency: {clientLLMDatachannelResponseTime: 10, clientLLMWebSocketConnectTime: 20},
103
+ };
83
104
  breakoutEvent.onBreakoutJoinResponse(eventInfo, submitClientEvent);
84
105
  assert.calledWith(breakoutEvent.postMoveCallAnalyzer, 'client.breakout-session.join.response', eventInfo, submitClientEvent);
85
106
  });
107
+
108
+ it('emits join response metric without llmLatency', () => {
109
+ const submitClientEvent = sinon.stub();
110
+
111
+ breakoutEvent.postMoveCallAnalyzer(
112
+ 'client.breakout-session.join.response',
113
+ {currentSession: newSession, meeting: mockMeeting, breakoutMoveId},
114
+ submitClientEvent
115
+ );
116
+
117
+ assert.calledOnceWithExactly(submitClientEvent, {
118
+ name: 'client.breakout-session.join.response',
119
+ payload: {
120
+ llmLatency: undefined,
121
+ identifiers: {
122
+ breakoutMoveId: 'breakoutMoveId',
123
+ breakoutSessionId: 'sessionId',
124
+ breakoutGroupId: 'groupId',
125
+ llmWebsocketUrl: undefined,
126
+ },
127
+ },
128
+ options: {meetingId: 'activeMeetingId', rawError: undefined},
129
+ });
130
+ });
131
+
132
+ it('does not emit duplicate join response metric with llmLatency for the same breakoutMoveId', () => {
133
+ const submitClientEvent = sinon.stub();
134
+ const shouldEmitBreakoutJoinResponseMetric = sinon.stub();
135
+
136
+ shouldEmitBreakoutJoinResponseMetric.onFirstCall().returns(true);
137
+ shouldEmitBreakoutJoinResponseMetric.onSecondCall().returns(false);
138
+
139
+ const eventInfo = {
140
+ currentSession: newSession,
141
+ meeting: {
142
+ ...mockMeeting,
143
+ shouldEmitBreakoutJoinResponseMetric,
144
+ },
145
+ breakoutMoveId,
146
+ llmLatency: {clientLLMDatachannelResponseTime: 10, clientLLMWebSocketConnectTime: 20},
147
+ };
148
+
149
+ breakoutEvent.postMoveCallAnalyzer(
150
+ 'client.breakout-session.join.response',
151
+ eventInfo,
152
+ submitClientEvent
153
+ );
154
+ breakoutEvent.postMoveCallAnalyzer(
155
+ 'client.breakout-session.join.response',
156
+ eventInfo,
157
+ submitClientEvent
158
+ );
159
+
160
+ assert.calledTwice(shouldEmitBreakoutJoinResponseMetric);
161
+ assert.calledWithExactly(shouldEmitBreakoutJoinResponseMetric, breakoutMoveId, true);
162
+ assert.calledOnce(submitClientEvent);
163
+ });
164
+
165
+ it('allows llmLatency join response after join response without llmLatency', () => {
166
+ const submitClientEvent = sinon.stub();
167
+ const shouldEmitBreakoutJoinResponseMetric = sinon.stub();
168
+
169
+ shouldEmitBreakoutJoinResponseMetric.onFirstCall().returns(true);
170
+ shouldEmitBreakoutJoinResponseMetric.onSecondCall().returns(true);
171
+
172
+ const baseEventInfo = {
173
+ currentSession: newSession,
174
+ meeting: {
175
+ ...mockMeeting,
176
+ shouldEmitBreakoutJoinResponseMetric,
177
+ },
178
+ breakoutMoveId,
179
+ };
180
+
181
+ breakoutEvent.postMoveCallAnalyzer(
182
+ 'client.breakout-session.join.response',
183
+ baseEventInfo,
184
+ submitClientEvent
185
+ );
186
+ breakoutEvent.postMoveCallAnalyzer(
187
+ 'client.breakout-session.join.response',
188
+ {
189
+ ...baseEventInfo,
190
+ llmLatency: {clientLLMDatachannelResponseTime: 10, clientLLMWebSocketConnectTime: 20},
191
+ },
192
+ submitClientEvent
193
+ );
194
+
195
+ assert.calledTwice(shouldEmitBreakoutJoinResponseMetric);
196
+ assert.calledWithExactly(shouldEmitBreakoutJoinResponseMetric.firstCall, breakoutMoveId, false);
197
+ assert.calledWithExactly(shouldEmitBreakoutJoinResponseMetric.secondCall, breakoutMoveId, true);
198
+ assert.calledTwice(submitClientEvent);
199
+ assert.deepEqual(submitClientEvent.secondCall.args[0].payload.llmLatency, {
200
+ clientLLMDatachannelResponseTime: 10,
201
+ clientLLMWebSocketConnectTime: 20,
202
+ });
203
+ });
86
204
  });
87
205
 
88
206
  });