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

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,402 @@
1
+ ---
2
+ type: Module Spec
3
+ title: 'Live annotation specification'
4
+ description: Responsibilities, boundaries, design, state, wire format, and verification for the meeting live-annotation module.
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
+ # Live annotation
17
+
18
+ This canonical source-local document at `src/annotation/docs/README.md` owns the stable
19
+ specification for **live annotation**: the `meeting.annotation` controller (`AnnotationChannel`, a
20
+ `WebexPlugin` in namespace `annotation`). It sends annotation approval actions on a content share to
21
+ the approval service, listens to Mercury approval requests, relays encrypted stroke data over the LLM
22
+ channel that `Meeting` or `Webinar` registers, and emits annotation command and stroke events. Ground
23
+ every claim in package evidence and link to the [package architecture](../../../docs/architecture.md)
24
+ instead of repeating broader facts. No service specification exists because this package is a
25
+ library.
26
+
27
+ Related context: [documentation index](../../../docs/index.md) ·
28
+ [package agent instructions](../../../AGENTS.md)
29
+
30
+ ## Metadata
31
+
32
+ | Field | Value |
33
+ | ----- | ----- |
34
+ | Owner | @webex/web-client, @webex/web-sdk |
35
+ | Source path | `src/annotation` |
36
+ | Resource kind | module |
37
+ | Status | Draft |
38
+ | Last verified | 2026-11-16 at `0b8c34db7f` |
39
+ | Module id | `plugin-meetings/annotation` |
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` or `src/annotation/index.ts` | Tier |
50
+ | `module.has_ui` | N/A | `src/annotation/index.ts` sends and relays data; drawing is the application's | UI use-case flow |
51
+ | `module.crosses_service_boundaries` | Applicable | Approval-service requests, the Mercury listener, the LLM relay, and KMS encryption in `src/annotation/index.ts` | Cross-boundary use-case flow |
52
+ | `module.holds_client_state` | Applicable | Sequence number, subscription flag, URLs, and the registered channel in `src/annotation/index.ts` | Client state model |
53
+ | `module.enforces_domain_rules` | Applicable | Approval resource and action values and the send preconditions in `src/annotation/index.ts` and `src/annotation/constants.ts` | Business rules and invariants |
54
+ | `module.is_concurrent_async` | Applicable | Asynchronous encryption between the connectivity check and the send in `src/annotation/index.ts` | Concurrency and reactive flow |
55
+ | `module.owns_persistence` | N/A | Nothing is stored (`src/annotation/index.ts`) | Data, schema, and migration discipline |
56
+ | `module.stateful_transitions` | N/A | Recorded false in `.sdd/manifest.json`; the declared status values in `src/annotation/constants.ts` drive no transition | State machine |
57
+ | `module.exposes_wire_protocol` | Applicable | The approval bodies and the LLM publishRequest envelope built in `src/annotation/index.ts` | Protocol and wire format |
58
+ | `module.ui_multi_screen` | N/A | No UI | UI flow |
59
+ | `module.large_data_model` | N/A | Five small types in `src/annotation/annotation.types.ts` | Data model |
60
+ | `module.returns_caller_errors` | Applicable | Approval request rejections and silent stroke failures in `src/annotation/index.ts` | Caller-visible failure modes |
61
+ | `module.module_specific_conventions` | N/A | Recorded false in `.sdd/manifest.json` | Module-specific rules |
62
+ | `module.published_package` | N/A | `src/index.ts` re-exports only the annotation types; the controller is reached through a meeting | Export stability |
63
+ | `module.embedded_in_host` | N/A | No host theme or embed API | Host integration and theming |
64
+ | `module.has_design_tradeoff` | N/A | Recorded false in `.sdd/manifest.json` | Key design trade-off |
65
+ | `module.has_submodules` | N/A | The annotation directory has no child module (`src/annotation/index.ts`) | Sub-modules |
66
+
67
+ ## Evidence register
68
+
69
+ Requirements cite current source and mirrored tests under `test/unit/spec/annotation/`. Where
70
+ prose and code disagree, current code wins; commit and PR history are not used as evidence. Missing
71
+ evidence stays a recorded gap.
72
+
73
+ | Evidence | What it establishes |
74
+ | -------- | ------------------- |
75
+ | `src/annotation/index.ts` | `AnnotationChannel` extends `WebexPlugin` and implements `IAnnotationChannel`: channel registration, the Mercury listener, approval requests, encryption, and the stroke envelope |
76
+ | `src/annotation/constants.ts` | `EVENT_TRIGGERS` (`annotation:strokeData`, `annotation:command`), `ANNOTATION_RESOURCE_TYPE` (`AnnotationOnShare`), `ANNOTATION_RELAY_TYPES`, `ANNOTATION_STATUS`, `ANNOTATION_POLICY`, `ANNOTATION_REQUEST_TYPE`, `ANNOTATION_ACTION_TYPE`, `ANNOTATION` (`annotation`) |
77
+ | `src/annotation/annotation.types.ts` | `StrokeData`, `RequestData`, `CommandRequestBody`, `AnnotationInfo`, `IAnnotationChannel` |
78
+ | `src/constants.ts` | `LOCUSEVENT.APPROVAL_REQUEST` (`locus.approval_request`), `EVENT_TRIGGERS.MEETING_UPDATE_ANNOTATION_INFO`, `ANNOTATION.ANNOTATION_ON_SHARE_SUPPORTED` |
79
+ | `src/meeting/index.ts` | `Meeting` creates `new Annotation({parent: webex})`, calls `locusUrlUpdate`, `approvalUrlUpdate`, `registerChannel` (outside a practice session), and `deregisterEvents`, and emits `meeting:updateAnnotationInfo` |
80
+ | `src/webinar/index.ts` | `Webinar` registers the practice-session LLM channel and switches back to the meeting channel |
81
+ | `src/meeting/request.ts` | A join with `liveAnnotationSupported` adds the `ANNOTATION_ON_SHARE_SUPPORTED` device capability |
82
+ | `src/index.ts` | Re-exports the annotation types as `sdkAnnotationTypes` |
83
+ | `test/unit/spec/annotation/index.ts` | Cases for channel registration, both event processors, encryption, the stroke envelope and its preconditions, every approval request, deregistration, and the URL setters |
84
+ | Observation, no stated WHY | `cancelApproveAnnotation` sends no `receivers`, while `approveAnnotation` and `closeAnnotation` add one when `toUserId` is set (`src/annotation/index.ts`) |
85
+ | Observation, no stated WHY | The `deviceUrl` property is declared but never assigned (`src/annotation/index.ts`) |
86
+
87
+ ## Purpose and boundary
88
+
89
+ - Responsibility: Owns annotation approval requests, Mercury/LLM listener registration, encrypted stroke relay, and the emitted annotation command/stroke events.
90
+ - In scope: `registerChannel`, `unregisterChannel`, `locusUrlUpdate`, `approvalUrlUpdate`,
91
+ `deregisterEvents`; `approveAnnotation`, `cancelApproveAnnotation`, `closeAnnotation`,
92
+ `acceptRequest`, `declineRequest`; `sendStrokeData` and the relay envelope; decryption of
93
+ received strokes; the `annotation:command` and `annotation:strokeData` events; the annotation
94
+ constants and types.
95
+ - Out of scope: the LLM connection and which channel is active (`Meeting`, `Webinar`,
96
+ `@webex/internal-plugin-llm`); the Mercury socket; KMS keys (`webex.internal.encryption`); the
97
+ share's annotation policy and `meeting:updateAnnotationInfo` (`Meeting`); drawing strokes.
98
+ - Consumers: `Meeting` and `Webinar` drive it; applications call `meeting.annotation` and listen to
99
+ its events.
100
+
101
+ ## Structure and key files
102
+
103
+ `src/annotation/` contains 3 direct source files and has 1 mirrored unit-test file,
104
+ `test/unit/spec/annotation/index.ts`. This specification separates its public operations, runtime
105
+ data movement, component ownership, state, and verification boundary. Sources are TypeScript in the
106
+ Node 22.14 Yarn workspace on the Webex core plugin abstraction (`WebexPlugin`); tests run under Mocha
107
+ with Sinon and `@webex/test-helper-chai` (`test:unit` in `package.json`).
108
+
109
+ | File | Holds |
110
+ | ---- | ----- |
111
+ | `src/annotation/annotation.types.ts` | Module type declarations: stroke, request, command body, annotation info, and the `IAnnotationChannel` interface |
112
+ | `src/annotation/constants.ts` | Module constants and wire values: event names, resource, relay, request, and action types, policy, and status |
113
+ | `src/annotation/index.ts` | `AnnotationChannel` controller mounted as `meeting.annotation`: module facade/controller and primary (default) export |
114
+ | `src/annotation/docs/README.md` | This module specification |
115
+ | `test/unit/spec/annotation/index.ts` | Mirrored characterization/unit coverage of the controller |
116
+
117
+ ## Public surface
118
+
119
+ `meeting.annotation` is the `AnnotationChannel` instance `Meeting` creates; `src/index.ts`
120
+ re-exports only the types as `sdkAnnotationTypes`, so applications reach the controller through a
121
+ meeting. Every row belongs to contract `annotation-api`, indexed in the
122
+ [package architecture](../../../docs/architecture.md#public-and-consumer-surfaces); contract IDs and
123
+ coverage state are recorded in `.sdd/manifest.json`.
124
+
125
+ | Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
126
+ |---|---|---|---|---|---|---|
127
+ | `annotation-api` | SDK / lifecycle | `registerChannel()`, `unregisterChannel()`, `locusUrlUpdate()`, `approvalUrlUpdate()`, and `deregisterEvents()` | Register one LLM channel for relay events, store Locus/approval URLs, install the Mercury listener from `locusUrlUpdate()`, and remove the Mercury and channel listeners on teardown. | `approvalUrlUpdate()` only assigns `approvalUrl`; preserve the once-only Mercury guard owned by `locusUrlUpdate()`, the two event topics, and the one-channel rule of `registerChannel()`. | `src/annotation/index.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
128
+ | `annotation-api` | SDK / remote | `approveAnnotation()`, `cancelApproveAnnotation()`, and `closeAnnotation()` | POST requested/closed share-annotation actions to `approvalUrl` or PUT cancellation to the approval's url. | Preserve action/resource values, share instance id, and optional receiver routing. | `src/annotation/index.ts`, `src/annotation/annotation.types.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
129
+ | `annotation-api` | SDK / remote | `acceptRequest()` and `declineRequest()` | PUT a presenter decision to the URL carried by an incoming approval. | Preserve the accepted/declined action values and direct request-promise result. | `src/annotation/index.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
130
+ | `annotation-api` | SDK / relay | `sendStrokeData()` and `ANNOTATION_STROKE_DATA` | Encrypt outbound stroke content, publish it on the registered LLM channel's socket, decrypt inbound content, and emit the scoped stroke event. | Preserve sequence increments, relay/message fields, and the no-op without a connected channel, socket, or binding. | `src/annotation/index.ts`, `src/annotation/constants.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
131
+ | `annotation-api` | module constants and exported types | `EVENT_TRIGGERS`, `ANNOTATION_RESOURCE_TYPE`, `ANNOTATION_RELAY_TYPES`, `ANNOTATION_STATUS`, `ANNOTATION_POLICY`, `ANNOTATION_REQUEST_TYPE`, `ANNOTATION_ACTION_TYPE`, `ANNOTATION`, `StrokeData`, `RequestData`, `CommandRequestBody`, `IAnnotationChannel`, and `AnnotationInfo` | Share the exact approval and relay vocabulary used by the controller and consumers; only the types reach applications, as `sdkAnnotationTypes`. | Add fields compatibly; existing raw action, relay, resource, and event values are wire-sensitive. | `src/annotation/constants.ts`, `src/annotation/annotation.types.ts` | [architecture](../../../docs/architecture.md#public-and-consumer-surfaces) |
132
+
133
+ 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.
134
+
135
+ | Event literal | Constant / expression | Emission evidence |
136
+ |---|---|---|
137
+ | `annotation:command` | `EVENT_TRIGGERS.ANNOTATION_COMMAND` | `src/annotation/index.ts` |
138
+ | `annotation:strokeData` | `EVENT_TRIGGERS.ANNOTATION_STROKE_DATA` | `src/annotation/index.ts` |
139
+ | `meeting:updateAnnotationInfo` | `EVENT_TRIGGERS.MEETING_UPDATE_ANNOTATION_INFO` | `src/meeting/index.ts` |
140
+
141
+ `annotation:command` carries `{type: approval.actionType, payload: approval}` and
142
+ `annotation:strokeData` carries `{payload: data}` with the decrypted content; both are triggered on
143
+ `meeting.annotation`. `meeting:updateAnnotationInfo` is triggered on `webex.meetings` with
144
+ `{annotationInfo, meetingId, resourceType}` when a content share's annotation info changes.
145
+
146
+ Compatibility notes:
147
+
148
+ - Prefer additive fields/options and preserve current rejection/event/cleanup semantics. Internal helpers are not public merely because they are exported within the source directory.
149
+
150
+ ## Dependencies
151
+
152
+ Requires: Approval and Locus URLs, Mercury, the registered LLM channel's socket and binding, Webex
153
+ encryption, annotation constants/types, and participant/device/share identity supplied by callers.
154
+
155
+ Contracts: provides `annotation-api`; requires `internal-plugin-llm-channel`, `locus-http`,
156
+ `internal-plugin-mercury-events`, and `webex-core-plugin-host` (`.sdd/manifest.json`).
157
+
158
+ | Dependency | Why it is required | Failure behavior |
159
+ | ---------- | ------------------ | ---------------- |
160
+ | `@webex/webex-core` (`webex-core-plugin-host`) | `WebexPlugin` base class, `this.request`, and `config.trackingIdPrefix` | Approval rejections reach the caller |
161
+ | Approval service (`locus-http`) | `approvalUrl` from Locus `services.approval.url`, and each approval's own `url` | No retry |
162
+ | LLM data channel (`internal-plugin-llm-channel`) | The registered `LLMChannel`: `on` and `off` for `event:relay.event`, `isConnected`, `getSocket`, `getBinding` | No channel, no connection, no socket, or no binding means nothing is sent |
163
+ | `webex.internal.mercury` (`internal-plugin-mercury-events`) | `event:locus.approval_request` | No retry |
164
+ | `webex.internal.encryption` | `encryptText` and `decryptText` with the stroke's `encryptionKeyUrl` | A rejection is not caught and reaches no caller |
165
+ | `Meeting` and `Webinar` | URLs, channel registration and switching, and deregistration on meeting cleanup | — |
166
+ | `uuid` (`v4`) | The relay `trackingId` | — |
167
+
168
+ ## Requirements
169
+
170
+ | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
171
+ |---|---|---|---|---|---|---|
172
+ | `ANNOTATION-R-001` | `locusUrlUpdate()` assigns `locusUrl` and registers the Mercury approval listener once; `approvalUrlUpdate()` only assigns `approvalUrl`; `registerChannel(channel)` first unregisters any channel, then listens to `event:relay.event` on the new one; `deregisterEvents()` removes the Mercury callback, unregisters the channel, and clears the subscription flag, but only when the Mercury listener was installed. | Duplicate subscriptions would emit the same annotation event more than once, while attributing registration to the approval URL setter invents a side effect; only one channel is registered at a time because its owner switches channels when the context changes, such as a practice session (JSDoc of `registerChannel`). | `src/annotation/index.ts`, `src/webinar/index.ts` | `test/unit/spec/annotation/index.ts` | none | Present |
173
+ | `ANNOTATION-R-002` | Approval methods send the declared action/resource body to the supplied approval URL; stroke sends encrypt content, publish on the registered channel's socket to its binding, and increment `seqNum` after publication. | Approval routing and relay sequence fields are service-visible protocol values and must remain stable. | `src/annotation/index.ts`, `src/annotation/annotation.types.ts` | `test/unit/spec/annotation/index.ts` | rejected encryption/decryption promises and a channel switch during encryption need explicit race/error coverage | Present |
174
+ | `ANNOTATION-R-003` | Approval methods return their request promises; stroke sends without a connected channel return without work; stroke encryption/decryption uses asynchronous callbacks without a returned caller promise or module retry; deregistration removes the installed Mercury and channel callbacks. | Callers must not assume encryption failures are converted into approval-style promise rejections or that disconnected strokes are queued. | `src/annotation/index.ts` | `test/unit/spec/annotation/index.ts` | none | Present |
175
+ | `ANNOTATION-R-004` | A Mercury event emits `annotation:command` only when its `eventType` is `locus.approval_request`, its approval `resourceType` is `AnnotationOnShare`, and an `actionType` is set; a relay event emits `annotation:strokeData` only for `relayType` `annotation.client`, after its content is decrypted. | Approvals for other resources share the Mercury event, and other relay types share the channel (`eventCommandProcessor`, `eventDataProcessor`). | `src/annotation/index.ts`, `src/annotation/constants.ts` | `test/unit/spec/annotation/index.ts` | WHY inferred from the filters | Weak |
176
+
177
+ ## Design overview
178
+
179
+ The controller subscribes directly to Mercury approval events, receives LLM relay events on the one
180
+ channel its owner registers, performs approval HTTP operations, and encrypts/decrypts relay content
181
+ before exposing annotation command/stroke events.
182
+
183
+ `Meeting` registers its LLM channel when the connection comes up, except while the meeting uses a
184
+ practice-session data channel; `Webinar` registers the practice-session channel and switches back to
185
+ the meeting channel when leaving it. `registerChannel()` always unregisters the previous channel
186
+ first, so relay events come from one channel. The Mercury approval listener is separate: it is
187
+ installed by the first `locusUrlUpdate()` and removed by `deregisterEvents()`, which `Meeting` calls
188
+ when it stops listening for meeting events.
189
+
190
+ Approval actions are HTTP requests: requests, cancellation, and closing are sent by an attendee or
191
+ presenter with the share instance id; accept and decline answer an incoming approval at its url.
192
+ Stroke data never goes through HTTP: it is encrypted with the share's key, wrapped in a
193
+ `publishRequest` envelope, and sent on the channel's socket.
194
+
195
+ ## Data flow and sequence coverage
196
+
197
+ Call style: in-process method calls on `meeting.annotation`; outbound HTTPS to the approval service
198
+ through `this.request`; outbound and inbound LLM relay messages on the registered channel's
199
+ WebSocket; inbound Mercury `locus.approval_request` events; KMS encryption through
200
+ `webex.internal.encryption`.
201
+
202
+ Sequence coverage:
203
+
204
+ | Operation group | Diagram | Failure coverage |
205
+ |---|---|---|
206
+ | UC-4 — stroke relay, send and receive | Annotation approval and relay primary sequence (diagram 1) | no registered or connected channel (return without encryption or send), missing or disconnected channel, missing socket or binding, and asynchronous encryption/decryption failure |
207
+ | UC-2, UC-3 — annotation approval actions | Annotation approval action sequence (diagram 2), HTTP only with no LLM relay | request rejection through the returned promise |
208
+ | UC-1 — listener and channel lifecycle | Diagram 3 | deregistration skipped when the Mercury listener was never installed |
209
+
210
+ ```mermaid
211
+ flowchart LR
212
+ Locus[Locus approval events via Mercury] --> Controller[index.ts]
213
+ Caller[Meeting / Webinar / annotation consumer] --> Controller
214
+ Controller --> Approval[HTTP approvalUrl]
215
+ Controller --> Crypto[Webex encryption]
216
+ Crypto --> LLM[registered LLM channel WebSocket]
217
+ LLM --> Controller
218
+ Controller --> Events[annotation command / stroke events]
219
+ ```
220
+
221
+ Diagram 1 — annotation approval and relay primary sequence:
222
+
223
+ ```mermaid
224
+ sequenceDiagram
225
+ participant C as Annotation consumer
226
+ participant A as Annotation index.ts
227
+ participant E as Encryption
228
+ participant L as Registered LLM channel
229
+ C->>A: sendStrokeData(stroke)
230
+ alt no registered channel, or it is disconnected
231
+ A-->>C: return without encryption or socket send
232
+ else connected
233
+ A->>E: encrypt relay payload
234
+ E-->>A: encrypted content
235
+ A->>A: read the registered channel's socket and binding now
236
+ A->>L: socket.send publishRequest (seq), then seqNum + 1
237
+ end
238
+ L-->>A: event:relay.event, relayType annotation.client
239
+ A->>E: decrypt content
240
+ E-->>A: annotation payload
241
+ A-->>C: scoped annotation event
242
+ ```
243
+
244
+ Diagram 2 — annotation approval actions:
245
+
246
+ ```mermaid
247
+ sequenceDiagram
248
+ participant C as Annotation consumer
249
+ participant A as Annotation index.ts
250
+ participant H as Webex request
251
+ C->>A: accept / decline / request / cancel / close approval action
252
+ A->>H: HTTP request with action/resource body
253
+ H-->>C: returned request promise outcome
254
+ ```
255
+
256
+ Diagram 3 — listener and channel lifecycle:
257
+
258
+ ```mermaid
259
+ sequenceDiagram
260
+ participant M as Meeting / Webinar
261
+ participant A as Annotation
262
+ participant Me as Mercury
263
+ participant L as LLM channel
264
+ M->>A: locusUrlUpdate(url)
265
+ opt not yet subscribed
266
+ A->>Me: on event:locus.approval_request
267
+ end
268
+ M->>A: registerChannel(meeting channel)
269
+ A->>A: unregisterChannel() first
270
+ A->>L: on event:relay.event
271
+ M->>A: registerChannel(practice-session channel), later back
272
+ M->>A: deregisterEvents()
273
+ alt Mercury listener installed
274
+ A->>Me: off event:locus.approval_request
275
+ A->>L: off event:relay.event
276
+ else never installed
277
+ A->>A: nothing removed, channel stays registered
278
+ end
279
+ ```
280
+
281
+ ## Class and component relationships
282
+
283
+ ```mermaid
284
+ classDiagram
285
+ class WebexPlugin
286
+ class IAnnotationChannel
287
+ class AnnotationChannel {
288
+ seqNum
289
+ hasSubscribedToEvents
290
+ approvalUrl
291
+ locusUrl
292
+ channel LLMChannel
293
+ }
294
+ class LLMChannel
295
+ WebexPlugin <|-- AnnotationChannel
296
+ IAnnotationChannel <|.. AnnotationChannel
297
+ AnnotationChannel --> LLMChannel : registered relay channel
298
+ AnnotationChannel ..> Mercury : Locus approval events
299
+ AnnotationChannel ..> Approval : HTTP approvalUrl
300
+ AnnotationChannel ..> Crypto : Webex encryption
301
+ AnnotationChannel ..> Events : annotation command and stroke events
302
+ ```
303
+
304
+ The arrows identify ownership and delegation inside `src/annotation/`; files that only declare types or constants are not presented as transports.
305
+
306
+ ## Use cases and flows
307
+
308
+ | Use case | Actor or caller | Primary steps and outcome | Failure or boundary behavior | Evidence |
309
+ | -------- | --------------- | ------------------------- | ---------------------------- | -------- |
310
+ | `UC-1` | `Meeting` and `Webinar` | Register the approval listener once when `locusUrlUpdate()` establishes context and register the active LLM relay channel (default or practice session) with `registerChannel()`; update `approvalUrl` independently without registering listeners, then remove installed listeners with `deregisterEvents()` | Deregistration does nothing when the Mercury listener was never installed | `src/annotation/index.ts`, `src/meeting/index.ts`, `src/webinar/index.ts` |
311
+ | `UC-2` | Attendee or presenter | Request, cancel, or close annotation for a share instance, optionally routing the request to a specific participant/device | The request promise rejects with the service error | `src/annotation/index.ts` |
312
+ | `UC-3` | Presenter | Accept or decline a presenter approval request by PUTting the exact action to the event-provided URL | The request promise rejects with the service error | `src/annotation/index.ts` |
313
+ | `UC-4` | Annotating attendee and presenter | Skip a stroke without a connected registered channel; otherwise encrypt, read the registered channel's socket and binding after encryption, publish with the next sequence, then decrypt and emit received stroke data | Missing socket or binding drops the stroke; encryption errors are silent | `src/annotation/index.ts` |
314
+
315
+ ### Cross-boundary use-case flow
316
+
317
+ | Boundary | Transport and ordering | Compatibility | Timeout, retry, and recovery |
318
+ | -------- | ---------------------- | ------------- | ---------------------------- |
319
+ | Approval service (`UC-2`, `UC-3`) | HTTPS POST to `approvalUrl`, PUT to the approval url | Bodies under Protocol and wire format | No retry |
320
+ | Mercury (`UC-1`, `UC-3`) | `event:locus.approval_request`, handled as it arrives | `data.eventType`, `data.approval.{resourceType, actionType, url}` | No retry |
321
+ | LLM relay (`UC-4`) | `socket.send` of a `publishRequest`; inbound `event:relay.event` | Envelope under Protocol and wire format | A stroke is dropped, not queued |
322
+ | KMS (`UC-4`) | `encryptText` and `decryptText` per stroke | `encryptionKeyUrl` carried in the stroke | No retry |
323
+
324
+ ## Client state model
325
+
326
+ The controller stores `seqNum`, `hasSubscribedToEvents`, `approvalUrl`, `locusUrl`, `channel`, and `channelHandler`; `deviceUrl` is declared but never set. `seqNum` starts at 1 and increments after each published stroke; `hasSubscribedToEvents` only records whether this controller installed its Mercury callback. The module does not transition between `NO_ANNOTATION` and `RUNNING_ANNOTATION`; those constants are not consumed by current source or tests.
327
+
328
+ | State or slice | Owner | Initial state | Transition triggers | Reset or persistence boundary |
329
+ | -------------- | ---------- | ------------- | ------------------- | ----------------------------- |
330
+ | `seqNum` | `AnnotationChannel` | `1` | Each sent stroke | Never reset on the instance |
331
+ | `hasSubscribedToEvents` | `AnnotationChannel` | unset | `locusUrlUpdate` sets it; `deregisterEvents` clears it | Per meeting |
332
+ | `channel`, `channelHandler` | `AnnotationChannel` | unset | `registerChannel`; `unregisterChannel` and `deregisterEvents` clear them | One channel at a time |
333
+ | `approvalUrl`, `locusUrl` | `AnnotationChannel` | unset | `approvalUrlUpdate`, `locusUrlUpdate` | — |
334
+
335
+ ## Business rules and invariants
336
+
337
+ | ID | Invariant | WHY | Enforcement source | Test evidence |
338
+ | -- | --------- | --- | ------------------ | ------------- |
339
+ | `INV-001` | Approval calls use their supplied approval URL and declared action/resource values: `resourceType` is always `AnnotationOnShare`. | The approval service routes the action by resource type, and the Mercury filter accepts only that type (`ANNOTATION_RESOURCE_TYPE`). | `src/annotation/index.ts`, `src/annotation/constants.ts` | `test/unit/spec/annotation/index.ts` |
340
+ | `INV-002` | Stroke publication is skipped when no registered channel is connected at the initial check, or when the channel, socket, or binding is missing at publication. | A stroke cannot be routed without a socket and binding, and strokes are not queued (`ANNOTATION-R-003`). | `src/annotation/index.ts` | `test/unit/spec/annotation/index.ts` |
341
+ | `INV-003` | Relay types and sequence fields use the declared wire values: `id`, `seq`, and `sequenceNumber` all carry the current `seqNum`, which grows by one per sent stroke. | See `ANNOTATION-R-002`. | `src/annotation/index.ts` | `test/unit/spec/annotation/index.ts` |
342
+ | `INV-004` | At most one LLM channel delivers relay events. | See `ANNOTATION-R-001`. | `src/annotation/index.ts` | `test/unit/spec/annotation/index.ts` |
343
+
344
+ ## Concurrency and reactive flow
345
+
346
+ - Execution model: one JavaScript event loop; approval requests return promises; encryption and
347
+ decryption resolve later and are not returned to the caller.
348
+ - Send race: Stroke encryption completes asynchronously. `sendStrokeData` checks the registered channel's connectivity before encryption, while `publishEncrypted` reads the then-registered channel's socket and binding when encryption resolves; the controller has no cancellation or supersession guard.
349
+ - Ordering guarantees: `seqNum` is assigned when encryption resolves, so strokes whose encryption
350
+ finishes out of order are sent and numbered in that order.
351
+ - Idempotency and retry: the Mercury listener is installed once; nothing is retried.
352
+ - Shared-state protection: none beyond `registerChannel` unregistering the previous channel.
353
+
354
+ ## Protocol and wire format
355
+
356
+ - `index.ts` constructs approval bodies and LLM `publishRequest` envelopes from the request/event/channel types and constants under `src/annotation/`. Preserve action/resource/relay values, receiver and route fields, sequence fields, and encryption metadata.
357
+
358
+ | Message or frame | Version | Producer or serializer | Consumer or parser | Compatibility and ordering rule |
359
+ | ---------------- | ------- | ---------------------- | ------------------ | ------------------------------- |
360
+ | POST `approvalUrl` `{actionType: 'REQUESTED' or 'CLOSED', resourceType: 'AnnotationOnShare', shareInstanceId, receivers?: [{participantId, deviceUrl}]}` | Unversioned | `approveAnnotation`, `closeAnnotation` | Approval service | `receivers` only when `toUserId` is set |
361
+ | PUT `<approval.url>` `{actionType: 'CANCELED', resourceType: 'AnnotationOnShare', shareInstanceId}` | Unversioned | `cancelApproveAnnotation` | Approval service | No receivers |
362
+ | PUT `<approval.url>` `{resourceType: 'AnnotationOnShare', actionType: 'ACCEPTED' or 'DECLINED'}` | Unversioned | `acceptRequest`, `declineRequest` | Approval service | The url comes from the incoming approval |
363
+ | Mercury `locus.approval_request` with `data.approval.{resourceType, actionType, url}` | — | Locus, through Mercury | `eventCommandProcessor` | Only `AnnotationOnShare` with an `actionType` |
364
+ | LLM `publishRequest` `{id, type, recipients: [{route: binding}], headers: {to}, data: {eventType: 'relay.event', relayType: 'annotation.client', request: {value: {type: 'annotation_message', content, deviceId, seq, requesterId, version, shareInstanceId, encryptionKeyUrl}}}, trackingId, timestamp, sequenceNumber, filterMessage: false}` | `version` from the stroke | `publishEncrypted` | Presenter clients, through the LLM relay | `content` is encrypted; `trackingId` is `<trackingIdPrefix>_<uuid>` |
365
+ | LLM `relay.event` with `data.relayType` `annotation.client` and `data.request.value.{content, encryptionKeyUrl}` | — | Other clients, through the LLM relay | `eventDataProcessor`, `processStrokeMessage` | Content is decrypted in place before the event |
366
+
367
+ ## Caller-visible failure modes
368
+
369
+ | Condition | Signal | Caller recovery |
370
+ |---|---|---|
371
+ | Approval request rejects | The approval method's returned promise rejects with the request failure. | Correct the URL/body or retry under the caller's policy. |
372
+ | No registered LLM channel, or it is disconnected, at the initial stroke-send check | `sendStrokeData` returns `undefined` without encryption or socket send. | Reinvoke only after connectivity is restored. |
373
+ | Stroke encrypt/decrypt rejects | The controller installs no catch and `sendStrokeData` returns no promise, so the failure is not converted into a caller-facing annotation result. | Observe the owning encryption/runtime failure path; do not assume a module retry. |
374
+ | The channel, socket, or binding is missing when encryption resolves | The stroke is dropped silently and `seqNum` does not change. | Resend after the channel is back. |
375
+
376
+ ## Pitfalls and constraints
377
+
378
+ - `ANNOTATION_STATUS.NO_ANNOTATION` and `RUNNING_ANNOTATION` are declarations only; do not treat them as a live controller lifecycle without a consuming transition path.
379
+ - Verify both typed constants/enums and raw wire values before changing a logical condition in this legacy package.
380
+ - `deregisterEvents()` unregisters the channel only when `locusUrlUpdate()` installed the Mercury
381
+ listener; a channel registered without a Locus URL stays registered.
382
+ - `listenToEvents()` is marked `@deprecated` in its JSDoc but is still the only path that installs
383
+ the Mercury approval listener.
384
+ - `src/constants.ts` declares a different `ANNOTATION` object (the device capability) from the
385
+ `ANNOTATION` namespace string in `src/annotation/constants.ts`.
386
+ - `ANNOTATION_ACTION_TYPE` is a `const enum`, so it has no runtime object outside TypeScript.
387
+
388
+ ## Verification
389
+
390
+ Use the current mirrored suites: `test/unit/spec/annotation/index.ts`. Characterize the annotation-specific use cases above and each listed failure condition; add cleanup or transition cases only for resources and state this module actually owns.
391
+
392
+ | Behavior / Requirement | Existing test evidence | Gap |
393
+ |---|---|---|
394
+ | `ANNOTATION-R-001` | `test/unit/spec/annotation/index.ts` | registration, replacement, deregistration, and the URL setters are covered; no case registers a channel without a Locus URL and then deregisters |
395
+ | `ANNOTATION-R-002` | `test/unit/spec/annotation/index.ts` | cover receiver-absent bodies for requested/closed actions; the receiver-present bodies and the envelope are covered |
396
+ | `ANNOTATION-R-003` | `test/unit/spec/annotation/index.ts` | assert that a disconnected stroke performs no encryption; deregistration of both listeners is covered |
397
+ | `ANNOTATION-R-004`, `INV-001` | `test/unit/spec/annotation/index.ts` | none |
398
+ | `INV-002` to `INV-004` | `test/unit/spec/annotation/index.ts` | no case for a channel switch during encryption |
399
+
400
+ Every cited case invokes the named behavior. A module specification is complete only when its
401
+ public surface, invariants, failure modes, and test evidence agree with the implementation. The
402
+ module stays Partial until coverage review and independent validation run on this specification.