@webex/plugin-meetings 3.12.0 → 3.13.0-next.2

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 (320) 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 +208 -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 +28 -0
  40. package/assets/e2ee-0.0.1.js +2 -0
  41. package/assets/e2ee-0.0.1.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-0.0.1.js +2 -0
  47. package/dist/assets/e2ee-0.0.1.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 +4 -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/constants.js +11 -1
  61. package/dist/controls-options-manager/constants.js.map +1 -1
  62. package/dist/controls-options-manager/index.js +67 -29
  63. package/dist/controls-options-manager/index.js.map +1 -1
  64. package/dist/controls-options-manager/util.js +91 -0
  65. package/dist/controls-options-manager/util.js.map +1 -1
  66. package/dist/hashTree/constants.js +13 -1
  67. package/dist/hashTree/constants.js.map +1 -1
  68. package/dist/hashTree/hashTreeParser.js +1245 -404
  69. package/dist/hashTree/hashTreeParser.js.map +1 -1
  70. package/dist/hashTree/utils.js +42 -0
  71. package/dist/hashTree/utils.js.map +1 -1
  72. package/dist/index.js +8 -0
  73. package/dist/index.js.map +1 -1
  74. package/dist/interceptors/dataChannelAuthToken.js +58 -16
  75. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  76. package/dist/interceptors/locusRetry.js +24 -9
  77. package/dist/interceptors/locusRetry.js.map +1 -1
  78. package/dist/interpretation/index.js +55 -12
  79. package/dist/interpretation/index.js.map +1 -1
  80. package/dist/interpretation/interpretation.types.js +7 -0
  81. package/dist/interpretation/interpretation.types.js.map +1 -0
  82. package/dist/interpretation/siLanguage.js +1 -1
  83. package/dist/locus-info/controlsUtils.js +4 -1
  84. package/dist/locus-info/controlsUtils.js.map +1 -1
  85. package/dist/locus-info/index.js +914 -196
  86. package/dist/locus-info/index.js.map +1 -1
  87. package/dist/locus-info/infoUtils.js +36 -5
  88. package/dist/locus-info/infoUtils.js.map +1 -1
  89. package/dist/locus-info/types.js +20 -0
  90. package/dist/locus-info/types.js.map +1 -1
  91. package/dist/media/MediaConnectionAwaiter.js +229 -166
  92. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  93. package/dist/media/index.js +8 -2
  94. package/dist/media/index.js.map +1 -1
  95. package/dist/media/properties.js +4 -5
  96. package/dist/media/properties.js.map +1 -1
  97. package/dist/meeting/in-meeting-actions.js +5 -1
  98. package/dist/meeting/in-meeting-actions.js.map +1 -1
  99. package/dist/meeting/index.js +1931 -887
  100. package/dist/meeting/index.js.map +1 -1
  101. package/dist/meeting/locusMediaRequest.js +229 -82
  102. package/dist/meeting/locusMediaRequest.js.map +1 -1
  103. package/dist/meeting/muteState.js +10 -1
  104. package/dist/meeting/muteState.js.map +1 -1
  105. package/dist/meeting/request.js +5 -2
  106. package/dist/meeting/request.js.map +1 -1
  107. package/dist/meeting/util.js +42 -3
  108. package/dist/meeting/util.js.map +1 -1
  109. package/dist/meeting/voicea-meeting.js +2 -1
  110. package/dist/meeting/voicea-meeting.js.map +1 -1
  111. package/dist/meeting-info/meeting-info-v2.js +12 -5
  112. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  113. package/dist/meetings/index.js +322 -129
  114. package/dist/meetings/index.js.map +1 -1
  115. package/dist/meetings/meetings.types.js +6 -1
  116. package/dist/meetings/meetings.types.js.map +1 -1
  117. package/dist/meetings/request.js +39 -0
  118. package/dist/meetings/request.js.map +1 -1
  119. package/dist/meetings/util.js +116 -18
  120. package/dist/meetings/util.js.map +1 -1
  121. package/dist/member/index.js +10 -0
  122. package/dist/member/index.js.map +1 -1
  123. package/dist/member/types.js.map +1 -1
  124. package/dist/member/util.js +30 -0
  125. package/dist/member/util.js.map +1 -1
  126. package/dist/members/index.js +101 -43
  127. package/dist/members/index.js.map +1 -1
  128. package/dist/members/util.js +8 -1
  129. package/dist/members/util.js.map +1 -1
  130. package/dist/metrics/constants.js +11 -1
  131. package/dist/metrics/constants.js.map +1 -1
  132. package/dist/multistream/codec/constants.js +63 -0
  133. package/dist/multistream/codec/constants.js.map +1 -0
  134. package/dist/multistream/mediaRequestManager.js +62 -15
  135. package/dist/multistream/mediaRequestManager.js.map +1 -1
  136. package/dist/multistream/receiveSlot.js +9 -0
  137. package/dist/multistream/receiveSlot.js.map +1 -1
  138. package/dist/multistream/remoteMediaManager.js +32 -4
  139. package/dist/multistream/remoteMediaManager.js.map +1 -1
  140. package/dist/multistream/sendSlotManager.js +127 -3
  141. package/dist/multistream/sendSlotManager.js.map +1 -1
  142. package/dist/reachability/clusterReachability.js.map +1 -1
  143. package/dist/reachability/index.js +121 -83
  144. package/dist/reachability/index.js.map +1 -1
  145. package/dist/reachability/reachability.types.js +2 -0
  146. package/dist/reachability/reachability.types.js.map +1 -1
  147. package/dist/reachability/util.js +45 -0
  148. package/dist/reachability/util.js.map +1 -1
  149. package/dist/reactions/reactions.type.js.map +1 -1
  150. package/dist/recording-controller/index.js +1 -3
  151. package/dist/recording-controller/index.js.map +1 -1
  152. package/dist/roap/turnDiscovery.js +8 -1
  153. package/dist/roap/turnDiscovery.js.map +1 -1
  154. package/dist/types/annotation/index.d.ts +19 -0
  155. package/dist/types/common/errors/webex-errors.d.ts +36 -2
  156. package/dist/types/config.d.ts +4 -2
  157. package/dist/types/constants.d.ts +15 -2
  158. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  159. package/dist/types/controls-options-manager/index.d.ts +16 -0
  160. package/dist/types/hashTree/constants.d.ts +2 -0
  161. package/dist/types/hashTree/hashTreeParser.d.ts +230 -18
  162. package/dist/types/hashTree/utils.d.ts +18 -0
  163. package/dist/types/index.d.ts +4 -0
  164. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  165. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  166. package/dist/types/locus-info/index.d.ts +151 -15
  167. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  168. package/dist/types/locus-info/types.d.ts +28 -1
  169. package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
  170. package/dist/types/media/properties.d.ts +6 -2
  171. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  172. package/dist/types/meeting/index.d.ts +247 -13
  173. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  174. package/dist/types/meeting/request.d.ts +1 -0
  175. package/dist/types/meeting/util.d.ts +12 -1
  176. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  177. package/dist/types/meetings/index.d.ts +40 -19
  178. package/dist/types/meetings/meetings.types.d.ts +15 -0
  179. package/dist/types/meetings/request.d.ts +14 -0
  180. package/dist/types/member/index.d.ts +1 -0
  181. package/dist/types/member/types.d.ts +1 -0
  182. package/dist/types/member/util.d.ts +9 -0
  183. package/dist/types/members/index.d.ts +15 -2
  184. package/dist/types/members/util.d.ts +1 -5
  185. package/dist/types/metrics/constants.d.ts +10 -0
  186. package/dist/types/multistream/codec/constants.d.ts +7 -0
  187. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  188. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  189. package/dist/types/multistream/sendSlotManager.d.ts +28 -2
  190. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  191. package/dist/types/reachability/index.d.ts +10 -3
  192. package/dist/types/reachability/reachability.types.d.ts +7 -0
  193. package/dist/types/reachability/util.d.ts +17 -0
  194. package/dist/types/reactions/reactions.type.d.ts +3 -0
  195. package/dist/webinar/index.js +539 -245
  196. package/dist/webinar/index.js.map +1 -1
  197. package/package.json +26 -24
  198. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  199. package/src/aiEnableRequest/index.ts +16 -0
  200. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  201. package/src/annotation/index.ts +61 -29
  202. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  203. package/src/breakouts/breakout.ts +3 -1
  204. package/src/breakouts/events.ts +33 -11
  205. package/src/breakouts/index.ts +145 -3
  206. package/src/common/errors/webex-errors.ts +56 -3
  207. package/src/config.ts +8 -3
  208. package/src/constants.ts +23 -4
  209. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  210. package/src/controls-options-manager/constants.ts +14 -1
  211. package/src/controls-options-manager/index.ts +87 -28
  212. package/src/controls-options-manager/util.ts +81 -1
  213. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  214. package/src/hashTree/constants.ts +16 -0
  215. package/src/hashTree/hashTreeParser.ts +1021 -214
  216. package/src/hashTree/utils.ts +36 -0
  217. package/src/index.ts +7 -0
  218. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  219. package/src/interceptors/dataChannelAuthToken.ts +59 -12
  220. package/src/interceptors/locusRetry.ts +26 -5
  221. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  222. package/src/interpretation/index.ts +65 -10
  223. package/src/interpretation/interpretation.types.ts +11 -0
  224. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  225. package/src/locus-info/controlsUtils.ts +3 -1
  226. package/src/locus-info/index.ts +907 -184
  227. package/src/locus-info/infoUtils.ts +41 -6
  228. package/src/locus-info/types.ts +33 -1
  229. package/src/media/MediaConnectionAwaiter.ts +229 -196
  230. package/src/media/ai-docs/media-spec.md +267 -0
  231. package/src/media/index.ts +10 -1
  232. package/src/media/properties.ts +8 -3
  233. package/src/meeting/ai-docs/meeting-spec.md +404 -0
  234. package/src/meeting/in-meeting-actions.ts +8 -0
  235. package/src/meeting/index.ts +1237 -254
  236. package/src/meeting/locusMediaRequest.ts +106 -6
  237. package/src/meeting/muteState.ts +10 -1
  238. package/src/meeting/request.ts +11 -0
  239. package/src/meeting/util.ts +53 -8
  240. package/src/meeting/voicea-meeting.ts +1 -1
  241. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  242. package/src/meeting-info/meeting-info-v2.ts +11 -4
  243. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  244. package/src/meetings/index.ts +224 -80
  245. package/src/meetings/meetings.types.ts +19 -0
  246. package/src/meetings/request.ts +43 -0
  247. package/src/meetings/util.ts +117 -4
  248. package/src/member/ai-docs/member-spec.md +196 -0
  249. package/src/member/index.ts +10 -0
  250. package/src/member/types.ts +1 -0
  251. package/src/member/util.ts +29 -0
  252. package/src/members/ai-docs/members-spec.md +256 -0
  253. package/src/members/index.ts +70 -7
  254. package/src/members/util.ts +12 -4
  255. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  256. package/src/metrics/constants.ts +11 -0
  257. package/src/multistream/ai-docs/multistream-spec.md +295 -0
  258. package/src/multistream/codec/constants.ts +58 -0
  259. package/src/multistream/mediaRequestManager.ts +119 -28
  260. package/src/multistream/receiveSlot.ts +18 -0
  261. package/src/multistream/remoteMediaManager.ts +23 -1
  262. package/src/multistream/sendSlotManager.ts +112 -4
  263. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  264. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  265. package/src/reachability/clusterReachability.ts +3 -2
  266. package/src/reachability/index.ts +47 -16
  267. package/src/reachability/reachability.types.ts +11 -0
  268. package/src/reachability/util.ts +36 -0
  269. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  270. package/src/reactions/reactions.type.ts +3 -0
  271. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  272. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  273. package/src/recording-controller/index.ts +1 -2
  274. package/src/roap/ai-docs/roap-spec.md +241 -0
  275. package/src/roap/turnDiscovery.ts +9 -1
  276. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  277. package/src/webinar/index.ts +333 -73
  278. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  279. package/test/unit/spec/annotation/index.ts +214 -182
  280. package/test/unit/spec/breakouts/breakout.ts +9 -3
  281. package/test/unit/spec/breakouts/events.ts +120 -2
  282. package/test/unit/spec/breakouts/index.ts +336 -15
  283. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  284. package/test/unit/spec/controls-options-manager/index.js +244 -29
  285. package/test/unit/spec/controls-options-manager/util.js +165 -0
  286. package/test/unit/spec/hashTree/hashTreeParser.ts +3126 -238
  287. package/test/unit/spec/hashTree/utils.ts +125 -1
  288. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
  289. package/test/unit/spec/interceptors/locusRetry.ts +234 -5
  290. package/test/unit/spec/interpretation/index.ts +119 -4
  291. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  292. package/test/unit/spec/locus-info/index.js +1880 -136
  293. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  294. package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
  295. package/test/unit/spec/media/index.ts +92 -0
  296. package/test/unit/spec/media/properties.ts +26 -26
  297. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  298. package/test/unit/spec/meeting/index.js +3697 -501
  299. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  300. package/test/unit/spec/meeting/muteState.js +81 -0
  301. package/test/unit/spec/meeting/request.js +12 -0
  302. package/test/unit/spec/meeting/utils.js +206 -16
  303. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  304. package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
  305. package/test/unit/spec/meetings/index.js +586 -53
  306. package/test/unit/spec/meetings/request.js +141 -0
  307. package/test/unit/spec/meetings/utils.js +402 -51
  308. package/test/unit/spec/member/index.js +7 -0
  309. package/test/unit/spec/member/util.js +89 -0
  310. package/test/unit/spec/members/index.js +216 -0
  311. package/test/unit/spec/members/request.js +37 -1
  312. package/test/unit/spec/members/utils.js +63 -0
  313. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  314. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  315. package/test/unit/spec/multistream/sendSlotManager.ts +165 -38
  316. package/test/unit/spec/reachability/index.ts +128 -46
  317. package/test/unit/spec/reachability/util.ts +31 -0
  318. package/test/unit/spec/recording-controller/index.js +9 -8
  319. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  320. package/test/unit/spec/webinar/index.ts +982 -328
