@webex/plugin-meetings 3.12.0-next.17 → 3.12.0-next.171

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 (301) 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/dist/aiEnableRequest/index.js +15 -2
  40. package/dist/aiEnableRequest/index.js.map +1 -1
  41. package/dist/annotation/index.js +2 -2
  42. package/dist/annotation/index.js.map +1 -1
  43. package/dist/breakouts/breakout.js +8 -3
  44. package/dist/breakouts/breakout.js.map +1 -1
  45. package/dist/breakouts/events.js +29 -14
  46. package/dist/breakouts/events.js.map +1 -1
  47. package/dist/breakouts/index.js +99 -4
  48. package/dist/breakouts/index.js.map +1 -1
  49. package/dist/common/errors/webex-errors.js +49 -5
  50. package/dist/common/errors/webex-errors.js.map +1 -1
  51. package/dist/config.js +2 -2
  52. package/dist/config.js.map +1 -1
  53. package/dist/constants.js +37 -10
  54. package/dist/constants.js.map +1 -1
  55. package/dist/controls-options-manager/index.js +46 -10
  56. package/dist/controls-options-manager/index.js.map +1 -1
  57. package/dist/hashTree/constants.js +4 -1
  58. package/dist/hashTree/constants.js.map +1 -1
  59. package/dist/hashTree/hashTreeParser.js +1096 -391
  60. package/dist/hashTree/hashTreeParser.js.map +1 -1
  61. package/dist/hashTree/utils.js +20 -0
  62. package/dist/hashTree/utils.js.map +1 -1
  63. package/dist/index.js +7 -0
  64. package/dist/index.js.map +1 -1
  65. package/dist/interceptors/dataChannelAuthToken.js +75 -15
  66. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  67. package/dist/interceptors/locusRetry.js +24 -9
  68. package/dist/interceptors/locusRetry.js.map +1 -1
  69. package/dist/interpretation/index.js +55 -12
  70. package/dist/interpretation/index.js.map +1 -1
  71. package/dist/interpretation/interpretation.types.js +7 -0
  72. package/dist/interpretation/interpretation.types.js.map +1 -0
  73. package/dist/interpretation/siLanguage.js +1 -1
  74. package/dist/locus-info/controlsUtils.js +4 -1
  75. package/dist/locus-info/controlsUtils.js.map +1 -1
  76. package/dist/locus-info/index.js +615 -176
  77. package/dist/locus-info/index.js.map +1 -1
  78. package/dist/locus-info/infoUtils.js +36 -5
  79. package/dist/locus-info/infoUtils.js.map +1 -1
  80. package/dist/locus-info/types.js +20 -0
  81. package/dist/locus-info/types.js.map +1 -1
  82. package/dist/media/MediaConnectionAwaiter.js +15 -2
  83. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  84. package/dist/media/index.js +8 -2
  85. package/dist/media/index.js.map +1 -1
  86. package/dist/media/properties.js +4 -5
  87. package/dist/media/properties.js.map +1 -1
  88. package/dist/meeting/in-meeting-actions.js +5 -1
  89. package/dist/meeting/in-meeting-actions.js.map +1 -1
  90. package/dist/meeting/index.js +1684 -835
  91. package/dist/meeting/index.js.map +1 -1
  92. package/dist/meeting/locusMediaRequest.js +229 -82
  93. package/dist/meeting/locusMediaRequest.js.map +1 -1
  94. package/dist/meeting/muteState.js +10 -1
  95. package/dist/meeting/muteState.js.map +1 -1
  96. package/dist/meeting/request.js +5 -2
  97. package/dist/meeting/request.js.map +1 -1
  98. package/dist/meeting/util.js +37 -3
  99. package/dist/meeting/util.js.map +1 -1
  100. package/dist/meeting/voicea-meeting.js +2 -1
  101. package/dist/meeting/voicea-meeting.js.map +1 -1
  102. package/dist/meeting-info/meeting-info-v2.js +12 -5
  103. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  104. package/dist/meetings/index.js +300 -128
  105. package/dist/meetings/index.js.map +1 -1
  106. package/dist/meetings/meetings.types.js +6 -1
  107. package/dist/meetings/meetings.types.js.map +1 -1
  108. package/dist/meetings/request.js +39 -0
  109. package/dist/meetings/request.js.map +1 -1
  110. package/dist/meetings/util.js +116 -18
  111. package/dist/meetings/util.js.map +1 -1
  112. package/dist/member/index.js +10 -0
  113. package/dist/member/index.js.map +1 -1
  114. package/dist/member/types.js.map +1 -1
  115. package/dist/member/util.js +30 -0
  116. package/dist/member/util.js.map +1 -1
  117. package/dist/members/index.js +101 -43
  118. package/dist/members/index.js.map +1 -1
  119. package/dist/members/util.js +8 -1
  120. package/dist/members/util.js.map +1 -1
  121. package/dist/metrics/constants.js +7 -1
  122. package/dist/metrics/constants.js.map +1 -1
  123. package/dist/multistream/codec/constants.js +63 -0
  124. package/dist/multistream/codec/constants.js.map +1 -0
  125. package/dist/multistream/mediaRequestManager.js +62 -15
  126. package/dist/multistream/mediaRequestManager.js.map +1 -1
  127. package/dist/multistream/receiveSlot.js +9 -0
  128. package/dist/multistream/receiveSlot.js.map +1 -1
  129. package/dist/multistream/remoteMediaManager.js +32 -4
  130. package/dist/multistream/remoteMediaManager.js.map +1 -1
  131. package/dist/reachability/clusterReachability.js.map +1 -1
  132. package/dist/reachability/index.js +121 -83
  133. package/dist/reachability/index.js.map +1 -1
  134. package/dist/reachability/reachability.types.js +2 -0
  135. package/dist/reachability/reachability.types.js.map +1 -1
  136. package/dist/reachability/util.js +45 -0
  137. package/dist/reachability/util.js.map +1 -1
  138. package/dist/reactions/reactions.type.js.map +1 -1
  139. package/dist/recording-controller/index.js +1 -3
  140. package/dist/recording-controller/index.js.map +1 -1
  141. package/dist/roap/turnDiscovery.js +8 -1
  142. package/dist/roap/turnDiscovery.js.map +1 -1
  143. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  144. package/dist/types/config.d.ts +2 -2
  145. package/dist/types/constants.d.ts +13 -1
  146. package/dist/types/controls-options-manager/index.d.ts +16 -0
  147. package/dist/types/hashTree/constants.d.ts +1 -0
  148. package/dist/types/hashTree/hashTreeParser.d.ts +201 -22
  149. package/dist/types/hashTree/utils.d.ts +7 -0
  150. package/dist/types/index.d.ts +3 -0
  151. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  152. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  153. package/dist/types/locus-info/index.d.ts +106 -8
  154. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  155. package/dist/types/locus-info/types.d.ts +22 -1
  156. package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
  157. package/dist/types/media/properties.d.ts +6 -2
  158. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  159. package/dist/types/meeting/index.d.ts +178 -11
  160. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  161. package/dist/types/meeting/request.d.ts +1 -0
  162. package/dist/types/meeting/util.d.ts +9 -0
  163. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  164. package/dist/types/meetings/index.d.ts +40 -19
  165. package/dist/types/meetings/meetings.types.d.ts +15 -0
  166. package/dist/types/meetings/request.d.ts +14 -0
  167. package/dist/types/member/index.d.ts +1 -0
  168. package/dist/types/member/types.d.ts +1 -0
  169. package/dist/types/member/util.d.ts +9 -0
  170. package/dist/types/members/index.d.ts +15 -2
  171. package/dist/types/members/util.d.ts +1 -5
  172. package/dist/types/metrics/constants.d.ts +6 -0
  173. package/dist/types/multistream/codec/constants.d.ts +7 -0
  174. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  175. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  176. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  177. package/dist/types/reachability/index.d.ts +10 -3
  178. package/dist/types/reachability/reachability.types.d.ts +7 -0
  179. package/dist/types/reachability/util.d.ts +17 -0
  180. package/dist/types/reactions/reactions.type.d.ts +3 -0
  181. package/dist/webinar/index.js +307 -161
  182. package/dist/webinar/index.js.map +1 -1
  183. package/package.json +23 -23
  184. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  185. package/src/aiEnableRequest/index.ts +16 -0
  186. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  187. package/src/annotation/index.ts +6 -4
  188. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  189. package/src/breakouts/breakout.ts +3 -1
  190. package/src/breakouts/events.ts +33 -11
  191. package/src/breakouts/index.ts +122 -2
  192. package/src/common/errors/webex-errors.ts +50 -3
  193. package/src/config.ts +2 -2
  194. package/src/constants.ts +21 -3
  195. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  196. package/src/controls-options-manager/index.ts +62 -10
  197. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  198. package/src/hashTree/constants.ts +7 -0
  199. package/src/hashTree/hashTreeParser.ts +861 -193
  200. package/src/hashTree/utils.ts +19 -0
  201. package/src/index.ts +6 -0
  202. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  203. package/src/interceptors/dataChannelAuthToken.ts +88 -12
  204. package/src/interceptors/locusRetry.ts +26 -5
  205. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  206. package/src/interpretation/index.ts +65 -10
  207. package/src/interpretation/interpretation.types.ts +11 -0
  208. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  209. package/src/locus-info/controlsUtils.ts +3 -1
  210. package/src/locus-info/index.ts +566 -164
  211. package/src/locus-info/infoUtils.ts +41 -6
  212. package/src/locus-info/types.ts +26 -1
  213. package/src/media/MediaConnectionAwaiter.ts +21 -4
  214. package/src/media/ai-docs/media-spec.md +267 -0
  215. package/src/media/index.ts +10 -1
  216. package/src/media/properties.ts +8 -3
  217. package/src/meeting/ai-docs/meeting-spec.md +401 -0
  218. package/src/meeting/in-meeting-actions.ts +8 -0
  219. package/src/meeting/index.ts +944 -120
  220. package/src/meeting/locusMediaRequest.ts +106 -6
  221. package/src/meeting/muteState.ts +10 -1
  222. package/src/meeting/request.ts +11 -0
  223. package/src/meeting/util.ts +51 -7
  224. package/src/meeting/voicea-meeting.ts +1 -1
  225. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  226. package/src/meeting-info/meeting-info-v2.ts +11 -4
  227. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  228. package/src/meetings/index.ts +200 -80
  229. package/src/meetings/meetings.types.ts +19 -0
  230. package/src/meetings/request.ts +43 -0
  231. package/src/meetings/util.ts +117 -4
  232. package/src/member/ai-docs/member-spec.md +196 -0
  233. package/src/member/index.ts +10 -0
  234. package/src/member/types.ts +1 -0
  235. package/src/member/util.ts +29 -0
  236. package/src/members/ai-docs/members-spec.md +256 -0
  237. package/src/members/index.ts +70 -7
  238. package/src/members/util.ts +12 -4
  239. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  240. package/src/metrics/constants.ts +6 -0
  241. package/src/multistream/ai-docs/multistream-spec.md +292 -0
  242. package/src/multistream/codec/constants.ts +58 -0
  243. package/src/multistream/mediaRequestManager.ts +119 -28
  244. package/src/multistream/receiveSlot.ts +18 -0
  245. package/src/multistream/remoteMediaManager.ts +23 -1
  246. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  247. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  248. package/src/reachability/clusterReachability.ts +3 -2
  249. package/src/reachability/index.ts +47 -16
  250. package/src/reachability/reachability.types.ts +11 -0
  251. package/src/reachability/util.ts +36 -0
  252. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  253. package/src/reactions/reactions.type.ts +3 -0
  254. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  255. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  256. package/src/recording-controller/index.ts +1 -2
  257. package/src/roap/ai-docs/roap-spec.md +241 -0
  258. package/src/roap/turnDiscovery.ts +9 -1
  259. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  260. package/src/webinar/index.ts +216 -38
  261. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  262. package/test/unit/spec/annotation/index.ts +3 -3
  263. package/test/unit/spec/breakouts/breakout.ts +9 -3
  264. package/test/unit/spec/breakouts/events.ts +120 -2
  265. package/test/unit/spec/breakouts/index.ts +223 -3
  266. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  267. package/test/unit/spec/controls-options-manager/index.js +139 -32
  268. package/test/unit/spec/hashTree/hashTreeParser.ts +2451 -184
  269. package/test/unit/spec/hashTree/utils.ts +37 -0
  270. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
  271. package/test/unit/spec/interceptors/locusRetry.ts +234 -5
  272. package/test/unit/spec/interpretation/index.ts +119 -4
  273. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  274. package/test/unit/spec/locus-info/index.js +1014 -58
  275. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  276. package/test/unit/spec/media/MediaConnectionAwaiter.ts +55 -0
  277. package/test/unit/spec/media/index.ts +92 -0
  278. package/test/unit/spec/media/properties.ts +23 -23
  279. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  280. package/test/unit/spec/meeting/index.js +2834 -110
  281. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  282. package/test/unit/spec/meeting/muteState.js +81 -0
  283. package/test/unit/spec/meeting/request.js +12 -0
  284. package/test/unit/spec/meeting/utils.js +189 -17
  285. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  286. package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
  287. package/test/unit/spec/meetings/index.js +544 -49
  288. package/test/unit/spec/meetings/request.js +141 -0
  289. package/test/unit/spec/meetings/utils.js +402 -51
  290. package/test/unit/spec/member/index.js +7 -0
  291. package/test/unit/spec/member/util.js +89 -0
  292. package/test/unit/spec/members/index.js +216 -0
  293. package/test/unit/spec/members/request.js +37 -1
  294. package/test/unit/spec/members/utils.js +63 -0
  295. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  296. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  297. package/test/unit/spec/reachability/index.ts +128 -46
  298. package/test/unit/spec/reachability/util.ts +31 -0
  299. package/test/unit/spec/recording-controller/index.js +9 -8
  300. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  301. package/test/unit/spec/webinar/index.ts +332 -31
