@webex/internal-plugin-voicea 3.13.0-next.3 → 3.13.0-next.5
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.
- package/.repo-context.json +444 -0
- package/.sdd/manifest.json +402 -0
- package/AGENTS.md +211 -0
- package/docs/adr/0001-retain-product-readme.md +100 -0
- package/docs/adr/index.md +25 -0
- package/docs/architecture.md +262 -0
- package/docs/getting-started.md +118 -0
- package/docs/index.md +43 -0
- package/docs/specs/README.md +68 -0
- package/package.json +4 -4
- package/schemas/repo-context.schema.json +796 -0
- package/src/docs/README.md +551 -0
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Module Spec
|
|
3
|
+
title: 'Voicea caption and transcription channel specification'
|
|
4
|
+
description: Responsibilities, boundaries, design, invariants, and verification for the voicea plugin 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-12T09:22:36Z
|
|
13
|
+
validation_status: pass-with-warnings
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# Voicea caption and transcription channel
|
|
17
|
+
|
|
18
|
+
This source-local document at `src/docs/README.md` owns the stable specification for **the voicea
|
|
19
|
+
plugin**: the internal plugin `webex.internal.voicea`, a factory that creates `VoiceaChannel`
|
|
20
|
+
objects, and `VoiceaChannel` itself. A channel turns meeting captions and transcription on through
|
|
21
|
+
Locus `controls`, announces the client to the voicea (AI bridge) service over an LLM data channel,
|
|
22
|
+
requests caption languages, sends manual captions, and turns inbound relay events into `voicea:*`
|
|
23
|
+
events. Ground every claim in package evidence and link to the
|
|
24
|
+
[package architecture](../../docs/architecture.md) instead of repeating broader facts. No service
|
|
25
|
+
specification exists because this package is a 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` |
|
|
36
|
+
| Resource kind | package |
|
|
37
|
+
| Status | Draft |
|
|
38
|
+
| Last verified | 2026-11-12 at `ecd5af12a1` |
|
|
39
|
+
| Module id | `internal-plugin-voicea` |
|
|
40
|
+
| Parent spec | — |
|
|
41
|
+
| Doc kind | Module spec |
|
|
42
|
+
| Coverage score | 93.3% assessed 2026-11-12 by the generator — 14 of 15 mandatory fields PRESENT, critical 8 of 8; test strategy is WEAK because the plugin registration, the outbound `trackingId` prefix, the `turnOnCaptions` request body, the deferred `online` restore after `deregisterEvents`, and the synchronous throws of the Locus control methods without a channel have no case, although 84 unit cases pass |
|
|
43
|
+
| Validation status | Pass with warnings — 2026-11-12; validator runtime 01a1cef2-ab9c-7f50-baf4-643aeae8b469; 0 Blocking, 1 Important finding (accepted command-source warning) |
|
|
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/voicea.ts` | Tier |
|
|
50
|
+
| `module.has_ui` | N/A | `src/voicea.ts` emits events and sends messages; it renders nothing | UI use-case flow |
|
|
51
|
+
| `module.crosses_service_boundaries` | Applicable | `src/voicea.ts` sends PUT requests to Locus controls and publishes relay messages over the LLM data channel to the voicea service | Cross-boundary use-case flow |
|
|
52
|
+
| `module.holds_client_state` | Applicable | Announce, caption, and manual-caption statuses, the caption service id, languages, and the sequence number are private fields in `src/voicea.ts` | Client state model |
|
|
53
|
+
| `module.enforces_domain_rules` | Applicable | Connected-channel preconditions, one turn-on in flight, and the spoken-language filter for detected languages in `src/voicea.ts` | Business rules and invariants |
|
|
54
|
+
| `module.is_concurrent_async` | Applicable | Promise chains, fire-and-forget subscription updates, and the deferred online listener in `src/voicea.ts` | Concurrency and reactive flow |
|
|
55
|
+
| `module.owns_persistence` | N/A | `src/voicea.ts` stores nothing outside memory | Data, schema, and migration discipline |
|
|
56
|
+
| `module.stateful_transitions` | Applicable | Announce status idle, joining, joined and caption status idle, sending, enabled in `src/constants.ts` and `src/voicea.ts` | State machine |
|
|
57
|
+
| `module.exposes_wire_protocol` | Applicable | publishRequest and subchannelSubscriptionRequest frames, relay types, and Locus controls bodies in `src/voicea.ts` and `src/constants.ts` | Protocol and wire format |
|
|
58
|
+
| `module.ui_multi_screen` | N/A | No UI | UI flow |
|
|
59
|
+
| `module.large_data_model` | N/A | `src/voicea.types.ts` declares payload shapes for a few messages, covered under Protocol and wire format | Data model |
|
|
60
|
+
| `module.returns_caller_errors` | Applicable | Thrown errors and rejected promises from the channel methods in `src/voicea.ts` | Caller-visible failure modes |
|
|
61
|
+
| `module.module_specific_conventions` | Applicable | The voicea: and aibridge: event names, the shared sequence number, and the caller-owned LLM channel in `src/voicea.ts` and `src/voicea-plugin.ts` | Module-specific rules |
|
|
62
|
+
| `module.published_package` | Applicable | `package.json` names the package @webex/internal-plugin-voicea and defines deploy:npm | Export stability |
|
|
63
|
+
| `module.embedded_in_host` | N/A | No host theme or embed API | Host integration and theming |
|
|
64
|
+
| `module.has_design_tradeoff` | Applicable | The caller-owned LLM channel and the reconciler that rebinds it, in `src/voicea-plugin.ts` and `src/voicea.ts` | Key design trade-off |
|
|
65
|
+
| `module.has_submodules` | N/A | The src directory has no child module | Sub-modules |
|
|
66
|
+
|
|
67
|
+
## Evidence register
|
|
68
|
+
|
|
69
|
+
| Evidence | What it establishes |
|
|
70
|
+
| -------- | ------------------- |
|
|
71
|
+
| `src/index.ts` | `registerInternalPlugin('voicea', Voicea, {})` at import time; exports: default and named `VoiceaPlugin`, `VoiceaChannel`, `EVENT_TRIGGERS`, `TURN_ON_CAPTION_STATUS`, and the types `MeetingTranscriptPayload` and `SpeakerNameUpdatePayload` |
|
|
72
|
+
| `src/voicea-plugin.ts` | `VoiceaPlugin` extends `WebexPlugin` in namespace `voicea`; `createChannel(llmChannel?)` returns a new `VoiceaChannel` bound to `webex.request`. Its JSDoc states that the channel does not take ownership of the LLM channel |
|
|
73
|
+
| `src/voicea.ts` | `VoiceaChannel`: relay-event dispatch, announcement, caption-language requests, manual captions, Locus controls requests, subchannel subscriptions, the channel reconciler, and teardown. Its JSDoc and inline comments are the only recorded rationale |
|
|
74
|
+
| `src/constants.ts` | Event names, relay types, transcription types, status values, `VOICEA`, `DEFAULT_SPOKEN_LANGUAGE` (`en`), and the unused `LANGUAGE_ASSIGNMENT` |
|
|
75
|
+
| `src/voicea.types.ts` | Payload and interface declarations, including `IVoiceaChannel`, which `VoiceaChannel` implements |
|
|
76
|
+
| `src/utils.ts` | `millisToMinutesAndSeconds`, the `m:ss` formatter for caption and highlight timestamps |
|
|
77
|
+
| `package.json` | Name, `main` (`dist/index.js`), `types` (`dist/types/index.d.ts`), `devMain` (`src/index.js`), `engines` (`node >=18`), dependencies, and scripts |
|
|
78
|
+
| `test/unit/spec/voicea.js` | 78 unit cases for `VoiceaChannel` with a stub LLM channel and a stub request function |
|
|
79
|
+
| `test/unit/spec/voicea-plugin.js` | 5 unit cases: `createChannel` with and without an LLM channel, independent channels, and the namespace |
|
|
80
|
+
| `test/unit/spec/utils.js` | 1 unit case: `millisToMinutesAndSeconds(2000)` is `0:02` |
|
|
81
|
+
| `README.md` | Retained npm page; context only. Its differences from code are recorded in `docs/adr/0001-retain-product-readme.md` |
|
|
82
|
+
| Sibling package webex-core, file src/docs/README.md | Module spec consulted. `registerInternalPlugin` is first-wins and rejects proxies; `WebexPlugin` supplies `webex` and `request`; the named `config` export is the default configuration object with `trackingIdPrefix` `webex-js-sdk` |
|
|
83
|
+
| Sibling package internal-plugin-llm, file src/docs/README.md | Module spec consulted and found stale on the points used here: it describes one session-keyed `LLMChannel` registered as `webex.internal.llm` and says this package re-exports `LLM_PRACTICE_SESSION`. Neither holds in code, so the sources below were used as the referee |
|
|
84
|
+
| Sibling package internal-plugin-llm, files src/llm-plugin.ts, src/llm.ts, src/llm.types.ts | Source consulted. `webex.internal.llm` is an `LLMPlugin` whose `createChannel()` returns a caller-owned `LLMChannel`; each channel holds one connection, connects without a session id, and exposes `isConnected`, `getBinding`, `getLocusUrl`, `getDatachannelUrl`, `isDataChannelTokenEnabled`, and the inherited Mercury `getSocket`, `on`, `once`, and `off` |
|
|
85
|
+
| Sibling package internal-plugin-mercury, file src/docs/README.md | Module spec consulted. Default-session events carry no suffix; `online` fires when the session connects; each inbound envelope is emitted as `event:<namespace>`, so relay events arrive as `event:relay.event` |
|
|
86
|
+
| Sibling package plugin-meetings, files src/meeting/index.ts and src/meeting/voicea-meeting.ts | Source consulted (consumer). Each meeting calls `createChannel()` without an LLM channel, calls `switchLLMChannel` after each LLM connection unless a practice session is active, listens to six `voicea:*` events, and calls `deregisterEvents` from `stopTranscription` and on permanent LLM cleanup |
|
|
87
|
+
| Sibling package webex, file src/meetings.js | Source consulted. Requires this package for its registration side effect |
|
|
88
|
+
| Observation, no stated WHY | Behavior the code shows without stating a reason is recorded once, under Pitfalls and constraints |
|
|
89
|
+
|
|
90
|
+
## Purpose and boundary
|
|
91
|
+
|
|
92
|
+
- Responsibility: give a meeting one object that drives its captions and transcription. A channel
|
|
93
|
+
sends Locus `controls` requests to turn captions, transcription, and manual captions on or off and to
|
|
94
|
+
set the spoken language; it announces the client to the voicea service and requests caption
|
|
95
|
+
languages over the meeting's LLM data channel; and it converts inbound relay events into
|
|
96
|
+
`voicea:*` and `aibridge:*` events.
|
|
97
|
+
- In scope: `VoiceaPlugin.createChannel`; every public method and event of `VoiceaChannel`; the relay
|
|
98
|
+
and subchannel frames it sends; the Locus `controls` request bodies; switching a channel to another
|
|
99
|
+
LLM channel while keeping caption state; the `m:ss` timestamp formatter.
|
|
100
|
+
- Out of scope: creating, registering, connecting, and disconnecting the LLM channel and its token
|
|
101
|
+
handling (the `@webex/internal-plugin-llm` package and the caller); WebSocket transport and event
|
|
102
|
+
naming (the `@webex/internal-plugin-mercury` package, through `LLMChannel`); deciding when to turn
|
|
103
|
+
captions on, reading Locus state, and re-subscribing after an LLM reconnect on the same channel
|
|
104
|
+
(plugin-meetings, which reads `getKeepTranscriptionSubscribed()` and calls
|
|
105
|
+
`updateSubchannelSubscriptions`; this module neither re-announces nor re-subscribes on its own); HTTP transport, retries, and authentication (`webex.request` in webex-core).
|
|
106
|
+
- Consumers: plugin-meetings, which owns one channel per meeting; the `webex` package, which requires
|
|
107
|
+
this package so `webex.internal.voicea` exists.
|
|
108
|
+
|
|
109
|
+
## Structure and key files
|
|
110
|
+
|
|
111
|
+
| Path | Responsibility |
|
|
112
|
+
| ---- | -------------- |
|
|
113
|
+
| `src/index.ts` | Registers internal plugin `voicea` and re-exports the public bindings |
|
|
114
|
+
| `src/voicea-plugin.ts` | `VoiceaPlugin`, the factory registered as `webex.internal.voicea` |
|
|
115
|
+
| `src/voicea.ts` | `VoiceaChannel`, where every flow behavior lives |
|
|
116
|
+
| `src/constants.ts` | Event names, relay types, transcription types, and status values |
|
|
117
|
+
| `src/voicea.types.ts` | Payload types and the `IVoiceaChannel` interface |
|
|
118
|
+
| `src/utils.ts` | `millisToMinutesAndSeconds` |
|
|
119
|
+
| `package.json` | Package name, entry points, scripts, and dependencies |
|
|
120
|
+
| `babel.config.js`, `jest.config.js` | Re-exports of the legacy Babel and Jest configurations |
|
|
121
|
+
| `.eslintrc.js` | Sets `root: true` and extends `@webex/eslint-config-legacy` |
|
|
122
|
+
| `tsconfig.json` | Extends the workspace `tsconfig.json` and includes `src` |
|
|
123
|
+
| `process` | Package-root file exporting `{browser: true}`; not imported by `src/` |
|
|
124
|
+
| `src/docs/README.md` | This module specification; ignored by the build and by lint |
|
|
125
|
+
| `test/unit/spec/voicea.js` | Unit spec for `VoiceaChannel` |
|
|
126
|
+
| `test/unit/spec/voicea-plugin.js` | Unit spec for `VoiceaPlugin` |
|
|
127
|
+
| `test/unit/spec/utils.js` | Unit spec for the formatter |
|
|
128
|
+
| dist/ (generated) | Build output of `build:src`, including `dist/types`; ignored by Git and never edited by hand |
|
|
129
|
+
|
|
130
|
+
## Public surface
|
|
131
|
+
|
|
132
|
+
| Surface | Consumer | Compatibility commitment | Source |
|
|
133
|
+
| ------- | -------- | ------------------------ | ------ |
|
|
134
|
+
| Import side effect: internal plugin `voicea` | `webex` (`src/meetings.js`), plugin-meetings | First registration of the name wins | `src/index.ts` |
|
|
135
|
+
| `webex.internal.voicea.createChannel(llmChannel?)` | plugin-meetings | Returns a new, independent `VoiceaChannel` each call; the caller owns both channels | `src/voicea-plugin.ts` |
|
|
136
|
+
| `VoiceaChannel` LLM binding: `switchLLMChannel(llmChannel)`, `isLLMConnected()`, `deregisterEvents()` | plugin-meetings | `switchLLMChannel` resolves once the binding is updated and any immediate caption restore settles | `src/voicea.ts` |
|
|
137
|
+
| `VoiceaChannel` Locus controls: `turnOnCaptions(spokenLanguage?)`, `toggleTranscribing(activate, spokenLanguage?)`, `toggleManualCaption(enable)`, `setSpokenLanguage(languageCode, languageAssignment?)` | plugin-meetings | Promise-returning; failures described under Caller-visible failure modes | `src/voicea.ts` |
|
|
138
|
+
| `VoiceaChannel` data-channel sends: `announce()`, `sendAnnouncement()`, `requestLanguage(languageCode)`, `sendManualClosedCaption(text, timeStamp, csis, isFinal)`, `updateSubchannelSubscriptions(options)`, `updateSubchannelSubscriptionsAndSyncCaptionState(options, keepSubscribed)` | plugin-meetings | Frames under Protocol and wire format | `src/voicea.ts` |
|
|
139
|
+
| `VoiceaChannel` Locus-driven inputs: `onSpokenLanguageUpdate(languageCode, meetingId)`, `onCaptionServiceIdUpdate(serviceId)` | plugin-meetings, from Locus updates | Emit or re-request as described in `MOD-012` and `MOD-010` | `src/voicea.ts` |
|
|
140
|
+
| `VoiceaChannel` getters: `getCaptionStatus()`, `getAnnounceStatus()`, `getKeepTranscriptionSubscribed()` | plugin-meetings | Return the current status strings or flag | `src/voicea.ts` |
|
|
141
|
+
| Events on `VoiceaChannel` (an `EventEmitter`): the values of `EVENT_TRIGGERS` | plugin-meetings | Payloads under Protocol and wire format | `src/constants.ts`, `src/voicea.ts` |
|
|
142
|
+
| Named exports `EVENT_TRIGGERS`, `TURN_ON_CAPTION_STATUS`; types `MeetingTranscriptPayload`, `SpeakerNameUpdatePayload` | plugin-meetings | Values and shapes are relied on by plugin-meetings | `src/index.ts`, `src/constants.ts`, `src/voicea.types.ts` |
|
|
143
|
+
|
|
144
|
+
Contract ID `voicea-internal-sdk` is indexed in the
|
|
145
|
+
[package architecture](../../docs/architecture.md#public-and-consumer-surfaces) and registered in
|
|
146
|
+
`.sdd/manifest.json`. Export stability is under [Export stability](#export-stability).
|
|
147
|
+
|
|
148
|
+
## Dependencies
|
|
149
|
+
|
|
150
|
+
| Dependency | Why it is required | Failure behavior |
|
|
151
|
+
| ---------- | ------------------ | ---------------- |
|
|
152
|
+
| `@webex/webex-core` plugin host (module spec consulted) | `registerInternalPlugin`, `WebexPlugin`, `webex.request` (bound into each channel), and the default `config` export for the `trackingId` prefix | Request rejections reach the channel method's promise |
|
|
153
|
+
| `@webex/internal-plugin-llm` `LLMChannel` (spec consulted and stale; code consulted) | The data channel: `getSocket().send`, `getBinding`, `getLocusUrl`, `getDatachannelUrl`, `isConnected`, `isDataChannelTokenEnabled`, and the `event:relay.event` and `online` events. Imported only as a type | No channel: `requireLLMChannel` throws `VoiceaChannel: LLM channel not available`; a disconnected channel makes the data-channel sends no-ops or throws, per method |
|
|
154
|
+
| `@webex/internal-plugin-mercury` (module spec consulted; reached through `LLMChannel`) | Event emission, default-session event names, and the socket | A closed socket is the LLM package's concern; voicea checks only `isConnected()` |
|
|
155
|
+
| Locus `controls` endpoint (external) | Captions, transcription, manual captions, and spoken language | A rejection is wrapped or passed through, per method |
|
|
156
|
+
| Voicea service through the AI bridge relay (external) | Announcement, translation, transcription, speaker-name, and manual-caption relay messages | Silence produces no event; there is no timeout |
|
|
157
|
+
| `uuid` | Version 4 values for `trackingId`, translation-request ids, and manual-caption ids | Not applicable |
|
|
158
|
+
| Node `events` `EventEmitter` | Base class of `VoiceaChannel` | Not applicable |
|
|
159
|
+
|
|
160
|
+
`@webex/internal-plugin-mercury` is a declared runtime dependency in `package.json`, but no file in
|
|
161
|
+
`src/` imports it; only `test/unit/spec/voicea.js` and `test/unit/spec/voicea-plugin.js` do.
|
|
162
|
+
|
|
163
|
+
## Requirements
|
|
164
|
+
|
|
165
|
+
| ID | WHAT | WHY | Source evidence | Test or example evidence | Assumptions or gaps | Confidence |
|
|
166
|
+
| -- | ---- | --- | --------------- | ------------------------ | ------------------- | ---------- |
|
|
167
|
+
| `MOD-001` | Importing the package registers `VoiceaPlugin` as internal plugin `voicea` with empty options, so `webex.internal.voicea` is the factory. | plugin-meetings reaches the factory through `webex.internal.voicea`, and the `webex` package requires this package for that side effect. | `src/index.ts` | `test/unit/spec/voicea-plugin.js` "has the correct namespace" constructs the class directly | No case imports the package entry or checks the registration | Weak |
|
|
168
|
+
| `MOD-002` | `createChannel(llmChannel?)` returns a new `VoiceaChannel` built with the given LLM channel (or none) and `webex.request` bound to the webex instance. Each call returns an independent channel. The channel never connects, disconnects, or cleans up the LLM channel. | The JSDoc: the caller retains ownership of the LLM channel and its lifecycle. plugin-meetings creates the channel before any LLM connection exists. | `src/voicea-plugin.ts` | `test/unit/spec/voicea-plugin.js` four #createChannel cases | None | Present |
|
|
169
|
+
| `MOD-003` | A new channel starts with sequence number 1, announce and caption status `idle`, manual-caption status `idle`, spoken language `en`, no caption language, no caption service id, and `keepTranscriptionSubscribed` false. With an LLM channel it subscribes to `event:relay.event`; without one it subscribes to nothing. | The JSDoc: a channel may be created first and attached later with `switchLLMChannel`. | `src/voicea.ts`, `src/constants.ts` | `test/unit/spec/voicea.js` #constructor cases | None | Present |
|
|
170
|
+
| `MOD-004` | Every relay event sets the sequence number to the event's `sequenceNumber` plus 1, then dispatches on `data.relayType`: `voicea.annc`, `voicea.transl.rsp`, `voicea.transcription`, `voicea.update_speakername`, `aibridge.manual_transcription`, and `client.manual_transcription`. Other relay types are ignored after the sequence update. | Outbound frames carry the sequence number as `id`, and the data channel's numbering continues from the last inbound frame. | `src/voicea.ts`, `src/constants.ts` | `test/unit/spec/voicea.js` "processes speaker name updates and advances the message sequence" | No case sends an unknown relay type | Present |
|
|
171
|
+
| `MOD-005` | On `voicea.annc` the channel takes `headers.from` as the caption service id (`MOD-010`), sets announce status `joined`, stores `ASR.spoken_languages`, and emits `voicea:announcement` with `captionLanguages`, `maxLanguages`, `spokenLanguages`, and `currentSpokenLanguage`, defaulting to `[]`, `0`, and `[]`. | The announcement is how the service reports which caption and spoken languages the meeting may use. | `src/voicea.ts` | `test/unit/spec/voicea.js` "processes voicea announcement events", "processes voicea announcement with empty payload" | None | Present |
|
|
172
|
+
| `MOD-006` | On `voicea.transcription` the channel emits: `voicea:newCaption` with `isFinal` false for `transcript_interim_results` and `isFinal` true for `transcript_final_result`, where each final transcript gains `timestamp` (`m:ss` of `end_millis`); `voicea:highlightCreated` for `highlight_created`; `voicea:wxa` with `isListening` true for `eva_wake`, false for `eva_cancel`, and false plus `text` for `eva_thanks`; and `voicea:languageDetected` for `language_detected` only when the language is in the last announced spoken languages. Other types emit nothing. | plugin-meetings renders captions and highlights from these events and reacts to the assistant state; a detected language outside the meeting's spoken languages is not actionable. | `src/voicea.ts`, `src/utils.ts` | `test/unit/spec/voicea.js` transcription, highlight, eva, and language-detected cases | None | Present |
|
|
173
|
+
| `MOD-007` | On `voicea.transl.rsp` the channel emits `voicea:captionLanguageUpdate` with `{statusCode: 200}` when `statusCode` is 200, else `{statusCode: errorCode, errorMessage: message}`. | plugin-meetings resolves or rejects its caption-language request from this event. | `src/voicea.ts` | `test/unit/spec/voicea.js` caption language response success and error cases | None | Present |
|
|
174
|
+
| `MOD-008` | On `voicea.update_speakername` the channel emits `voicea:speakerNameUpdated` with the payload unchanged. On either manual relay type it emits `aibridge:newManualCaption` with `isFinal`, `transcriptId`, `transcripts`, `sender` (`headers.from`), and `source` (the relay type), but only for `manual_caption_final_result` and `manual_caption_interim_result`. | Manual captions come from a human captioner and are told apart from voicea captions by event name and source. | `src/voicea.ts`, `src/constants.ts` | `test/unit/spec/voicea.js` speaker-name and "processes manual transcription events" cases | The interim manual type is not tested inbound | Present |
|
|
175
|
+
| `MOD-009` | `announce()` does nothing when announce status is `joined`, throws `voicea can not announce before llm connected` when the channel is not connected, and otherwise calls `sendAnnouncement()`. `sendAnnouncement()` sets status `joining` and sends a `publishRequest` with relay type `client.annc`, `clientPayload.version` `v2`, `headers.to` set to the caption service id only when one is known, and increments the sequence number. | The service joins a meeting's data channel only after a client announces; the `to` header targets the caption service already in the meeting. | `src/voicea.ts` | `test/unit/spec/voicea.js` #announce and #sendAnnouncement cases | `sendAnnouncement` itself does not check `isConnected` | Present |
|
|
176
|
+
| `MOD-010` | `requestLanguage(code)` does nothing while disconnected; otherwise it sends a `publishRequest` with relay type `voicea.transl.req`, `headers.to` the caption service id, and `clientPayload` `{translationLanguage, id}`, records the code as the current caption language, and increments the sequence number. `onCaptionServiceIdUpdate(id)` ignores a falsy id and, when the id changes, stores it and repeats `requestLanguage` with the current caption language if there is one. | A new caption service instance does not know the language the client chose, so the request is replayed to it. | `src/voicea.ts` | `test/unit/spec/voicea.js` #requestLanguage and #onCaptionServiceIdUpdate cases | None | Present |
|
|
177
|
+
| `MOD-011` | `sendManualClosedCaption(text, timeStamp, csis, isFinal)` does nothing while disconnected; otherwise it sends a `publishRequest` with relay type `client.manual_transcription` and a `transcriptPayload` of type `manual_caption_final_result` or `manual_caption_interim_result`, one transcript `{text, start_millis, end_millis, csis}` with both times set to `timeStamp`, and fresh `id` and `transcript_id`, then increments the sequence number. | The relay type is the `MANUAL.CAPTIONER` constant: the frame comes from a human captioner, and other clients receive it as `aibridge:newManualCaption` (`MOD-008`). | `src/voicea.ts` | `test/unit/spec/voicea.js` #sendManualClosedCaption cases | None | Present |
|
|
178
|
+
| `MOD-012` | `setSpokenLanguage(code, assignment?)` PUTs `<locusUrl>/controls/` with `{transcribe: {spokenLanguage, languageAssignment?}}` and then emits `voicea:spokenLanguageUpdate` with `{languageCode}`. `onSpokenLanguageUpdate(code, meetingId)` emits `voicea:spokenLanguageUpdate` with `{languageCode, meetingId}` and then records the code as the current spoken language. | The host changes the meeting's spoken language through Locus; Locus reports the result back, which is when the channel adopts it. | `src/voicea.ts` | `test/unit/spec/voicea.js` #setSpokenLanguage and #onSpokenLanguageUpdate cases | `setSpokenLanguage` does not change the recorded spoken language | Present |
|
|
179
|
+
| `MOD-013` | `turnOnCaptions(lang?)` resolves `undefined` when caption status is `sending` or `enabled`, rejects with `can not turn on captions before llm connected` when disconnected, and otherwise sets status `sending` and PUTs `<locusUrl>/controls/` with `{transcribe: {caption: true}, languageCode}`. On success it emits `voicea:captionOn`, marks captions enabled, sets status `enabled`, calls `announce()`, and starts `updateSubchannelSubscriptionsAndSyncCaptionState({subscribe: ['transcription']}, true)` without awaiting it. On failure it sets status `idle` and rejects with `turn on captions fail` whose `cause` is the original error. | One turn-on request at a time; captions need the service announced and the transcription subchannel subscribed, and the subscription is remembered for restore. | `src/voicea.ts` | `test/unit/spec/voicea.js` #turnOnCaptions cases | The request body is not asserted | Present |
|
|
180
|
+
| `MOD-014` | `toggleTranscribing(activate, lang?)` PUTs `<locusUrl>/controls/` with `{transcribe: {transcribing: activate}, spokenLanguage}`; after success, when `activate` is true and captions are not enabled, it returns `turnOnCaptions(lang)`. Turning transcription off does not turn captions off. | No WHY is stated in code; the code ties enabling transcription to the caption turn-on of `MOD-013`. | `src/voicea.ts` | `test/unit/spec/voicea.js` #toggleTranscribing cases | None | Present |
|
|
181
|
+
| `MOD-015` | `toggleManualCaption(enable)` returns `undefined` while a previous toggle is `sending`; otherwise it sets `sending`, PUTs `<locusUrl>/controls/` with `{manualCaption: {enable}}`, and resets to `idle` on settle. A failure rejects with `toggle manual captions fail` and drops the original error. | One manual-caption toggle at a time. | `src/voicea.ts` | `test/unit/spec/voicea.js` #toggleManualCaption cases | The original error is not kept as `cause` | Present |
|
|
182
|
+
| `MOD-016` | `updateSubchannelSubscriptions({subscribe, unsubscribe})` does nothing while disconnected or when `isDataChannelTokenEnabled()` resolves false; otherwise it sends a `subchannelSubscriptionRequest` with `datachannelUri`, `subscribe`, and `unsubscribe` (both default `[]`) and increments the sequence number. `updateSubchannelSubscriptionsAndSyncCaptionState(options, keep = false)` first sets `keepTranscriptionSubscribed` to `keep`, then delegates. | Subchannel subscriptions exist only in the token-based data-channel flow; the flag lets a reconnect or channel switch restore captions. | `src/voicea.ts` | `test/unit/spec/voicea.js` #updateSubchannelSubscriptions and #updateSubchannelSubscriptionsAndSyncCaptionState cases | None | Present |
|
|
183
|
+
| `MOD-017` | `switchLLMChannel(target)` records the target and reconciles: when the bound channel differs it unsubscribes from the old channel, drops any pending `online` listener, subscribes to the target, resets announce and caption state, and marks a caption restore pending when `keepTranscriptionSubscribed` is true. A pending restore runs `turnOnCaptions(currentSpokenLanguage)` immediately when the target is connected, ignoring its failure; otherwise one `once('online')` listener re-runs the reconcile later. Switching to the already bound channel changes nothing unless a restore is pending. | The JSDoc: preserve caption state across the main-meeting and practice-session LLM channels; the reconcile is idempotent so a late `online` callback self-corrects. | `src/voicea.ts` | `test/unit/spec/voicea.js` eleven #switchLLMChannel cases | The deferred restore's own `turnOnCaptions` result is not observed by the `switchLLMChannel` caller | Present |
|
|
184
|
+
| `MOD-018` | `deregisterEvents()` clears the captions flag, `keepTranscriptionSubscribed`, the caption service id, the target channel, the pending restore and its `online` listener, the relay subscription, both languages, and resets all three statuses to `idle`. It keeps the LLM channel reference and the sequence number. | plugin-meetings calls it when transcription stops and on permanent cleanup. | `src/voicea.ts` | `test/unit/spec/voicea.js` #deregisterEvents cases and "removes pending online listener when deregisterEvents is called" | None | Present |
|
|
185
|
+
| `MOD-019` | `isLLMConnected()` returns the channel's `isConnected()` or `false` without a channel. Every method that needs the channel calls `requireLLMChannel()`, which throws `VoiceaChannel: LLM channel not available` without one. | Methods fail loudly instead of sending to an unbound channel. | `src/voicea.ts` | `test/unit/spec/voicea.js` #isLLMConnected and #requireLLMChannel cases | None | Present |
|
|
186
|
+
| `MOD-020` | `millisToMinutesAndSeconds(ms)` returns `<minutes>:<seconds>` with seconds rounded by `toFixed(0)` and zero-padded below 10. | Captions and highlights show a short elapsed time. | `src/utils.ts` | `test/unit/spec/utils.js` | One case only; see Pitfalls for the rounding edge | Present |
|
|
187
|
+
|
|
188
|
+
## Design overview
|
|
189
|
+
|
|
190
|
+
`VoiceaPlugin` is a stateless factory. All state lives in `VoiceaChannel`, a Node `EventEmitter`, so
|
|
191
|
+
each meeting owns one channel and its events never mix with another meeting's.
|
|
192
|
+
|
|
193
|
+
A channel uses two transports. Locus `controls` PUTs, sent through the `webex.request` function it
|
|
194
|
+
was given, change meeting settings: captions, transcription, manual captions, spoken language. The
|
|
195
|
+
LLM data channel, which the caller owns and lends to it, carries the conversation with the voicea
|
|
196
|
+
service: the client announcement, caption-language requests, manual captions, subchannel
|
|
197
|
+
subscriptions, and every inbound caption or highlight.
|
|
198
|
+
|
|
199
|
+
The channel can be created without an LLM channel. plugin-meetings does this when a meeting is built
|
|
200
|
+
and binds the real channel with `switchLLMChannel` after each LLM connection. That method is an
|
|
201
|
+
intent-setter: it records the target and calls a reconciler that compares the bound channel with the
|
|
202
|
+
target, rebinds when they differ, and restores captions when the caller had asked for the
|
|
203
|
+
transcription subscription to be kept.
|
|
204
|
+
|
|
205
|
+
## Data flow and sequence coverage
|
|
206
|
+
|
|
207
|
+
Call style: in-process method calls on a `VoiceaChannel`; outbound HTTPS through the injected
|
|
208
|
+
request function; outbound and inbound frames over the caller's `LLMChannel`. Three operation groups
|
|
209
|
+
differ in actors, ordering, or outcome, and each has a diagram. The remaining methods are single
|
|
210
|
+
sends or emits whose shape is under Protocol and wire format.
|
|
211
|
+
|
|
212
|
+
| Operation group | Entry and outcome | Diagram or evidence | Failure and recovery coverage |
|
|
213
|
+
| --------------- | ----------------- | ------------------- | ----------------------------- |
|
|
214
|
+
| Turn captions on | `turnOnCaptions` enables captions, announces, and subscribes | Diagram 1; `src/voicea.ts` | Disconnected rejects; request failure rejects and resets to `idle` |
|
|
215
|
+
| Receive relay events | `event:relay.event` becomes a `voicea:*` or `aibridge:*` event | Diagram 2; `src/voicea.ts` | Unknown types are ignored |
|
|
216
|
+
| Switch LLM channel | `switchLLMChannel` rebinds and restores captions | Diagram 3; `src/voicea.ts` | Restore failure is swallowed; a disconnected target defers to `online` |
|
|
217
|
+
| Single sends and emits | `requestLanguage`, `sendManualClosedCaption`, `setSpokenLanguage`, `toggleTranscribing`, `toggleManualCaption`, `updateSubchannelSubscriptions` | Protocol and wire format; `src/voicea.ts` | Caller-visible failure modes |
|
|
218
|
+
|
|
219
|
+
Diagram 1 — turn captions on:
|
|
220
|
+
|
|
221
|
+
```mermaid
|
|
222
|
+
sequenceDiagram
|
|
223
|
+
participant M as plugin-meetings
|
|
224
|
+
participant V as VoiceaChannel
|
|
225
|
+
participant L as Locus controls
|
|
226
|
+
participant D as LLMChannel
|
|
227
|
+
M->>V: turnOnCaptions(lang)
|
|
228
|
+
alt status sending or enabled
|
|
229
|
+
V-->>M: resolves undefined
|
|
230
|
+
else not connected
|
|
231
|
+
V-->>M: rejects "can not turn on captions before llm connected"
|
|
232
|
+
else
|
|
233
|
+
V->>V: caption status sending
|
|
234
|
+
V->>L: PUT controls {transcribe: {caption: true}, languageCode}
|
|
235
|
+
alt rejected
|
|
236
|
+
L-->>V: error
|
|
237
|
+
V->>V: caption status idle
|
|
238
|
+
V-->>M: rejects "turn on captions fail" (cause)
|
|
239
|
+
else ok
|
|
240
|
+
L-->>V: ok
|
|
241
|
+
V-->>M: emit voicea:captionOn
|
|
242
|
+
V->>V: captions enabled, status enabled
|
|
243
|
+
opt announce status not joined
|
|
244
|
+
V->>D: publishRequest client.annc
|
|
245
|
+
end
|
|
246
|
+
V->>D: subchannelSubscriptionRequest subscribe transcription (not awaited, token flow only)
|
|
247
|
+
V-->>M: resolves
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Diagram 2 — receive relay events:
|
|
253
|
+
|
|
254
|
+
```mermaid
|
|
255
|
+
sequenceDiagram
|
|
256
|
+
participant S as Voicea service via AI bridge
|
|
257
|
+
participant D as LLMChannel
|
|
258
|
+
participant V as VoiceaChannel
|
|
259
|
+
participant M as plugin-meetings
|
|
260
|
+
S->>D: relay frame
|
|
261
|
+
D->>V: event:relay.event
|
|
262
|
+
V->>V: sequence number = sequenceNumber + 1
|
|
263
|
+
alt voicea.annc
|
|
264
|
+
V->>V: caption service id, announce joined, spoken languages
|
|
265
|
+
V-->>M: voicea:announcement
|
|
266
|
+
else voicea.transcription
|
|
267
|
+
V-->>M: voicea:newCaption, voicea:highlightCreated, voicea:wxa, or voicea:languageDetected
|
|
268
|
+
else voicea.transl.rsp
|
|
269
|
+
V-->>M: voicea:captionLanguageUpdate
|
|
270
|
+
else voicea.update_speakername
|
|
271
|
+
V-->>M: voicea:speakerNameUpdated
|
|
272
|
+
else manual relay types
|
|
273
|
+
V-->>M: aibridge:newManualCaption (final or interim_result only)
|
|
274
|
+
else other
|
|
275
|
+
V->>V: ignored
|
|
276
|
+
end
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Diagram 3 — switch LLM channel:
|
|
280
|
+
|
|
281
|
+
```mermaid
|
|
282
|
+
sequenceDiagram
|
|
283
|
+
participant M as plugin-meetings
|
|
284
|
+
participant V as VoiceaChannel
|
|
285
|
+
participant Old as bound LLMChannel
|
|
286
|
+
participant New as target LLMChannel
|
|
287
|
+
M->>V: switchLLMChannel(New)
|
|
288
|
+
V->>V: target = New
|
|
289
|
+
alt bound channel differs
|
|
290
|
+
V->>Old: off event:relay.event, off pending online
|
|
291
|
+
V->>New: on event:relay.event
|
|
292
|
+
V->>V: reset announce and caption state, restore pending = keepTranscriptionSubscribed
|
|
293
|
+
end
|
|
294
|
+
alt no restore pending
|
|
295
|
+
V-->>M: resolves
|
|
296
|
+
else New connected
|
|
297
|
+
V->>V: turnOnCaptions(currentSpokenLanguage), failure ignored
|
|
298
|
+
V-->>M: resolves after it settles
|
|
299
|
+
else New not connected
|
|
300
|
+
V->>New: once online, reconcile again
|
|
301
|
+
V-->>M: resolves immediately
|
|
302
|
+
end
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Class and component relationships
|
|
306
|
+
|
|
307
|
+
```mermaid
|
|
308
|
+
classDiagram
|
|
309
|
+
class WebexPlugin
|
|
310
|
+
class VoiceaPlugin {
|
|
311
|
+
namespace voicea
|
|
312
|
+
createChannel(llmChannel)
|
|
313
|
+
}
|
|
314
|
+
class EventEmitter
|
|
315
|
+
class VoiceaChannel {
|
|
316
|
+
switchLLMChannel(llmChannel)
|
|
317
|
+
turnOnCaptions(lang)
|
|
318
|
+
toggleTranscribing(activate, lang)
|
|
319
|
+
toggleManualCaption(enable)
|
|
320
|
+
setSpokenLanguage(code, assignment)
|
|
321
|
+
requestLanguage(code)
|
|
322
|
+
sendManualClosedCaption(text, timeStamp, csis, isFinal)
|
|
323
|
+
announce()
|
|
324
|
+
deregisterEvents()
|
|
325
|
+
}
|
|
326
|
+
class IVoiceaChannel
|
|
327
|
+
class LLMChannel
|
|
328
|
+
WebexPlugin <|-- VoiceaPlugin
|
|
329
|
+
EventEmitter <|-- VoiceaChannel
|
|
330
|
+
IVoiceaChannel <|.. VoiceaChannel
|
|
331
|
+
VoiceaPlugin ..> VoiceaChannel : creates
|
|
332
|
+
VoiceaChannel ..> LLMChannel : borrows, subscribes, sends
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
`VoiceaChannel` holds the LLM channel and the request function it was given; it holds no reference to
|
|
336
|
+
the webex instance or the plugin.
|
|
337
|
+
|
|
338
|
+
## Use cases and flows
|
|
339
|
+
|
|
340
|
+
| Use case | Actor or caller | Primary steps and outcome | Failure or boundary behavior | Evidence |
|
|
341
|
+
| -------- | --------------- | ------------------------- | ---------------------------- | -------- |
|
|
342
|
+
| `UC-001` | plugin-meetings building a meeting | `createChannel()` with no LLM channel; `switchLLMChannel` after each LLM connection unless a practice session holds the binding | A disconnected target defers caption restore to `online` | `src/voicea-plugin.ts`, `src/voicea.ts` |
|
|
343
|
+
| `UC-002` | A participant starting captions | `turnOnCaptions` or `toggleTranscribing(true)`; the service announces and captions arrive as `voicea:newCaption` | Disconnected rejects; request failure rejects | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
344
|
+
| `UC-003` | A participant choosing a caption language | `requestLanguage(code)`; the result arrives as `voicea:captionLanguageUpdate` | No-op while disconnected, so no event follows | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
345
|
+
| `UC-004` | A host changing the spoken language | `setSpokenLanguage(code, assignment)`; Locus later reports it through `onSpokenLanguageUpdate` | Request rejection propagates | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
346
|
+
| `UC-005` | A captioner | `toggleManualCaption(true)`, then `sendManualClosedCaption` per phrase; others receive `aibridge:newManualCaption` | Disconnected sends are dropped silently | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
347
|
+
| `UC-006` | plugin-meetings stopping transcription or leaving | `deregisterEvents()` | The LLM channel reference is kept; see Pitfalls | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
348
|
+
|
|
349
|
+
### Cross-boundary use-case flow
|
|
350
|
+
|
|
351
|
+
| Boundary | Transport and ordering | Compatibility | Timeout, retry, and recovery |
|
|
352
|
+
| -------- | ---------------------- | ------------- | ---------------------------- |
|
|
353
|
+
| Locus `controls` (`UC-002`, `UC-004`, `UC-005`) | HTTPS PUT through the injected `webex.request` to `<locusUrl>/controls/`, where `locusUrl` comes from the bound LLM channel | Bodies under Protocol and wire format | No retry in this module; webex-core interceptors apply |
|
|
354
|
+
| LLM data channel, outbound (`UC-002`, `UC-003`, `UC-005`) | `getSocket().send(frame)`; frames numbered by the shared sequence number | Frames under Protocol and wire format | None; disconnected sends are skipped or throw per method |
|
|
355
|
+
| LLM data channel, inbound (`UC-002`, `UC-003`) | `event:relay.event` from the bound channel's default session | Relay types under Protocol and wire format | None; a missing announcement leaves status `joining` |
|
|
356
|
+
|
|
357
|
+
## Client state model
|
|
358
|
+
|
|
359
|
+
| State or slice | Owner | Initial state | Transition triggers | Reset or persistence boundary |
|
|
360
|
+
| -------------- | ----- | ------------- | ------------------- | ----------------------------- |
|
|
361
|
+
| Bound `llmChannel` and relay subscription | `VoiceaChannel` | Constructor argument | `switchLLMChannel` when the target differs | `deregisterEvents` drops the subscription; see Pitfalls for the kept reference |
|
|
362
|
+
| Target channel and pending restore | `VoiceaChannel` | none, false | `switchLLMChannel` | Cleared by `deregisterEvents`; restore cleared when it runs |
|
|
363
|
+
| Pending `online` listener | `VoiceaChannel` | none | Reconcile against a disconnected target | Detached on rebind and by `deregisterEvents` |
|
|
364
|
+
| Announce status | `VoiceaChannel` | `idle` | State machine below | Reset on rebind and by `deregisterEvents` |
|
|
365
|
+
| Caption status and captions-enabled flag | `VoiceaChannel` | `idle`, false | `turnOnCaptions` | Reset on rebind and by `deregisterEvents` |
|
|
366
|
+
| Manual-caption toggle status | `VoiceaChannel` | `idle` | `toggleManualCaption` | Reset by `deregisterEvents`, not on rebind |
|
|
367
|
+
| `keepTranscriptionSubscribed` | `VoiceaChannel` | false | `updateSubchannelSubscriptionsAndSyncCaptionState`, set true by a successful turn-on | Cleared by `deregisterEvents`; read by plugin-meetings after an LLM reconnect |
|
|
368
|
+
| Caption service id | `VoiceaChannel` | none | `voicea.annc` `headers.from`, `onCaptionServiceIdUpdate` | Reset on rebind and by `deregisterEvents` |
|
|
369
|
+
| Current spoken and caption language; announced spoken languages | `VoiceaChannel` | `en`, none, `[]` | `onSpokenLanguageUpdate`, `requestLanguage`, `voicea.annc` | Cleared by `deregisterEvents` (see Pitfalls); the announced list is never cleared |
|
|
370
|
+
| Sequence number | `VoiceaChannel` | 1 | Inbound relay events and each outbound frame | Never reset |
|
|
371
|
+
|
|
372
|
+
## Business rules and invariants
|
|
373
|
+
|
|
374
|
+
| ID | Invariant | WHY | Enforcement source | Test evidence |
|
|
375
|
+
| -- | --------- | --- | ------------------ | ------------- |
|
|
376
|
+
| `INV-001` | A channel never connects, disconnects, or tears down the LLM channel it was given. | The JSDoc: the caller owns the LLM channel's lifecycle. | `src/voicea-plugin.ts`, `src/voicea.ts` | `test/unit/spec/voicea-plugin.js` |
|
|
377
|
+
| `INV-002` | At most one caption turn-on request is in flight, and none is sent once captions are enabled. | Avoids duplicate Locus requests, including when channel switches race. | `src/voicea.ts` | `test/unit/spec/voicea.js` |
|
|
378
|
+
| `INV-003` | Relay events are processed from exactly one LLM channel, the bound one. | Captions from a channel the meeting left must not appear. | `src/voicea.ts` | `test/unit/spec/voicea.js` |
|
|
379
|
+
| `INV-004` | `voicea:languageDetected` is emitted only for a language in the last announced spoken languages. | A language the meeting cannot use is not actionable. | `src/voicea.ts` | `test/unit/spec/voicea.js` |
|
|
380
|
+
| `INV-005` | Every outbound data-channel frame carries the current sequence number as `id`, and sending advances it by one. | Frames continue the data channel's numbering. | `src/voicea.ts` | `test/unit/spec/voicea.js` |
|
|
381
|
+
|
|
382
|
+
## Concurrency and reactive flow
|
|
383
|
+
|
|
384
|
+
- Execution model: one JavaScript event loop; methods return promises or `void`, and inbound events
|
|
385
|
+
arrive as `EventEmitter` callbacks from the LLM channel.
|
|
386
|
+
- Ordering guarantees: in `turnOnCaptions`, `voicea:captionOn` is emitted before the announcement and
|
|
387
|
+
subscription frames are sent. `onSpokenLanguageUpdate` emits before it records the language.
|
|
388
|
+
- Idempotency and retry: the caption status gate makes `turnOnCaptions` idempotent while `sending` or
|
|
389
|
+
`enabled`, and the toggle status does the same for `toggleManualCaption`. Concurrent
|
|
390
|
+
`switchLLMChannel` calls to the same channel send one turn-on request because the restore flag is
|
|
391
|
+
cleared synchronously before the request starts. No method retries.
|
|
392
|
+
- Fire-and-forget work: the subscription update after a turn-on and the reconcile run by the
|
|
393
|
+
deferred `online` listener are not awaited by anyone. The reconcile swallows a failed restore; a
|
|
394
|
+
rejected `isDataChannelTokenEnabled()` in the subscription update is an unhandled rejection.
|
|
395
|
+
- Shared-state protection: none beyond the status gates; the sequence number is shared by every
|
|
396
|
+
outbound frame.
|
|
397
|
+
|
|
398
|
+
## State machine
|
|
399
|
+
|
|
400
|
+
```mermaid
|
|
401
|
+
stateDiagram-v2
|
|
402
|
+
[*] --> idle
|
|
403
|
+
idle --> joining: sendAnnouncement
|
|
404
|
+
joining --> joined: voicea.annc received
|
|
405
|
+
idle --> joined: voicea.annc received
|
|
406
|
+
joined --> idle: rebind or deregisterEvents
|
|
407
|
+
joining --> idle: rebind or deregisterEvents
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Announce status. `announce()` sends only when the status is not `joined`, so it re-sends while
|
|
411
|
+
`joining`.
|
|
412
|
+
|
|
413
|
+
```mermaid
|
|
414
|
+
stateDiagram-v2
|
|
415
|
+
[*] --> idle
|
|
416
|
+
idle --> sending: turnOnCaptions
|
|
417
|
+
sending --> enabled: controls PUT resolved
|
|
418
|
+
sending --> idle: controls PUT rejected
|
|
419
|
+
enabled --> idle: rebind or deregisterEvents
|
|
420
|
+
sending --> idle: rebind or deregisterEvents
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Caption status. No transition leaves `enabled` except a rebind or `deregisterEvents`; this module has
|
|
424
|
+
no caption-off request.
|
|
425
|
+
|
|
426
|
+
## Protocol and wire format
|
|
427
|
+
|
|
428
|
+
| Message or frame | Version | Producer or serializer | Consumer or parser | Compatibility and ordering rule |
|
|
429
|
+
| ---------------- | ------- | ---------------------- | ------------------ | ------------------------------- |
|
|
430
|
+
| `PUT <locusUrl>/controls/` `{transcribe: {caption: true}, languageCode}` | Unversioned | `turnOnCaptions` | Locus | `languageCode` sits beside `transcribe` |
|
|
431
|
+
| `PUT <locusUrl>/controls/` `{transcribe: {transcribing}, spokenLanguage}` | Unversioned | `toggleTranscribing` | Locus | `spokenLanguage` sits beside `transcribe` |
|
|
432
|
+
| `PUT <locusUrl>/controls/` `{transcribe: {spokenLanguage, languageAssignment?}}` | Unversioned | `setSpokenLanguage` | Locus | `languageAssignment` is `DEFAULT`, `AUTO`, or `MANUAL` and omitted when absent |
|
|
433
|
+
| `PUT <locusUrl>/controls/` `{manualCaption: {enable}}` | Unversioned | `toggleManualCaption` | Locus | — |
|
|
434
|
+
| `publishRequest` `{id, recipients: [{route: binding}], headers, data: {eventType: 'relay.event', relayType, ...}, trackingId}` | Unversioned | `sendAnnouncement`, `requestLanguage`, `sendManualClosedCaption` | Voicea service via the AI bridge | `id` is the sequence number as a string; `trackingId` is `<config.trackingIdPrefix>_<uuid>` |
|
|
435
|
+
| Announcement `relayType: client.annc`, `clientPayload: {version: 'v2'}`, `headers.to` optional | v2 | `sendAnnouncement` | Voicea service | `to` is the caption service id when known |
|
|
436
|
+
| Translation request `relayType: voicea.transl.req`, `clientPayload: {translationLanguage, id}`, `headers.to` | Unversioned | `requestLanguage` | Voicea service | `to` may be `undefined` before an announcement |
|
|
437
|
+
| Manual caption `relayType: client.manual_transcription`, `transcriptPayload: {type, id, transcripts: [{text, start_millis, end_millis, csis}], transcript_id}` | Unversioned | `sendManualClosedCaption` | AI bridge, relayed to other clients | `type` is `manual_caption_final_result` or `manual_caption_interim_result` |
|
|
438
|
+
| `subchannelSubscriptionRequest` `{id, data: {datachannelUri, subscribe, unsubscribe}, trackingId}` | Unversioned | `updateSubchannelSubscriptions` | LLM data channel | Sent only when the token flow is enabled |
|
|
439
|
+
| Inbound relay `{sequenceNumber, headers: {from}, data: {relayType, voiceaPayload or transcriptPayload}}` | Unversioned | Voicea service or AI bridge | Relay-event dispatch | Relay types in `src/constants.ts`; payload shapes in `src/voicea.types.ts` |
|
|
440
|
+
| Event `voicea:announcement` `{captionLanguages, maxLanguages, spokenLanguages, currentSpokenLanguage}` | — | `VoiceaChannel` | plugin-meetings | `MOD-005` |
|
|
441
|
+
| Event `voicea:newCaption` `{isFinal, transcriptId, transcripts}` | — | `VoiceaChannel` | plugin-meetings (`MeetingTranscriptPayload`) | Final transcripts carry `timestamp` |
|
|
442
|
+
| Event `voicea:highlightCreated` `{csis, highlightId, text, highlightLabel, highlightSource, timestamp}` | — | `VoiceaChannel` | Listeners | — |
|
|
443
|
+
| Event `voicea:wxa` `{isListening, text?}` | — | `VoiceaChannel` | plugin-meetings | — |
|
|
444
|
+
| Event `voicea:languageDetected` `{languageCode}` | — | `VoiceaChannel` | Listeners | `INV-004` |
|
|
445
|
+
| Event `voicea:captionLanguageUpdate` `{statusCode, errorMessage?}` | — | `VoiceaChannel` | plugin-meetings | `MOD-007` |
|
|
446
|
+
| Event `voicea:spokenLanguageUpdate` `{languageCode, meetingId?}` | — | `VoiceaChannel` | plugin-meetings | `meetingId` only from `onSpokenLanguageUpdate` |
|
|
447
|
+
| Event `voicea:speakerNameUpdated` (payload unchanged), `aibridge:newManualCaption` `{isFinal, transcriptId, transcripts, sender, source}`, `voicea:captionOn` (no payload) | — | `VoiceaChannel` | Listeners | `MOD-008`, `MOD-013` |
|
|
448
|
+
|
|
449
|
+
## Caller-visible failure modes
|
|
450
|
+
|
|
451
|
+
| Condition | Signal or result | Caller behavior | Retry or recovery | Evidence |
|
|
452
|
+
| --------- | ---------------- | --------------- | ----------------- | -------- |
|
|
453
|
+
| A Locus control method (`setSpokenLanguage`, `toggleTranscribing`, `toggleManualCaption`) or `sendAnnouncement` with no LLM channel | Synchronous `Error` `VoiceaChannel: LLM channel not available`, not a rejection | Bind a channel first | None | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
454
|
+
| `announce()` while disconnected | Synchronous `Error` `voicea can not announce before llm connected` | Wait for the LLM channel | None | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
455
|
+
| `turnOnCaptions` while disconnected | Rejection `can not turn on captions before llm connected` | Wait for the LLM channel | `switchLLMChannel` restores when asked | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
456
|
+
| Captions PUT fails | Rejection `turn on captions fail` with `cause`; status back to `idle` | Report and allow retry | Call again | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
457
|
+
| Manual-caption PUT fails | Rejection `toggle manual captions fail` without the cause | Report and allow retry | Call again | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
458
|
+
| `setSpokenLanguage` or `toggleTranscribing` PUT fails | The request rejection, unchanged | Handle the HTTP error | Call again | `src/voicea.ts` |
|
|
459
|
+
| `requestLanguage`, `sendManualClosedCaption`, or `updateSubchannelSubscriptions` while disconnected | Nothing is sent and nothing is reported | Check `isLLMConnected()` first | Call again when connected | `src/voicea.ts`, `test/unit/spec/voicea.js` |
|
|
460
|
+
| Caption restore during `switchLLMChannel` fails | Swallowed; `switchLLMChannel` still resolves | Inspect `getCaptionStatus()` | Call `turnOnCaptions` | `src/voicea.ts` |
|
|
461
|
+
|
|
462
|
+
## Pitfalls and constraints
|
|
463
|
+
|
|
464
|
+
- `deregisterEvents` drops the relay subscription but keeps the LLM channel reference. A later
|
|
465
|
+
`switchLLMChannel` with that same channel finds it already bound and does not subscribe again, so
|
|
466
|
+
relay events stay unprocessed until a different channel is supplied (inferred from code; no test).
|
|
467
|
+
- `toggleManualCaption` sets its status to `sending` before `requireLLMChannel` runs. Without a
|
|
468
|
+
channel it throws synchronously and the status stays `sending`, so every later call returns
|
|
469
|
+
`undefined` until `deregisterEvents`.
|
|
470
|
+
- The Locus control methods read `getLocusUrl()` without checking it, so a channel without a Locus URL
|
|
471
|
+
sends to `undefined/controls/`.
|
|
472
|
+
- `turnOnCaptions` treats a failed `announce()` inside its success path as a request failure: Locus
|
|
473
|
+
has already enabled captions and `voicea:captionOn` was emitted, yet the call rejects and the status
|
|
474
|
+
returns to `idle`.
|
|
475
|
+
- `deregisterEvents` sets the spoken language to `undefined`, not `en`. A channel reused afterwards
|
|
476
|
+
restores captions or announces with `currentSpokenLanguage` `undefined` until Locus reports one.
|
|
477
|
+
- Outbound `trackingId` uses the module-level default `config` export of webex-core, not
|
|
478
|
+
`webex.config`, so a host's `trackingIdPrefix` setting is not applied.
|
|
479
|
+
- `millisToMinutesAndSeconds` can produce `0:60` (for example 59 999 ms), because seconds are rounded
|
|
480
|
+
after the minute is taken (inferred from code; no test).
|
|
481
|
+
- `manual_caption_interim_results` (plural) is declared in `src/constants.ts` and the
|
|
482
|
+
`TRANSCRIPTION_TYPES` union but is never emitted; only the singular interim type is.
|
|
483
|
+
- `TRANSCRIBING_ON`, `TRANSCRIBING_OFF`, and `LANGUAGE_ASSIGNMENT` are declared but never used.
|
|
484
|
+
- `IVoiceaChannel` in `src/voicea.types.ts` lags the class: it declares `setSpokenLanguage` with one
|
|
485
|
+
argument, `spokenLanguage` as required for `toggleTranscribing`, and omits `switchLLMChannel` and
|
|
486
|
+
the data-channel methods. The `TRANSCRIPTION_TYPES` union omits `language_detected`, and
|
|
487
|
+
`MeetingTranscripts` spells its time fields `start_mills` and `end_mills`.
|
|
488
|
+
- The final-caption path mutates the inbound transcript objects to add `timestamp`.
|
|
489
|
+
- `package.json` `devMain` names `src/index.js`, but the entry is `src/index.ts`.
|
|
490
|
+
- `package.json` `test` runs `yarn test:integration`, which this package does not define, and there
|
|
491
|
+
is no `test/integration` directory, so `test` and `test:browser` verify nothing beyond unit tests.
|
|
492
|
+
|
|
493
|
+
## Module-specific rules
|
|
494
|
+
|
|
495
|
+
- Do: keep the LLM channel caller-owned; never connect or disconnect it here (`INV-001`).
|
|
496
|
+
- Do: route every outbound data-channel frame through the shared sequence number (`INV-005`).
|
|
497
|
+
- Do: go through `requireLLMChannel()` for any new method that needs the channel (`MOD-019`), and
|
|
498
|
+
check the channel before changing a status flag (see Pitfalls).
|
|
499
|
+
- Do: add new event names to `EVENT_TRIGGERS` with the `voicea:` prefix, or `aibridge:` for manual
|
|
500
|
+
captions, and add relay types to `AIBRIDGE_RELAY_TYPES` (`src/constants.ts`).
|
|
501
|
+
- Do not: add per-meeting state to `VoiceaPlugin`; state belongs in `VoiceaChannel` (Design overview).
|
|
502
|
+
|
|
503
|
+
## Export stability
|
|
504
|
+
|
|
505
|
+
| Export or entry point | Consumer | Stability | Versioning and deprecation rule | Declaration or API report |
|
|
506
|
+
| --------------------- | -------- | --------- | ------------------------------- | ------------------------- |
|
|
507
|
+
| Import side effect: internal plugin `voicea` | `webex`, plugin-meetings | Internal | The README states that internal plugins do not strictly follow semantic versioning | `src/index.ts` |
|
|
508
|
+
| Default and named `VoiceaPlugin`, `VoiceaChannel` | plugin-meetings | Internal | Same | `src/index.ts`, `src/voicea-plugin.ts`, `src/voicea.ts` |
|
|
509
|
+
| `EVENT_TRIGGERS`, `TURN_ON_CAPTION_STATUS` | plugin-meetings | Internal; values relied on | Changing a value breaks plugin-meetings listeners | `src/constants.ts` |
|
|
510
|
+
| Types `MeetingTranscriptPayload`, `SpeakerNameUpdatePayload` | plugin-meetings | Internal | Same | `src/voicea.types.ts` |
|
|
511
|
+
|
|
512
|
+
The build emits TypeScript declarations to `dist/types` (`package.json` `types`); no API report is
|
|
513
|
+
kept in the repository.
|
|
514
|
+
|
|
515
|
+
## Key design trade-off
|
|
516
|
+
|
|
517
|
+
| Chosen trade-off | Preserved invariant or benefit | Cost or limitation | Decision evidence |
|
|
518
|
+
| ---------------- | ------------------------------ | ------------------ | ----------------- |
|
|
519
|
+
| A factory that returns caller-owned channels, each borrowing a caller-owned LLM channel | Several meetings, and a meeting's main and practice sessions, keep separate caption state | The caller must bind, switch, and deregister correctly; a forgotten `deregisterEvents` leaves a subscription behind | `src/voicea-plugin.ts`, `src/voicea.ts` |
|
|
520
|
+
| An idempotent reconciler behind `switchLLMChannel` | A late `online` callback or a repeated switch converges on the latest target without duplicate requests | A deferred restore's outcome is invisible to the caller | `src/voicea.ts` |
|
|
521
|
+
|
|
522
|
+
## Verification
|
|
523
|
+
|
|
524
|
+
| Requirement or invariant | Test level | Positive evidence | Negative or boundary evidence | Gap |
|
|
525
|
+
| ------------------------ | ---------- | ----------------- | ----------------------------- | --- |
|
|
526
|
+
| `MOD-001` | Unit | `test/unit/spec/voicea-plugin.js` namespace case | None found | Registration through the package entry untested |
|
|
527
|
+
| `MOD-002`, `INV-001` | Unit | `test/unit/spec/voicea-plugin.js` #createChannel cases | `test/unit/spec/voicea-plugin.js` cases without an LLM channel | None |
|
|
528
|
+
| `MOD-003` | Unit | `test/unit/spec/voicea.js` #constructor | `test/unit/spec/voicea.js` undefined-channel case | None |
|
|
529
|
+
| `MOD-004`, `INV-005` | Unit | `test/unit/spec/voicea.js` speaker-name case (sequence) and send cases | None found | Unknown relay type untested |
|
|
530
|
+
| `MOD-005` | Unit | `test/unit/spec/voicea.js` announcement case | `test/unit/spec/voicea.js` empty-payload case | None |
|
|
531
|
+
| `MOD-006`, `INV-004` | Unit | `test/unit/spec/voicea.js` transcription, highlight, and eva cases | `test/unit/spec/voicea.js` language not in spoken languages | None |
|
|
532
|
+
| `MOD-007` | Unit | `test/unit/spec/voicea.js` success case | `test/unit/spec/voicea.js` error case | None |
|
|
533
|
+
| `MOD-008` | Unit | `test/unit/spec/voicea.js` speaker-name and manual final cases | None found | Inbound interim manual type untested |
|
|
534
|
+
| `MOD-009` | Unit | `test/unit/spec/voicea.js` #announce, #sendAnnouncement | `test/unit/spec/voicea.js` disconnected and already-joined cases | `trackingId` prefix untested |
|
|
535
|
+
| `MOD-010` | Unit | `test/unit/spec/voicea.js` #requestLanguage, #onCaptionServiceIdUpdate | `test/unit/spec/voicea.js` disconnected and falsy-id cases | None |
|
|
536
|
+
| `MOD-011` | Unit | `test/unit/spec/voicea.js` interim and final cases | `test/unit/spec/voicea.js` disconnected case | None |
|
|
537
|
+
| `MOD-012` | Unit | `test/unit/spec/voicea.js` #setSpokenLanguage, #onSpokenLanguageUpdate | None found | Rejection untested |
|
|
538
|
+
| `MOD-013`, `INV-002` | Unit | `test/unit/spec/voicea.js` #turnOnCaptions | `test/unit/spec/voicea.js` disconnected, already sending, already enabled, and failure cases | Request body untested |
|
|
539
|
+
| `MOD-014` | Unit | `test/unit/spec/voicea.js` #toggleTranscribing | `test/unit/spec/voicea.js` captions-already-enabled case | None |
|
|
540
|
+
| `MOD-015` | Unit | `test/unit/spec/voicea.js` #toggleManualCaption | `test/unit/spec/voicea.js` already-sending and failure cases | Missing-channel status leak untested |
|
|
541
|
+
| `MOD-016` | Unit | `test/unit/spec/voicea.js` subscription cases | `test/unit/spec/voicea.js` disconnected and token-disabled cases | None |
|
|
542
|
+
| `MOD-017`, `INV-003` | Unit | `test/unit/spec/voicea.js` #switchLLMChannel cases | `test/unit/spec/voicea.js` same-channel, deferred, and concurrent cases | Re-binding the same channel after `deregisterEvents` untested |
|
|
543
|
+
| `MOD-018` | Unit | `test/unit/spec/voicea.js` #deregisterEvents | `test/unit/spec/voicea.js` undefined-channel case | Kept channel reference not asserted |
|
|
544
|
+
| `MOD-019` | Unit | `test/unit/spec/voicea.js` #isLLMConnected, #requireLLMChannel | `test/unit/spec/voicea.js` undefined-channel cases | None |
|
|
545
|
+
| `MOD-020` | Unit | `test/unit/spec/utils.js` | None found | Rounding edge untested |
|
|
546
|
+
|
|
547
|
+
The unit suites (84 cases in three files) passed under Node 22.14 after `build:src` on 2026-11-12. A
|
|
548
|
+
module specification is complete only when its public surface, invariants, failure modes, and test
|
|
549
|
+
evidence agree with the implementation. Generator-side field measurement is complete (93.3%, assessed 2026-11-12). Independent semantic
|
|
550
|
+
validation reran on 2026-11-12 and passed with warnings: 0 Blocking findings and one accepted Important
|
|
551
|
+
command-source finding. A characterization baseline and promotion past Partial remain pending.
|