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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -110,6 +110,7 @@ export type HashTreeParserCallbacks = {
110
110
  locusInfoUpdateCallback: LocusInfoUpdateCallback;
111
111
  syncLatencyTracker?: SyncLatencyTracker;
112
112
  generateTrackingId?: GenerateTrackingId;
113
+ isLlmExpected: () => boolean;
113
114
  };
114
115
 
115
116
  const SYNC_METRICS_DATA_SETS = [
@@ -176,6 +177,9 @@ class HashTreeParser {
176
177
  private syncQueueProcessingPromise: Promise<void> = Promise.resolve();
177
178
  // top-level heartbeat interval from the most recent message, used as fallback when dataset-level value is missing
178
179
  private topLevelHeartbeatIntervalMs?: number;
180
+ // LLM data sets that were received while LLM was not expected, so their heartbeat watchdog was
181
+ // skipped; reevaluateLlmWatchdogs() arms these once LLM becomes expected and then clears this set
182
+ private pendingLlmWatchdogDataSetNames: Set<string> = new Set();
179
183
  /**
180
184
  * Constructor for HashTreeParser
181
185
  * @param {Object} options
@@ -1222,11 +1226,11 @@ class HashTreeParser {
1222
1226
  // emitted only from the LLM message path, so no completion happens here.
1223
1227
  const updatedObjects = this.parseMessage(message, debugText);
1224
1228
 
1225
- this.resetHeartbeatWatchdogs(message.dataSets);
1226
1229
  this.callLocusInfoUpdateCallback({
1227
1230
  updateType: LocusInfoUpdateType.OBJECTS_UPDATED,
1228
1231
  updatedObjects,
1229
1232
  });
1233
+ this.resetHeartbeatWatchdogs(message.dataSets);
1230
1234
  }
1231
1235
  }
1232
1236
 
@@ -1876,7 +1880,22 @@ class HashTreeParser {
1876
1880
  // dataset-level heartbeatIntervalMs takes priority; fall back to top-level common value
1877
1881
  const heartbeatIntervalMs = dataSet?.heartbeatIntervalMs ?? this.topLevelHeartbeatIntervalMs;
1878
1882
 
1879
- if (!dataSet?.hashTree || !heartbeatIntervalMs) {
1883
+ if (!dataSet?.hashTree || !this.isVisibleDataSet(dataSet.name) || !heartbeatIntervalMs) {
1884
+ // eslint-disable-next-line no-continue
1885
+ continue;
1886
+ }
1887
+
1888
+ if (
1889
+ LLM_DATASET_NAMES.includes(dataSet.name) &&
1890
+ this.callbacks.isLlmExpected &&
1891
+ !this.callbacks.isLlmExpected()
1892
+ ) {
1893
+ LoggerProxy.logger.info(
1894
+ `HashTreeParser#resetHeartbeatWatchdogs --> ${this.debugId} skipping heartbeat watchdog timer for data set "${dataSet.name}" because LLM is disconnected`
1895
+ );
1896
+
1897
+ // remember it so reevaluateLlmWatchdogs() can arm the watchdog once LLM becomes expected
1898
+ this.pendingLlmWatchdogDataSetNames.add(dataSet.name);
1880
1899
  // eslint-disable-next-line no-continue
1881
1900
  continue;
1882
1901
  }
@@ -1888,7 +1907,7 @@ class HashTreeParser {
1888
1907
  dataSet.heartbeatWatchdogTimer = undefined;
1889
1908
 
1890
1909
  LoggerProxy.logger.warn(
1891
- `HashTreeParser#resetHeartbeatWatchdogs --> ${this.debugId} Heartbeat watchdog fired for data set "${dataSet.name}" - no heartbeat received within expected interval, initiating sync`
1910
+ `HashTreeParser#resetHeartbeatWatchdogs --> ${this.debugId} Heartbeat watchdog fired for data set "${dataSet.name}" - no heartbeat received within expected interval(heartbeatIntervalMs=${heartbeatIntervalMs}, backoffTime=${backoffTime}), initiating sync`
1892
1911
  );
1893
1912
 
1894
1913
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED, {
@@ -1904,6 +1923,50 @@ class HashTreeParser {
1904
1923
  }
1905
1924
  }
1906
1925
 
1926
+ /**
1927
+ * Re-evaluates heartbeat watchdog timers for LLM data sets. While LLM is not expected,
1928
+ * resetHeartbeatWatchdogs skips setting watchdog timers for LLM data sets and records them in
1929
+ * pendingLlmWatchdogDataSetNames. This must be called when LLM transitions to expected (e.g. self
1930
+ * reports JOINED) to arm the watchdogs for those pending data sets (avoids a timing issue where
1931
+ * the "main"/"atd-active"/"atd-unmuted" data set arrives before the self update). The pending set
1932
+ * is consumed and cleared here.
1933
+ * @returns {void}
1934
+ */
1935
+ reevaluateLlmWatchdogs(): void {
1936
+ if (this.state === 'stopped') {
1937
+ return;
1938
+ }
1939
+
1940
+ if (this.pendingLlmWatchdogDataSetNames.size === 0) {
1941
+ return;
1942
+ }
1943
+
1944
+ // consume the pending set - these LLM data sets were received while LLM was not expected
1945
+ const pendingDataSetNames = [...this.pendingLlmWatchdogDataSetNames];
1946
+ this.pendingLlmWatchdogDataSetNames.clear();
1947
+
1948
+ const dataSetsNeedingWatchdog = pendingDataSetNames
1949
+ .map((name) => this.dataSets[name])
1950
+ .filter((dataSet): dataSet is InternalDataSet => {
1951
+ if (!dataSet?.hashTree || dataSet.heartbeatWatchdogTimer) {
1952
+ return false;
1953
+ }
1954
+
1955
+ return this.isVisibleDataSet(dataSet.name);
1956
+ });
1957
+
1958
+ if (dataSetsNeedingWatchdog.length > 0) {
1959
+ LoggerProxy.logger.info(
1960
+ `HashTreeParser#reevaluateLlmWatchdogs --> ${
1961
+ this.debugId
1962
+ } LLM became expected, setting heartbeat watchdog timers for data sets: ${dataSetsNeedingWatchdog
1963
+ .map((ds) => ds.name)
1964
+ .join(', ')}`
1965
+ );
1966
+ this.resetHeartbeatWatchdogs(dataSetsNeedingWatchdog);
1967
+ }
1968
+ }
1969
+
1907
1970
  /**
1908
1971
  * Stops all timers for the data sets to prevent any further sync attempts.
1909
1972
  * @returns {void}
@@ -1936,6 +1999,7 @@ class HashTreeParser {
1936
1999
  this.topLevelHeartbeatIntervalMs = undefined;
1937
2000
  this.syncAllBackoffType = SyncAllBackoffType.NONE;
1938
2001
  this.dataSetsSyncedDuringBackoff = new Set();
2002
+ this.pendingLlmWatchdogDataSetNames = new Set();
1939
2003
  Object.values(this.dataSets).forEach((dataSet) => {
1940
2004
  dataSet.syncAbortController?.abort();
1941
2005
  dataSet.syncAbortController = undefined;
@@ -538,6 +538,15 @@ export default class LocusInfo extends EventsScope {
538
538
  this.updateLinks(locus.links);
539
539
  }
540
540
 
541
+ /**
542
+ * Whether we expect to receive updates over the LLM connection. This is used by hash tree parsers
543
+ * to decide whether to arm heartbeat watchdog timers for LLM data sets.
544
+ * @returns {boolean}
545
+ */
546
+ private isLlmExpected(): boolean {
547
+ return this.parsedLocus.self?.joinedWith?.state === 'JOINED';
548
+ }
549
+
541
550
  /**
542
551
  * Creates a HashTreeParser instance for a given locusUrl and stores it in the map.
543
552
  * @param {Object} params
@@ -568,6 +577,7 @@ export default class LocusInfo extends EventsScope {
568
577
  callbacks: {
569
578
  locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
570
579
  syncLatencyTracker: this.callbacks.syncLatencyTracker,
580
+ isLlmExpected: () => this.isLlmExpected(),
571
581
  // Reuse webex-core's tracking-id interceptor sequence (exposed publicly via
572
582
  // webexTrackingIdSequenceNumbers) so Locus requests share the client's unified
573
583
  // ${sessionId}_${sequence} tracking id space instead of minting an unrelated id. Fall
@@ -2713,6 +2723,7 @@ export default class LocusInfo extends EventsScope {
2713
2723
  */
2714
2724
  updateSelf(self: any) {
2715
2725
  if (self) {
2726
+ const wasLlmExpected = this.isLlmExpected();
2716
2727
  // @ts-ignore
2717
2728
  const parsedSelves = SelfUtils.getSelves(
2718
2729
  this.parsedLocus.self,
@@ -2992,6 +3003,15 @@ export default class LocusInfo extends EventsScope {
2992
3003
  this.parsedLocus.self = parsedSelves.current;
2993
3004
  // @ts-ignore
2994
3005
  this.self = self;
3006
+
3007
+ // If LLM just became expected (self reported JOINED), some hash tree parsers may have skipped
3008
+ // arming heartbeat watchdog timers for LLM data sets whose messages arrived before this
3009
+ // update. Re-evaluate them now so those watchdogs get armed.
3010
+ if (!wasLlmExpected && this.isLlmExpected()) {
3011
+ this.hashTreeParsers.forEach((entry) => {
3012
+ entry.parser.reevaluateLlmWatchdogs();
3013
+ });
3014
+ }
2995
3015
  } else {
2996
3016
  this.compareAndUpdateFlags.compareHostAndSelf = false;
2997
3017
  }
@@ -80,6 +80,7 @@ export type ReplacesInfo = {
80
80
 
81
81
  export const LocusErrorCodes = {
82
82
  LOCUS_INACTIVE: 2403004,
83
+ LOCUS_USER_FULL: 2423001,
83
84
  } as const;
84
85
 
85
86
  export type LocusErrorCodes = Enum<typeof LocusErrorCodes>;
@@ -186,7 +186,7 @@ import {ReachabilityMetrics} from '../reachability/reachability.types';
186
186
  import {SetStageOptions, SetStageVideoLayout, UnsetStageVideoLayout} from './request.type';
187
187
  import {Invitee} from './type';
188
188
  import {DataSet, HashTreeMessage, Metadata} from '../hashTree/hashTreeParser';
189
- import {LocusDTO} from '../locus-info/types';
189
+ import {LocusDTO, LocusErrorCodes} from '../locus-info/types';
190
190
  import AIEnableRequest from '../aiEnableRequest';
191
191
 
192
192
  // default callback so we don't call an undefined function, but in practice it should never be used
@@ -739,6 +739,26 @@ export default class Meeting extends StatelessWebexPlugin {
739
739
  turnDiscoverySkippedReason: TurnDiscoverySkipReason;
740
740
  turnServerUsed: boolean;
741
741
  areVoiceaEventsSetup = false;
742
+ /**
743
+ * Returns the initial transcription object shape.
744
+ * Used by constructor and reset paths to ensure consistent initialization.
745
+ * @private
746
+ * @returns {Transcription}
747
+ */
748
+ private getInitialTranscription(): Transcription {
749
+ return {
750
+ captions: [],
751
+ isListening: false,
752
+ commandText: '',
753
+ languageOptions: {currentSpokenLanguage: 'en'},
754
+ showCaptionBox: false,
755
+ transcribingRequestStatus: 'INACTIVE',
756
+ isCaptioning: false,
757
+ interimCaptions: {} as Map<string, CaptionData>,
758
+ speakerProxy: {} as Map<string, any>,
759
+ } as Transcription;
760
+ }
761
+
742
762
  isMoveToInProgress = false;
743
763
  registrationIdStatus: string;
744
764
  brbState: BrbState;
@@ -985,6 +1005,16 @@ export default class Meeting extends StatelessWebexPlugin {
985
1005
  */
986
1006
  // @ts-ignore
987
1007
  this.webinar = new Webinar({meetingId: this.id}, {parent: this.webex});
1008
+ /**
1009
+ * VoiceaChannel for transcription/captions. Created without llmChannel;
1010
+ * switchLLMChannel() is called in updateLLMConnection() when LLM connects.
1011
+ * @instance
1012
+ * @type {VoiceaChannel}
1013
+ * @public
1014
+ * @memberof Meeting
1015
+ */
1016
+ // @ts-ignore - Fix type
1017
+ this.voiceaChannel = this.webex.internal.voicea.createChannel();
988
1018
  /**
989
1019
  * helper class for managing receive slots (for multistream media connections)
990
1020
  */
@@ -1508,17 +1538,7 @@ export default class Meeting extends StatelessWebexPlugin {
1508
1538
  * @private
1509
1539
  * @memberof Meeting
1510
1540
  */
1511
- this.transcription = {
1512
- captions: [],
1513
- isListening: false,
1514
- commandText: '',
1515
- languageOptions: {currentSpokenLanguage: 'en'},
1516
- showCaptionBox: false,
1517
- transcribingRequestStatus: 'INACTIVE',
1518
- isCaptioning: false,
1519
- interimCaptions: {} as Map<string, CaptionData>,
1520
- speakerProxy: {} as Map<string, any>,
1521
- } as Transcription;
1541
+ this.transcription = this.getInitialTranscription();
1522
1542
 
1523
1543
  /**
1524
1544
  * Password status. If it's PASSWORD_STATUS.REQUIRED then verifyPassword() needs to be called
@@ -2106,7 +2126,7 @@ export default class Meeting extends StatelessWebexPlugin {
2106
2126
  this.config.installedOrgID,
2107
2127
  this.locusId,
2108
2128
  extraParams,
2109
- {meetingId: this.id, sendCAevents},
2129
+ {meetingId: this.id, sendCAevents, correlationId: this.correlationId},
2110
2130
  registrationId,
2111
2131
  null,
2112
2132
  classificationId
@@ -3046,18 +3066,22 @@ export default class Meeting extends StatelessWebexPlugin {
3046
3066
  // user need to be joined to start the llm and receive transcription
3047
3067
  if (this.isJoined()) {
3048
3068
  // @ts-ignore - config coming from registerPlugin
3049
- if (transcribing && !this.transcription) {
3050
- this.startTranscription();
3051
- } else if (!transcribing && this.transcription) {
3052
- Trigger.trigger(
3053
- this,
3054
- {
3055
- file: 'meeting/index',
3056
- function: 'setupLocusControlsListener',
3057
- },
3058
- EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION,
3059
- {caption, transcribing}
3060
- );
3069
+ if (transcribing && !this.areVoiceaEventsSetup) {
3070
+ if (this.voiceaChannel?.isLLMConnected()) {
3071
+ this.startTranscription();
3072
+ }
3073
+ } else if (!transcribing) {
3074
+ if (this.areVoiceaEventsSetup) {
3075
+ Trigger.trigger(
3076
+ this,
3077
+ {
3078
+ file: 'meeting/index',
3079
+ function: 'setupLocusControlsListener',
3080
+ },
3081
+ EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION,
3082
+ {caption, transcribing}
3083
+ );
3084
+ }
3061
3085
  }
3062
3086
  }
3063
3087
  }
@@ -5874,10 +5898,12 @@ export default class Meeting extends StatelessWebexPlugin {
5874
5898
 
5875
5899
  if (
5876
5900
  CallDiagnosticUtils.isSdpOfferCreationError(error) ||
5877
- CallDiagnosticUtils.isWebrtcApiNotAvailableError(error)
5901
+ CallDiagnosticUtils.isWebrtcApiNotAvailableError(error) ||
5902
+ this.isLocusUserFullError(error)
5878
5903
  ) {
5879
5904
  // errors related to offer creation (for example missing H264 codec) will happen again no matter how many times we try,
5880
5905
  // so there is no point doing a retry
5906
+ // when the locus is full, we also don't want to retry, because it will just fail again
5881
5907
  shouldRetry = false;
5882
5908
  }
5883
5909
 
@@ -5943,7 +5969,9 @@ export default class Meeting extends StatelessWebexPlugin {
5943
5969
 
5944
5970
  this.locusInfo.suspendDestroyMeeting(false);
5945
5971
 
5946
- throw firstError ?? error;
5972
+ // LOCUS_USER_FULL is a definitive capacity error the client must surface, so it takes
5973
+ // precedence over any earlier retryable error stored in firstError.
5974
+ throw this.isLocusUserFullError(error) ? error : firstError ?? error;
5947
5975
  }
5948
5976
  }
5949
5977
 
@@ -6168,6 +6196,22 @@ export default class Meeting extends StatelessWebexPlugin {
6168
6196
  }
6169
6197
  }
6170
6198
 
6199
+ /**
6200
+ * Starts transcription when requested by the current Locus controls and an
6201
+ * active LLM channel is ready.
6202
+ * @internal
6203
+ * @returns {void}
6204
+ */
6205
+ public startTranscriptionIfNeeded(): void {
6206
+ if (
6207
+ this.locusInfo.controls?.transcribe?.transcribing &&
6208
+ !this.areVoiceaEventsSetup &&
6209
+ this.voiceaChannel?.isLLMConnected()
6210
+ ) {
6211
+ this.startTranscription();
6212
+ }
6213
+ }
6214
+
6171
6215
  /** Handles Locus LLM events
6172
6216
  *
6173
6217
  * @param {LocusLLMEvent} event - The Locus LLM event to process
@@ -6670,8 +6714,7 @@ export default class Meeting extends StatelessWebexPlugin {
6670
6714
  this.llmChannel?.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6671
6715
  this.llmChannel?.off('online', this.handleLLMOnline);
6672
6716
  this.breakouts?.unregisterLLMChannel();
6673
- this.voiceaChannel?.deregisterEvents();
6674
- this.voiceaChannel = undefined;
6717
+ // voiceaChannel persists across LLM reconnects; switchLLMChannel() handles re-subscribing
6675
6718
  this.clearLLMHealthCheckTimer();
6676
6719
  }
6677
6720
 
@@ -6694,10 +6737,11 @@ export default class Meeting extends StatelessWebexPlugin {
6694
6737
  private stopListeningForMeetingEvents() {
6695
6738
  this.stopListeningForLLMEvents();
6696
6739
  this.stopListeningForMercuryEvents();
6697
- if (this.transcription) {
6740
+ if (this.areVoiceaEventsSetup) {
6698
6741
  this.stopTranscription();
6699
- this.transcription = undefined;
6700
6742
  }
6743
+ // Reset to initial shape instead of null - transcription is always a valid object
6744
+ this.transcription = this.getInitialTranscription();
6701
6745
  this.annotation.deregisterEvents();
6702
6746
  }
6703
6747
 
@@ -6706,16 +6750,27 @@ export default class Meeting extends StatelessWebexPlugin {
6706
6750
  *
6707
6751
  * @param {Object} options
6708
6752
  * @param {boolean} [options.throwOnError=true] rethrows disconnect errors when true
6753
+ * @param {boolean} [options.preserveVoiceaChannel=false] when true, keeps voiceaChannel for switchLLMChannel() during reconnects
6709
6754
  * @returns {Promise<void>}
6710
6755
  */
6711
6756
  private cleanupLLMConneciton = async ({
6712
6757
  throwOnError = true,
6758
+ preserveVoiceaChannel = false,
6713
6759
  }: {
6714
6760
  throwOnError?: boolean;
6761
+ preserveVoiceaChannel?: boolean;
6715
6762
  } = {}): Promise<void> => {
6716
6763
  // Always clear the timer, even if there's no channel
6717
6764
  this.clearLLMHealthCheckTimer();
6718
6765
 
6766
+ // Permanent cleanup must deregister voiceaChannel regardless of LLM presence.
6767
+ // When a transient reconnect fails (LLM registration error), llmChannel is undefined
6768
+ // but voiceaChannel may still exist with listeners attached to the old emitter.
6769
+ if (!preserveVoiceaChannel) {
6770
+ this.voiceaChannel?.deregisterEvents();
6771
+ this.voiceaChannel = undefined;
6772
+ }
6773
+
6719
6774
  if (!this.llmChannel) {
6720
6775
  return;
6721
6776
  }
@@ -6855,7 +6910,7 @@ export default class Meeting extends StatelessWebexPlugin {
6855
6910
  }
6856
6911
 
6857
6912
  // URLs changed or not joined, disconnect existing channel
6858
- await this.cleanupLLMConneciton();
6913
+ await this.cleanupLLMConneciton({preserveVoiceaChannel: true});
6859
6914
  }
6860
6915
 
6861
6916
  if (!isJoined) {
@@ -6901,14 +6956,39 @@ export default class Meeting extends StatelessWebexPlugin {
6901
6956
  // Register breakouts channel
6902
6957
  this.breakouts.registerLLMChannel(this.llmChannel);
6903
6958
 
6904
- // Create VoiceaChannel for this meeting
6905
- // @ts-ignore - Fix type
6906
- this.voiceaChannel = this.webex.internal.voicea.createChannel(this.llmChannel);
6907
6959
  LoggerProxy.logger.info(
6908
6960
  'Meeting:index#updateLLMConnection --> enabled to receive relay events!'
6909
6961
  );
6910
6962
  this.startLLMHealthCheckTimer();
6911
6963
 
6964
+ // Switch voiceaChannel to use the new LLM channel (preserves transcription state).
6965
+ // Skip if practice session is active - practice session manages its own voicea binding
6966
+ // via updatePSDataChannel, and switching here would break practice session captions.
6967
+ const isPracticeSessionActive =
6968
+ this.webinar?.isPracticeSessionLLMChannelConnected() ?? false;
6969
+
6970
+ if (!this.voiceaChannel) {
6971
+ // @ts-ignore - Fix type
6972
+ this.voiceaChannel = this.webex.internal.voicea.createChannel();
6973
+ }
6974
+
6975
+ if (!isPracticeSessionActive) {
6976
+ // Fire-and-forget: caption restoration shouldn't block LLM connection result.
6977
+ // transcription is always initialized (reset to initial shape, never null),
6978
+ // so no re-init needed here.
6979
+ this.voiceaChannel
6980
+ .switchLLMChannel(this.llmChannel)
6981
+ .then(() => {
6982
+ this.startTranscriptionIfNeeded();
6983
+ })
6984
+ .catch((error) => {
6985
+ LoggerProxy.logger.warn(
6986
+ 'Meeting:index#updateLLMConnection --> failed to switch voicea channel:',
6987
+ error
6988
+ );
6989
+ });
6990
+ }
6991
+
6912
6992
  if (registerAndConnectResult) {
6913
6993
  if (isInitialJoinPhase) {
6914
6994
  this.sendLLMConnectMetric(registerAndConnectResult);
@@ -8108,6 +8188,10 @@ export default class Meeting extends StatelessWebexPlugin {
8108
8188
  );
8109
8189
  }
8110
8190
 
8191
+ private isLocusUserFullError(error: Error | undefined): boolean {
8192
+ return (error as any)?.error?.body?.errorCode === LocusErrorCodes.LOCUS_USER_FULL;
8193
+ }
8194
+
8111
8195
  /**
8112
8196
  * Determines if the next media attempt should use only TURN-TLS (iceTransportPolicy='relay').
8113
8197
  * We do this in the hope that it will minimize the chance of Homer sending DTLS packets on a wrong
@@ -10436,8 +10520,10 @@ export default class Meeting extends StatelessWebexPlugin {
10436
10520
  // stopListeningForMeetingEvents() before /leave and /end so events
10437
10521
  // received mid-teardown do not trigger Locus syncs.
10438
10522
  // Token cleanup happens automatically when cleanupLLMConneciton destroys the channel.
10523
+ // A new voiceaChannel is created on the next join. In-session LLM reconnects and
10524
+ // practice-session transitions use their own cleanup paths and preserve the channel.
10439
10525
 
10440
- await this.cleanupLLMConneciton({throwOnError: false});
10526
+ await this.cleanupLLMConneciton({throwOnError: false, preserveVoiceaChannel: false});
10441
10527
  };
10442
10528
 
10443
10529
  /**
@@ -365,7 +365,7 @@ const MeetingUtil = {
365
365
  });
366
366
  },
367
367
 
368
- cleanUp: (meeting) => {
368
+ cleanUp: (meeting, {preserveVoiceaChannel = true}: {preserveVoiceaChannel?: boolean} = {}) => {
369
369
  meeting.getWebexObject().internal.device.meetingEnded();
370
370
  meeting.stopPeriodicLogUpload();
371
371
 
@@ -396,7 +396,7 @@ const MeetingUtil = {
396
396
  .then(() => meeting.stopKeepAlive())
397
397
  .then(() => {
398
398
  if (meeting.config?.enableAutomaticLLM) {
399
- return meeting.cleanupLLMConneciton({throwOnError: false});
399
+ return meeting.cleanupLLMConneciton({throwOnError: false, preserveVoiceaChannel});
400
400
  }
401
401
 
402
402
  return undefined;
@@ -102,7 +102,7 @@ export const processNewCaptions = ({
102
102
 
103
103
  interimTranscriptionIds.push(interimId);
104
104
  } else {
105
- transcriptData.interimCaptions[transcriptId].forEach((innerInterimId) => {
105
+ (transcriptData.interimCaptions[transcriptId] ?? []).forEach((innerInterimId) => {
106
106
  const interimTranscriptIndex = transcriptData.captions.findIndex(
107
107
  (transcript) => transcript.id === innerInterimId
108
108
  );
@@ -649,12 +649,12 @@ export default class MeetingInfoV2 {
649
649
  installedOrgID = null,
650
650
  locusId = null,
651
651
  extraParams: object = {},
652
- options: {meetingId?: string; sendCAevents?: boolean} = {},
652
+ options: {meetingId?: string; sendCAevents?: boolean; correlationId?: string} = {},
653
653
  registrationId: string = null,
654
654
  fullSiteUrl: string = null,
655
655
  classificationId: string = null
656
656
  ) {
657
- const {meetingId, sendCAevents} = options;
657
+ const {meetingId, sendCAevents, correlationId} = options;
658
658
 
659
659
  const destinationType = await MeetingInfoUtil.getDestinationType({
660
660
  destination,
@@ -706,6 +706,10 @@ export default class MeetingInfoV2 {
706
706
  body,
707
707
  };
708
708
 
709
+ if (meetingId && sendCAevents && correlationId) {
710
+ requestOptions.headers = {correlationId};
711
+ }
712
+
709
713
  const directURI = await MeetingInfoUtil.getDirectMeetingInfoURI(destinationType);
710
714
 
711
715
  if (fullSiteUrl) {
@@ -219,19 +219,34 @@ export default class Meetings extends WebexPlugin {
219
219
  * @returns {void}
220
220
  */
221
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.
222
+ // Probe and telemetry failures must not prevent meeting creation.
224
223
  WasmRuntimeProbe.check()
225
224
  .then((result) => {
225
+ const {status, capability, reason, measurements} = result;
226
+ const {
227
+ divRatio = null,
228
+ sqrtRatio = null,
229
+ addNsPerOp = null,
230
+ addMedianMs = null,
231
+ divMedianMs = null,
232
+ sqrtMedianMs = null,
233
+ } = measurements ?? {};
234
+ const measurementsLog = JSON.stringify(measurements);
235
+
226
236
  LoggerProxy.logger.log(
227
- `Meetings:index#emitWasmRuntimePerformance --> WASM runtime performance status: ${result.status}, ratio: ${result.ratio}, wasmMs: ${result.wasmMs}, jsMs: ${result.jsMs}`
237
+ `Meetings:index#emitWasmRuntimePerformance --> WASM runtime performance status: ${status}, capability: ${capability}, reason: ${reason}, measurements: ${measurementsLog}`
228
238
  );
229
239
 
230
240
  return Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.WASM_RUNTIME_PERFORMANCE, {
231
- status: result.status,
232
- ratio: result.ratio,
233
- wasmMs: result.wasmMs,
234
- jsMs: result.jsMs,
241
+ status,
242
+ capability,
243
+ reason,
244
+ divRatio,
245
+ sqrtRatio,
246
+ addNsPerOp,
247
+ addMedianMs,
248
+ divMedianMs,
249
+ sqrtMedianMs,
235
250
  correlation_id: correlationId,
236
251
  });
237
252
  })
@@ -1470,7 +1485,7 @@ export default class Meetings extends WebexPlugin {
1470
1485
  * @memberof Meetings
1471
1486
  */
1472
1487
  private destroy(meeting: Meeting, reason: object) {
1473
- MeetingUtil.cleanUp(meeting);
1488
+ MeetingUtil.cleanUp(meeting, {preserveVoiceaChannel: false});
1474
1489
  // keep some basic info about the deleted meeting forever
1475
1490
  this.deletedMeetings.set(meeting.id, {
1476
1491
  id: meeting.id,
@@ -226,13 +226,15 @@ const Webinar = WebexPlugin.extend({
226
226
  this._pendingOnlineListener = null;
227
227
  }
228
228
 
229
- // Switch voicea back to main meeting LLM channel before disconnecting PS channel
230
229
  const meeting = this.getValidatedWebinarMeeting();
231
- if (meeting?.voiceaChannel && meeting?.llmChannel) {
232
- await meeting.voiceaChannel.switchLLMChannel(meeting.llmChannel);
233
- }
234
230
 
235
231
  if (!this._practiceSessionLLMChannel) {
232
+ // Even without PS channel, ensure voicea is bound to main channel
233
+ if (meeting?.voiceaChannel && meeting?.llmChannel) {
234
+ await meeting.voiceaChannel.switchLLMChannel(meeting.llmChannel);
235
+ meeting.startTranscriptionIfNeeded();
236
+ }
237
+
236
238
  return;
237
239
  }
238
240
 
@@ -260,6 +262,15 @@ const Webinar = WebexPlugin.extend({
260
262
  }
261
263
  }
262
264
  this._practiceSessionLLMChannel = undefined;
265
+
266
+ // Switch voicea to current main channel. Switching after disconnect ensures:
267
+ // - If main channel was replaced during disconnect (concurrent updateLLMConnection),
268
+ // meeting.llmChannel will be the new channel
269
+ // - If the channel is still connecting, switchLLMChannel waits for it to come online
270
+ if (meeting?.voiceaChannel && meeting?.llmChannel) {
271
+ await meeting.voiceaChannel.switchLLMChannel(meeting.llmChannel);
272
+ meeting.startTranscriptionIfNeeded();
273
+ }
263
274
  }
264
275
  },
265
276
 
@@ -442,10 +453,12 @@ const Webinar = WebexPlugin.extend({
442
453
  // Switch annotation to practice session channel
443
454
  meeting.annotation.registerChannel(psChannel);
444
455
 
445
- // Switch meeting's voicea channel to use the PS LLM connection
446
- // This preserves caption state and re-announces automatically
456
+ // Switch meeting's voicea channel to use the PS LLM connection.
457
+ // The reconciler pattern preserves caption state and handles all timing.
458
+ // transcription is always initialized (reset to initial shape, never null).
447
459
  if (meeting.voiceaChannel) {
448
460
  await meeting.voiceaChannel.switchLLMChannel(psChannel);
461
+ meeting.startTranscriptionIfNeeded();
449
462
  }
450
463
 
451
464
  LoggerProxy.logger.info(
@@ -317,7 +317,7 @@ describe('live-annotation', () => {
317
317
  const sendObject = {
318
318
  id: sinon.match.string,
319
319
  type: 'publishRequest',
320
- recipients: {route: 'binding'},
320
+ recipients: [{route: 'binding'}],
321
321
  headers: {to: '987ead98-6c93-4fcb-899d-517305c47503'},
322
322
  data: {
323
323
  eventType: 'relay.event',