@webex/plugin-meetings 3.12.0-next.18 → 3.12.0-next.180

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 (307) hide show
  1. package/.sdd/manifest.json +1312 -0
  2. package/.sdd/templates/.source.json +30 -0
  3. package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
  4. package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
  5. package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
  6. package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
  7. package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
  8. package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
  9. package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
  10. package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
  11. package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
  12. package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
  13. package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
  14. package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
  15. package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
  16. package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
  17. package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
  18. package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
  19. package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
  20. package/.sdd/templates/component-repo/template-map.json +112 -0
  21. package/AGENTS.md +135 -0
  22. package/ai-docs/ARCHITECTURE.md +207 -0
  23. package/ai-docs/CONTRACTS.md +267 -0
  24. package/ai-docs/DATA_MODEL.md +64 -0
  25. package/ai-docs/GETTING_STARTED.md +73 -0
  26. package/ai-docs/GLOSSARY.md +56 -0
  27. package/ai-docs/REVIEW_CHECKLIST.md +45 -0
  28. package/ai-docs/RULES.md +79 -0
  29. package/ai-docs/SECURITY.md +74 -0
  30. package/ai-docs/SERVICE_STATE.md +59 -0
  31. package/ai-docs/SPEC_INDEX.md +85 -0
  32. package/ai-docs/TEST_INDEX.md +45 -0
  33. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
  34. package/ai-docs/patterns/defensive-error-propagation.md +55 -0
  35. package/ai-docs/patterns/event-scope-emission.md +46 -0
  36. package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
  37. package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
  38. package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
  39. package/assets/README.md +26 -0
  40. package/assets/e2ee.js +2 -0
  41. package/assets/e2ee.wasm +0 -0
  42. package/dist/aiEnableRequest/index.js +15 -2
  43. package/dist/aiEnableRequest/index.js.map +1 -1
  44. package/dist/annotation/index.js +55 -19
  45. package/dist/annotation/index.js.map +1 -1
  46. package/dist/assets/e2ee.js +2 -0
  47. package/dist/assets/e2ee.wasm +0 -0
  48. package/dist/breakouts/breakout.js +8 -3
  49. package/dist/breakouts/breakout.js.map +1 -1
  50. package/dist/breakouts/events.js +29 -14
  51. package/dist/breakouts/events.js.map +1 -1
  52. package/dist/breakouts/index.js +128 -7
  53. package/dist/breakouts/index.js.map +1 -1
  54. package/dist/common/errors/webex-errors.js +54 -5
  55. package/dist/common/errors/webex-errors.js.map +1 -1
  56. package/dist/config.js +3 -2
  57. package/dist/config.js.map +1 -1
  58. package/dist/constants.js +39 -11
  59. package/dist/constants.js.map +1 -1
  60. package/dist/controls-options-manager/index.js +46 -10
  61. package/dist/controls-options-manager/index.js.map +1 -1
  62. package/dist/hashTree/constants.js +4 -1
  63. package/dist/hashTree/constants.js.map +1 -1
  64. package/dist/hashTree/hashTreeParser.js +1096 -391
  65. package/dist/hashTree/hashTreeParser.js.map +1 -1
  66. package/dist/hashTree/utils.js +20 -0
  67. package/dist/hashTree/utils.js.map +1 -1
  68. package/dist/index.js +8 -0
  69. package/dist/index.js.map +1 -1
  70. package/dist/interceptors/dataChannelAuthToken.js +58 -16
  71. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  72. package/dist/interceptors/locusRetry.js +24 -9
  73. package/dist/interceptors/locusRetry.js.map +1 -1
  74. package/dist/interpretation/index.js +55 -12
  75. package/dist/interpretation/index.js.map +1 -1
  76. package/dist/interpretation/interpretation.types.js +7 -0
  77. package/dist/interpretation/interpretation.types.js.map +1 -0
  78. package/dist/interpretation/siLanguage.js +1 -1
  79. package/dist/locus-info/controlsUtils.js +4 -1
  80. package/dist/locus-info/controlsUtils.js.map +1 -1
  81. package/dist/locus-info/index.js +615 -176
  82. package/dist/locus-info/index.js.map +1 -1
  83. package/dist/locus-info/infoUtils.js +36 -5
  84. package/dist/locus-info/infoUtils.js.map +1 -1
  85. package/dist/locus-info/types.js +20 -0
  86. package/dist/locus-info/types.js.map +1 -1
  87. package/dist/media/MediaConnectionAwaiter.js +229 -166
  88. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  89. package/dist/media/index.js +8 -2
  90. package/dist/media/index.js.map +1 -1
  91. package/dist/media/properties.js +4 -5
  92. package/dist/media/properties.js.map +1 -1
  93. package/dist/meeting/in-meeting-actions.js +5 -1
  94. package/dist/meeting/in-meeting-actions.js.map +1 -1
  95. package/dist/meeting/index.js +1844 -959
  96. package/dist/meeting/index.js.map +1 -1
  97. package/dist/meeting/locusMediaRequest.js +229 -82
  98. package/dist/meeting/locusMediaRequest.js.map +1 -1
  99. package/dist/meeting/muteState.js +10 -1
  100. package/dist/meeting/muteState.js.map +1 -1
  101. package/dist/meeting/request.js +5 -2
  102. package/dist/meeting/request.js.map +1 -1
  103. package/dist/meeting/util.js +42 -4
  104. package/dist/meeting/util.js.map +1 -1
  105. package/dist/meeting/voicea-meeting.js +2 -1
  106. package/dist/meeting/voicea-meeting.js.map +1 -1
  107. package/dist/meeting-info/meeting-info-v2.js +12 -5
  108. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  109. package/dist/meetings/index.js +304 -129
  110. package/dist/meetings/index.js.map +1 -1
  111. package/dist/meetings/meetings.types.js +6 -1
  112. package/dist/meetings/meetings.types.js.map +1 -1
  113. package/dist/meetings/request.js +39 -0
  114. package/dist/meetings/request.js.map +1 -1
  115. package/dist/meetings/util.js +116 -18
  116. package/dist/meetings/util.js.map +1 -1
  117. package/dist/member/index.js +10 -0
  118. package/dist/member/index.js.map +1 -1
  119. package/dist/member/types.js.map +1 -1
  120. package/dist/member/util.js +30 -0
  121. package/dist/member/util.js.map +1 -1
  122. package/dist/members/index.js +101 -43
  123. package/dist/members/index.js.map +1 -1
  124. package/dist/members/util.js +8 -1
  125. package/dist/members/util.js.map +1 -1
  126. package/dist/metrics/constants.js +7 -1
  127. package/dist/metrics/constants.js.map +1 -1
  128. package/dist/multistream/codec/constants.js +63 -0
  129. package/dist/multistream/codec/constants.js.map +1 -0
  130. package/dist/multistream/mediaRequestManager.js +62 -15
  131. package/dist/multistream/mediaRequestManager.js.map +1 -1
  132. package/dist/multistream/receiveSlot.js +9 -0
  133. package/dist/multistream/receiveSlot.js.map +1 -1
  134. package/dist/multistream/remoteMediaManager.js +32 -4
  135. package/dist/multistream/remoteMediaManager.js.map +1 -1
  136. package/dist/reachability/clusterReachability.js.map +1 -1
  137. package/dist/reachability/index.js +121 -83
  138. package/dist/reachability/index.js.map +1 -1
  139. package/dist/reachability/reachability.types.js +2 -0
  140. package/dist/reachability/reachability.types.js.map +1 -1
  141. package/dist/reachability/util.js +45 -0
  142. package/dist/reachability/util.js.map +1 -1
  143. package/dist/reactions/reactions.type.js.map +1 -1
  144. package/dist/recording-controller/index.js +1 -3
  145. package/dist/recording-controller/index.js.map +1 -1
  146. package/dist/roap/turnDiscovery.js +8 -1
  147. package/dist/roap/turnDiscovery.js.map +1 -1
  148. package/dist/types/annotation/index.d.ts +19 -0
  149. package/dist/types/common/errors/webex-errors.d.ts +36 -2
  150. package/dist/types/config.d.ts +3 -2
  151. package/dist/types/constants.d.ts +15 -2
  152. package/dist/types/controls-options-manager/index.d.ts +16 -0
  153. package/dist/types/hashTree/constants.d.ts +1 -0
  154. package/dist/types/hashTree/hashTreeParser.d.ts +201 -22
  155. package/dist/types/hashTree/utils.d.ts +7 -0
  156. package/dist/types/index.d.ts +4 -0
  157. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  158. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  159. package/dist/types/locus-info/index.d.ts +106 -8
  160. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  161. package/dist/types/locus-info/types.d.ts +22 -1
  162. package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
  163. package/dist/types/media/properties.d.ts +6 -2
  164. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  165. package/dist/types/meeting/index.d.ts +217 -16
  166. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  167. package/dist/types/meeting/request.d.ts +1 -0
  168. package/dist/types/meeting/util.d.ts +12 -1
  169. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  170. package/dist/types/meetings/index.d.ts +40 -19
  171. package/dist/types/meetings/meetings.types.d.ts +15 -0
  172. package/dist/types/meetings/request.d.ts +14 -0
  173. package/dist/types/member/index.d.ts +1 -0
  174. package/dist/types/member/types.d.ts +1 -0
  175. package/dist/types/member/util.d.ts +9 -0
  176. package/dist/types/members/index.d.ts +15 -2
  177. package/dist/types/members/util.d.ts +1 -5
  178. package/dist/types/metrics/constants.d.ts +6 -0
  179. package/dist/types/multistream/codec/constants.d.ts +7 -0
  180. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  181. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  182. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  183. package/dist/types/reachability/index.d.ts +10 -3
  184. package/dist/types/reachability/reachability.types.d.ts +7 -0
  185. package/dist/types/reachability/util.d.ts +17 -0
  186. package/dist/types/reactions/reactions.type.d.ts +3 -0
  187. package/dist/webinar/index.js +441 -252
  188. package/dist/webinar/index.js.map +1 -1
  189. package/package.json +26 -24
  190. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  191. package/src/aiEnableRequest/index.ts +16 -0
  192. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  193. package/src/annotation/index.ts +61 -29
  194. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  195. package/src/breakouts/breakout.ts +3 -1
  196. package/src/breakouts/events.ts +33 -11
  197. package/src/breakouts/index.ts +145 -3
  198. package/src/common/errors/webex-errors.ts +56 -3
  199. package/src/config.ts +3 -2
  200. package/src/constants.ts +23 -4
  201. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  202. package/src/controls-options-manager/index.ts +62 -10
  203. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  204. package/src/hashTree/constants.ts +7 -0
  205. package/src/hashTree/hashTreeParser.ts +861 -193
  206. package/src/hashTree/utils.ts +19 -0
  207. package/src/index.ts +7 -0
  208. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  209. package/src/interceptors/dataChannelAuthToken.ts +59 -12
  210. package/src/interceptors/locusRetry.ts +26 -5
  211. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  212. package/src/interpretation/index.ts +65 -10
  213. package/src/interpretation/interpretation.types.ts +11 -0
  214. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  215. package/src/locus-info/controlsUtils.ts +3 -1
  216. package/src/locus-info/index.ts +566 -164
  217. package/src/locus-info/infoUtils.ts +41 -6
  218. package/src/locus-info/types.ts +26 -1
  219. package/src/media/MediaConnectionAwaiter.ts +229 -196
  220. package/src/media/ai-docs/media-spec.md +267 -0
  221. package/src/media/index.ts +10 -1
  222. package/src/media/properties.ts +8 -3
  223. package/src/meeting/ai-docs/meeting-spec.md +401 -0
  224. package/src/meeting/in-meeting-actions.ts +8 -0
  225. package/src/meeting/index.ts +1085 -252
  226. package/src/meeting/locusMediaRequest.ts +106 -6
  227. package/src/meeting/muteState.ts +10 -1
  228. package/src/meeting/request.ts +11 -0
  229. package/src/meeting/util.ts +53 -9
  230. package/src/meeting/voicea-meeting.ts +1 -1
  231. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  232. package/src/meeting-info/meeting-info-v2.ts +11 -4
  233. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  234. package/src/meetings/index.ts +202 -81
  235. package/src/meetings/meetings.types.ts +19 -0
  236. package/src/meetings/request.ts +43 -0
  237. package/src/meetings/util.ts +117 -4
  238. package/src/member/ai-docs/member-spec.md +196 -0
  239. package/src/member/index.ts +10 -0
  240. package/src/member/types.ts +1 -0
  241. package/src/member/util.ts +29 -0
  242. package/src/members/ai-docs/members-spec.md +256 -0
  243. package/src/members/index.ts +70 -7
  244. package/src/members/util.ts +12 -4
  245. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  246. package/src/metrics/constants.ts +6 -0
  247. package/src/multistream/ai-docs/multistream-spec.md +292 -0
  248. package/src/multistream/codec/constants.ts +58 -0
  249. package/src/multistream/mediaRequestManager.ts +119 -28
  250. package/src/multistream/receiveSlot.ts +18 -0
  251. package/src/multistream/remoteMediaManager.ts +23 -1
  252. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  253. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  254. package/src/reachability/clusterReachability.ts +3 -2
  255. package/src/reachability/index.ts +47 -16
  256. package/src/reachability/reachability.types.ts +11 -0
  257. package/src/reachability/util.ts +36 -0
  258. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  259. package/src/reactions/reactions.type.ts +3 -0
  260. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  261. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  262. package/src/recording-controller/index.ts +1 -2
  263. package/src/roap/ai-docs/roap-spec.md +241 -0
  264. package/src/roap/turnDiscovery.ts +9 -1
  265. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  266. package/src/webinar/index.ts +247 -89
  267. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  268. package/test/unit/spec/annotation/index.ts +214 -182
  269. package/test/unit/spec/breakouts/breakout.ts +9 -3
  270. package/test/unit/spec/breakouts/events.ts +120 -2
  271. package/test/unit/spec/breakouts/index.ts +336 -15
  272. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  273. package/test/unit/spec/controls-options-manager/index.js +139 -32
  274. package/test/unit/spec/hashTree/hashTreeParser.ts +2451 -184
  275. package/test/unit/spec/hashTree/utils.ts +37 -0
  276. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
  277. package/test/unit/spec/interceptors/locusRetry.ts +234 -5
  278. package/test/unit/spec/interpretation/index.ts +119 -4
  279. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  280. package/test/unit/spec/locus-info/index.js +1014 -58
  281. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  282. package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
  283. package/test/unit/spec/media/index.ts +92 -0
  284. package/test/unit/spec/media/properties.ts +26 -26
  285. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  286. package/test/unit/spec/meeting/index.js +3462 -493
  287. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  288. package/test/unit/spec/meeting/muteState.js +81 -0
  289. package/test/unit/spec/meeting/request.js +12 -0
  290. package/test/unit/spec/meeting/utils.js +205 -19
  291. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  292. package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
  293. package/test/unit/spec/meetings/index.js +549 -49
  294. package/test/unit/spec/meetings/request.js +141 -0
  295. package/test/unit/spec/meetings/utils.js +402 -51
  296. package/test/unit/spec/member/index.js +7 -0
  297. package/test/unit/spec/member/util.js +89 -0
  298. package/test/unit/spec/members/index.js +216 -0
  299. package/test/unit/spec/members/request.js +37 -1
  300. package/test/unit/spec/members/utils.js +63 -0
  301. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  302. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  303. package/test/unit/spec/reachability/index.ts +128 -46
  304. package/test/unit/spec/reachability/util.ts +31 -0
  305. package/test/unit/spec/recording-controller/index.js +9 -8
  306. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  307. package/test/unit/spec/webinar/index.ts +935 -466
