@webex/plugin-meetings 3.13.0-next.13 → 3.13.0-next.14

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 (100) hide show
  1. package/.repo-context.json +577 -0
  2. package/.sdd/manifest.json +1320 -428
  3. package/AGENTS.md +528 -72
  4. package/dist/aiEnableRequest/index.js +1 -1
  5. package/dist/breakouts/breakout.js +1 -1
  6. package/dist/breakouts/index.js +1 -1
  7. package/dist/config.js +1 -1
  8. package/dist/interpretation/index.js +1 -1
  9. package/dist/interpretation/siLanguage.js +1 -1
  10. package/dist/webinar/index.js +1 -1
  11. package/docs/adr/0001-migrate-existing-docs-into-sdd.md +141 -0
  12. package/docs/adr/index.md +26 -0
  13. package/docs/architecture.md +816 -0
  14. package/docs/getting-started.md +177 -0
  15. package/docs/index.md +53 -0
  16. package/docs/specs/README.md +126 -0
  17. package/package.json +21 -21
  18. package/schemas/repo-context.schema.json +796 -0
  19. package/src/aiEnableRequest/docs/README.md +376 -0
  20. package/src/annotation/docs/README.md +402 -0
  21. package/src/breakouts/docs/README.md +643 -0
  22. package/src/controls-options-manager/docs/README.md +365 -0
  23. package/src/hashTree/docs/README.md +566 -0
  24. package/src/interceptors/docs/README.md +434 -0
  25. package/src/interpretation/docs/README.md +420 -0
  26. package/src/locus-info/docs/README.md +609 -0
  27. package/src/media/docs/README.md +488 -0
  28. package/src/meeting/docs/README.md +834 -0
  29. package/src/meeting-info/docs/README.md +352 -0
  30. package/src/meetings/docs/README.md +549 -0
  31. package/src/member/docs/README.md +347 -0
  32. package/src/members/docs/README.md +514 -0
  33. package/src/metrics/docs/README.md +287 -0
  34. package/src/multistream/docs/README.md +523 -0
  35. package/src/personal-meeting-room/docs/README.md +322 -0
  36. package/src/reachability/docs/README.md +548 -0
  37. package/src/reactions/docs/README.md +296 -0
  38. package/src/reconnection-manager/docs/README.md +485 -0
  39. package/src/recording-controller/docs/README.md +335 -0
  40. package/src/roap/docs/README.md +444 -0
  41. package/src/webinar/docs/README.md +425 -0
  42. package/.sdd/templates/.source.json +0 -30
  43. package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +0 -111
  44. package/.sdd/templates/component-repo/module-docs/module-spec.template.md +0 -321
  45. package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +0 -59
  46. package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +0 -49
  47. package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +0 -42
  48. package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +0 -120
  49. package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +0 -206
  50. package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +0 -90
  51. package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +0 -68
  52. package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +0 -111
  53. package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +0 -57
  54. package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +0 -69
  55. package/.sdd/templates/component-repo/standing-docs/RULES.template.md +0 -96
  56. package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +0 -84
  57. package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +0 -82
  58. package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +0 -94
  59. package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +0 -64
  60. package/.sdd/templates/component-repo/template-map.json +0 -112
  61. package/ai-docs/ARCHITECTURE.md +0 -208
  62. package/ai-docs/CONTRACTS.md +0 -267
  63. package/ai-docs/DATA_MODEL.md +0 -64
  64. package/ai-docs/GETTING_STARTED.md +0 -73
  65. package/ai-docs/GLOSSARY.md +0 -56
  66. package/ai-docs/REVIEW_CHECKLIST.md +0 -45
  67. package/ai-docs/RULES.md +0 -79
  68. package/ai-docs/SECURITY.md +0 -74
  69. package/ai-docs/SERVICE_STATE.md +0 -59
  70. package/ai-docs/SPEC_INDEX.md +0 -85
  71. package/ai-docs/TEST_INDEX.md +0 -45
  72. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +0 -61
  73. package/ai-docs/patterns/defensive-error-propagation.md +0 -55
  74. package/ai-docs/patterns/event-scope-emission.md +0 -46
  75. package/ai-docs/patterns/source-to-test-path-mirroring.md +0 -45
  76. package/ai-docs/patterns/stateless-plugin-request-classes.md +0 -53
  77. package/ai-docs/patterns/typed-constants-and-enum-values.md +0 -47
  78. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +0 -223
  79. package/src/annotation/ai-docs/annotation-spec.md +0 -236
  80. package/src/breakouts/ai-docs/breakouts-spec.md +0 -324
  81. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +0 -243
  82. package/src/hashTree/ai-docs/hash-tree-spec.md +0 -267
  83. package/src/interceptors/ai-docs/interceptors-spec.md +0 -247
  84. package/src/interpretation/ai-docs/interpretation-spec.md +0 -256
  85. package/src/locus-info/ai-docs/locus-info-spec.md +0 -293
  86. package/src/media/ai-docs/media-spec.md +0 -267
  87. package/src/meeting/ai-docs/meeting-spec.md +0 -404
  88. package/src/meeting-info/ai-docs/meeting-info-spec.md +0 -261
  89. package/src/meetings/ai-docs/meetings-spec.md +0 -298
  90. package/src/member/ai-docs/member-spec.md +0 -196
  91. package/src/members/ai-docs/members-spec.md +0 -256
  92. package/src/metrics/ai-docs/metrics-spec.md +0 -185
  93. package/src/multistream/ai-docs/multistream-spec.md +0 -295
  94. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +0 -234
  95. package/src/reachability/ai-docs/reachability-spec.md +0 -261
  96. package/src/reactions/ai-docs/reactions-spec.md +0 -198
  97. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +0 -272
  98. package/src/recording-controller/ai-docs/recording-controller-spec.md +0 -223
  99. package/src/roap/ai-docs/roap-spec.md +0 -241
  100. package/src/webinar/ai-docs/webinar-spec.md +0 -243