@@ -1,5 +1,6 @@
1
- import {DISPLAY_HINTS} from '../constants';
1
+ import {CONTROLS, DISPLAY_HINTS, HTTP_VERBS} from '../constants';
2
2
  import {Control} from './enums';
3
+ import {AUDIO_CONTROL_BODY_KEYS} from './constants';
3
4
  import {
4
5
  ControlConfig,
5
6
  AudioProperties,
@@ -400,6 +401,85 @@ class Utils {
400
401
 
401
402
  return determinant;
402
403
  }
404
+
405
+ /**
406
+ * Check if all body keys represent audio controls.
407
+ *
408
+ * @param {Record<string, any>} body - The request body to inspect.
409
+ * @returns {boolean} - True if every key in the body is an audio control key.
410
+ */
411
+ public static isAudioControl(body: Record<string, any>): boolean {
412
+ return Object.keys(body).every((key) => AUDIO_CONTROL_BODY_KEYS.has(key));
413
+ }
414
+
415
+ /**
416
+ * Check if the current locus URL differs from the main locus URL,
417
+ * indicating a breakout session.
418
+ *
419
+ * @param {string} locusUrl - The current locus URL.
420
+ * @param {string} [mainLocusUrl] - The main locus URL.
421
+ * @returns {boolean} - True if in a breakout session.
422
+ */
423
+ public static isBreakoutLocusUrl(locusUrl: string, mainLocusUrl?: string): boolean {
424
+ return Boolean(mainLocusUrl) && mainLocusUrl !== locusUrl;
425
+ }
426
+
427
+ /**
428
+ * Resolve the target URL and extra body fields for a controls request,
429
+ * handling breakout session routing. Note: This is a pure computation function.
430
+ * It does not validate that locusUrl is
431
+ * defined. Callers must guard against falsy locusUrl before
432
+ * invoking this function.
433
+ * Mixed audio and non-audio keys in a single body (e.g., {audio: {...},
434
+ * raiseHand: {...}}) are treated as non-audio and routed to mainLocusUrl with
435
+ * authorizingLocusUrl. This means the audio portion would go through unsupported
436
+ * cross-locus authorization. Callers must not produce mixed payloads — update()
437
+ * sends each control scope as a separate request, and setControls() only handles
438
+ * audio-related settings.
439
+ *
440
+ * The authorizingLocusUrl mechanism on PATCH /loci/{lid}/controls is not supported
441
+ * for audio control updates (mute/unmute, muteOnEntry, disallowUnmute).
442
+ * Audio controls are not wired into the cross-locus GraphQL authorization path that
443
+ * other control types (raiseHand, viewParticipantList, admit, reactions, etc.) use.
444
+ * Specifically, the GraphQL authorization layer does not recognize audio as a control
445
+ * type eligible for remote locus authorization.
446
+ * This means authorizingLocusUrl is effectively ignored for audio controls and the
447
+ * server evaluates the request against the target locus only, where the host may not
448
+ * be currently joined.
449
+ * Audio control updates must be sent directly to the locus the user is currently in.
450
+ * If the host is in a breakout and wants to mute participants in that breakout, the
451
+ * request should target the breakout locus URL directly, not the main session locus
452
+ * with authorizingLocusUrl.
453
+ * Meeting-wide audio control actions (e.g., muting panelists across all breakouts
454
+ * from a single request) are not currently supported through this mechanism.
455
+ *
456
+ * @param {object} options
457
+ * @param {Record<string, any>} options.body - The request body.
458
+ * @param {string} options.locusUrl - The current locus URL. Must be defined (callers must validate).
459
+ * @param {string} [options.mainLocusUrl] - The main locus URL.
460
+ * @returns {{ uri: string, body: Record<string, any>, method: string }}
461
+ */
462
+ public static getControlsRequestParams(options: {
463
+ body: Record<string, any>;
464
+ locusUrl: string;
465
+ mainLocusUrl?: string;
466
+ }): {
467
+ uri: string;
468
+ body: Record<string, any>;
469
+ method: string;
470
+ } {
471
+ const {body, locusUrl, mainLocusUrl} = options;
472
+
473
+ const isAudio = Utils.isAudioControl(body);
474
+ const inBreakout = Utils.isBreakoutLocusUrl(locusUrl, mainLocusUrl);
475
+ const targetUrl = inBreakout && !isAudio ? mainLocusUrl : locusUrl;
476
+
477
+ return {
478
+ uri: `${targetUrl}/${CONTROLS}`,
479
+ body: inBreakout && !isAudio ? {...body, authorizingLocusUrl: locusUrl} : body,
480
+ method: HTTP_VERBS.PATCH,
481
+ };
482
+ }
403
483
  }