@@ -4,20 +4,23 @@
4
4
  import {WebexPlugin, config} from '@webex/webex-core';
5
5
  import uuid from 'uuid';
6
6
  import {get} from 'lodash';
7
- import {DataChannelTokenType} from '@webex/internal-plugin-llm';
7
+ import type LLMChannel from '@webex/internal-plugin-llm';
8
8
  import {
9
9
  _ID_,
10
+ EVENT_TRIGGERS,
10
11
  HEADERS,
11
12
  HTTP_VERBS,
12
13
  MEETINGS,
13
14
  SELF_ROLES,
14
15
  SHARE_STATUS,
15
16
  DEFAULT_LARGE_SCALE_WEBINAR_ATTENDEE_SEARCH_LIMIT,
16
- LLM_PRACTICE_SESSION,
17
+ LOCUS_LLM_EVENT,
17
18
  } from '../constants';
19
+ import Trigger from '../common/events/trigger-proxy';
18
20
 
19
21
  import WebinarCollection from './collection';
20
22
  import LoggerProxy from '../common/logs/logger-proxy';
23
+ import MeetingUtil from '../meeting/util';
21
24
  import {sanitizeParams} from './utils';
22
25
 
23
26
  /**
@@ -39,6 +42,21 @@ const Webinar = WebexPlugin.extend({
39
42
  meetingId: 'string',
40
43
  },
41
44
 
45
+ /**
46
+ * LLM channel for practice session, owned by this webinar instance.
47
+ * @private
48
+ * @type {LLMChannel|undefined}
49
+ */
50
+ _practiceSessionLLMChannel: undefined as LLMChannel | undefined,
51
+
52
+ /**
53
+ * Pending practice session datachannel token, saved from join response.
54
+ * Used when creating the practice session LLM channel.
55
+ * @private
56
+ * @type {string|undefined}
57
+ */
58
+ _pendingPracticeSessionDatachannelToken: undefined as string | undefined,
59
+
42
60
  /**
43
61
  * Calls this to clean up listeners
44
62
  * @returns {void}
@@ -98,13 +116,49 @@ const Webinar = WebexPlugin.extend({
98
116
  return {isPromoted, isDemoted};
99
117
  },
100
118
 
119
+ /**
120
+ * Resolves the meeting associated with this webinar instance, guarded against the
121
+ * meetingId pointer drifting onto an unrelated transient meeting (e.g. an inbound
122
+ * 1:1 call) that may exist in the meeting collection. Returns the meeting only when
123
+ * its locusUrl matches this webinar's tracked locusUrl. Returns undefined (with a
124
+ * warning) when the meeting cannot be resolved or when the webinar's locusUrl has
125
+ * not been initialized yet — callers must treat this as "no owned meeting" rather
126
+ * than fall through to an unvalidated lookup.
127
+ * @returns {object|undefined}
128
+ */
129
+ getValidatedWebinarMeeting() {
130
+ const meeting = this.webex.meetings.getMeetingByType(_ID_, this.meetingId);
131
+
132
+ if (!meeting) {
133
+ return undefined;
134
+ }
135
+
136
+ if (!this.locusUrl) {
137
+ LoggerProxy.logger.warn(
138
+ `Webinar:index#getValidatedWebinarMeeting --> skipping; webinar locusUrl is not yet initialized for meetingId ${this.meetingId}`
139
+ );
140
+
141
+ return undefined;
142
+ }
143
+
144
+ if (meeting.locusUrl !== this.locusUrl) {
145
+ LoggerProxy.logger.warn(
146
+ `Webinar:index#getValidatedWebinarMeeting --> skipping; meeting ${this.meetingId} locusUrl ${meeting.locusUrl} does not match webinar locusUrl ${this.locusUrl}`
147
+ );
148
+
149
+ return undefined;
150
+ }
151
+
152
+ return meeting;
153
+ },
154
+
101
155
  /**
102
156
  * should join practice session data channel or not
103
157
  * @param {Object} {isPromoted: boolean, isDemoted: boolean}} Role transition states
104
158
  * @returns {void}
105
159
  */
