@webex/plugin-meetings 3.12.0-webex-services-ready.4 → 3.13.0

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 (165) 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 +130 -4
  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 +1 -1
  43. package/dist/annotation/index.js +55 -19
  44. package/dist/annotation/index.js.map +1 -1
  45. package/dist/assets/e2ee-0.0.1.js +2 -0
  46. package/dist/assets/e2ee-0.0.1.wasm +0 -0
  47. package/dist/breakouts/breakout.js +1 -1
  48. package/dist/breakouts/index.js +39 -5
  49. package/dist/breakouts/index.js.map +1 -1
  50. package/dist/common/errors/webex-errors.js +7 -2
  51. package/dist/common/errors/webex-errors.js.map +1 -1
  52. package/dist/config.js +1 -0
  53. package/dist/config.js.map +1 -1
  54. package/dist/constants.js +6 -5
  55. package/dist/constants.js.map +1 -1
  56. package/dist/hashTree/hashTreeParser.js +101 -48
  57. package/dist/hashTree/hashTreeParser.js.map +1 -1
  58. package/dist/index.js +1 -0
  59. package/dist/index.js.map +1 -1
  60. package/dist/interceptors/dataChannelAuthToken.js +41 -59
  61. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  62. package/dist/interceptors/locusRetry.js +1 -1
  63. package/dist/interceptors/locusRetry.js.map +1 -1
  64. package/dist/interpretation/index.js +46 -12
  65. package/dist/interpretation/index.js.map +1 -1
  66. package/dist/interpretation/siLanguage.js +1 -1
  67. package/dist/locus-info/index.js +236 -80
  68. package/dist/locus-info/index.js.map +1 -1
  69. package/dist/locus-info/types.js +2 -1
  70. package/dist/locus-info/types.js.map +1 -1
  71. package/dist/media/MediaConnectionAwaiter.js +225 -175
  72. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  73. package/dist/meeting/index.js +355 -299
  74. package/dist/meeting/index.js.map +1 -1
  75. package/dist/meeting/util.js +8 -2
  76. package/dist/meeting/util.js.map +1 -1
  77. package/dist/meeting/voicea-meeting.js +2 -1
  78. package/dist/meeting/voicea-meeting.js.map +1 -1
  79. package/dist/meeting-info/meeting-info-v2.js +10 -3
  80. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  81. package/dist/meetings/index.js +72 -31
  82. package/dist/meetings/index.js.map +1 -1
  83. package/dist/multistream/remoteMediaManager.js +32 -4
  84. package/dist/multistream/remoteMediaManager.js.map +1 -1
  85. package/dist/multistream/sendSlotManager.js +11 -1
  86. package/dist/multistream/sendSlotManager.js.map +1 -1
  87. package/dist/types/annotation/index.d.ts +19 -0
  88. package/dist/types/common/errors/webex-errors.d.ts +6 -2
  89. package/dist/types/config.d.ts +1 -0
  90. package/dist/types/constants.d.ts +2 -1
  91. package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
  92. package/dist/types/index.d.ts +1 -0
  93. package/dist/types/locus-info/index.d.ts +45 -1
  94. package/dist/types/locus-info/types.d.ts +1 -0
  95. package/dist/types/media/MediaConnectionAwaiter.d.ts +61 -53
  96. package/dist/types/meeting/index.d.ts +49 -12
  97. package/dist/types/meeting/util.d.ts +3 -1
  98. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  99. package/dist/types/meetings/index.d.ts +2 -1
  100. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  101. package/dist/types/multistream/sendSlotManager.d.ts +5 -1
  102. package/dist/webinar/index.js +298 -255
  103. package/dist/webinar/index.js.map +1 -1
  104. package/package.json +25 -23
  105. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  106. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  107. package/src/annotation/index.ts +61 -29
  108. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  109. package/src/breakouts/index.ts +35 -2
  110. package/src/common/errors/webex-errors.ts +8 -2
  111. package/src/config.ts +5 -1
  112. package/src/constants.ts +2 -1
  113. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  114. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  115. package/src/hashTree/hashTreeParser.ts +67 -3
  116. package/src/index.ts +1 -0
  117. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  118. package/src/interceptors/dataChannelAuthToken.ts +48 -77
  119. package/src/interceptors/locusRetry.ts +1 -1
  120. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  121. package/src/interpretation/index.ts +38 -1
  122. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  123. package/src/locus-info/index.ts +156 -35
  124. package/src/locus-info/types.ts +1 -0
  125. package/src/media/MediaConnectionAwaiter.ts +223 -207
  126. package/src/media/ai-docs/media-spec.md +267 -0
  127. package/src/meeting/ai-docs/meeting-spec.md +404 -0
  128. package/src/meeting/index.ts +332 -296
  129. package/src/meeting/util.ts +7 -4
  130. package/src/meeting/voicea-meeting.ts +1 -1
  131. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  132. package/src/meeting-info/meeting-info-v2.ts +7 -2
  133. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  134. package/src/meetings/index.ts +59 -23
  135. package/src/member/ai-docs/member-spec.md +196 -0
  136. package/src/members/ai-docs/members-spec.md +256 -0
  137. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  138. package/src/multistream/ai-docs/multistream-spec.md +295 -0
  139. package/src/multistream/remoteMediaManager.ts +23 -1
  140. package/src/multistream/sendSlotManager.ts +15 -1
  141. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  142. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  143. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  144. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  145. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  146. package/src/roap/ai-docs/roap-spec.md +241 -0
  147. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  148. package/src/webinar/index.ts +168 -188
  149. package/test/unit/spec/annotation/index.ts +214 -182
  150. package/test/unit/spec/breakouts/index.ts +145 -13
  151. package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
  152. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
  153. package/test/unit/spec/interceptors/locusRetry.ts +29 -1
  154. package/test/unit/spec/interpretation/index.ts +93 -0
  155. package/test/unit/spec/locus-info/index.js +397 -0
  156. package/test/unit/spec/media/MediaConnectionAwaiter.ts +426 -19
  157. package/test/unit/spec/media/properties.ts +3 -3
  158. package/test/unit/spec/meeting/index.js +1219 -723
  159. package/test/unit/spec/meeting/utils.js +52 -18
  160. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  161. package/test/unit/spec/meeting-info/meetinginfov2.js +69 -1
  162. package/test/unit/spec/meetings/index.js +145 -43
  163. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  164. package/test/unit/spec/multistream/sendSlotManager.ts +30 -2
  165. package/test/unit/spec/webinar/index.ts +886 -718
@@ -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`
@@ -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`