404
484
 
405
485
  export default Utils;
@@ -0,0 +1,267 @@
1
+ <!-- sdd-generated-metadata
2
+ doc_kind: module-spec
3
+ generated_from: module-spec@0.2.2
4
+ generator_plugin: repo-annotation@1.0.5+codex.20260818094939
5
+ generated_by: codex
6
+ approved_by: repository user
7
+ updated_at: 2026-09-08T00:00:00Z
8
+ validation_status: pass-with-warnings
9
+ -->
10
+ # HASH TREE — SPEC
11
+
12
+ > Start here → root [`AGENTS.md`](../../../AGENTS.md) · router [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md) · system [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md). This is the canonical source-local spec for `src/hashTree/`.
13
+
14
+ ## Metadata
15
+
16
+ | Field | Value |
17
+ |---|---|
18
+ | Module id | `hashTree` |
19
+ | Source path(s) | `src/hashTree/` |
20
+ | Parent spec | — |
21
+ | Doc kind | Module spec |
22
+ | Coverage score | 93% assessed 2026-08-22; 13/14 mandatory fields present; all critical and Important fields present; one noncritical polish gap remains; pending independent validation of the participant-role repair |
23
+ | Generated from | `module-spec` @ SDLC template library `0.2.2` |
24
+ | generated_by / approved_by / updated_at | codex / repository user / 2026-09-08T00:00:00Z |
25
+ | Revalidated against | `b7b93b443e` (manual diff review of `f9a29f61..b7b93b443e`; not a generator/validator tool run) |
26
+ | Validation status | pass-with-warnings |
27
+
28
+ ## Evidence Rules
29
+
30
+ Requirements cite current implementation and mirrored unit-test paths. Current code wins over retained prose when they conflict; commit and PR history are excluded by repository-owner decision. Missing test evidence is stated as a gap rather than inferred.
31
+
32
+ ## Source Material Register
33
+
34
+ | Source material | Scope | Decision | Detail location or disposition |
35
+ |---|---|---|---|
36
+ | No routed legacy module spec | overview / API / behavior / tests | none; generated from current hash-tree code and tests |
37
+ | Current source and mirrored tests | implementation / tests | verified | requirements, flows, failures, and test strategy below |
38
+
39
+ ## Overview
40
+
41
+ `src/hashTree/` contains 5 direct source/reference file(s) and has 3 mirrored unit-test file(s). This spec separates its public operations, runtime data movement, component ownership, state applicability, and verification boundary.
42
+
43
+ ## Purpose / Responsibility
44
+
45
+ Tracks incremental Locus dataset versions, detects gaps, fetches missing datasets, and emits typed update callbacks.
46
+
47
+ ## Stack
48
+
49
+ TypeScript/JavaScript in the Node 22.14 Yarn workspace; Webex core/plugin abstractions and Mocha/Sinon/`@webex/test-helper-chai` tests. Build target: `yarn workspace @webex/plugin-meetings build:src`.
50
+
51
+ ## Folder / Package Structure
52
+
53
+ ```text
54
+ src/hashTree/
55
+ ├── constants.ts — module constants and wire values
56
+ ├── hashTree.ts — hashTree implementation responsibility
57
+ ├── hashTreeParser.ts — hashTreeParser implementation responsibility
58
+ ├── types.ts — module type declarations
59
+ ├── utils.ts — normalization/helper functions
60
+ └── ai-docs/hash-tree-spec.md — canonical module specification
61
+ ```
62
+
63
+ ## Key Files (source of truth)
64
+
65
+ | File | Holds |
66
+ |---|---|
67
+ | `src/hashTree/constants.ts` | module constants and wire values |
68
+ | `src/hashTree/hashTree.ts` | hashTree implementation responsibility |
69
+ | `src/hashTree/hashTreeParser.ts` | hashTreeParser implementation responsibility |
70
+ | `src/hashTree/types.ts` | module type declarations |
71
+ | `src/hashTree/utils.ts` | normalization/helper functions |
72
+ | `test/unit/spec/hashTree/hashTree.ts` and 2 sibling test file(s) | mirrored characterization/unit coverage |
73
+
74
+ ## Public Surface
75
+
76
+ | Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
77
+ |---|---|---|---|---|---|---|
78
+ | `hashTree.1` | in-memory structure | `HashTree.putItem()`, `putItems()`, `removeItem()`, `removeItems()`, and `updateItems()` | Apply version-aware leaf mutations to the pure hash-tree data structure. | Older/equal item versions do not replace newer data; preserve leaf-bucket semantics. | `src/hashTree/hashTree.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
79
+ | `hashTree.2` | in-memory structure | `computeLeafHash()`, `computeTreeHashes()`, `getHashes()`, `getRootHash()`, `getLeafCount()`, `getTotalItemCount()`, `getLeafData()`, and `getItemVersion()` | Compute and inspect dataset hashes and stored item/version information. | Hash ordering and result shapes are synchronization contracts. | `src/hashTree/hashTree.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
80
+ | `hashTree.3` | in-memory structure | `HashTree.resize()` and `diffHashes()` | Resize the leaf layout and locate differing hash ranges during synchronization. | Preserve deterministic redistribution and diff-index semantics. | `src/hashTree/hashTree.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
81
+ | `hashTree.4` | parser initialization | `HashTreeParser.initializeFromMessage()` and `initializeFromGetLociResponse()` | Seed dataset state from Mercury hash-tree metadata or a get-loci response before applying deltas. | Preserve dataset initialization priority and callback timing. | `src/hashTree/hashTreeParser.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
82
+ | `hashTree.5` | parser updates | `handleMetadataUpdate()`, `handleLocusUpdate()`, and `handleMessage()` | Apply message items, emit the resulting callback, and schedule any root-hash reconciliation required for the dataset. | Preserve the implemented ordering: `parseMessage()` mutates item state, `handleMessage()` invokes the callback, and the delayed sync algorithm checks the resulting root hash separately. | `src/hashTree/hashTreeParser.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
83
+ | `hashTree.6` | parser synchronization | `syncAllDatasets()`, `resumeFromMessage()`, and `resumeFromApiResponse()` | Fetch/replace missing datasets and resume queued processing from the synchronized view. | Preserve ended/not-found sentinel handling and stopped-parser guards. | `src/hashTree/hashTreeParser.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
84
+ | `hashTree.7` | parser lifecycle | `stop()` and `cleanUp()` | Stop future mutation and release queued/parser-owned state. | Work completed after stop must not mutate the stopped parser. | `src/hashTree/hashTreeParser.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
85
+ | `hashTree.8` | exported contracts/helpers | `EMPTY_HASH`, `DataSetNames`, `DATA_SET_INIT_PRIORITY`, `LLM_DATASET_NAMES`, `LeafDataItem`, `SyncAllBackoffType`, `DataSet`, `RootHashMessage`, `HashTreeMessage`, `VisibleDataSetInfo`, `LocusInfoUpdateType`, `LocusInfoUpdate`, `LocusInfoUpdateCallback`, `SyncLatencyTracker`, `HashTreeParserCallbacks`, `MeetingEndedError`, `LocusNotFoundError`, `ObjectType`, `ObjectTypeToLocusKeyMap`, `HtMeta`, `HashTreeObject`, `isSelf()`, `isMetadata()`, `deleteNestedObjectsWithHtMeta()`, `sortByInitPriority()`, and `sleep()` | Share the exact dataset protocol vocabulary, sentinel errors, and normalization helpers used by Locus integration. | Preserve dataset names, error identity, ordering, and raw message fields. | `src/hashTree/hashTree.ts`, `src/hashTree/hashTreeParser.ts`, `src/hashTree/types.ts`, `src/hashTree/constants.ts`, `src/hashTree/utils.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
86
+
87
+ Compatibility notes:
88
+ - Prefer additive options and payload fields. Preserve method/event names, rejection semantics, and cleanup timing; route public changes through `src/index.ts` or the documented owning object.
89
+
90
+ ## Requires (dependencies)
91
+
92
+ Hash-tree wire messages, dataset request function, Locus identifiers, checksum utilities, and consumer callbacks.
93
+
94
+ ## Requirements
95
+
96
+ | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
97
+ |---|---|---|---|---|---|---|
98
+ | `HASH-TREE-R-001` | `HashTreeParser` parses hash-tree messages, tracks dataset versions, detects gaps, fetches datasets, and emits typed update callbacks; `HashTree` stores leaf items and computes leaf/tree hashes. | Parser synchronization behavior and the hash data structure have different ownership and must not be attributed to the same file. | `src/hashTree/hashTreeParser.ts`, `src/hashTree/hashTree.ts` | `test/unit/spec/hashTree/hashTreeParser.ts`, `test/unit/spec/hashTree/hashTree.ts` | none | PRESENT |
99
+ | `HASH-TREE-R-002` | `HashTreeParser.parseMessage()` updates dataset metadata and applies message items; `handleMessage()` then invokes the object-update callback. `runSyncAlgorithm()` performs the root-hash comparison later after the configured idle/backoff delay and queues synchronization on mismatch. | Callers need the real callback-versus-reconciliation ordering and must not assume the callback waits for the deferred root-hash check. | `src/hashTree/hashTreeParser.ts`, `src/hashTree/hashTree.ts`, `src/hashTree/utils.ts` | `test/unit/spec/hashTree/hashTreeParser.ts`, `test/unit/spec/hashTree/hashTree.ts`, `test/unit/spec/hashTree/utils.ts` | none | PRESENT |
100
+ | `HASH-TREE-R-003` | `performSync()` converts meeting-ended/not-found responses into their sentinel callback paths, catches and logs other synchronization failures, and prevents stopped-parser work from being applied. | Sentinel dataset outcomes, logged sync failure, and stopped work must remain distinct so no failed fetch is misreported as a caller-visible rejection or current state. | `src/hashTree/hashTreeParser.ts` | `test/unit/spec/hashTree/hashTreeParser.ts` | non-sentinel failure recovery after logging needs explicit queue coverage | PRESENT |
101
+ | `HASH-TREE-R-004` | `resetHeartbeatWatchdogs()` clears and re-arms a per-dataset timer at `heartbeatIntervalMs + getWeightedBackoffTime(backoff)`, preferring the dataset-level `heartbeatIntervalMs` over `topLevelHeartbeatIntervalMs`. It skips any dataset without a `hashTree`, without a resolved interval, or that `isVisibleDataSet()` rejects, and skips a dataset in `LLM_DATASET_NAMES` when the injected `callbacks.isLlmExpected()` returns false. On expiry it emits `HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED`, saves the backoff latency, enqueues a sync for that dataset, and re-arms itself. `handleMessage()` re-arms the watchdogs *after* `callLocusInfoUpdateCallback()` on the state-elements path, and immediately after `handleRootHashHeartBeatMessage()` on the heartbeat-only path. | A watchdog armed for a dataset whose transport is not connected would fire on every interval and enqueue perpetual syncs, so visibility and LLM-expectation gating are part of the contract, not an optimization. Re-arming after the update callback keeps the timer anchored to the point the message was actually applied. | `src/hashTree/hashTreeParser.ts`, `src/hashTree/constants.ts` | `test/unit/spec/hashTree/hashTreeParser.ts` | the `isLlmExpected` callback is declared required on `HashTreeParserCallbacks` but is also guarded for absence at the call site; treat the guard as current behavior | PRESENT |
102
+
103
+ ## Design Overview
104
+
105
+ `HashTreeParser` consumes state-element messages, compares dataset versions with `utils.ts`, stores per-dataset hash metadata in `hashTree.ts`, fetches visible or missing datasets through its injected `webexRequest`, and reports normalized changes through callbacks.
106
+
107
+ ## Data Flow
108
+
109
+ ```mermaid
110
+ flowchart LR
111
+ Mercury[stateElementsMessage] --> Parser[hashTreeParser.ts]
112
+ Parser --> Compare[utils.ts / constants.ts]
113
+ Compare --> Tree[hashTree.ts datasets]
114
+ Parser --> Request[injected webexRequest]
115
+ Request --> Dataset[visible / missing dataset URLs]
116
+ Dataset --> Parser
117
+ Parser --> Callback[typed update / ended / not-found callbacks]
118
+ ```
119
+
120
+ ## Sequence Diagram(s)
121
+
122
+ Sequence coverage:
123
+
124
+ | Operation group | Diagram | Failure coverage |
125
+ |---|---|---|
126
+ | UC-1…UC-5 — hash-tree mutation and synchronization operation groups | Hash-tree mutation and synchronization primary sequence | stale/gapped metadata, ended/not-found datasets, logged sync failure, and stopped-parser suppression |
127
+ | UC-1…UC-5 — hash-tree mutation and synchronization alternate/failure paths | Hash-tree mutation and synchronization alternate/failure sequence | out-of-order sequence, hash mismatch, dataset 404, or a stopped parser receiving queued work |
128
+
129
+ ### Hash-tree mutation and synchronization primary sequence
130
+
131
+ ```mermaid
132
+ sequenceDiagram
133
+ participant M as Mercury
134
+ participant P as HashTreeParser
135
+ participant H as HashTree dataset state
136
+ participant W as webexRequest
137
+ participant O as Injected owner callback
138
+ M-->>P: state-elements message
139
+ P->>H: update dataset metadata and apply message leaves
140
+ P-->>O: invoke injected owner callback with applied objects
141
+ P->>P: after idle/backoff, compare computed and received root hashes
142
+ opt deferred root mismatch
143
+ P->>W: fetch missing/visible dataset
144
+ W-->>P: dataset or 404
145
+ P->>H: replace synchronized dataset
146
+ end
147
+ ```
148
+
149
+ ### Hash-tree mutation and synchronization alternate/failure sequence
150
+
151
+ ```mermaid
152
+ sequenceDiagram
153
+ participant Q as Queued state-elements message
154
+ participant P as HashTreeParser
155
+ participant W as Injected webexRequest
156
+ participant C as Owning callback
157
+ Q->>P: next sequence and hash-tree elements
158
+ P->>P: apply message items and schedule root-hash check
159
+ P-->>C: object update callback
160
+ alt later root check or visible-dataset change requires synchronization
161
+ P->>W: fetch dataset URL
162
+ W-->>P: dataset, sentinel error, or non-sentinel rejection
163
+ alt dataset succeeds
164
+ P-->>C: synchronized object update callback
165
+ else ended or not-found sentinel
166
+ P-->>C: ended or not-found callback
167
+ else non-sentinel rejection
168
+ P->>P: log failure; invoke no owner callback
169
+ end
170
+ else parser has been stopped
171
+ P->>P: discard queued work without applying it
172
+ end
173
+ ```
174
+
175
+ ## Class / Component Relationships
176
+
177
+ ```mermaid
178
+ classDiagram
179
+ class Mercury
180
+ class OwnerCallback
181
+ class Parser
182
+ class Compare
183
+ class Tree
184
+ class Request
185
+ class Dataset
186
+ Mercury --> Parser
187
+ Parser --> Compare
188
+ Compare --> Tree
189
+ Parser --> Request
190
+ Request --> Dataset
191
+ Dataset --> Parser
192
+ OwnerCallback --> Parser : injected at construction
193
+ Parser --> OwnerCallback : invokes updates
194
+ ```
195
+
196
+ The arrows identify ownership and delegation inside `src/hashTree/`; files that only declare types or constants are not presented as transports.
197
+
198
+ ## Use Cases
199
+
200
+ - **UC-1:** Insert, update, remove, resize, and diff versioned items in the pure `HashTree` without invoking remote synchronization. Evidence: `src/hashTree/hashTree.ts`.
201
+ - **UC-2:** Initialize parser datasets from a Mercury message or get-loci response in declared dataset priority. Evidence: `src/hashTree/hashTreeParser.ts`, `src/hashTree/constants.ts`.
202
+ - **UC-3:** Apply message items in `parseMessage()` and invoke the normalized Locus callback from `handleMessage()` before the delayed root-hash reconciliation runs. Evidence: `src/hashTree/hashTreeParser.ts`.
203
+ - **UC-4:** Queue and synchronize missing datasets when a gap/hash mismatch is detected, mapping ended/not-found sentinels to their callback paths. Evidence: `src/hashTree/hashTreeParser.ts`.
204
+ - **UC-5:** Stop and clean up a parser so queued or later-completing work cannot mutate its state. Evidence: `src/hashTree/hashTreeParser.ts`.
205
+
206
+ ## State Model
207
+
208
+ Per-dataset sequence/hash metadata, pending synchronization work, and last applied objects are held in memory.
209
+
210
+ ## Business Rules & Invariants
211
+
212
+ - `HashTreeParser` applies only newer item versions and emits the applied-object callback for the received message. Root-hash mismatch detection is a later idle/backoff task that can enqueue synchronization; it is not a precondition for the first callback. Enforced by `src/hashTree/hashTreeParser.ts` and `src/hashTree/hashTree.ts`.
213
+
214
+ ## Concurrency & Reactive Flow
215
+
216
+ - State-elements work applies through `parseMessage()` and callbacks synchronously within `handleMessage()`, while root-hash reconciliation is deferred by dataset timers. `stop()` prevents queued or subsequently completed dataset work from mutating the stopped parser.
217
+ - Heartbeat watchdog timers are per dataset and are re-armed after the owning message has been applied, so watchdog delay is measured from application rather than from receipt. `stopAllTimers()` clears them alongside the sync timers.
218
+
219
+ ## State Machine
220
+
221
+ ```mermaid
222
+ stateDiagram-v2
223
+ [*] --> active: construct
224
+ active --> active: apply or synchronize dataset update
225
+ active --> stopped: stop()
226
+ stopped --> [*]
227
+ ```
228
+
229
+ The parser stores only `active` or `stopped` in `src/hashTree/hashTreeParser.ts`.
230
+
231
+ ## Protocol / Wire Format
232
+
233
+ - External payloads are parsed/serialized by files under `src/hashTree/` and existing Webex/media dependencies. Preserve current field names, enum/raw values, sequence identifiers, and compatibility behavior; do not treat the normalized client model as the wire schema.
234
+
235
+ ## Error Handling & Failure Modes
236
+
237
+ | Condition | Signal | Caller recovery |
238
+ |---|---|---|
239
+ | Sequence or hash comparison requires a missing/visible dataset | `hashTreeParser.ts` fetches the dataset through the injected request function before replacing the synchronized dataset. | Let the synchronization request settle; do not apply the incomplete delta directly. |
240
+ | Dataset fetch returns 404 or the dataset has ended | The parser invokes its established not-found/ended callback path. | The owner decides whether to stop or establish a new dataset. |
241
+ | Dataset fetch fails outside the ended/not-found sentinels, or queued work reaches a stopped parser | `performSync()` catches/logs the fetch failure; stopped-parser work is not applied. | Observe parser diagnostics and establish a new synchronization trigger if the owner still needs current state. |
242
+ | No heartbeat arrives for a visible dataset within its interval plus backoff | The watchdog fires, emits `HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED`, enqueues a sync for that dataset, and re-arms. For an LLM dataset while `isLlmExpected()` is false, no watchdog is armed at all and the skip is logged instead. | Do not treat a missing watchdog metric as proof of a healthy transport; check whether the dataset is visible and whether LLM is expected. |
243
+
244
+ ## Pitfalls
245
+
246
+ - Sequence comparison includes rollover/ordering edge cases. Numeric or lexical comparison in place of the shared comparator corrupts reconciliation.
247
+ - Public behavior may be reachable through a parent `Meeting`/`Meetings` object even when the source helper is not exported directly.
248
+
249
+ ## Key Design Trade-off
250
+
251
+ - Incremental datasets reduce full-state traffic but require version, checksum, and resynchronization bookkeeping.
252
+
253
+ ## Test-Case Strategy (module)
254
+
255
+ Use the current mirrored suites: `test/unit/spec/hashTree/hashTree.ts`, `test/unit/spec/hashTree/hashTreeParser.ts`, `test/unit/spec/hashTree/utils.ts`. Characterize the hashTree-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
256
+
257
+ | Behavior / Requirement | Existing test evidence | Gap |
258
+ |---|---|---|
259
+ | `HASH-TREE-R-001` | `test/unit/spec/hashTree/hashTreeParser.ts` | cover versioned put/remove/resize/diff separately from parser synchronization |
260
+ | `HASH-TREE-R-002` | `test/unit/spec/hashTree/hashTreeParser.ts` | non-sentinel synchronization failures are logged internally; verify queue behavior after that failure |
261
+ | `HASH-TREE-R-003` | `test/unit/spec/hashTree/hashTreeParser.ts` | separate sentinel callback handling, logged non-sentinel sync failure, and stopped-parser suppression cases |
262
+ | `HASH-TREE-R-004` | `test/unit/spec/hashTree/hashTreeParser.ts` | assert the dataset-level interval preference, the invisible-dataset and LLM-not-expected skips, expiry re-arming, and re-arm ordering relative to the update callback |
263
+
264
+ ## Traceability
265
+
266
+ - Repo architecture: [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md) · Registry: [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md)
267
+ - Coverage state and contracts baseline: `../../../.sdd/manifest.json`
@@ -8,3 +8,19 @@ export const DataSetNames = {
8
8
  SELF: 'self', // sent to web client, over Mercury
9
9
  UNJOINED: 'unjoined', // sent when you are not joined, but can still see some stuff from the meeting (mutually exclusive with "main")
10
10
  };
11
+
12
+ // Priority order for initializing data sets — higher priority names come first.
13
+ // Data sets not listed here will be initialized after all prioritized ones.
14
+ // MAIN must come before SELF because LocusInfo.updateFromHashTree processes the
15
+ // batch of updatedObjects in order, and the SELF handler in updateLocusFromHashTreeObject
16
+ // checks locus.info?.isWebinar (which comes from MAIN) to decide whether to create a
17
+ // participant object for webinar attendees. If SELF were initialized first, locus.info
18
+ // would not yet be populated and the attendee participant would be skipped.
19
+ export const DATA_SET_INIT_PRIORITY: string[] = [DataSetNames.MAIN, DataSetNames.SELF];
20
+
21
+ // Data sets for which we normally receive events over LLM connection
22
+ export const LLM_DATASET_NAMES = [
23
+ DataSetNames.MAIN,
24
+ DataSetNames.ATD_ACTIVE,
25
+ DataSetNames.ATD_UNMUTED,
26
+ ];