106
160
  updateStatusByRole({isPromoted, isDemoted}) {
107
- const meeting = this.webex.meetings.getMeetingByType(_ID_, this.meetingId);
161
+ const meeting = this.getValidatedWebinarMeeting();
108
162
 
109
163
  if (
110
164
  (isDemoted && meeting?.shareStatus === SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE) ||
@@ -127,35 +181,103 @@ const Webinar = WebexPlugin.extend({
127
181
  },
128
182
 
129
183
  /**
130
- * Disconnects the practice session data channel and removes its relay listener.
184
+ * Returns the practice session LLM channel binding, if connected.
185
+ * @returns {string|undefined}
186
+ */
187
+ getPracticeSessionBinding() {
188
+ return this._practiceSessionLLMChannel?.getBinding();
189
+ },
190
+
191
+ /**
192
+ * Returns whether the practice session LLM channel is connected.
193
+ * @returns {boolean}
194
+ */
195
+ isPracticeSessionLLMChannelConnected() {
196
+ return this._practiceSessionLLMChannel?.isConnected() ?? false;
197
+ },
198
+
199
+ /**
200
+ * Returns the practice session LLM channel's locus URL, if available.
201
+ * @returns {string|undefined}
202
+ */
203
+ getPracticeSessionLocusUrl() {
204
+ return this._practiceSessionLLMChannel?.getLocusUrl();
205
+ },
206
+
207
+ /**
208
+ * Stores the practice session datachannel token for later use when
209
+ * creating the practice session LLM channel.
210
+ * @param {string} token - The datachannel token to store
211
+ * @returns {void}
212
+ */
213
+ setPracticeSessionDatachannelToken(token: string) {
214
+ this._pendingPracticeSessionDatachannelToken = token;
215
+ },
216
+
217
+ /**
218
+ * Disconnects the practice session LLM channel and cleans up listeners.
131
219
  * @returns {Promise<void>}
132
220
  */
133
221
  async cleanupPSDataChannel() {
222
+ // Remove pending online listener if any
134
223
  if (this._pendingOnlineListener) {
135
- // @ts-ignore - Fix type
136
- this.webex.internal.llm.off('online', this._pendingOnlineListener);
224
+ const meeting = this.getValidatedWebinarMeeting();
225
+ meeting?.llmChannel?.off('online', this._pendingOnlineListener);
137
226
  this._pendingOnlineListener = null;
138
227
  }
139
228
 
140
- const meeting = this.webex.meetings.getMeetingByType(_ID_, this.meetingId);
229
+ const meeting = this.getValidatedWebinarMeeting();
141
230
 
142
- // @ts-ignore - Fix type
143
- await this.webex.internal.llm.disconnectLLM(
144
- {
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
+
238
+ return;
239
+ }
240
+
241
+ try {
242
+ await this._practiceSessionLLMChannel.disconnect({
145
243
  code: 3050,
146
244
  reason: 'done (permanent)',
147
- },
148
- LLM_PRACTICE_SESSION
149
- );
150
- // @ts-ignore - Fix type
151
- this.webex.internal.llm.off(
152
- `event:relay.event:${LLM_PRACTICE_SESSION}`,
153
- meeting?.processRelayEvent
154
- );
245
+ });
246
+ } catch (error) {
247
+ LoggerProxy.logger.error(
248
+ 'Webinar:index#cleanupPSDataChannel --> Failed to disconnect practice session LLM channel',
249
+ error
250
+ );
251
+ throw error;
252
+ } finally {
253
+ // Remove listeners from the channel
254
+ if (meeting) {
255
+ this._practiceSessionLLMChannel?.off('event:relay.event', meeting.processRelayEvent);
256
+ this._practiceSessionLLMChannel?.off(LOCUS_LLM_EVENT, meeting.processLocusLLMEvent);
257
+ this._practiceSessionLLMChannel?.off('online', meeting.handleLLMOnline);
258
+
259
+ // Switch annotation back to the meeting's default channel
260
+ if (meeting.llmChannel) {
261
+ meeting.annotation.registerChannel(meeting.llmChannel);
262
+ }
263
+ }
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
+ }
274
+ }
155
275
  },
156
276
 
157
277
  /**
158
278
  * Ensures practice-session token exists before registering the practice LLM channel.
279
+ * Caller is responsible for passing a meeting that has already been resolved via
280
+ * getValidatedWebinarMeeting() — this method does not re-validate ownership.
159
281
  * @param {object} meeting
160
282
  * @returns {Promise<string|undefined>}
161
283
  */
@@ -167,10 +289,10 @@ const Webinar = WebexPlugin.extend({
167
289
  return undefined;
168
290
  }
169
291
 
170
- // @ts-ignore
171
- const cachedToken = this.webex.internal.llm.getDatachannelToken(
172
- DataChannelTokenType.PracticeSession
173
- );
292
+ // Check for cached token on the channel or pending token
293
+ const cachedToken =
294
+ this._practiceSessionLLMChannel?.getDatachannelToken() ??
295
+ this._pendingPracticeSessionDatachannelToken;
174
296
 
175
297
  if (cachedToken) {
176
298
  return cachedToken;
@@ -178,17 +300,18 @@ const Webinar = WebexPlugin.extend({
178
300
 
179
301
  try {
180
302
  const refreshResponse = await meeting.refreshDataChannelToken();
181
- const {datachannelToken, dataChannelTokenType} = refreshResponse?.body ?? {};
303
+ const {datachannelToken} = refreshResponse?.body ?? {};
182
304
 
183
305
  if (!datachannelToken) {
184
306
  return undefined;
185
307
  }
186
308
 
187
- // @ts-ignore
188
- this.webex.internal.llm.setDatachannelToken(
189
- datachannelToken,
190
- dataChannelTokenType || DataChannelTokenType.PracticeSession
191
- );
309
+ // Store token on the channel if it exists, otherwise save for later
310
+ if (this._practiceSessionLLMChannel) {
311
+ this._practiceSessionLLMChannel.setDatachannelToken(datachannelToken);
312
+ } else {
313
+ this._pendingPracticeSessionDatachannelToken = datachannelToken;
314
+ }
192
315
 
193
316
  return datachannelToken;
194
317
  } catch (error) {
@@ -203,15 +326,16 @@ const Webinar = WebexPlugin.extend({
203
326
  },
204
327
 
205
328
  /**
206
- * Connects to low latency mercury and reconnects if the address has changed
207
- * It will also disconnect if called when the meeting has ended
329
+ * Connects practice session LLM channel. Creates a new channel if needed.
330
+ * Will disconnect if the meeting has ended or is no longer in practice session mode.
331
+ * Waits for the main LLM channel to be connected before connecting practice session.
208
332
  * @returns {Promise}
209
333
  */
210
334
  async updatePSDataChannel() {
211
335
  this._updatePSDataChannelSequence = (this._updatePSDataChannelSequence || 0) + 1;
212
336
  const invocationSequence = this._updatePSDataChannelSequence;
213
337
 
214
- const meeting = this.webex.meetings.getMeetingByType(_ID_, this.meetingId);
338
+ const meeting = this.getValidatedWebinarMeeting();
215
339
  const isPracticeSession = meeting?.isJoined() && this.isJoinPracticeSessionDataChannel();
216
340
 
217
341
  if (!isPracticeSession) {
@@ -224,48 +348,36 @@ const Webinar = WebexPlugin.extend({
224
348
  const {url = undefined, info: {practiceSessionDatachannelUrl = undefined} = {}} =
225
349
  meeting?.locusInfo || {};
226
350
 
227
- // @ts-ignore
228
- let practiceSessionDatachannelToken = this.webex.internal.llm.getDatachannelToken(
229
- DataChannelTokenType.PracticeSession
230
- );
231
-
232
- const isCaptionBoxOn = this.webex.internal.voicea.getIsCaptionBoxOn();
233
-
234
351
  if (!practiceSessionDatachannelUrl) {
235
352
  return undefined;
236
353
  }
237
- // @ts-ignore - Fix type
238
- if (this.webex.internal.llm.isConnected(LLM_PRACTICE_SESSION)) {
354
+
355
+ // If already connected to same URLs, skip reconnect
356
+ if (this._practiceSessionLLMChannel?.isConnected()) {
239
357
  if (
240
- // @ts-ignore - Fix type
241
- url === this.webex.internal.llm.getLocusUrl(LLM_PRACTICE_SESSION) &&
242
- // @ts-ignore - Fix type
243
- practiceSessionDatachannelUrl ===
244
- this.webex.internal.llm.getDatachannelUrl(LLM_PRACTICE_SESSION)
358
+ url === this._practiceSessionLLMChannel.getLocusUrl() &&
359
+ practiceSessionDatachannelUrl === this._practiceSessionLLMChannel.getDatachannelUrl()
245
360
  ) {
246
361
  return undefined;
247
362
  }
248
-
363
+ // URLs changed, disconnect existing channel
249
364
  await this.cleanupPSDataChannel();
250
365
  }
251
366
 
252
- // Ensure the default session data channel is connected before connecting the practice session.
367
+ // Ensure the default session LLM channel is connected before connecting the practice session.
253
368
  // Subscribe before checking isConnected() to avoid a race where the 'online' event fires
254
- // between the check and the subscription — Mercury does not replay missed events.
255
- if (!this._pendingOnlineListener) {
369
+ // between the check and the subscription — the channel does not replay missed events.
370
+ if (!this._pendingOnlineListener && meeting?.llmChannel) {
256
371
  const onDefaultSessionConnected = () => {
257
372
  this._pendingOnlineListener = null;
258
- // @ts-ignore - Fix type
259
- this.webex.internal.llm.off('online', onDefaultSessionConnected);
373
+ meeting.llmChannel?.off('online', onDefaultSessionConnected);
260
374
  this.updatePSDataChannel();
261
375
  };
262
376
  this._pendingOnlineListener = onDefaultSessionConnected;
263
- // @ts-ignore - Fix type
264
- this.webex.internal.llm.on('online', onDefaultSessionConnected);
377
+ meeting.llmChannel.on('online', onDefaultSessionConnected);
265
378
  }
266
379
 
267
- // @ts-ignore - Fix type
268
- if (!this.webex.internal.llm.isConnected()) {
380
+ if (!meeting?.llmChannel?.isConnected()) {
269
381
  LoggerProxy.logger.info(
270
382
  'Webinar:index#updatePSDataChannel --> default session not yet connected, deferring practice session connect.'
271
383
  );
@@ -275,12 +387,16 @@ const Webinar = WebexPlugin.extend({
275
387
 
276
388
  // Default session is already connected — cancel the pending listener and proceed
277
389
  if (this._pendingOnlineListener) {
278
- // @ts-ignore - Fix type
279
- this.webex.internal.llm.off('online', this._pendingOnlineListener);
390
+ meeting.llmChannel.off('online', this._pendingOnlineListener);
280
391
  this._pendingOnlineListener = null;
281
392
  }
282
393
 
283
- const refreshedPracticeSessionToken = await this.ensurePracticeSessionDatachannelToken(meeting);
394
+ // Get token from pending or refresh if needed
395
+ let practiceSessionDatachannelToken =
396
+ this._pendingPracticeSessionDatachannelToken ??
397
+ this._practiceSessionLLMChannel?.getDatachannelToken();
398
+
399
+ const refreshedToken = await this.ensurePracticeSessionDatachannelToken(meeting);
284
400
 
285
401
  const latestPracticeSessionDatachannelUrl = get(
286
402
  meeting,
@@ -299,39 +415,64 @@ const Webinar = WebexPlugin.extend({
299
415
  return undefined;
300
416
  }
301
417
 
302
- if (refreshedPracticeSessionToken) {
303
- practiceSessionDatachannelToken = refreshedPracticeSessionToken;
418
+ if (refreshedToken) {
419
+ practiceSessionDatachannelToken = refreshedToken;
304
420
  }
305
421
 
422
+ // Create a new practice session LLM channel
306
423
  // @ts-ignore - Fix type
307
- return this.webex.internal.llm
308
- .registerAndConnect(
309
- url,
310
- practiceSessionDatachannelUrl,
311
- practiceSessionDatachannelToken,
312
- LLM_PRACTICE_SESSION
313
- )
314
- .then((registerAndConnectResult) => {
315
- // @ts-ignore - Fix type
316
- this.webex.internal.llm.off(
317
- `event:relay.event:${LLM_PRACTICE_SESSION}`,
318
- meeting?.processRelayEvent
319
- );
320
- // @ts-ignore - Fix type
321
- this.webex.internal.llm.on(
322
- `event:relay.event:${LLM_PRACTICE_SESSION}`,
323
- meeting?.processRelayEvent
324
- );
325
- // @ts-ignore - Fix type
326
- this.webex.internal.voicea?.announce?.();
327
- if (isCaptionBoxOn) {
328
- this.webex.internal.voicea.updateSubchannelSubscriptions({subscribe: ['transcription']});
424
+ const psChannel = this.webex.internal.llm.createChannel();
425
+ this._practiceSessionLLMChannel = psChannel;
426
+
427
+ // Set up refresh handler before registration
428
+ psChannel.setRefreshHandler(() => meeting.refreshDataChannelToken());
429
+
430
+ // If we have a pending token, store it on the channel
431
+ if (this._pendingPracticeSessionDatachannelToken) {
432
+ psChannel.setDatachannelToken(this._pendingPracticeSessionDatachannelToken);
433
+ this._pendingPracticeSessionDatachannelToken = undefined;
434
+ }
435
+
436
+ return psChannel
437
+ .registerAndConnect(url, practiceSessionDatachannelUrl, practiceSessionDatachannelToken)
438
+ .then(async (registerAndConnectResult) => {
439
+ // Check if this channel is still the current one (race condition guard)
440
+ if (this._practiceSessionLLMChannel !== psChannel) {
441
+ psChannel.disconnect({code: 3050, reason: 'replaced'}).catch(() => {});
442
+
443
+ return undefined;
329
444
  }
445
+ // Register event listeners on the practice session channel
446
+ psChannel.off('event:relay.event', meeting.processRelayEvent);
447
+ psChannel.on('event:relay.event', meeting.processRelayEvent);
448
+ psChannel.off(LOCUS_LLM_EVENT, meeting.processLocusLLMEvent);
449
+ psChannel.on(LOCUS_LLM_EVENT, meeting.processLocusLLMEvent);
450
+ psChannel.off('online', meeting.handleLLMOnline);
451
+ psChannel.on('online', meeting.handleLLMOnline);
452
+
453
+ // Switch annotation to practice session channel
454
+ meeting.annotation.registerChannel(psChannel);
455
+
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).
459
+ if (meeting.voiceaChannel) {
460
+ await meeting.voiceaChannel.switchLLMChannel(psChannel);
461
+ meeting.startTranscriptionIfNeeded();
462
+ }
463
+
330
464
  LoggerProxy.logger.info(
331
- `Webinar:index#updatePSDataChannel --> enabled to receive relay events for default session for ${LLM_PRACTICE_SESSION}!`
465
+ 'Webinar:index#updatePSDataChannel --> enabled to receive relay events for practice session!'
332
466
  );
333
467
 
334
468
  return Promise.resolve(registerAndConnectResult);
469
+ })
470
+ .catch((error) => {
471
+ // Clean up the channel on failure, but only if it's still the current one
472
+ if (this._practiceSessionLLMChannel === psChannel) {
473
+ this._practiceSessionLLMChannel = undefined;
474
+ }
475
+ throw error;
335
476
  });
336
477
  },
337
478
 
@@ -341,6 +482,8 @@ const Webinar = WebexPlugin.extend({
341
482
  * @returns {Promise}
342
483
  */
343
484
  setPracticeSessionState(enabled) {
485
+ const meeting = this.getValidatedWebinarMeeting();
486
+
344
487
  return this.request({
345
488
  method: HTTP_VERBS.PATCH,
346
489
  uri: `${this.locusUrl}/controls`,
@@ -349,10 +492,16 @@ const Webinar = WebexPlugin.extend({
349
492
  enabled,
350
493
  },
351
494
  },
352
- }).catch((error) => {
353
- LoggerProxy.logger.error('Meeting:webinar#setPracticeSessionState failed', error);
354
- throw error;
355
- });
495
+ })
496
+ .then((response) => {
497
+ MeetingUtil.updateLocusFromApiResponse(meeting, response);
498
+
499
+ return response;
500
+ })
501
+ .catch((error) => {
502
+ LoggerProxy.logger.error('Meeting:webinar#setPracticeSessionState failed', error);
503
+ throw error;
504
+ });
356
505
  },
357
506
 
358
507
  /**
@@ -532,7 +681,14 @@ const Webinar = WebexPlugin.extend({
532
681
  * @returns {Promise}
533
682
  */
534
683
  async searchLargeScaleWebinarAttendees(payload) {
535
- const meeting = this.webex.meetings.getMeetingByType(_ID_, this.meetingId);
684
+ const meeting = this.getValidatedWebinarMeeting();
685
+ if (!meeting) {
686
+ LoggerProxy.logger.error(
687
+ 'Meeting:webinar5k#searchLargeScaleWebinarAttendees failed --> webinar meeting could not be validated'
688
+ );
689
+ throw new Error('Meeting:webinar5k#Webinar meeting is not resolvable for the current locus');
690
+ }
691
+
536
692
  const rawParams = {
537
693
  search_text: payload?.queryString,
538
694
  limit: payload?.limit ?? DEFAULT_LARGE_SCALE_WEBINAR_ATTENDEE_SEARCH_LIMIT,
@@ -540,7 +696,9 @@ const Webinar = WebexPlugin.extend({
540
696
  };
541
697
  const attendeeSearchUrl = meeting?.locusInfo?.links?.resources?.attendeeSearch?.url;
542
698
  if (!attendeeSearchUrl) {
543
- LoggerProxy.logger.error(`Meeting:webinar5k#searchLargeScaleWebinarAttendees failed`);
699
+ LoggerProxy.logger.error(
700
+ 'Meeting:webinar5k#searchLargeScaleWebinarAttendees failed --> attendee search url unavailable'
701
+ );
544
702
  throw new Error('Meeting:webinar5k#Attendee search url is not available');
545
703
  }
546
704
 
@@ -55,6 +55,27 @@ describe('plugin-meetings', () => {
55
55
  });
56
56
  });
57
57
 
58
+ describe('#locusUrlUpdate', () => {
59
+ it('should update the locusUrl property', () => {
60
+ const testLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id';
61
+
62
+ aiEnableRequest.locusUrlUpdate(testLocusUrl);
63
+
64
+ assert.equal(aiEnableRequest.locusUrl, testLocusUrl);
65
+ });
66
+
67
+ it('should handle updating locusUrl multiple times', () => {
68
+ const firstUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id-1';
69
+ const secondUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id-2';
70
+
71
+ aiEnableRequest.locusUrlUpdate(firstUrl);
72
+ assert.equal(aiEnableRequest.locusUrl, firstUrl);
73
+
74
+ aiEnableRequest.locusUrlUpdate(secondUrl);
75
+ assert.equal(aiEnableRequest.locusUrl, secondUrl);
76
+ });
77
+ });
78
+
58
79
  describe('#selfParticipantIdUpdate', () => {
59
80
  it('should update the selfParticipantId property', () => {
60
81
  const testSelfParticipantId = 'participant-123';
@@ -254,6 +275,71 @@ describe('plugin-meetings', () => {
254
275
  sinon.assert.notCalled(triggerSpy);
255
276
  });
256
277
 
278
+ it('should not trigger event when locusUrl does not match', () => {
279
+ const testLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id';
280
+ const differentLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/different-id';
281
+
282
+ aiEnableRequest.locusUrl = testLocusUrl;
283
+
284
+ // Reset the spy after setting locusUrl to avoid counting property change events
285
+ triggerSpy.resetHistory();
286
+
287
+ aiEnableRequest.listenToApprovalRequests();
288
+
289
+ const event = {
290
+ data: {
291
+ locusUrl: differentLocusUrl,
292
+ approval: {
293
+ resourceType: AI_ENABLE_REQUEST.RESOURCE_TYPE,
294
+ receivers: [{participantId: testSelfParticipantId}],
295
+ initiator: {participantId: testInitiatorId},
296
+ actionType: AI_ENABLE_REQUEST.ACTION_TYPE.REQUESTED,
297
+ url: testUrl,
298
+ },
299
+ },
300
+ };
301
+
302
+ webex.internal.mercury.emit(`event:${LOCUSEVENT.APPROVAL_REQUEST}`, event);
303
+
304
+ sinon.assert.notCalled(triggerSpy);
305
+ });
306
+
307
+ it('should trigger event when locusUrl matches', () => {
308
+ const testLocusUrl = 'https://locus-a.wbx2.com/locus/api/v1/loci/test-id';
309
+
310
+ aiEnableRequest.locusUrl = testLocusUrl;
311
+
312
+ // Reset the spy after setting locusUrl to avoid counting property change events
313
+ triggerSpy.resetHistory();
314
+
315
+ aiEnableRequest.listenToApprovalRequests();
316
+
317
+ const event = {
318
+ data: {
319
+ locusUrl: testLocusUrl,
320
+ approval: {
321
+ resourceType: AI_ENABLE_REQUEST.RESOURCE_TYPE,
322
+ receivers: [{participantId: testSelfParticipantId}],
323
+ initiator: {participantId: testInitiatorId},
324
+ actionType: AI_ENABLE_REQUEST.ACTION_TYPE.REQUESTED,
325
+ url: testUrl,
326
+ },
327
+ },
328
+ };
329
+
330
+ webex.internal.mercury.emit(`event:${LOCUSEVENT.APPROVAL_REQUEST}`, event);
331
+
332
+ sinon.assert.calledOnce(triggerSpy);
333
+ sinon.assert.calledWith(triggerSpy, AI_ENABLE_REQUEST.EVENTS.APPROVAL_REQUEST_ARRIVED, {
334
+ actionType: AI_ENABLE_REQUEST.ACTION_TYPE.REQUESTED,
335
+ isApprover: true,
336
+ isInitiator: false,
337
+ initiatorId: testInitiatorId,
338
+ approverId: testSelfParticipantId,
339
+ url: testUrl,
340
+ });
341
+ });
342
+
257
343
  it('should handle events with different action types', () => {
258
344
  aiEnableRequest.listenToApprovalRequests();
259
345