@@ -1,267 +0,0 @@
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
- # MEDIA — 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/media/`.
13
-
14
- ## Metadata
15
-
16
- | Field | Value |
17
- |---|---|
18
- | Module id | `media` |
19
- | Source path(s) | `src/media/` |
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 README and upgrade guide | overview / API / behavior / tests | used and verified; local-media acquisition, add/update/stop media, ready/stopped events, and teardown guidance were placed into behavior and test strategy |
36
- | Current source and mirrored tests | implementation / tests | verified | requirements, flows, failures, and test strategy below |
37
-
38
- ## Overview
39
-
40
- `src/media/` contains 4 direct source/reference file(s) and has 3 mirrored unit-test file(s). This spec separates its public operations, runtime data movement, component ownership, state applicability, and verification boundary.
41
-
42
- ## Purpose / Responsibility
43
-
44
- Creates/configures media-core connections, derives media properties, awaits readiness, and exposes media lifecycle helpers to Meeting.
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/media/
54
- ├── MediaConnectionAwaiter.ts — MediaConnectionAwaiter implementation responsibility
55
- ├── index.ts — module facade/controller or primary exports
56
- ├── properties.ts — properties implementation responsibility
57
- ├── util.ts — normalization/helper functions
58
- └── ai-docs/media-spec.md — canonical module specification
59
- ```
60
-
61
- ## Key Files (source of truth)
62
-
63
- | File | Holds |
64
- |---|---|
65
- | `src/media/MediaConnectionAwaiter.ts` | MediaConnectionAwaiter implementation responsibility |
66
- | `src/media/index.ts` | module facade/controller or primary exports |
67
- | `src/media/properties.ts` | properties implementation responsibility |
68
- | `src/media/util.ts` | normalization/helper functions |
69
- | `test/unit/spec/media/MediaConnectionAwaiter.ts` and 2 sibling test file(s) | mirrored characterization/unit coverage |
70
-
71
- ## Public Surface
72
-
73
- | Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
74
- |---|---|---|---|---|---|---|
75
- | `media.1` | SDK / in-process | `MediaProperties.setMediaDirection()`, `setMediaSettings()`, `setMediaPeerConnection()`, and `getVideoDeviceId()` / `setVideoDeviceId()` | Hold the media-core configuration and preferred camera identity used by Meeting. | Preserve default directions, null-device behavior, and setter names. | `src/media/properties.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
76
- | `media.2` | SDK / in-process | local stream setters: `setLocalAudioStream()`, `setLocalVideoStream()`, `setLocalShareAudioStream()`, `setLocalShareVideoStream()`, and `hasLocalShareStream()` | Keep microphone, camera, and share tracks distinct so Meeting can publish and stop them independently. | Preserve optional-stream inputs and the boolean share predicate. | `src/media/properties.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
77
- | `media.3` | SDK / in-process | remote setters: `setRemoteAudioStream()`, `setRemoteVideoStream()`, `setRemoteShareStream()`, `setRemoteQualityLevel()` | Store the remote media projections consumed by Meeting and UI code. | Preserve independent audio, video, share, and quality fields. | `src/media/properties.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
78
- | `media.4` | SDK / lifecycle | `unsetRemoteMedia()`, `unsetRemoteShareStream()`, `unsetRemoteStreams()`, and `unsetPeerConnection()` | Detach stored references when the owning Meeting explicitly replaces or tears down media. | These methods do not close the peer connection or stop tracks themselves. | `src/media/properties.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
79
- | `media.5` | SDK / async | `MediaProperties.waitForMediaConnectionConnected()` plus `peerConnectionStateHandler()`, `iceConnectionStateHandler()`, `iceGatheringStateHandler()`, `onTimeout()`, and `waitForMediaConnectionConnected()` | Resolve readiness or reject with `{iceConnected, iceConnectedAtLeastOnce}` after concrete connection/ICE event and timeout evaluation. | Allow one incomplete-gathering retry per ICE phase; DTLS does not retry. Preserve terminal cleanup. | `src/media/properties.ts`, `src/media/MediaConnectionAwaiter.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
80
- | `media.6` | diagnostic | `MediaProperties.getCurrentConnectionInfo()`, `sendMediaIssueMetric()`, and `MediaConnectionAwaiter.sendMetric()` | Derive connection/IP diagnostics and emit bounded media issue information. | Preserve metric throttling and the existing unknown/fallback values. | `src/media/properties.ts`, `src/media/MediaConnectionAwaiter.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
81
- | `media.7` | exported types/constants | `BundlePolicy`, `MediaDirection`, `IPVersion`, `MediaConnectionAwaiterProps`, and `FailureResult` | Provide the concrete configuration and failure shapes used across the meetings package. | Definitions are partitioned precisely: BundlePolicy is in the media index, MediaDirection and IPVersion are in properties, and the awaiter props/result types are in MediaConnectionAwaiter. Add fields compatibly; raw enum/type values are shared package contracts. | `src/media/index.ts`, `src/media/properties.ts`, `src/media/MediaConnectionAwaiter.ts` | [CONTRACTS](../../../ai-docs/CONTRACTS.md) |
82
-
83
- ### Emitted events
84
-
85
- 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.
86
-
87
- | Event literal | Constant / expression | Emission evidence |
88
- |---|---|---|
89
- | `media:activeSpeakerChanged` | `EVENT_TRIGGERS.ACTIVE_SPEAKER_CHANGED` | `src/meeting/index.ts` |
90
- | `media:codec:loaded` | `EVENT_TRIGGERS.MEDIA_CODEC_LOADED` | `src/meetings/util.ts` |
91
- | `media:codec:missing` | `EVENT_TRIGGERS.MEDIA_CODEC_MISSING` | `src/meetings/util.ts` |
92
- | `media:inboundAudio:issueDetected` | `EVENT_TRIGGERS.MEDIA_INBOUND_AUDIO_ISSUE_DETECTED` | `src/meeting/index.ts` |
93
- | `media:negotiated` | `EVENT_TRIGGERS.MEDIA_NEGOTIATED` | `src/meeting/index.ts` |
94
- | `media:ready` | `EVENT_TRIGGERS.MEDIA_READY` | `src/meeting/index.ts` |
95
- | `media:remoteAudio:created` | `EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED` | `src/meeting/index.ts` |
96
- | `media:remoteInterpretationAudio:created` | `EVENT_TRIGGERS.REMOTE_MEDIA_INTERPRETATION_AUDIO_CREATED` | `src/meeting/index.ts` |
97
- | `media:remoteScreenShareAudio:created` | `EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED` | `src/meeting/index.ts` |
98
- | `media:remoteVideo:layoutChanged` | `EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED` | `src/meeting/index.ts` |
99
- | `media:remoteAudioSourceCountChanged` | `EVENT_TRIGGERS.REMOTE_AUDIO_SOURCE_COUNT_CHANGED` | `src/meeting/index.ts` |
100
- | `media:remoteVideoSourceCountChanged` | `EVENT_TRIGGERS.REMOTE_VIDEO_SOURCE_COUNT_CHANGED` | `src/meeting/index.ts` |
101
- | `media:stopped` | `EVENT_TRIGGERS.MEDIA_STOPPED` | `src/meeting/index.ts` |
102
-
103
- Compatibility notes:
104
- - 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.
105
-
106
- ## Requires (dependencies)
107
-
108
- Browser WebRTC, @webex/internal-media-core, media helpers, meeting/Locus signaling, ROAP, and logging/metrics.
109
-
110
- ## Requirements
111
-
112
- | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
113
- |---|---|---|---|---|---|---|
114
- | `MEDIA-R-001` | create and configure a media connection. | Creates/configures media-core connections, derives media properties, awaits readiness, and exposes media lifecycle helpers to Meeting. | `src/media/index.ts` | `test/unit/spec/media/index.ts` | none | PRESENT |
115
- | `MEDIA-R-002` | `MediaProperties` attaches/replaces local and remote streams and the peer connection; `util.ts` constructs a `MediaStream` from received tracks. `MediaConnectionAwaiter` registers connection-readiness listeners and schedules its timeout, and clears its timer and listeners on every terminal transition. | Stream ownership must remain separate from readiness waiting, and readiness settlement must release its timer and listeners without closing the owned transport. | `src/media/properties.ts`, `src/media/util.ts`, `src/media/MediaConnectionAwaiter.ts` | `test/unit/spec/media/properties.ts`, `test/unit/spec/media/MediaConnectionAwaiter.ts` | none | PRESENT |
116
- | `MEDIA-R-003` | Connection failure or timeout rejects with the awaiter result and `MediaConnectionAwaiter.clearCallbacks()` removes only the listeners it registered. It does not close the peer connection or unset streams; explicit `MediaProperties` unset methods detach stored references, while Meeting owns connection closure. | Callers must distinguish readiness-listener cleanup from transport and stream teardown. | `src/media/MediaConnectionAwaiter.ts`, `src/media/properties.ts`, `src/meeting/index.ts` | `test/unit/spec/media/MediaConnectionAwaiter.ts`, `test/unit/spec/media/properties.ts` | none | PRESENT |
117
- | `MEDIA-R-004` | Media properties translate meeting options and local-stream state into media-core connection configuration. | Meeting callers should not depend directly on low-level media-core option shapes. | `src/media/properties.ts`, `src/media/index.ts` | `test/unit/spec/media/properties.ts`, `test/unit/spec/media/index.ts` | none | PRESENT |
118
- | `MEDIA-R-005` | The awaiter transitions through idle, ICE, DTLS, connected, and failed states. Each ICE entry permits one retry if gathering remains incomplete; DTLS rejects at its deadline without retrying. Terminal transitions clear the timer and listeners exactly once. | Lifecycle state must own its deadline and retry allowance so ICE recovery resets only the ICE retry, and DTLS cannot be extended by incomplete gathering. | `src/media/MediaConnectionAwaiter.ts` | `test/unit/spec/media/MediaConnectionAwaiter.ts` | none | PRESENT |
119
- | `MEDIA-R-006` | `MediaProperties.unsetRemoteStreams()` and `unsetPeerConnection()` detach the owned remote streams and connection during replacement/teardown; `util.ts` only creates a `MediaStream` from tracks. | Teardown ownership must be explicit so browser tracks and media-core callbacks do not outlive their meeting. | `src/media/properties.ts`, `src/media/util.ts` | `test/unit/spec/media/properties.ts` | none | PRESENT |
120
-
121
- ## Design Overview
122
-
123
- `index.ts` exports media-facing types and helpers; `util.ts` only creates a `MediaStream`; `properties.ts` owns local/remote streams, the peer connection, teardown, and construction of `MediaConnectionAwaiter`, which waits on WebRTC/ICE events with phase deadlines. Its `State` union owns lifecycle and ICE retry allowance; `waitForMediaConnectionConnected()` registers listeners once before evaluation, including for an already terminal connection; `evaluate()` selects transitions, `enter()` applies deadlines or settlement, and `teardown()` removes timers and registered callbacks idempotently.
124
-
125
- ## Data Flow
126
-
127
- ```mermaid
128
- flowchart LR
129
- Meeting[Meeting media operations] --> Props[properties.ts]
130
- Props --> Core[internal-media-core connection]
131
- Props --> Awaiter[MediaConnectionAwaiter.ts]
132
- Awaiter --> Core
133
- Tracks[MediaStreamTrack inputs] --> Util[util.ts createMediaStream]
134
- Util --> Props
135
- Props --> Output[local/remote streams and connection result]
136
- ```
137
-
138
- ## Sequence Diagram(s)
139
-
140
- Sequence coverage:
141
-
142
- | Operation group | Diagram | Failure coverage |
143
- |---|---|---|
144
- | UC-1…UC-5 — media properties and readiness operation groups | Media properties and readiness primary sequence | connection failure, bounded ICE timeout, listener removal, and explicit owner teardown |
145
- | UC-1…UC-5 — media properties and readiness alternate/failure paths | Media properties and readiness alternate/failure sequence | WebRTC connection failure, incomplete ICE gathering after the bounded retry, missing tracks, or teardown during wait |
146
-
147
- ### Media properties and readiness primary sequence
148
-
149
- ```mermaid
150
- sequenceDiagram
151
- participant M as Meeting
152
- participant P as MediaProperties
153
- participant C as WebRTC media connection
154
- participant A as MediaConnectionAwaiter
155
- M->>P: set streams / peer connection
156
- P->>A: waitForMediaConnectionConnected()
157
- A->>C: subscribe to connection and ICE changes
158
- alt connected
159
- C-->>A: connected/completed
160
- A-->>P: resolve
161
- else failed or timeout
162
- C--xA: failed/incomplete
163
- A--xP: failure result
164
- end
165
- A->>C: remove the awaiter's registered listeners
166
- P-->>M: connection outcome
167
- ```
168
-
169
- ### Media properties and readiness alternate/failure sequence
170
-
171
- ```mermaid
172
- sequenceDiagram
173
- participant P as MediaProperties
174
- participant A as MediaConnectionAwaiter
175
- participant C as Media-core connection
176
- P->>A: waitForMediaConnectionConnected()
177
- A->>C: register connection and ICE listeners
178
- alt connection reaches connected/completed
179
- C-->>A: readiness event
180
- A-->>P: resolve once; clear timer and listeners
181
- else failure, closure, or timeout
182
- C--xA: terminal event or timer expiry
183
- A--xP: reject and remove listeners; immediate failure leaves timer scheduled
184
- end
185
- ```
186
-
187
- ## Class / Component Relationships
188
-
189
- ```mermaid
190
- classDiagram
191
- class Meeting
192
- class Props
193
- class Core
194
- class Awaiter
195
- class Tracks
196
- class Util
197
- class Output
198
- Meeting --> Props
199
- Props --> Core
200
- Props --> Awaiter
201
- Awaiter --> Core
202
- Tracks --> Util
203
- Util --> Props
204
- Props --> Output
205
- ```
206
-
207
- The arrows identify ownership and delegation inside `src/media/`; files that only declare types or constants are not presented as transports.
208
-
209
- ## Use Cases
210
-
211
- - **UC-1:** Store media direction, media settings, preferred video device, and the active media-core connection on `MediaProperties`. Evidence: `src/media/properties.ts`.
212
- - **UC-2:** Assign microphone, camera, share-audio, and share-video streams independently and test local sharing with `hasLocalShareStream()`. Evidence: `src/media/properties.ts`.
213
- - **UC-3:** Replace or unset remote audio, video, and share references without treating those assignments as track or peer-connection closure. Evidence: `src/media/properties.ts`.
214
- - **UC-4:** Await connection readiness, retry one incomplete ICE-gathering timeout, and remove only the awaiter's WebRTC listeners when it settles. Evidence: `src/media/MediaConnectionAwaiter.ts`.
215
- - **UC-5:** Derive current connection diagnostics and throttle repeated media-issue metric submission. Evidence: `src/media/properties.ts`, `src/media/MediaConnectionAwaiter.ts`.
216
-
217
- ## State Model
218
-
219
- Media connection, transceivers/streams, readiness waiters, and listener cleanup are held for the meeting media lifetime.
220
-
221
- ## Business Rules & Invariants
222
-
223
- - Every readiness waiter exposes one defer result and removes registered listeners on its terminal path. Connected and failed transitions both clear the timer through idempotent teardown. Closed media is not reused, and permission/negotiation failures remain visible. Enforced by `src/media/MediaConnectionAwaiter.ts` and supporting code under `src/media/`.
224
-
225
- ## Concurrency & Reactive Flow
226
-
227
- - Each `MediaConnectionAwaiter` uses one defer for its specific media-core connection and removes its WebRTC listeners on terminal paths. Both terminal states clear the timer and prevent later callbacks from restarting the wait. Replacing or tearing down media uses `MediaProperties.unsetRemoteStreams()` and `unsetPeerConnection()` so old stream/connection references are detached before reuse.
228
-
229
- ## Protocol / Wire Format
230
-
231
- - External payloads are parsed/serialized by files under `src/media/` and existing Webex/media dependencies. Preserve current field names, enum/raw values, sequence identifiers, and compatibility behavior; do not treat the normalized client model as the wire schema.
232
-
233
- ## Error Handling & Failure Modes
234
-
235
- | Condition | Signal | Caller recovery |
236
- |---|---|---|
237
- | Media connection reports immediate failure | `evaluate()` enters failed with its connectivity result; teardown clears the timer and registered listeners. | Tear down or replace the connection before beginning a new attempt. |
238
- | Media does not become ready before the awaiter's timeout | The timeout callback rejects with its connection result and removes registered listeners; one retry is allowed on an incomplete-gathering ICE deadline, reset on each new ICE entry. DTLS deadlines reject without retrying. | Tear down or replace that connection before beginning a new media attempt. |
239
- | Media connection reaches the expected connected/completed state | The awaiter resolves once and removes its listeners and timer. | Continue using the established connection. |
240
- | Remote streams or peer connection are replaced/removed | `MediaProperties` unsets the owned stream or connection reference; `util.ts` only constructs a `MediaStream` from supplied tracks. | Do not assign transport lifecycle ownership to the utility helper. |
241
-
242
- ## Pitfalls
243
-
244
- - Event listeners can fire before or after a wait begins. Register and inspect atomically. Terminal transitions clear the timer and listeners. Returning from DTLS to ICE grants a fresh ICE gathering retry; repeated events within the same phase do not reset that allowance.
245
- - Public behavior may be reachable through a parent `Meeting`/`Meetings` object even when the source helper is not exported directly.
246
-
247
- ## Key Design Trade-off
248
-
249
- - A media-core adapter isolates Meeting from lower-level WebRTC details, adding translation code but keeping public meeting semantics stable.
250
-
251
- ## Test-Case Strategy (module)
252
-
253
- Use the current mirrored suites: `test/unit/spec/media/MediaConnectionAwaiter.ts`, `test/unit/spec/media/index.ts`, `test/unit/spec/media/properties.ts`. Characterize the media-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
254
-
255
- | Behavior / Requirement | Existing test evidence | Gap |
256
- |---|---|---|
257
- | `MEDIA-R-001` | `test/unit/spec/media/index.ts` | cover property assignment, readiness waiting, diagnostics, and explicit teardown separately |
258
- | `MEDIA-R-002` | `test/unit/spec/media/index.ts` | awaiter settlement versus Meeting-owned peer closure needs a boundary assertion |
259
- | `MEDIA-R-003` | `test/unit/spec/media/MediaConnectionAwaiter.ts`, `test/unit/spec/media/properties.ts` | add a boundary assertion that awaiter rejection removes listeners but neither closes the connection nor unsets `MediaProperties` references |
260
- | `MEDIA-R-004` | `test/unit/spec/media/properties.ts` | none |
261
- | `MEDIA-R-005` | The awaiter transitions through idle, ICE, DTLS, connected, and failed states. Each ICE entry permits one retry if gathering remains incomplete; DTLS rejects at its deadline without retrying. Terminal transitions clear the timer and listeners exactly once. | Lifecycle state must own its deadline and retry allowance so ICE recovery resets only the ICE retry, and DTLS cannot be extended by incomplete gathering. | `src/media/MediaConnectionAwaiter.ts` | `test/unit/spec/media/MediaConnectionAwaiter.ts` | none | PRESENT |
262
- | `MEDIA-R-006` | `test/unit/spec/media/properties.ts` | verify unset during partial setup and replacement |
263
-
264
- ## Traceability
265
-
266
- - Repo architecture: [`ARCHITECTURE.md`](../../../ai-docs/ARCHITECTURE.md) · Registry: [`SPEC_INDEX.md`](../../../ai-docs/SPEC_INDEX.md)
267
- - Coverage state and contracts baseline: `../../../.sdd/manifest.json`