@@ -0,0 +1,256 @@
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-08-22T15:21:29Z
8
+ validation_status: pass-with-warnings
9
+ -->
10
+ # MEMBERS — 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/members/`.
13
+
14
+ ## Metadata
15
+
16
+ | Field | Value |
17
+ |---|---|
18
+ | Module id | `members` |
19
+ | Source path(s) | `src/members/` |
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-08-22T15:21:29Z |
25
+ | Validation status | pass-with-warnings |
26
+
27
+ ## Evidence Rules
28
+
29
+ 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.
30
+
31
+ ## Source Material Register
32
+
33
+ | Source material | Scope | Decision | Detail location or disposition |
34
+ |---|---|---|---|
35
+ | Retained package consumer documentation | overview / API / behavior / tests | used and verified; member collection properties, mutations, and events were distributed across the public surface, requirements, and use cases |
36
+ | Current source and mirrored tests | implementation / tests | verified | requirements, flows, failures, and test strategy below |
37
+
38
+ ## Overview
39
+
40
+ `src/members/` contains 5 direct source/reference file(s) and has 4 mirrored unit-test file(s). This spec separates its public operations, runtime data movement, component ownership, state applicability, and verification boundary.
41
+
42
+ ## Purpose / Responsibility
43
+
44
+ Owns the meeting roster collection, reconciles participant updates, performs participant mutations, and emits member events.
45
+
46
+ ## Stack
47
+
48
+ 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`.
49
+
50
+ ## Folder / Package Structure
51
+
52
+ ```text
53
+ src/members/
54
+ ├── collection.ts — module-owned collection
55
+ ├── index.ts — module facade/controller or primary exports
56
+ ├── request.ts — HTTP request boundary
57
+ ├── types.ts — module type declarations
58
+ ├── util.ts — normalization/helper functions
59
+ └── ai-docs/members-spec.md — canonical module specification
60
+ ```
61
+
62
+ ## Key Files (source of truth)
63
+
64
+ | File | Holds |
65
+ |---|---|
66
+ | `src/members/collection.ts` | module-owned collection |
67
+ | `src/members/index.ts` | module facade/controller or primary exports |
68
+ | `src/members/request.ts` | HTTP request boundary |
69
+ | `src/members/types.ts` | module type declarations |
70
+ | `src/members/util.ts` | normalization/helper functions |
71
+ | `test/unit/spec/members/collection.js` and 3 sibling test file(s) | mirrored characterization/unit coverage |
72
+
73
+ ## Public Surface
74
+
75
+ | Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
76
+ |---|---|---|---|---|---|---|
77
+ | `members.1` | SDK collection | `MembersCollection.set()`, `setAll()`, `get()`, `getAll()`, `remove()`, and `reset()` | Store member models by identity and support atomic roster replacement/reset. | Preserve collection keying and returned model identity. | `src/members/collection.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
78
+ | `members.2` | SDK / Locus input | `locusSelfUpdate()`, `locusHostUpdate()`, `locusParticipantsUpdate()`, `locusMediaSharesUpdate()`, `locusUrlUpdate()`, `locusFullStateTypeUpdate()`, `setLocusUrl()`, `setHostId()`, `setType()`, `setSelfId()`, `setMediaShareContentId()`, `setMediaShareWhiteboardId()`, and `clearMembers()` | Reconcile authoritative Locus roster/context into the current collection. | Preserve one `MEMBERS_UPDATE` emission with `{delta, full, isReplace}`; the nested delta carries added/updated/removed ids/models. | `src/members/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
79
+ | `members.3` | SDK / model mutation | `addMember()` and participant reconciliation | Create/update `Member` projections and compute the ids reported in the roster update payload. | Preserve member identity and local comparison behavior. | `src/members/index.ts`, `src/member/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
80
+ | `members.4` | SDK / remote | `cancelPhoneInvite()`, `cancelInviteByMemberId()`, `admitMembers()`, `removeMember()`, and `muteMember()` | Execute invitation/lobby/removal/mute operations against current Locus/member URLs. | Preserve request inputs and each method's actual caller-visible failure boundary: returned rejections are common, while `admitMembers()` can surface a synchronous `MembersRequest.admitMember()` validation throw. No blanket local capability pre-check exists for every operation. | `src/members/index.ts`, `src/members/request.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
81
+ | `members.5` | SDK / remote | `assignRoles()`, `moveToLobby()`, `raiseOrLowerHand()`, `lowerAllHands()`, and `transferHostToMember()` | Mutate participant roles, lobby placement, hand state, or host assignment. | Preserve role/action body shapes and current per-method validation. | `src/members/index.ts`, `src/members/request.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
82
+ | `members.6` | SDK / remote | `sendDialPadKey()` and `editDisplayName()` | Send member-scoped DTMF or display-name changes through the request adapter. | Preserve target member/session context and caller-visible request errors. | `src/members/index.ts`, `src/members/request.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
83
+ | `members.7` | SDK / query | `findMemberByCsi()` and `getCsisForMember()` | Resolve media CSI/member relationships from the current roster projection. | Preserve null/empty outcomes for unresolved mappings. | `src/members/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
84
+ | `members.8` | request/types | `MembersRequest.addMembers()`, `admitMember()`, `removeMember()`, `muteMember()`, `assignRolesMember()`, `moveToLobbyMember()`, `raiseOrLowerHandMember()`, `lowerAllHandsMember()`, `editDisplayNameMember()`, `transferHostToMember()`, `sendDialPadKey()`, `cancelPhoneInvite()`, and `cancelInviteByMemberId()` plus `ServerRoles`, `ServerRoleShape`, `RoleAssignmentOptions`, `RoleAssignmentBody`, and `RoleAssignmentRequest` | Provide the direct HTTP boundary and exact role-assignment vocabulary used by the facade. | Request helpers do not own roster mutation; role raw values are compatibility-sensitive. | `src/members/request.ts`, `src/members/types.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
85
+
86
+ ### Emitted events
87
+
88
+ Current source emits or forwards these observable literals for this operation boundary. Preserve literal values, scope, payload shape, and emission timing; a constant name alone is not a substitute for the consumer-visible value.
89
+
90
+ | Event literal | Constant / expression | Emission evidence |
91
+ |---|---|---|
92
+ | `members:clear` | `EVENT_TRIGGERS.MEMBERS_CLEAR` | `src/members/index.ts` |
93
+ | `members:content:update` | `EVENT_TRIGGERS.MEMBERS_CONTENT_UPDATE` | `src/members/index.ts` |
94
+ | `members:host:update` | `EVENT_TRIGGERS.MEMBERS_HOST_UPDATE` | `src/members/index.ts` |
95
+ | `members:self:update` | `EVENT_TRIGGERS.MEMBERS_SELF_UPDATE` | `src/members/index.ts` |
96
+ | `members:update` | `EVENT_TRIGGERS.MEMBERS_UPDATE` | `src/members/index.ts` |
97
+
98
+ Compatibility notes:
99
+ - 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.
100
+
101
+ ## Requires (dependencies)
102
+
103
+ Locus participant updates, Member models, meeting/Locus URLs, request helper, event utilities, and role/capability state.
104
+
105
+ ## Requirements
106
+
107
+ | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
108
+ |---|---|---|---|---|---|---|
109
+ | `MEMBERS-R-001` | initialize and reconcile the members collection. | Owns the meeting roster collection, reconciles participant updates, performs participant mutations, and emits member events. | `src/members/index.ts` | `test/unit/spec/members/index.js` | none | PRESENT |
110
+ | `MEMBERS-R-002` | admit/remove/mute/transfer-role and related participant controls. | Participant controls target distinct URLs/bodies, while roster state changes only from authoritative Locus updates. | `src/members/index.ts`, `src/members/request.ts` | `test/unit/spec/members/index.js` | mixed add/update/remove reconciliation needs one-payload assertions | PRESENT |
111
+ | `MEMBERS-R-003` | Server failures reject their caller, while validation may either return a rejected promise or throw synchronously at the request-helper boundary; malformed/stale roster updates follow existing diff rules, and collection reset removes the local models owned by this module. | Callers must handle the actual synchronous-versus-promise boundary, while roster consumers need one authoritative update payload and a deterministic local reset. | `src/members/` | `test/unit/spec/members/index.js`, `test/unit/spec/members/request.js` | none | PRESENT |
112
+ | `MEMBERS-R-004` | Roster reconciliation preserves one Member per participant id and emits `{delta, full, isReplace}`; `delta` contains the added/updated models and removed ids, while `full` is the current collection. | Stable object identity and the exact wrapper shape let consumers distinguish incremental versus replacement updates without inventing top-level changed/removed fields. | `src/members/index.ts`, `src/members/collection.ts` | `test/unit/spec/members/index.js`, `test/unit/spec/members/collection.js` | none | PRESENT |
113
+ | `MEMBERS-R-005` | Host, self, and active-content changes emit their dedicated member events with active/ended ids. | These roles/streams can change independently of general participant fields and consumers need focused transitions. | `src/members/index.ts`, `src/members/types.ts` | `test/unit/spec/members/index.js` | none | PRESENT |
114
+ | `MEMBERS-R-006` | Participant mutations use current Locus/device/participant context and propagate server rejection. | Admit, remove, mute, and role changes are privileged remote state, not optimistic local edits. | `src/members/index.ts`, `src/members/request.ts` | `test/unit/spec/members/request.js` | none | PRESENT |
115
+
116
+ ## Design Overview
117
+
118
+ `Members` owns roster collection reconciliation and member-control requests. `index.ts` computes the added/updated/removed delta in `update()`; `handleLocusInfoUpdatedParticipants()` updates contextual ids, delegates participant reconciliation to `update()`, and applies removed participant ids before `locusParticipantsUpdate()` wraps the result with the full collection and `isReplace`. `collection.ts` stores `Member` models and `request.ts` sends admit/remove/mute/role operations to current Locus URLs.
119
+
120
+ ## Data Flow
121
+
122
+ ```mermaid
123
+ flowchart LR
124
+ Locus[Locus participant updates] --> Controller[index.ts]
125
+ Controller --> Delta[index.ts update and handleLocusInfoUpdatedParticipants]
126
+ Delta --> Collection[collection.ts]
127
+ Collection --> Member[src/member]
128
+ Caller[Meeting / consumer] --> Controller
129
+ Controller --> Request[request.ts]
130
+ Request --> Locus
131
+ Controller --> Events[members update/host/self/content events]
132
+ ```
133
+
134
+ ## Sequence Diagram(s)
135
+
136
+ Sequence coverage:
137
+
138
+ | Operation group | Diagram | Failure coverage |
139
+ |---|---|---|
140
+ | UC-1…UC-5 — roster and member-control operation groups | Roster and member-control primary sequence | stale roster input, request rejection, single update payload, and collection reset |
141
+ | UC-1…UC-5 — roster and member-control alternate/failure paths | Roster and member-control alternate/failure sequence | missing member/Locus URL, request rejection, or inconsistent roster update; no blanket local capability gate |
142
+
143
+ ### Roster and member-control primary sequence
144
+
145
+ ```mermaid
146
+ sequenceDiagram
147
+ participant L as Locus update
148
+ participant M as Members index.ts
149
+ participant D as index.ts delta methods
150
+ participant C as collection.ts
151
+ participant E as roster consumers
152
+ L-->>M: participant projection
153
+ M->>D: update / handleLocusInfoUpdatedParticipants
154
+ D-->>M: added/updated models and removed ids
155
+ M->>C: reconcile Member models
156
+ M->>M: wrap {delta, full, isReplace}
157
+ M-->>E: emit scoped roster/host/self/content changes
158
+ ```
159
+
160
+ ### Roster and member-control alternate/failure sequence
161
+
162
+ ```mermaid
163
+ sequenceDiagram
164
+ participant L as Locus roster update
165
+ participant M as Members
166
+ participant U as Members index.ts reconciliation methods
167
+ participant C as Member collection
168
+ participant A as Calling Meeting / consumer
169
+ participant E as External roster event consumers
170
+ L-->>M: current participants and roster delta
171
+ M->>U: update / handleLocusInfoUpdatedParticipants / handleMembersUpdate
172
+ U-->>M: delta and current full collection
173
+ M->>C: add, update, or remove Member models
174
+ alt member action request rejects
175
+ M--xA: caller-visible rejection or synchronous validation throw
176
+ else roster reconciliation succeeds
177
+ M-->>E: scoped roster/host/self/content events through Trigger
178
+ end
179
+ ```
180
+
181
+ ## Class / Component Relationships
182
+
183
+ ```mermaid
184
+ classDiagram
185
+ class Locus
186
+ class Controller
187
+ class Collection
188
+ class Member
189
+ class Caller
190
+ class Request
191
+ class Events
192
+ Locus --> Controller
193
+ Controller --> Collection
194
+ Collection --> Member
195
+ Caller --> Controller
196
+ Controller --> Request
197
+ Request --> Locus
198
+ Controller --> Events
199
+ ```
200
+
201
+ The arrows identify ownership and delegation inside `src/members/`; files that only declare types or constants are not presented as transports.
202
+
203
+ ## Use Cases
204
+
205
+ - **UC-1:** Replace or incrementally reconcile Locus participants into stable `Member` models and emit one `MEMBERS_UPDATE` payload shaped as `{delta, full, isReplace}`. Evidence: `src/members/index.ts`, `src/members/collection.ts`.
206
+ - **UC-2:** Resolve member/CSI relationships for media consumers from the current roster. Evidence: `src/members/index.ts`.
207
+ - **UC-3:** Cancel invitations, admit lobby members, remove or mute a participant using current Locus/member request context. Evidence: `src/members/index.ts`, `src/members/request.ts`.
208
+ - **UC-4:** Assign roles, move to lobby, raise/lower hands, lower all hands, or transfer host using each method's actual validation/body. Evidence: `src/members/index.ts`, `src/members/request.ts`.
209
+ - **UC-5:** Send member DTMF or edit a display name and propagate the request adapter's outcome. Evidence: `src/members/index.ts`, `src/members/request.ts`.
210
+
211
+ ## State Model
212
+
213
+ The roster collection, self/host/participant indexes, and event-listener state are scoped to a meeting.
214
+
215
+ ## Business Rules & Invariants
216
+
217
+ - Each participant id maps to one current Member and removed participants leave the collection. Remote mutations validate their own ids/Locus context, but `Members` does not apply a blanket meeting-capability check before sending them. Enforced by `src/members/index.ts` and supporting code under `src/members/`.
218
+
219
+ ## Concurrency & Reactive Flow
220
+
221
+ - Roster reconciliation keys additions, updates, and removals by current participant/member identity before mutating the collection. `reset()` removes the local member models; member-control requests settle independently and do not turn a rejected server action into a local optimistic update.
222
+
223
+ ## Error Handling & Failure Modes
224
+
225
+ | Condition | Signal | Caller recovery |
226
+ |---|---|---|
227
+ | Required input to a synchronous context setter such as `setLocusUrl()`, `setHostId()`, `setType()`, or `setSelfId()` is absent | The setter throws `ParameterError` synchronously. | Supply the direct value or its accepted Locus/full-state container before calling. |
228
+ | `admitMembers()` receives an empty member-id array | It returns a rejected `ParameterError` promise before constructing request options. | Supply at least one member id and handle the returned rejection. |
229
+ | `admitMembers()` receives member ids but its generated request options lack `locusUrl` | `MembersRequest.admitMember()` throws `ParameterError` synchronously; `admitMembers()` is not `async`, so a chained `.catch()` does not observe this validation error. | Refresh Locus context and catch at the synchronous call boundary when it may be absent. |
230
+ | `sendDialPadKey()` cannot resolve the member | It returns a rejected `ParameterError` promise. | Refresh the roster and retry with a current member id. |
231
+ | `sendDialPadKey()` resolves the member but lacks a Locus URL or SIP device URL | It returns a rejected plain `Error` promise, not `ParameterError`. | Restore the meeting/device call-control context before retrying. |
232
+ | Member-control request rejects | The request promise rejects and no successful server mutation is claimed. | Handle the rejection before attempting a later action. |
233
+ | Accepted roster update adds, changes, or removes participants | The collection reconciles the affected `Member` models and emits only the scoped roster/host/self/content changes. | Consume the updated collection projection. |
234
+
235
+ ## Pitfalls
236
+
237
+ - Roster snapshots and deltas may represent the same participant differently. Replacing the collection wholesale can lose object identity and event semantics.
238
+ - Public behavior may be reachable through a parent `Meeting`/`Meetings` object even when the source helper is not exported directly.
239
+
240
+ ## Test-Case Strategy (module)
241
+
242
+ Use the current mirrored suites: `test/unit/spec/members/collection.js`, `test/unit/spec/members/index.js`, `test/unit/spec/members/request.js`, `test/unit/spec/members/utils.js`. Characterize the members-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
243
+
244
+ | Behavior / Requirement | Existing test evidence | Gap |
245
+ |---|---|---|
246
+ | `MEMBERS-R-001` | `test/unit/spec/members/index.js` | cover collection reconciliation, CSI queries, and every member request family |
247
+ | `MEMBERS-R-002` | `test/unit/spec/members/index.js` | mixed add/update/remove reconciliation needs one-payload assertions |
248
+ | `MEMBERS-R-003` | `test/unit/spec/members/index.js` | assert the exact `{delta, full, isReplace}` payload and per-operation request rejection without a fabricated global capability gate |
249
+ | `MEMBERS-R-004` | `test/unit/spec/members/index.js`, `test/unit/spec/members/collection.js` | none |
250
+ | `MEMBERS-R-005` | `test/unit/spec/members/index.js` | verify simultaneous host/content changes |
251
+ | `MEMBERS-R-006` | `test/unit/spec/members/request.js` | verify service rejection and confirm the facade does not invent a local capability-denied branch |
252
+
253
+ ## Traceability
254
+
255
+ - Repo architecture: [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md) · Registry: [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md)
256
+ - Coverage state and contracts baseline: `../../../.sdd/manifest.json`
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
- import {get, isEmpty, set} from 'lodash';
4
+ import {get, isEmpty, isEqual, set} from 'lodash';
5
5
  // @ts-ignore
