@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
@@ -0,0 +1,376 @@
1
+ ---
2
+ type: Module Spec
3
+ title: 'AI Enable Request specification'
4
+ description: Responsibilities, boundaries, design, state, invariants, and verification for the meeting-scoped AI Assistant enablement approval workflow.
5
+ tags: [module, specification]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: module-spec
9
+ generated_from: module-spec@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rarajes2@cisco.com
12
+ updated_at: 2026-11-17T03:14:21Z
13
+ validation_status: pass-with-warnings
14
+ -->
15
+
16
+ # AI Enable Request
17
+
18
+ This source-local document at `src/aiEnableRequest/docs/README.md` owns the stable canonical
19
+ specification for **AI Enable Request**: `meeting.aiEnableRequest`, the meeting-scoped approval
20
+ workflow used when a participant requests host approval to enable AI Assistant, plus the exported
21
+ `getAIEnablementApprover` utility. Ground every claim in repository evidence and link to the
22
+ [package architecture](../../../docs/architecture.md) instead of repeating broader facts. No service
23
+ specification exists because this package is a library.
24
+
25
+ Start here: root [package agent instructions](../../../AGENTS.md) · router
26
+ [documentation index](../../../docs/index.md) · system
27
+ [package architecture](../../../docs/architecture.md) · registry
28
+ [module registry](../../../docs/specs/README.md).
29
+
30
+ ## Metadata
31
+
32
+ | Field | Value |
33
+ | ----------------- | ----- |
34
+ | Owner | @webex/web-client, @webex/web-sdk |
35
+ | Source path | `src/aiEnableRequest` |
36
+ | Resource kind | module |
37
+ | Status | Draft |
38
+ | Last verified | 2026-11-16 at `0b8c34db7f` |
39
+ | Module id | `plugin-meetings/aiEnableRequest` |
40
+ | Parent spec | — |
41
+ | Doc kind | Module spec |
42
+ | Coverage score | Pending coverage assessment |
43
+ | Validation status | not-run |
44
+
45
+ ## Applicability
46
+
47
+ | Condition ID | Status | Evidence or reason | Owned section |
48
+ | ------------------------------------ | ---------- | ------------------ | ------------- |
49
+ | `module.has_tiers` | N/A | No tier policy exists in `package.json` | Tier |
50
+ | `module.has_ui` | N/A | `src/aiEnableRequest/index.ts` returns promises and triggers events; it renders nothing | UI use-case flow |
51
+ | `module.crosses_service_boundaries` | Applicable | `src/aiEnableRequest/index.ts` listens to Mercury locus.approval_request events and sends HTTP requests to the Locus approval URL | Cross-boundary use-case flow |
52
+ | `module.holds_client_state` | Applicable | `src/aiEnableRequest/index.ts` keeps locusUrl, approvalUrl, selfParticipantId, and hasSubscribedToEvents | Client state model |
53
+ | `module.enforces_domain_rules` | Applicable | Approver selection in `src/aiEnableRequest/utils.ts` and the event relevance filter in `src/aiEnableRequest/index.ts` | Business rules and invariants |
54
+ | `module.is_concurrent_async` | Applicable | Every approval action returns a promise and the Mercury listener runs between calls (`src/aiEnableRequest/index.ts`) | Concurrency and reactive flow |
55
+ | `module.owns_persistence` | N/A | Nothing is stored; the approval record is owned by Locus | Data, schema, and migration discipline |
56
+ | `module.stateful_transitions` | N/A | The only transition is the one-time hasSubscribedToEvents flag in `src/aiEnableRequest/index.ts`; request state lives in Locus | State machine |
57
+ | `module.exposes_wire_protocol` | N/A | The request body is a fixed four-field object listed under Use cases and flows; no versioned format is owned here | Protocol and wire format |
58
+ | `module.ui_multi_screen` | N/A | No UI | UI flow |
59
+ | `module.large_data_model` | N/A | Four instance props in `src/aiEnableRequest/index.ts` | Data model |
60
+ | `module.returns_caller_errors` | Applicable | HTTP rejections propagate from `src/aiEnableRequest/index.ts` | Caller-visible failure modes |
61
+ | `module.module_specific_conventions` | Applicable | The selector and transport split between `src/aiEnableRequest/utils.ts` and `src/aiEnableRequest/index.ts` | Module-specific rules |
62
+ | `module.published_package` | N/A | The package is published, but this module is reached through meeting.aiEnableRequest and the root export in `src/index.ts`; export stability is owned by the package architecture | Export stability |
63
+ | `module.embedded_in_host` | N/A | No host embedding | Host integration and theming |
64
+ | `module.has_design_tradeoff` | N/A | No recorded trade-off in `src/aiEnableRequest/index.ts` | Key design trade-off |
65
+ | `module.has_submodules` | N/A | The directory has no child module | Sub-modules |
66
+
67
+ ## Evidence register
68
+
69
+ Requirements cite current source and mirrored tests. Current code wins over retained prose when they
70
+ conflict; commit and PR history are excluded. Missing evidence stays a gap.
71
+
72
+ | Evidence | What it establishes |
73
+ | -------- | ------------------- |
74
+ | `src/aiEnableRequest/index.ts` | `AIEnableRequest` extends `WebexPlugin` in namespace `Meetings`; props, the three setters, the Mercury listener, `sendApprovalRequest`, and the four approval actions |
75
+ | `src/aiEnableRequest/utils.ts` | `getAIEnablementApprover(meeting)` approver selection over `meeting.members.membersCollection.members` |
76
+ | `src/constants.ts` | `AI_ENABLE_REQUEST` (event `APPROVAL_REQUEST_ARRIVED`, action types `REQUESTED`, `ACCEPTED`, `DECLINED`, `DECLINED_ALL`, resource type `AiAssistant`) and `LOCUSEVENT.APPROVAL_REQUEST` (`locus.approval_request`) |
77
+ | `src/meeting/index.ts` | Meeting constructs the instance with its locusUrl and forwards LOCUS_INFO_UPDATE_URL, the LINKS_SERVICES approval URL, and SELF_ID_CHANGED to the setters |
78
+ | `src/member/util.ts`, `src/member/index.ts` | `canApproveAIEnablement` is true unless the participant has `attendeeRequestAiAssistantNotAllowed` |
79
+ | `src/index.ts` | The package root exports `getAIEnablementApprover` |
80
+ | `test/unit/spec/aiEnableRequest/index.ts` | Setters, the one-listener guard, the event filter, and each action's verb, body, resolution, and rejection |
81
+ | `test/unit/spec/aiEnableRequest/utils.ts` | Moderator, sorted cohost, no-candidate, and dual-role selection cases |
82
+ | `test/unit/spec/meeting/index.js` | Meeting creates `AIEnableRequest` and forwards the locus URL, approval URL, and self id |
83
+ | `src/aiEnableRequest/README.md` | Retained human guide; context only. Its event name differs from the code (see Pitfalls and constraints) |
84
+
85
+ ## Purpose and boundary
86
+
87
+ - Responsibility: owns the meeting-scoped approval workflow used when a participant requests host
88
+ approval to enable AI Assistant.
89
+ - In scope: the approval URL, Locus URL, and self participant id setters; the single Mercury
90
+ `locus.approval_request` listener and its relevance filter; the `APPROVAL_REQUEST_ARRIVED` event;
91
+ the `REQUESTED` POST and the `ACCEPTED`, `DECLINED`, and `DECLINED_ALL` PUTs; approver selection.
92
+ - Out of scope: the roster and role data (`src/members`, `src/member`); the Locus approval record and
93
+ its policy; enabling AI Assistant itself; UI.
94
+ - Consumers: `Meeting` (`src/meeting/index.ts`) creates and feeds the instance; applications call
95
+ `meeting.aiEnableRequest` and the root export `getAIEnablementApprover`.
96
+
97
+ ## Structure and key files
98
+
99
+ `src/aiEnableRequest/` contains two direct source files (`index.ts`, `utils.ts`) and one retained
100
+ reference file (`README.md`), and has two mirrored unit-test files. This spec separates its public
101
+ operations, runtime data movement, component ownership, state applicability, and verification
102
+ boundary.
103
+
104
+ | File | Holds |
105
+ | ---- | ----- |
106
+ | `src/aiEnableRequest/README.md` | retained human guide for the events and initiator/approver methods; context only |
107
+ | `src/aiEnableRequest/index.ts` | `AIEnableRequest` plugin: props, setters, the Mercury listener, and the approval actions |
108
+ | `src/aiEnableRequest/utils.ts` | `getAIEnablementApprover` approver-selection helper |
109
+ | `test/unit/spec/aiEnableRequest/index.ts` and `test/unit/spec/aiEnableRequest/utils.ts` | mirrored unit coverage of the plugin and the selector |
110
+ | `src/aiEnableRequest/docs/README.md` | this module specification |
111
+
112
+ ## Public surface
113
+
114
+ | Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
115
+ | ----------- | ---- | ------- | ------- | --------------------------- | -------------------- | ---------- |
116
+ | `ai-enable-request-api` | SDK / in-process | `approvalUrlUpdate()`, `locusUrlUpdate()`, and `selfParticipantIdUpdate()` | Keep the listener and outgoing approval actions scoped to the current meeting participant and URLs. | Preserve setter names and the one-listener side effect of the first `selfParticipantIdUpdate()`. | `src/aiEnableRequest/index.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
117
+ | `ai-enable-request-api` | SDK / event | `listenToApprovalRequests()` and `APPROVAL_REQUEST_ARRIVED` | Filter Mercury approval events by resource type, Locus URL, and participant role before exposing them to Meeting consumers. | Preserve the once-only registration guard, the event payload fields, and `DECLINED_ALL` observer behavior. | `src/aiEnableRequest/index.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
118
+ | `ai-enable-request-api` | SDK / remote | `requestEnableAIAssistant({approverId})` and `sendApprovalRequest()` | POST a `REQUESTED` action using the current approval URL and the self participant as initiator. | Preserve HTTP verb, body roles, action value, and returned request promise. | `src/aiEnableRequest/index.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
119
+ | `ai-enable-request-api` | SDK / remote | `acceptEnableAIAssistantRequest()`, `declineEnableAIAssistantRequest()`, and `declineAllEnableAIAssistantRequests()`, each `({url, initiatorId})` | PUT the approver decision to the URL supplied by the incoming approval event, with the self participant as approver. | Preserve all three action values and participant-id placement in the request body. | `src/aiEnableRequest/index.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
120
+ | `ai-enable-request-api` | exported utility | `getAIEnablementApprover(meeting)`, re-exported from the package root | Select the capable moderator, otherwise the lexicographically first capable cohost, or `null`. | The current utility does not exclude the requesting/self participant. | `src/aiEnableRequest/utils.ts`, `src/index.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
121
+
122
+ Contract ID `ai-enable-request-api` is indexed in the
123
+ [package architecture](../../../docs/architecture.md#public-and-consumer-surfaces) and registered in
124
+ `.sdd/manifest.json`; it requires `webex-core-plugin-host`.
125
+
126
+ Compatibility notes:
127
+
128
+ - Prefer additive fields/options and preserve current rejection/event semantics. Internal helpers
129
+ are not public merely because they are exported within the source directory; `sendApprovalRequest`
130
+ and `listenToApprovalRequests` are reachable on the instance but are helpers of the actions and the
131
+ setter.
132
+
133
+ ## Dependencies
134
+
135
+ The module requires Meeting self/host/cohost identity and policy, the Locus and approval URLs,
136
+ request access, Mercury approval events, and the WebexPlugin event utilities.
137
+
138
+ | Dependency | Why it is required | Failure behavior |
139
+ | ---------- | ------------------ | ---------------- |
140
+ | `@webex/webex-core` `WebexPlugin`, contract `webex-core-plugin-host` | `this.request` for the approval HTTP calls; `listenTo` and `trigger` for the Mercury listener and the emitted event; `webex.logger` | Request rejections propagate unchanged through the returned promise |
141
+ | `webex.internal.mercury` | Source of `event:locus.approval_request` | Without Mercury events no `APPROVAL_REQUEST_ARRIVED` is emitted; nothing is retried |
142
+ | `Meeting` (`src/meeting/index.ts`) | Supplies the initial locusUrl and forwards LOCUS_INFO_UPDATE_URL, the LINKS_SERVICES approval URL, and SELF_ID_CHANGED | If a setter has not run, the matching value is undefined and requests use it as is |
143
+ | `meeting.members.membersCollection` and `MemberUtil.canApproveAIEnablement` (`src/member/util.ts`) | Roster, `roles.moderator`, `roles.cohost`, and `canApproveAIEnablement` for approver selection | An empty roster or no capable member returns `null` |
144
+ | `src/constants.ts` | `AI_ENABLE_REQUEST`, `LOCUSEVENT.APPROVAL_REQUEST`, `HTTP_VERBS`, `MEETINGS` | — |
145
+
146
+ ## Requirements
147
+
148
+ | ID | WHAT | WHY | Source evidence | Test / example evidence | Assumptions / gaps | Confidence |
149
+ | --- | ---- | --- | --------------- | ----------------------- | ------------------ | ---------- |
150
+ | `MOD-001` | `getAIEnablementApprover` selects the eligible AI-enablement approver: the first member with `roles.moderator` and `canApproveAIEnablement`, else the capable cohost whose id sorts first by `localeCompare`, else `null`. | The meeting-scoped approval workflow needs one participant who is allowed to answer an enablement request; the code comments name the host first and capable cohosts next. | `src/aiEnableRequest/utils.ts` | `test/unit/spec/aiEnableRequest/utils.ts` | requester/self exclusion is not implemented; retain as an explicit product-policy gap | Present |
151
+ | `MOD-002` | `requestEnableAIAssistant({approverId})` requests AI Assistant enablement approval: it POSTs to the current `approvalUrl` a body with `actionType: REQUESTED`, `resourceType: AiAssistant`, `initiator.participantId` = self, and `approver.participantId` = `approverId`. | The exact initiator/approver roles and action value determine which participant can respond to the enablement request. | `src/aiEnableRequest/index.ts`, `src/constants.ts` | `test/unit/spec/aiEnableRequest/index.ts` | requester/self exclusion is not implemented by `getAIEnablementApprover`; no guard rejects a missing `approvalUrl` | Present |
152
+ | `MOD-003` | HTTP rejections propagate through the returned promise, while unrelated Mercury approval events are ignored and the single listener is installed only once. | The listener must not emit another meeting's approval or multiply registrations, while callers still need the original HTTP failure. | `src/aiEnableRequest/index.ts` | `test/unit/spec/aiEnableRequest/index.ts` | none | Present |
153
+ | `MOD-004` | `acceptEnableAIAssistantRequest`, `declineEnableAIAssistantRequest`, and `declineAllEnableAIAssistantRequests` PUT to the caller's `url` with `actionType` `ACCEPTED`, `DECLINED`, or `DECLINED_ALL`, `initiator.participantId` = the caller's `initiatorId`, and `approver.participantId` = self. | The approver answers the specific request URL carried by the incoming event, and Locus needs both roles to match the decision to the original request. | `src/aiEnableRequest/index.ts` | `test/unit/spec/aiEnableRequest/index.ts` | none | Present |
154
+ | `MOD-005` | An `APPROVAL_REQUEST_ARRIVED` event is emitted for an `AiAssistant` approval on the current Locus when self is the approver (`receivers[0].participantId`) or the initiator, and for `DECLINED_ALL` regardless of role; the payload is `{actionType, isApprover, isInitiator, initiatorId, approverId, url}`. | The code comment: not just the initiator needs to know about declined all, because all future requests will be rejected while the meeting is in the declined-all state. | `src/aiEnableRequest/index.ts` | `test/unit/spec/aiEnableRequest/index.ts` | none | Present |
155
+ | `MOD-006` | `selfParticipantIdUpdate` stores the id and, on its first call only, calls `listenToApprovalRequests()` and sets `hasSubscribedToEvents`; `approvalUrlUpdate` and `locusUrlUpdate` only store their values. | Meeting forwards every SELF_ID_CHANGED, so the guard keeps one listener while later identity updates refresh matching context. | `src/aiEnableRequest/index.ts`, `src/meeting/index.ts` | `test/unit/spec/aiEnableRequest/index.ts`, `test/unit/spec/meeting/index.js` | none | Present |
156
+
157
+ ## Design overview
158
+
159
+ AIEnableRequest owns one Mercury approval listener and the HTTP writes to the current Locus approval
160
+ URL. `utils.ts` only selects an eligible approver from roster data; it is not a transport.
161
+
162
+ The implementation is TypeScript/JavaScript in the Node 22.14 Yarn workspace, built on the Webex
163
+ core/plugin abstractions (`WebexPlugin.extend`) and tested with Mocha/Sinon/`@webex/test-helper-chai`.
164
+ `Meeting` constructs the instance as `new AIEnableRequest({locusUrl}, {parent: webex})` and keeps it
165
+ current: the locus URL from LOCUS_INFO_UPDATE_URL, the approval URL from the LINKS_SERVICES
166
+ `services.approval.url`, and the self participant id from SELF_ID_CHANGED. The first self id starts
167
+ the listener. Meeting does not re-emit `APPROVAL_REQUEST_ARRIVED`; consumers subscribe on
168
+ `meeting.aiEnableRequest`. Every action funnels through `sendApprovalRequest`, which builds the one
169
+ request body shape.
170
+
171
+ ## Data flow and sequence coverage
172
+
173
+ Call style: in-process method calls on `meeting.aiEnableRequest`; outbound HTTPS through
174
+ `WebexPlugin.request` to the Locus approval URL; inbound Mercury `event:locus.approval_request`.
175
+
176
+ ```mermaid
177
+ flowchart LR
178
+ Roster[Meeting roster] --> Selector[utils.ts: approver selection]
179
+ Caller[Meeting / consumer] --> Controller[index.ts: approval workflow]
180
+ Selector --> Caller
181
+ Mercury[Mercury approval events] --> Controller
182
+ Controller --> Approval[HTTP request to approvalUrl]
183
+ Controller --> Event[APPROVAL_REQUEST_ARRIVED]
184
+ ```
185
+
186
+ Sequence coverage:
187
+
188
+ | Operation group | Diagram | Failure coverage |
189
+ | --------------- | ------- | ---------------- |
190
+ | UC-002…UC-005 — AI approval operation groups (incoming event, request, decisions) | AI approval sequence | Mercury filtering (an event for another resource type or Locus, or one this participant is not party to, except `DECLINED_ALL`) and HTTP action rejection |
191
+ | UC-001 — approver selection | `src/aiEnableRequest/utils.ts` (one synchronous call, MOD-001) | returns `null` when no capable moderator or cohost exists |
192
+ | UC-002 — context setup and listener registration | Context setup sequence | later self id updates do not register another listener |
193
+
194
+ ### AI approval sequence
195
+
196
+ ```mermaid
197
+ sequenceDiagram
198
+ participant C as Meeting / consumer
199
+ participant A as AIEnableRequest index.ts
200
+ participant M as Mercury
201
+ participant H as approvalUrl
202
+ M-->>A: approval-request event
203
+ A->>A: filter resourceType, locusUrl, and participant ids
204
+ alt resourceType is not AiAssistant
205
+ A->>A: ignore the event
206
+ else locusUrl differs from the current Locus
207
+ A->>A: log and ignore the event
208
+ else self is initiator or approver, or actionType is DECLINED_ALL
209
+ A-->>C: APPROVAL_REQUEST_ARRIVED when relevant
210
+ else event belongs to another participant
211
+ A->>A: ignore the event
212
+ end
213
+ C->>A: request / accept / decline
214
+ A->>H: POST or PUT action payload
215
+ H-->>A: response or rejection
216
+ A-->>C: settle the request promise
217
+ ```
218
+
219
+ ### Context setup sequence
220
+
221
+ ```mermaid
222
+ sequenceDiagram
223
+ participant MT as Meeting
224
+ participant L as LocusInfo
225
+ participant A as AIEnableRequest
226
+ participant M as Mercury
227
+ MT->>A: new AIEnableRequest({locusUrl}, {parent: webex})
228
+ L-->>MT: LOCUS_INFO_UPDATE_URL {url}
229
+ MT->>A: locusUrlUpdate(url)
230
+ L-->>MT: LINKS_SERVICES {services.approval.url}
231
+ MT->>A: approvalUrlUpdate(url)
232
+ L-->>MT: SELF_ID_CHANGED {selfId}
233
+ MT->>A: selfParticipantIdUpdate(selfId)
234
+ opt hasSubscribedToEvents is false
235
+ A->>M: listenTo event:locus.approval_request
236
+ A->>A: hasSubscribedToEvents = true
237
+ end
238
+ ```
239
+
240
+ ## Class and component relationships
241
+
242
+ ```mermaid
243
+ classDiagram
244
+ class WebexPlugin
245
+ class AIEnableRequest {
246
+ locusUrl
247
+ approvalUrl
248
+ selfParticipantId
249
+ hasSubscribedToEvents
250
+ approvalUrlUpdate(approvalUrl)
251
+ locusUrlUpdate(locusUrl)
252
+ selfParticipantIdUpdate(selfParticipantId)
253
+ listenToApprovalRequests()
254
+ sendApprovalRequest(params)
255
+ requestEnableAIAssistant(params)
256
+ acceptEnableAIAssistantRequest(params)
257
+ declineEnableAIAssistantRequest(params)
258
+ declineAllEnableAIAssistantRequests(params)
259
+ }
260
+ class Meeting
261
+ class Roster
262
+ class Selector
263
+ class Mercury
264
+ class Approval
265
+ WebexPlugin <|-- AIEnableRequest
266
+ Meeting --> AIEnableRequest : caller, owns controller
267
+ Roster --> Selector : getAIEnablementApprover reads members
268
+ Selector --> Meeting : approver id
269
+ Mercury --> AIEnableRequest : approval event
270
+ AIEnableRequest --> Approval : POST or PUT approvalUrl
271
+ ```
272
+
273
+ The arrows identify ownership and delegation around `src/aiEnableRequest/`: `index.ts` is the
274
+ controller and transport, `utils.ts` is the selector over the meeting roster, and `src/constants.ts`
275
+ only declares constants and is not presented as a transport.
276
+
277
+ ## Use cases and flows
278
+
279
+ | Use case | Actor or caller | Primary steps and outcome | Failure or boundary behavior | Evidence |
280
+ | -------- | --------------- | ------------------------- | ---------------------------- | -------- |
281
+ | `UC-001` | Requesting participant's client | Select a capable moderator or the lexicographically first capable cohost with `getAIEnablementApprover`; return `null` when neither exists | Does not exclude self/requester | `src/aiEnableRequest/utils.ts`, `test/unit/spec/aiEnableRequest/utils.ts` |
282
+ | `UC-002` | Meeting | On the first `selfParticipantIdUpdate()`, call `listenToApprovalRequests()` and retain the one-listener guard for later identity updates | Later updates only replace the id | `src/aiEnableRequest/index.ts`, `test/unit/spec/aiEnableRequest/index.ts` |
283
+ | `UC-003` | Mercury, then any participant | Filter Mercury approval events to the current Locus and expose only requests relevant to the self initiator, self approver, or all observers of `DECLINED_ALL` | Other events are dropped silently; a different Locus is logged at info level | `src/aiEnableRequest/index.ts`, `test/unit/spec/aiEnableRequest/index.ts` |
284
+ | `UC-004` | Requesting participant | POST an enablement request with `requestEnableAIAssistant({approverId})`, using the exact initiator/approver ids required by the action | The HTTP rejection rejects the promise | `src/aiEnableRequest/index.ts`, `test/unit/spec/aiEnableRequest/index.ts` |
285
+ | `UC-005` | Approver (host or cohost) | On `APPROVAL_REQUEST_ARRIVED` with `isApprover`, PUT accept, decline, or decline-all decisions with the event's `url` and `initiatorId` | The HTTP rejection rejects the promise | `src/aiEnableRequest/index.ts`, `test/unit/spec/aiEnableRequest/index.ts` |
286
+
287
+ ### Cross-boundary use-case flow
288
+
289
+ | Boundary | Transport and ordering | Compatibility | Timeout, retry, and recovery |
290
+ | -------- | ---------------------- | ------------- | ---------------------------- |
291
+ | Locus approval service (`UC-004`, `UC-005`) | HTTPS through `WebexPlugin.request`; one request per call; POST for `REQUESTED`, PUT for decisions | Body `{actionType, resourceType: 'AiAssistant', initiator: {participantId}, approver: {participantId}}` | No retry or timeout here; the request layer's behavior applies |
292
+ | Mercury (`UC-003`) | Inbound `event:locus.approval_request`, handled one at a time as it arrives | Reads `data.locusUrl` and `data.approval.{resourceType, receivers, initiator, actionType, url}` | Ignored events are not retried or buffered |
293
+
294
+ ## Client state model
295
+
296
+ Approval and Locus URLs, self participant id, and the listener registration are meeting scoped: one
297
+ instance per Meeting.
298
+
299
+ | State or slice | Owner | Initial state | Transition triggers | Reset or persistence boundary |
300
+ | -------------- | ---------- | ------------- | ------------------- | ----------------------------- |
301
+ | `locusUrl` | `AIEnableRequest` instance | The Meeting's locusUrl at construction | `locusUrlUpdate` | Instance memory; never persisted |
302
+ | `approvalUrl` | `AIEnableRequest` instance | undefined | `approvalUrlUpdate` | Instance memory |
303
+ | `selfParticipantId` | `AIEnableRequest` instance | undefined | `selfParticipantIdUpdate` | Instance memory |
304
+ | `hasSubscribedToEvents` | `AIEnableRequest` instance | undefined (falsy) | Set true by the first `selfParticipantIdUpdate` | Never reset by this module |
305
+
306
+ ## Business rules and invariants
307
+
308
+ | ID | Invariant | WHY | Enforcement source | Test evidence |
309
+ | --- | --------- | --- | ------------------ | ------------- |
310
+ | `INV-001` | The selector prefers a capable moderator and otherwise the lexicographically first capable cohost; it does not exclude self/requester. | Only a host or cohost allowed by `canApproveAIEnablement` can answer; a stable sort gives every client the same answer (inferred from the sort). | `src/aiEnableRequest/utils.ts` | `test/unit/spec/aiEnableRequest/utils.ts` |
311
+ | `INV-002` | Initiator and approver ids are preserved: requests carry self as initiator, decisions carry self as approver and the event's initiatorId, and decision actions target the supplied approval request URL. | Locus matches the decision to the original request by these ids and URL (MOD-004). | `src/aiEnableRequest/index.ts` | `test/unit/spec/aiEnableRequest/index.ts` |
312
+ | `INV-003` | At most one Mercury approval listener exists per instance. | Duplicate listeners would emit each approval more than once (MOD-003). | `src/aiEnableRequest/index.ts` | `test/unit/spec/aiEnableRequest/index.ts` |
313
+
314
+ ## Concurrency and reactive flow
315
+
316
+ - Execution model: one JavaScript event loop; each approval action returns the request promise.
317
+ - Mercury approval events are filtered against the controller's current Locus, self participant,
318
+ initiator, and approver ids before emission. `selfParticipantIdUpdate()` calls
319
+ `listenToApprovalRequests()` only while `hasSubscribedToEvents` is false, so later participant
320
+ updates refresh matching context without registering a duplicate listener.
321
+ - Ordering guarantees: none across calls; each event is handled synchronously when it arrives.
322
+ - Idempotency and retry: nothing is retried; repeating an action sends another request.
323
+ - Shared-state protection: none needed beyond the single-threaded event loop.
324
+
325
+ ## Caller-visible failure modes
326
+
327
+ | Condition | Signal | Caller recovery |
328
+ | --------- | ------ | --------------- |
329
+ | An approval action request rejects | The promise returned by `requestEnableAIAssistant`, `acceptEnableAIAssistantRequest`, `declineEnableAIAssistantRequest`, or `declineAllEnableAIAssistantRequests` rejects with the HTTP failure. | Correct the request context or retry under the caller's policy. |
330
+ | A Mercury approval event targets another Locus or participant context | The listener ignores it and emits no `APPROVAL_REQUEST_ARRIVED` event; a different Locus is logged at info level. | No caller action; wait for a matching event. |
331
+ | An eligible approver is found | `getAIEnablementApprover` returns a capable moderator or the sorted-first capable cohost; it does not exclude self/requester. | Apply any requester-exclusion policy outside this utility if the product requires it. |
332
+ | No capable moderator or cohost exists | `getAIEnablementApprover` returns `null`. | Do not send a request without an approver. |
333
+
334
+ Evidence: `src/aiEnableRequest/index.ts`, `src/aiEnableRequest/utils.ts`, and the request-failure
335
+ cases in `test/unit/spec/aiEnableRequest/index.ts`.
336
+
337
+ ## Pitfalls and constraints
338
+
339
+ - The approver is derived from current meeting roster/roles. Caching it across host/cohost changes
340
+ can send a request to an ineligible participant.
341
+ - Verify both typed constants/enums and raw wire values before changing a logical condition in this
342
+ legacy package (`AI_ENABLE_REQUEST` in `src/constants.ts` against the Locus `AiAssistant` and action
343
+ strings).
344
+ - The retained `src/aiEnableRequest/README.md` names the event `approval-request-arrived`; the code
345
+ triggers `APPROVAL_REQUEST_ARRIVED`.
346
+ - No method removes the Mercury listener, and `hasSubscribedToEvents` is never reset; the listener
347
+ lives as long as the instance.
348
+ - No action guards a missing `approvalUrl` or `selfParticipantId`; the request is sent with the
349
+ undefined value.
350
+
351
+ ## Module-specific rules
352
+
353
+ - Do: preserve this boundary: select a capable moderator or sorted-first capable cohost with
354
+ `getAIEnablementApprover`; do not document requester exclusion unless code adds it.
355
+ - Do not: move remote I/O or lifecycle ownership into a passive type, constant, catalog, or
356
+ normalization file such as `utils.ts` or `src/constants.ts`.
357
+
358
+ ## Verification
359
+
360
+ Use the current mirrored suites: `test/unit/spec/aiEnableRequest/index.ts` and
361
+ `test/unit/spec/aiEnableRequest/utils.ts`. Characterize the aiEnableRequest-specific use cases above
362
+ and each listed failure condition; add cleanup or transition cases only for resources and state this
363
+ module actually owns.
364
+
365
+ | Behavior / Requirement | Existing test evidence | Gap |
366
+ | ---------------------- | ---------------------- | --- |
367
+ | `MOD-001`, `INV-001` | `test/unit/spec/aiEnableRequest/utils.ts` covers moderator, sorted cohost, no candidate, empty roster, and dual-role selection | cover a self/requester candidate |
368
+ | `MOD-002`, `MOD-004`, `INV-002` | `test/unit/spec/aiEnableRequest/index.ts` asserts each action's POST or PUT verb, action type, and participant roles on success, and that each rejection propagates | add an explicit assertion that each decision method preserves its PUT action and participant roles on request rejection |
369
+ | `MOD-003`, `MOD-006`, `INV-003` | `test/unit/spec/aiEnableRequest/index.ts` covers a second selfParticipantIdUpdate() call and proves it does not install another Mercury listener | none |
370
+ | `MOD-005` | `test/unit/spec/aiEnableRequest/index.ts` covers approver, initiator, neither, DECLINED_ALL, resource type, Locus URL, and missing ids | none |
371
+ | Meeting wiring | `test/unit/spec/meeting/index.js` covers construction and the three forwarded updates | none |
372
+
373
+ Run them with `yarn workspace @webex/plugin-meetings test:unit --targets aiEnableRequest/index.ts`
374
+ and `--targets aiEnableRequest/utils.ts`. Coverage state and the contracts baseline are recorded in
375
+ `.sdd/manifest.json`. Coverage measurement is pending; the module stays Partial until coverage review
376
+ and independent validation run.