6
6
  import {StatelessWebexPlugin} from '@webex/webex-core';
7
7
 
@@ -15,6 +15,7 @@ import {
15
15
  } from '../constants';
16
16
  import Trigger from '../common/events/trigger-proxy';
17
17
  import Member from '../member';
18
+ import MemberUtil from '../member/util';
18
19
  import LoggerProxy from '../common/logs/logger-proxy';
19
20
  import ParameterError from '../common/errors/parameter';
20
21
  import {
@@ -99,6 +100,15 @@ export default class Members extends StatelessWebexPlugin {
99
100
  selfId: any;
100
101
  type: any;
101
102
 
103
+ /**
104
+ * Map of CSI -> memberId that previously used the CSI in a Locus update.
105
+ * Keyed by CSI so findMemberByCsi can resolve it in O(1).
106
+ * Kept here (rather than on each Member) so it survives members being removed
107
+ * and re-added (e.g. when entering/leaving a breakout session).
108
+ * @private
109
+ */
110
+ private memberIdByHistoryCsi: Map<number, string> = new Map();
111
+
102
112
  namespace = MEETINGS;
103
113
 
104
114
  /**
@@ -315,6 +325,14 @@ export default class Members extends StatelessWebexPlugin {
315
325
  * @memberof Members
316
326
  */
317
327
  clearMembers() {
328
+ // capture CSIs of all current members before reset so findMemberByCsi can
329
+ // still resolve them if a member is later re-added (e.g. when leaving a
330
+ // breakout session)
331
+ Object.values(this.membersCollection.getAll()).forEach((member) => {
332
+ MemberUtil.extractCsis(member.participant).forEach((csi) =>
333
+ this.memberIdByHistoryCsi.set(csi, member.id)
334
+ );
335
+ });
318
336
  this.membersCollection.reset();
319
337
  Trigger.trigger(
320
338
  this,
@@ -569,6 +587,15 @@ export default class Members extends StatelessWebexPlugin {
569
587
  */
570
588
  private removeMembers(removedMembers: Array<string>) {
571
589
  removedMembers.forEach((memberId) => {
590
+ // capture CSIs before removal so findMemberByCsi can still resolve them
591
+ // if the member is later re-added (e.g. when leaving a breakout session)
592
+ // with a participant payload that no longer contains the original CSIs
593
+ const existingMember = this.membersCollection.get(memberId);
594
+ if (existingMember) {
595
+ MemberUtil.extractCsis(existingMember.participant).forEach((csi) =>
596
+ this.memberIdByHistoryCsi.set(csi, memberId)
597
+ );
598
+ }
572
599
  this.membersCollection.remove(memberId);
573
600
  });
574
601
  }
@@ -598,6 +625,19 @@ export default class Members extends StatelessWebexPlugin {
598
625
  set(member, prop, existingValue);
599
626
  }
600
627
  });
628
+
629
+ // remember CSIs the member used previously so findMemberByCsi can still
630
+ // resolve a CSI even after participant.devices[].csis no longer contains it.
631
+ // Skip re-extracting when devices haven't changed - existing history already covers them.
632
+ const devicesUnchanged = isEqual(
633
+ existingMember.participant?.devices,
634
+ member.participant?.devices
635
+ );
636
+ if (!devicesUnchanged) {
637
+ MemberUtil.extractCsis(existingMember.participant).forEach((csi) =>
638
+ this.memberIdByHistoryCsi.set(csi, member.id)
639
+ );
640
+ }
601
641
  }
602
642
  }
603
643
  this.membersCollection.set(member.id, member);
@@ -1096,12 +1136,16 @@ export default class Members extends StatelessWebexPlugin {
1096
1136
  * Transfers the host to another member
1097
1137
  * @param {String} memberId
1098
1138
  * @param {boolean} [moderator] default true
1139
+ * @param {String} [breakoutLocusUrl] when provided, the request is sent against this locus url
1140
+ * (i.e. the breakout session's locus) instead of the main session's locus url
1099
1141
  * @returns {Promise}
1100
1142
  * @public
1101
1143
  * @memberof Members
1102
1144
  */
1103
- public transferHostToMember(memberId: string, moderator = true) {
1104
- if (!this.locusUrl) {
1145
+ public transferHostToMember(memberId: string, moderator = true, breakoutLocusUrl = '') {
1146
+ const locusUrl = breakoutLocusUrl || this.locusUrl;
1147
+
1148
+ if (!locusUrl) {
1105
1149
  return Promise.reject(
1106
1150
  new ParameterError(
1107
1151
  'The associated locus url for this meetings members object must be defined.'
@@ -1113,11 +1157,14 @@ export default class Members extends StatelessWebexPlugin {
1113
1157
  new ParameterError('The member id must be defined to transfer host to the member.')
1114
1158
  );
1115
1159
  }
1116
- const options = MembersUtil.generateTransferHostMemberOptions(
1160
+ const options: Record<string, any> = MembersUtil.generateTransferHostMemberOptions(
1117
1161
  memberId,
1118
1162
  moderator,
1119
- this.locusUrl
1163
+ locusUrl
1120
1164
  );
1165
+ if (breakoutLocusUrl && breakoutLocusUrl !== this.locusUrl) {
1166
+ options.authorizingLocusUrl = this.locusUrl;
1167
+ }
1121
1168
 
1122
1169
  return this.membersRequest.transferHostToMember(options);
1123
1170
  }
@@ -1161,18 +1208,34 @@ export default class Members extends StatelessWebexPlugin {
1161
1208
  );
1162
1209
  }
1163
1210
 
1164
- /** Finds a member that has any device with a csi matching provided value
1211
+ /** Finds a member that has any device with a csi matching provided value.
1212
+ * Falls back to the `memberIdByHistoryCsi` map so that a CSI a member used in
1213
+ * a previous Locus update can still be resolved even if it is no longer
1214
+ * present in `participant.devices[].csis`.
1165
1215
  *
1166
1216
  * @param {number} csi
1167
1217
  * @returns {Member}
1168
1218
  */
1169
1219
  findMemberByCsi(csi) {
1170
- return Object.values(this.membersCollection.getAll()).find((member) =>
1220
+ const members = Object.values(this.membersCollection.getAll());
1221
+
1222
+ const currentMatch = members.find((member) =>
1171
1223
  // @ts-ignore
1172
1224
  member.participant?.devices?.find((device) =>
1173
1225
  device.csis?.find((memberCsi) => memberCsi === csi)
1174
1226
  )
1175
1227
  );
1228
+
1229
+ if (currentMatch) {
1230
+ return currentMatch;
1231
+ }
1232
+
1233
+ const historyMemberId = this.memberIdByHistoryCsi.get(csi);
1234
+ if (historyMemberId) {
1235
+ return this.membersCollection.get(historyMemberId);
1236
+ }
1237
+
1238
+ return undefined;
1176
1239
  }
1177
1240
 
1178
1241
  /**
@@ -13,7 +13,7 @@ import {
13
13
  ALIAS,
14
14
  } from '../constants';
15
15
 
16
- import {RoleAssignmentOptions, RoleAssignmentRequest, ServerRoleShape} from './types';
16
+ import {RoleAssignmentOptions, RoleAssignmentRequest, ServerRoleShape, ServerRoles} from './types';
17
17
  import {Invitee} from '../meeting/type';
18
18
 
19
19
  const MembersUtil = {
@@ -330,12 +330,20 @@ const MembersUtil = {
330
330
  };
331
331
  },
332
332
 
333
- getTransferHostToMemberRequestParams: (options) => {
334
- const body = {
333
+ getTransferHostToMemberRequestParams: (options: any) => {
334
+ const body: Record<string, any> = {
335
335
  role: {
336
- moderator: options.moderator,
336
+ roles: [
337
+ {
338
+ hasRole: true,
339
+ type: ServerRoles.Moderator,
340
+ },
341
+ ],
337
342
  },
338
343
  };
344
+ if (options.authorizingLocusUrl) {
345
+ body.authorizingLocusUrl = options.authorizingLocusUrl;
346
+ }
339
347
  const uri = `${options.locusUrl}/${PARTICIPANT}/${options.memberId}/${CONTROLS}`;
340
348
 
341
349
  return {
@@ -0,0 +1,185 @@
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-08-22T15:21:29Z
8
+ validation_status: pass-with-warnings
9
+ -->
10
+ # METRICS — 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/metrics/`.
13
+
14
+ ## Metadata
15
+
16
+ | Field | Value |
17
+ |---|---|
18
+ | Module id | `metrics` |
19
+ | Source path(s) | `src/metrics/` |
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-08-22T15:21:29Z |
25
+ | Validation status | pass-with-warnings |
26
+
27
+ ## Evidence Rules
28
+
29
+ Requirements cite current source and mirrored tests. Current code wins over retained prose when they conflict; commit and PR history are excluded. Missing evidence stays a gap.
30
+
31
+ ## Source Material Register
32
+
33
+ | Source material | Scope | Decision | Detail location or disposition |
34
+ |---|---|---|---|
35
+ | No routed legacy module spec | overview / API / behavior / tests | none; generated from current metrics implementation/constants and tests |
36
+ | Current source and mirrored tests | implementation / tests | verified | requirements, flows, failures, and test strategy below |
37
+
38
+ ## Overview
39
+
40
+ `src/metrics/` contains 2 direct source/reference file(s) and has 1 mirrored unit-test file(s). This spec separates its public operations, runtime data movement, component ownership, state applicability, and verification boundary.
41
+
42
+ ## Purpose / Responsibility
43
+
44
+ Initializes meeting behavioral telemetry, flattens metric fields, and submits established metric names/tags through the Webex metrics host.
45
+
46
+ ## Stack
47
+
48
+ TypeScript/JavaScript in the Node 22.14 Yarn workspace; Webex core/plugin abstractions and Mocha/Sinon/`@webex/test-helper-chai` tests.
49
+
50
+ ## Folder / Package Structure
51
+
52
+ ```text
53
+ src/metrics/
54
+ ├── constants.ts — module constants and wire values
55
+ ├── index.ts — module facade/controller or primary exports
56
+ └── ai-docs/metrics-spec.md — canonical module specification
57
+ ```
58
+
59
+ ## Key Files (source of truth)
60
+
61
+ | File | Holds |
62
+ |---|---|
63
+ | `src/metrics/constants.ts` | module constants and wire values |
64
+ | `src/metrics/index.ts` | module facade/controller or primary exports |
65
+ | `test/unit/spec/metrics/index.js` | mirrored characterization/unit coverage |
66
+
67
+ ## Public Surface
68
+
69
+ | Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
70
+ |---|---|---|---|---|---|---|
71
+ | `metrics.1` | singleton setup | default singleton `initialSetup(webex)` | Store the Webex host used by later behavioral submissions. | Repeated setup replaces the host; there is no one-time guard or readiness check. | `src/metrics/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
72
+ | `metrics.2` | pure normalization | `prepareMetricFields(payload, prefix)` | Flatten nested objects/arrays and wrap root literals for clients that reject nested metric fields. | Preserve underscore path construction, array indices, and `{value}` root-literal behavior. | `src/metrics/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
73
+ | `metrics.3` | remote side effect | `sendBehavioralMetric(metricName, metricFields, metricTags)` | Forward the metric name, configured metrics type, fields, and tags to `submitClientMetrics()`. | The method returns `void` and does not expose an operational-metric API or promise. | `src/metrics/index.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
74
+
75
+ Compatibility notes:
76
+ - Prefer additive fields/options and preserve current return and rejection semantics. Internal helpers are not public merely because they are exported within the source directory.
77
+
78
+ ## Requires (dependencies)
79
+
80
+ Webex metrics plugin/host, behavioral metric constants, logging/error handling, and callers in meeting/feature modules.
81
+
82
+ ## Requirements
83
+
84
+ | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
85
+ |---|---|---|---|---|---|---|
86
+ | `METRICS-R-001` | `initialSetup(webex)` replaces the singleton's stored Webex host on every call. | Later behavioral submissions must use the host supplied by the owning SDK instance without implying an idempotence guard the implementation does not have. | `src/metrics/index.ts` | `test/unit/spec/metrics/index.js` | repeat setup is not covered explicitly | PRESENT |
87
+ | `METRICS-R-002` | `prepareMetricFields` recursively flattens objects and arrays into underscore-delimited keys and wraps a top-level literal as `{value}`. | The behavioral metrics client cannot accept nested field objects, so callers need a deterministic flattening helper. | `src/metrics/index.ts` | `test/unit/spec/metrics/index.js` | no cycle or size bound is implemented | PRESENT |
88
+ | `METRICS-R-003` | `sendBehavioralMetric` calls `webex.internal.metrics.submitClientMetrics` with the configured metric type, supplied fields, and tags; the method returns no independent result. | The facade must preserve the actual behavioral-metrics boundary without inventing an operational-metrics API or lifecycle guarantee. | `src/metrics/index.ts` | `test/unit/spec/metrics/index.js` | thrown dependency errors propagate synchronously | PRESENT |
89
+
90
+ ## Design Overview
91
+
92
+ `src/metrics/index.ts` is a singleton facade that stores the current Webex host, flattens caller-supplied fields, and forwards behavioral metrics to `submitClientMetrics`. `constants.ts` defines meeting metric names and fields. The module owns no listener, timer, or remote controller.
93
+
94
+ ## Data Flow
95
+
96
+ ```mermaid
97
+ flowchart LR
98
+ Owner[Meeting feature owner] --> Metrics[index.ts]
99
+ Constants[constants.ts] --> Metrics
100
+ Metrics --> Flatten[prepareMetricFields recursive flattening]
101
+ Metrics --> Behavioral[sendBehavioralMetric to submitClientMetrics]
102
+ ```
103
+
104
+ ## Sequence Diagram(s)
105
+
106
+ Sequence coverage:
107
+
108
+ | Operation group | Diagram | Failure coverage |
109
+ |---|---|---|
110
+ | UC-1…UC-2 — behavioral metrics operation groups | Behavioral metrics primary sequence | uninitialized host submission failure and nested/array/literal field normalization |
111
+ | UC-2 — field preparation | Behavioral metrics alternate/failure sequence | literal, array, object, and optional-prefix branches |
112
+
113
+ ### Behavioral metrics primary sequence
114
+
115
+ ```mermaid
116
+ sequenceDiagram
117
+ participant O as Meeting feature owner
118
+ participant M as Metrics
119
+ participant W as Webex metrics client
120
+ O->>M: sendBehavioralMetric(name, fields, tags)
121
+ M->>W: submitClientMetrics(name, type, fields, tags)
122
+ W-->>M: synchronous return or throw
123
+ M-->>O: undefined, unless the dependency throws
124
+ ```
125
+
126
+ ### Behavioral metrics alternate/failure sequence
127
+
128
+ ```mermaid
129
+ sequenceDiagram
130
+ participant C as Caller / current input owner
131
+ participant M as Metrics
132
+ C->>M: prepareMetricFields(value, optional prefix)
133
+ M->>M: recursively visit objects and arrays
134
+ alt nested value
135
+ M-->>C: flattened underscore-delimited object
136
+ else top-level literal or null
137
+ M-->>C: value wrapped as {value}
138
+ end
139
+ ```
140
+
141
+ ## Class / Component Relationships
142
+
143
+ ```mermaid
144
+ classDiagram
145
+ class Owner
146
+ class Metrics
147
+ class Constants
148
+ class Flatten
149
+ class Behavioral
150
+ Owner --> Metrics
151
+ Constants --> Metrics
152
+ Metrics --> Flatten
153
+ Metrics --> Behavioral
154
+ ```
155
+
156
+ The arrows identify ownership and delegation inside `src/metrics/`; files that only declare types or constants are not presented as transports.
157
+
158
+ ## Use Cases
159
+
160
+ - **UC-1:** Initialize the singleton with a Webex host and forward a named behavioral metric with configured type plus caller-supplied fields/tags. Evidence: `src/metrics/index.ts`.
161
+ - **UC-2:** Flatten nested objects, arrays, prefixed values, null, and root literals into the exact field shape accepted by the metrics client. Evidence: `src/metrics/index.ts`.
162
+
163
+ ## Business Rules & Invariants
164
+
165
+ - Behavioral submission requires `initialSetup` to have assigned a Webex host; the facade does not validate metric names or remove sensitive fields. Flattening is deterministic but unbounded, so callers remain responsible for bounded, non-sensitive input. Enforced under `src/metrics/`.
166
+
167
+ ## Pitfalls
168
+
169
+ - Flattening arbitrary service payloads can create unbounded or sensitive tags. Callers must submit an intentional bounded projection.
170
+ - Verify both typed constants/enums and raw wire values before changing a logical condition in this legacy package.
171
+
172
+ ## Test-Case Strategy (module)
173
+
174
+ Use the current mirrored suites: `test/unit/spec/metrics/index.js`. Characterize the metrics-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
175
+
176
+ | Behavior / Requirement | Existing test evidence | Gap |
177
+ |---|---|---|
178
+ | `METRICS-R-001` | `test/unit/spec/metrics/index.js` | cover singleton setup, submission, and recursive flattening branches |
179
+ | `METRICS-R-002` | `test/unit/spec/metrics/index.js` | extend the flattening matrix for nested arrays, prefixed primitives, and null values |
180
+ | `METRICS-R-003` | `test/unit/spec/metrics/index.js` | assert the exact `submitClientMetrics` call and the method's `undefined` return |
181
+
182
+ ## Traceability
183
+
184
+ - Repo architecture: [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md) · Registry: [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md)
185
+ - Coverage state and contracts baseline: `../../../.sdd/manifest.json`
@@ -11,6 +11,7 @@ const BEHAVIORAL_METRICS = {
11
11
  ADD_MEDIA_SUCCESS: 'js_sdk_add_media_success',
12
12
  ADD_MEDIA_FAILURE: 'js_sdk_add_media_failures',
13
13
  ADD_MEDIA_RETRY: 'js_sdk_add_media_retry',
14
+ LOCUS_MEDIA_REQUEST_RETRY: 'js_sdk_locus_media_request_retry',
14
15
  ROAP_MERCURY_EVENT_RECEIVED: 'js_sdk_roap_mercury_received',
15
16
  CONNECTION_SUCCESS: 'js_sdk_connection_success',
16
17
  CONNECTION_FAILURE: 'js_sdk_connection_failures',
@@ -96,6 +97,11 @@ const BEHAVIORAL_METRICS = {
96
97
  SET_CUSTOM_CODEC_PARAMETERS_USED: 'js_sdk_set_custom_codec_parameters_used',
97
98
  MARK_CUSTOM_CODEC_PARAMETERS_FOR_DELETION_USED:
98
99
  'js_sdk_mark_custom_codec_parameters_for_deletion_used',
100
+ HASH_TREE_SYNC_FAILURE: 'js_sdk_hash_tree_sync_failure',
101
+ HASH_TREE_HEARTBEAT_WATCHDOG_EXPIRED: 'js_sdk_hash_tree_heartbeat_watchdog_expired',
102
+ HASH_TREE_EMPTY_LOCUS_STATE_ELEMENTS: 'js_sdk_hash_tree_empty_locus_state_elements',
103
+ DESTROY_MEETING_WHILE_SUSPENDED: 'js_sdk_destroy_meeting_while_suspended',
104
+ WASM_RUNTIME_PERFORMANCE: 'js_sdk_wasm_runtime_performance',
99
105
  };
100
106
 
101
107
  export {BEHAVIORAL_METRICS as default};