@webex/internal-plugin-presence 3.13.0-next.4 → 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.
@@ -0,0 +1,98 @@
1
+ ---
2
+ type: ADR
3
+ title: ADR-0001 - Retain the product README
4
+ description: SDD onboarding keeps README.md as product documentation and routes it only as context.
5
+ tags: [adr]
6
+ timestamp: 2026-11-12T12:46:09Z
7
+ status: accepted
8
+ ---
9
+ <!-- sdd-generated-metadata
10
+ doc_kind: standing-doc
11
+ generated_from: adr@0.3.0
12
+ generated_by: claude-code
13
+ approved_by: rarajes2@cisco.com
14
+ updated_at: 2026-11-12T13:05:26Z
15
+ validation_status: blocked
16
+ -->
17
+
18
+ # ADR-0001 - Retain the product README
19
+
20
+ | Field | Value |
21
+ | ------------- | ----- |
22
+ | Status | Accepted |
23
+ | Decision date | 2026-11-12 |
24
+ | Deciders | rarajes2@cisco.com (bootstrap questionnaire) |
25
+ | Supersedes | N/A |
26
+ | Superseded by | N/A |
27
+
28
+ ## Context
29
+
30
+ Onboarding found one existing document, `README.md`. It is the npm page: a one-line description
31
+ ("Plugin for the Presence service"), an internal-plugin notice, an install command, and a Usage block.
32
+ No other intent, design, or AI-authored spec exists in this package.
33
+
34
+ The README documents no behavior that the code has:
35
+
36
+ | README content | Code |
37
+ | -------------- | ---- |
38
+ | Usage ends with the placeholder member `webex.internal.presence.WHATEVER` | The plugin exposes `get`, `list`, `subscribe`, `unsubscribe`, `setStatus`, `enable`, `disable`, `isEnabled`, `initializeWorker`, `enqueue`, and `dequeue` (`src/presence.js`) |
39
+ | No method, option, result, or event is described | The worker reports changes as `updated` events with three envelope types (`src/presence-worker.js`, `src/constants.js`) |
40
+ | Nothing about configuration | Importing the package sets `config.presence` batcher defaults and registers an inbound transform (`src/config.js`, `src/index.js`) |
41
+
42
+ ## Decision
43
+
44
+ Keep `README.md` unchanged. Do not migrate it into the module specification. Record
45
+ `spec_source_policy.mode` as `keep-separate` with `migrated_source_disposition` `retain`, and route
46
+ `README.md` in `spec_sources` as `reference-only` and `context-only`.
47
+
48
+ The canonical behavior is `src/` plus `test/`. The module specification follows code.
49
+
50
+ ## Why
51
+
52
+ The README is the npm-facing page. Filling it in is a product-doc change, not a requirement of making
53
+ the package SDD-ready, and the other onboarded packages in this workspace kept their READMEs the same
54
+ way. It holds no behavioral claim to preserve, so nothing is lost by not migrating it.
55
+
56
+ ## Alternatives considered
57
+
58
+ | Alternative | Why it was not selected |
59
+ | ----------- | ----------------------- |
60
+ | Migrate the README into `src/docs/README.md` and delete it | It carries no behavior to migrate; deletion was not requested |
61
+ | Reconcile the README with the module specification in place | Reconciling would only preserve placeholder wording; the developer chose `keep-separate` |
62
+ | Rewrite the README during onboarding | Onboarding writes the SDD tree only and does not edit `README.md` |
63
+
64
+ ## Consequences
65
+
66
+ **Positive:**
67
+
68
+ - The npm page stays stable for consumers.
69
+ - The module specification is the single behavioral reference.
70
+
71
+ **Negative / tradeoffs:**
72
+
73
+ - Agents must not treat `README.md` as a usage reference; its Usage block names a member that does not
74
+ exist.
75
+ - The placeholder README remains until a maintainer makes a separate product-doc change.
76
+
77
+ ## Constraint on future changes
78
+
79
+ Do not delete `README.md` as part of spec maintenance. If its usage text changes, keep the module
80
+ specification aligned with code rather than with the README.
81
+
82
+ ## Follow-up
83
+
84
+ - [ ] A maintainer may replace the README Usage placeholder with real request, worker, and `updated`
85
+ event examples in a separate product-doc change.
86
+
87
+ ## Revisit when
88
+
89
+ - A maintainer rewrites the README to document the presence methods and the worker.
90
+
91
+ ## References
92
+
93
+ - `README.md`
94
+ - `src/index.js`
95
+ - `src/config.js`
96
+ - `src/presence.js`
97
+ - `src/presence-worker.js`
98
+ - `.sdd/manifest.json` `spec_source_policy`
@@ -0,0 +1,25 @@
1
+ <!-- sdd-generated-metadata
2
+ doc_kind: standing-doc
3
+ generated_from: adr-index@0.3.0
4
+ generated_by: claude-code
5
+ approved_by: rarajes2@cisco.com
6
+ updated_at: 2026-11-12T13:05:26Z
7
+ validation_status: blocked
8
+ -->
9
+
10
+ # Architectural decision records
11
+
12
+ Numbered, append-only records of structural decisions affecting this package and its documentation.
13
+ Add a concrete ADR (for example, `0042-cache-policy.md`) when a decision is non-obvious, hard to
14
+ reverse, or worth explaining to a future contributor. Do not edit an accepted decision in place when
15
+ its outcome changes; supersede it with a new ADR and link both records.
16
+
17
+ ## Index
18
+
19
+ - [ADR-0001 - Retain the product README](0001-retain-product-readme.md) — accepted 2026-11-12
20
+
21
+ Add new entries as ADRs are accepted. Keep this list in numeric order.
22
+
23
+ Each ADR should state its context, decision, alternatives, consequences, and the condition that would
24
+ cause the team to revisit it. Record the deciders, any superseded decision, and the constraint future
25
+ changes must preserve.
@@ -0,0 +1,266 @@
1
+ ---
2
+ type: Architecture
3
+ title: '@webex/internal-plugin-presence architecture'
4
+ description: Package-wide boundaries, resources, interactions, dependencies, and cross-cutting architecture.
5
+ tags: [architecture]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: standing-doc
9
+ generated_from: architecture@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rarajes2@cisco.com
12
+ updated_at: 2026-11-12T13:05:26Z
13
+ validation_status: blocked
14
+ -->
15
+
16
+ # @webex/internal-plugin-presence architecture
17
+
18
+ Canonical architecture for this package. Flow behavior lives in the
19
+ [Presence plugin specification](../src/docs/README.md). This page owns package boundaries, the plugin
20
+ registration, the contract index, and how the package meets the rest of the SDK.
21
+
22
+ Related context: [specification registry](specs/README.md) ·
23
+ [package agent instructions](../AGENTS.md)
24
+
25
+ ## Applicability
26
+
27
+ | Condition ID | Status | Evidence or reason | Owned section |
28
+ | ------------------------------------ | ---------- | ------------------ | ------------- |
29
+ | `repo.owns_datastore` | N/A | No database, file store, or migration in `src/presence-worker.js` or `src/presence.js` | Repository data and schema |
30
+ | `repo.holds_client_state` | Applicable | `src/presence-worker.js` keeps per-user watch, fetch, and subscription maps; defaults in `src/config.js` | Client state model |
31
+ | `repo.components_interact` | Applicable | `src/presence.js` drives the batcher and the worker, and the worker calls back into the plugin (`src/presence-worker.js`) | Dependency and interaction topology |
32
+ | `repo.domain_data_across_components` | Applicable | Presence status objects pass from the presence service through the batcher and worker to the client (`src/presence-batcher.js`, `src/presence-worker.js`) | Object and data ownership |
33
+ | `repo.caches_data` | N/A | `src/presence-worker.js` stores times and counts, not presence objects; the client keeps the data | Caching catalog |
34
+ | `repo.observability_convention` | N/A | `src/presence.js`, `src/presence-worker.js`, and `src/presence-batcher.js` make no logger, metrics, or trace call | Observability patterns |
35
+ | `repo.deploys_to_infra` | N/A | Library published to npm (`package.json`). No service runtime | Runtime and infrastructure |
36
+ | `repo.shared_base_libs` | Applicable | Extends WebexPlugin and the webex-core Batcher, and uses the legacy build, lint, and test stack (`babel.config.js`, `jest.config.js`, `.eslintrc.js`) | Shared and base libraries |
37
+ | `repo.is_monorepo` | N/A | This SDD root is one package. The workspace around it is out of scope | Package map and inter-package dependencies |
38
+ | `repo.multi_platform` | N/A | `src/presence-worker.js` uses only timers; `process` declares only {browser: true} | Platform matrix |
39
+ | `repo.published_package` | Applicable | `package.json` name is @webex/internal-plugin-presence and deploy:npm publishes it | Release and versioning |
40
+ | `repo.embedded_in_host` | N/A | No host theme or embed API in `src/presence.js` | Host integration and theming |
41
+ | `repo.exposes_commands_or_artifacts` | Applicable | build:src in `package.json` writes dist | Commands and generated artifacts |
42
+ | `repo.cross_repo_deps_material` | Applicable | Behavior depends on the presence service, Mercury, and the feature plugin (`src/presence.js`, `src/presence-worker.js`) | Cross-repository topology |
43
+ | `repo.security_arch_warranted` | Applicable | Other users' presence and the current user's id leave or enter the client under the SDK's authorization (`src/presence.js`) | Security architecture |
44
+
45
+ ## Design overview
46
+
47
+ `@webex/internal-plugin-presence` is a published JavaScript library with one module. Importing it
48
+ registers the device plugin and then `Presence` as the internal plugin `presence`, reached as
49
+ `webex.internal.presence`. The `webex`, `webex-node`, and `@webex/recipe-private-web-client`
50
+ packages load it; no workspace code calls it, so its callers are first-party clients.
51
+
52
+ The plugin talks to the presence service, catalog name `apheleia`. It reads one user's presence or
53
+ many users' through a batcher that folds lookups into one `compositions` request, subscribes to and
54
+ unsubscribes from presence updates, and sets the current user's status. It turns the presence
55
+ feature on and off through the feature plugin. Registration also adds an inbound transform to the
56
+ SDK's global pipeline that copies `eventType` to `status` on events responses.
57
+
58
+ An optional worker, started on request, tracks which users the client is showing. It fetches their
59
+ presence, subscribes after a minute, renews while they are shown, receives updates from Mercury, and
60
+ tells the client about every change through `updated` events. The package serves no routes and
61
+ persists nothing.
62
+
63
+ ## Resource inventory and responsibilities
64
+
65
+ | Resource | Kind | Responsibility | Owner | Source | Detailed specification |
66
+ | -------- | ---- | -------------- | ----- | ------ | ---------------------- |
67
+ | Presence plugin | package (one module) | Registration, transform, and config defaults; presence service requests; feature toggle; batcher; worker | @webex/web-sdk | src/ | [`src/docs/README.md`](../src/docs/README.md) |
68
+
69
+ ## Interaction and execution flows
70
+
71
+ Representative end-to-end flow: a client shows a person, and the worker keeps that person's presence
72
+ current.
73
+
74
+ ```mermaid
75
+ flowchart LR
76
+ Client[client] -->|enqueue id| Plugin[webex.internal.presence]
77
+ Plugin --> Worker[PresenceWorker]
78
+ Worker -->|list| Batcher[PresenceBatcher]
79
+ Batcher -->|POST compositions| Svc[presence service]
80
+ Worker -->|subscribe after 1 min| Svc
81
+ Svc -->|apheleia.subscription_update| Mercury[Mercury]
82
+ Mercury --> Worker
83
+ Worker -->|updated envelopes| Client
84
+ ```
85
+
86
+ | From | To | Interaction or transport | Purpose | Failure or compatibility behavior |
87
+ | ---- | -- | ------------------------ | ------- | --------------------------------- |
88
+ | Client | `webex.internal.presence` | In-process calls and `updated` events | Presence reads, writes, and worker control | Request rejections propagate |
89
+ | `Presence` | `PresenceBatcher` | In-process calls | Batched lookups | A failed flush rejects each lookup |
90
+ | `PresenceWorker` | `Presence` | In-process calls | `list`, `subscribe`, `emitEvent` | Rejections are not caught |
91
+ | `Presence`, `PresenceBatcher` | Presence service | HTTPS through `webex.request` | Compositions, subscriptions, events | No retry here |
92
+ | `PresenceWorker` | Mercury | Event listener | Subscription updates | Mercury owns the socket |
93
+ | `Presence` | Feature plugin | In-process calls | Presence feature toggle | Requires the host to register it |
94
+
95
+ ## Dependency topology
96
+
97
+ | Dependency | Type | Used by | Purpose | Version, failure, or fallback policy |
98
+ | ---------- | ---- | ------- | ------- | ------------------------------------ |
99
+ | `@webex/webex-core` | Internal | `src/index.js`, `src/presence.js`, `src/presence-batcher.js` | Registration, plugin base, `Batcher`, `webex.request`, transform pipeline | `workspace:*` in `package.json` |
100
+ | `@webex/internal-plugin-device` | Internal | `src/index.js`, `src/presence.js` | Registration side effect; `userId` | `workspace:*` |
101
+ | `@webex/internal-plugin-mercury` | Internal | `src/presence-worker.js` | `connect`, `connected`, the subscription update event | `workspace:*`; reached as `webex.internal.mercury`, not imported by `src/` |
102
+ | `@webex/internal-plugin-feature` | Internal, not declared | `src/presence.js` | `setFeature`, `getFeature` | Provided by the host |
103
+ | `lodash` | External | `src/index.js`, `src/presence-worker.js` | `has`, `debounce` | `^4.17.21` in `package.json` |
104
+ | `@webex/test-helper-*` packages | Internal, declared under dependencies | Specs only | Test setup | `workspace:*`; not used by `src/` |
105
+ | Presence service | External service | `src/presence.js`, `src/presence-batcher.js` | Compositions, subscriptions, events | Resolved through the service catalog |
106
+
107
+ No import cycle exists: neither webex-core, Mercury, the device plugin, nor the feature plugin imports
108
+ this package.
109
+
110
+ ## Public and consumer surfaces
111
+
112
+ | Surface | Type | Owner | Consumers | Compatibility policy | Source |
113
+ | ------- | ---- | ----- | --------- | -------------------- | ------ |
114
+ | `presence-internal-sdk` — package @webex/internal-plugin-presence, `webex.internal.presence`, its request, toggle, and worker methods, the `updated` event, the config defaults, and the inbound transform | SDK, published to npm, internal | Presence plugin | First-party clients; `webex`, `webex-node`, `@webex/recipe-private-web-client` | The README states that internal plugins do not strictly follow semantic versioning; no deprecation rule is declared | `package.json`, `src/index.js`, `src/presence.js` |
115
+
116
+ The compositions, subscriptions, and events requests, the Mercury event, and the `updated` envelope
117
+ are protocols this package speaks with other parties, described under *Protocol and wire format* in
118
+ the [module specification](../src/docs/README.md#protocol-and-wire-format). The other contracts this
119
+ package requires are registered in `.sdd/manifest.json` `contract_catalog`.
120
+
121
+ ## Client state model
122
+
123
+ | State or slice | Owner | Transition triggers | Persistence or reset boundary |
124
+ | -------------- | ----- | ------------------- | ----------------------------- |
125
+ | Worker maps (watchers, campers, fetchers, flights, subscribers, presences) | `PresenceWorker` | `enqueue`, `dequeue`, fetches, the groundskeeper, Mercury events | In memory for the life of the plugin |
126
+ | Batcher queue and pending lookups | `PresenceBatcher` | `list` and flushes | Settled lookups are removed |
127
+ | `config.presence` | webex-core config | Host config at construction | SDK instance lifetime |
128
+
129
+ Full detail is in the module specification's *Client state model* and *State machine*.
130
+
131
+ ## Cross-cutting architecture
132
+
133
+ ### Security
134
+
135
+ - Trust boundaries and identity flow: see [Security architecture](#security-architecture).
136
+ - Sensitive surfaces and data classes: other users' presence (status, last activity, last device
137
+ URL), the current user's id sent as `subject` and `label`, and the presence feature toggle.
138
+ - Encryption and secret boundaries: see [Security architecture](#security-architecture).
139
+
140
+ ### Observability and operations
141
+
142
+ - Logging and correlation: the package writes no log line; the webex-core `Batcher` base logs a failed
143
+ flush through the plugin logger, and webex-core adds tracking ids to every request.
144
+ - Metrics, traces, and audit signals: none in this package.
145
+ - Ownership and operational entry points: `.github/CODEOWNERS` at the workspace root has no line for
146
+ this package, so its default rule assigns it to `@webex/web-sdk`. No dashboards or runbooks are
147
+ recorded in this package.
148
+
149
+ ### Quality attributes
150
+
151
+ - Compatibility: clients rely on the registered name `presence`, the method names and argument
152
+ order, the `updated` event and its envelope types, and the result shapes `{statusList}` and
153
+ `{responses}`.
154
+ - Footprint: six source files; runtime imports are webex-core, the device plugin, and lodash. The
155
+ worker adds one 20-second interval per start.
156
+ - Test confidence: every unit and integration case is skipped, so no behavior has a running test.
157
+ No coverage threshold is enforced.
158
+
159
+ ## Dependency and interaction topology
160
+
161
+ ```mermaid
162
+ flowchart LR
163
+ Index[src/index.js] -->|registerInternalPlugin presence| Core[webex-core]
164
+ Index -->|import| Device[internal-plugin-device]
165
+ Index --> Config[src/config.js]
166
+ Index --> Plugin[src/presence.js]
167
+ Plugin -->|child batcher| Batcher[src/presence-batcher.js]
168
+ Plugin -->|session worker| Worker[src/presence-worker.js]
169
+ Worker --> Constants[src/constants.js]
170
+ Batcher -->|extends Batcher| Core
171
+ Plugin -->|extends WebexPlugin, request| Core
172
+ Plugin -.->|webex.internal.feature, not imported| Feature[internal-plugin-feature]
173
+ Worker -.->|webex.internal.mercury, not imported| Mercury[internal-plugin-mercury]
174
+ Worker -.->|list, subscribe, emitEvent| Plugin
175
+ ```
176
+
177
+ | From | To | Kind | Purpose | Ordering or failure boundary |
178
+ | ---- | -- | ---- | ------- | ---------------------------- |
179
+ | `src/index.js` | webex-core | Call at import | Register `presence` and its transform | First registration wins |
180
+ | `src/presence.js` | `src/presence-batcher.js` | Child plugin | Batched `list` lookups | Flush timing from `config.presence` |
181
+ | `src/presence.js` | `src/presence-worker.js` | Session property, created per instance | Watch upkeep | Started only on request |
182
+ | `src/presence-worker.js` | `src/presence.js` | Calls through `webex.internal.presence` | Lookups, subscriptions, events | Rejections are not caught |
183
+ | `src/presence-worker.js` | Mercury | Property reads and a listener, no import | Subscription updates | The host must provide Mercury |
184
+ | `src/presence.js` | Feature plugin | Calls, no import | Feature toggle | The host must provide the feature plugin |
185
+
186
+ ## Object and data ownership
187
+
188
+ | Object or state | System of record | May write | May read | Movement or lifecycle |
189
+ | --------------- | ---------------- | --------- | -------- | --------------------- |
190
+ | Presence status objects | Presence service | The service | This package, then the client | Returned per request or Mercury event; not kept here |
191
+ | The current user's status | Presence service | This package through `setStatus` | The service and subscribers | Sent per call with a TTL |
192
+ | Presence subscriptions | Presence service | This package | The service | Created, renewed, or ended by TTL |
193
+ | `user-presence-enabled` toggle | Feature service through the feature and device plugins | This package through `enable` and `disable` | This package through `isEnabled` | Merged into the device feature collection |
194
+ | Worker times and counts | `PresenceWorker` | The worker | The worker | In memory |
195
+
196
+ ## Shared and base libraries
197
+
198
+ | Library | Inherited responsibility | Consumers | Version floor | Compatibility rule |
199
+ | ------- | ------------------------ | --------- | ------------- | ------------------ |
200
+ | `@webex/webex-core` `WebexPlugin` | `webex`, `config`, `trigger`, `request` | `Presence` | `workspace:*` | Keep the registered name `presence` |
201
+ | `@webex/webex-core` `Batcher` | Fingerprint de-duplication, capped-debounce flush, failure fan-out | `PresenceBatcher` | `workspace:*` | Keep `batcherWait`, `batcherMaxCalls`, `batcherMaxWait` in `config.presence` |
202
+ | `@webex/babel-config-legacy`, `@webex/eslint-config-legacy`, `@webex/jest-config-legacy`, `@webex/legacy-tools` | Build, lint, and test stack through one-line config files | Package tooling | `workspace:*` | Do not fork the config locally |
203
+
204
+ ## Release and versioning
205
+
206
+ | Artifact | Publish target | Versioning rule | Deprecation window | Changelog or migration obligation |
207
+ | -------- | -------------- | --------------- | ------------------ | --------------------------------- |
208
+ | @webex/internal-plugin-presence | npm through `deploy:npm` | Internal plugin; the README says semantic versioning is not strictly followed | None declared | None declared in the package; the workspace owns changelog generation |
209
+
210
+ ## Commands and generated artifacts
211
+
212
+ | Command or artifact | Owner | Inputs | Output or side effect | Compatibility boundary |
213
+ | ------------------- | ----- | ------ | --------------------- | ---------------------- |
214
+ | `yarn workspace @webex/internal-plugin-presence build:src` | Package scripts | `src` | Writes `dist/` (JavaScript and source maps) through `webex-legacy-tools` | `dist/` is generated and never edited by hand |
215
+ | `yarn workspace @webex/internal-plugin-presence build` | Package scripts | `src` | Runs `build:src` | Same output |
216
+ | `yarn workspace @webex/internal-plugin-presence test:unit` | Package scripts | `test/unit/spec`, `dist/` | Jest run; every case is skipped today | Run `build:src` first |
217
+ | `yarn workspace @webex/internal-plugin-presence test:style` | Package scripts | `src` | ESLint run | The shared config ignores `docs/**` and `*.md` |
218
+
219
+ ## Cross-repository topology
220
+
221
+ | Repository or external system | Relationship | Exchanged contract or artifact | Owner | Sequencing constraint |
222
+ | ----------------------------- | ------------- | ------------------------------ | ----- | --------------------- |
223
+ | `@webex/webex-core` (workspace sibling; module, interceptors, and services specs consulted) | Consumes | `registerInternalPlugin`, `WebexPlugin`, `Batcher`, `transform`, `webex.request` | @webex/web-sdk | Registration at import |
224
+ | `@webex/internal-plugin-mercury` (workspace sibling; spec consulted, stale on sessions, code used) | Consumes | `connect`, `connected`, `event:apheleia.subscription_update` | @webex/web-sdk | Device registered before Mercury connects |
225
+ | `@webex/internal-plugin-feature` (workspace sibling; module spec consulted) | Consumes | `setFeature`, `getFeature` | @webex/web-sdk | Device registered before a toggle is set |
226
+ | `@webex/internal-plugin-device` (workspace sibling; spec consulted) | Consumes | `userId` | @webex/web-sdk | Device registered before `setStatus` |
227
+ | `webex`, `webex-node`, `@webex/recipe-private-web-client` (workspace siblings) | Consumed by | The plugin registration | @webex/web-sdk | None |
228
+ | `@webex/plugin-presence` (workspace sibling) | Parallel public package | Same service requests and transform name, registered as public plugin `presence` | @webex/web-sdk | No workspace package imports it |
229
+ | Presence service | Consumes | Compositions, subscriptions, events | Not recorded in this repository | Subscribe before expecting Mercury updates |
230
+
231
+ ## Security architecture
232
+
233
+ ```mermaid
234
+ flowchart LR
235
+ Client[client] -->|ids, status| Plugin[Presence]
236
+ Plugin -->|user token via webex-core| Svc[presence service]
237
+ Svc -->|other users' presence| Plugin
238
+ Svc -->|subscription updates| Mercury[Mercury socket]
239
+ Mercury --> Plugin
240
+ Plugin -->|updated envelopes| Client
241
+ ```
242
+
243
+ - This package holds no credential. Every request goes through `webex.request`, so the webex-core auth
244
+ interceptor adds the user's authorization.
245
+ - `setStatus` sends the device `userId` as `subject` and, except for `dnd`, as `label`.
246
+ - Responses and Mercury events carry other users' presence; the worker passes them to the client
247
+ unchanged and keeps only times and counts. The package logs none of it.
248
+
249
+ ## Domain language
250
+
251
+ | Term | Repository-specific meaning | Authoritative source |
252
+ | ---- | --------------------------- | -------------------- |
253
+ | apheleia | The catalog name of the presence service | `src/presence.js` |
254
+ | Composition | The presence service's composed presence of one user, read through `compositions` | `src/presence.js` |
255
+ | Watcher | A count of the client's `enqueue` calls for a user, less its `dequeue` calls | `src/presence-worker.js` |
256
+ | Camper | A watched user waiting a minute before the worker subscribes | `src/presence-worker.js` |
257
+ | Groundskeeper | The worker's 20-second upkeep: subscribe, renew, expire, clean | `src/presence-worker.js` |
258
+ | Envelope | The `{type, payload}` object of an `updated` event | `src/constants.js` |
259
+
260
+ ## References and maintenance
261
+
262
+ - Decisions: [adr/](adr/index.md)
263
+ - Instantiated specifications and routing: [specs/README.md](specs/README.md)
264
+ - Repository rules and patterns: [package agent instructions](../AGENTS.md)
265
+ - Update this document in the same change that alters package boundaries, resource ownership,
266
+ cross-resource interaction, or cross-cutting architecture.
@@ -0,0 +1,134 @@
1
+ ---
2
+ type: Getting Started
3
+ title: Getting started
4
+ description: Local setup, build, run, and test routing for @webex/internal-plugin-presence.
5
+ tags: [onboarding]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: standing-doc
9
+ generated_from: getting-started@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rarajes2@cisco.com
12
+ updated_at: 2026-11-12T13:05:26Z
13
+ validation_status: blocked
14
+ -->
15
+
16
+ # Getting started
17
+
18
+ Onboarding for **@webex/internal-plugin-presence**, a package inside the `webex-js-sdk` Yarn
19
+ workspace. Run every command from the workspace root.
20
+
21
+ ## Prerequisites
22
+
23
+ | Tool or access | Version or requirement |
24
+ | -------------- | ---------------------- |
25
+ | Node.js | Use 22.14: the workspace root `AGENTS.md` requires it and the workspace `.nvmrc` selects `lts/jod` (Node 22). This package's `engines` accepts `>=16`. The workspace root `package.json` `engines.node` reads `18.x`, which conflicts with the other pins; the build, unit tests, and lint pass on 22.14 |
26
+ | Yarn | `yarn@3.4.1` (`packageManager` in the workspace root `package.json`) |
27
+ | Registry or account access | N/A for building, unit tests, and linting |
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ yarn
33
+ ```
34
+
35
+ The workspace `deploy.yml` workflow installs with the same command.
36
+
37
+ On a fresh checkout, prebuild the workspace before the first package build. `yarn` does not build
38
+ `@webex/legacy-tools`, whose `webex-legacy-tools` binary runs this package's build and tests, or the
39
+ sibling packages' `dist/`:
40
+
41
+ ```bash
42
+ yarn prebuild:modules
43
+ ```
44
+
45
+ It runs `yarn`, then builds the tools, the legacy tools, `@webex/webex-core`, and every package, in
46
+ that order (root `package.json`; see the workspace `CONTRIBUTING.md` "Prebuilding").
47
+
48
+ ## Build
49
+
50
+ ```bash
51
+ yarn workspace @webex/internal-plugin-presence build:src
52
+ ```
53
+
54
+ `build:src` writes JavaScript and source maps for the six source files to `dist/` through
55
+ `webex-legacy-tools`. `dist/` is ignored by Git. The `build` script runs `yarn build:src`; the package
56
+ emits no type declarations.
57
+
58
+ ```bash
59
+ yarn workspace @webex/internal-plugin-presence build
60
+ ```
61
+
62
+ ## Run
63
+
64
+ N/A — this is a library with no start script. Importing `@webex/internal-plugin-presence` registers
65
+ `webex.internal.presence`. `enable`, `disable`, and `isEnabled` need the host to register
66
+ `@webex/internal-plugin-feature`, and the worker needs `@webex/internal-plugin-mercury`.
67
+
68
+ ## Tests
69
+
70
+ ```bash
71
+ yarn workspace @webex/internal-plugin-presence test:unit
72
+ ```
73
+
74
+ ```bash
75
+ yarn workspace @webex/internal-plugin-presence test:style
76
+ ```
77
+
78
+ | Tier | Command | Test location | Framework | External dependencies |
79
+ | ---- | ------- | ------------- | --------- | --------------------- |
80
+ | Unit | `yarn workspace @webex/internal-plugin-presence test:unit` | `test/unit/spec` | jest through `webex-legacy-tools` and `@webex/jest-config-legacy` | None; `@webex/test-helper-mock-webex` and sinon stubs |
81
+
82
+ Run `build:src` before `test:unit`. The unit specs import `@webex/internal-plugin-presence` by name,
83
+ which resolves to `dist/index.js`, so a stale build tests old code.
84
+
85
+ Both unit suites are `describe.skip`, so `test:unit` reports 2 skipped suites and 29 skipped cases and
86
+ exits zero without running anything. The reason is in the
87
+ [module specification](../src/docs/README.md#verification).
88
+
89
+ `test:style` lints `src/` with eslint through `@webex/eslint-config-legacy`.
90
+
91
+ - Coverage or quality gate: none; the package defines no coverage script, and the legacy Jest
92
+ configuration it re-exports sets no threshold
93
+ - Enforcement source: N/A
94
+ - Test environment or QA dependencies: none for unit tests and lint
95
+
96
+ `test:browser` runs `webex-legacy-tools test --integration --runner karma` over
97
+ `test/integration/spec/presence.js`, which needs live test users and the presence service and is
98
+ itself `describe.skip`. On 2026-11-12 under Node 22.14 the karma bundle failed to parse `isbot` (an ES
99
+ module in the workspace `node_modules`), so the run reported "0 tests completed" and still exited
100
+ zero. It is not listed in the table above because it verifies nothing today.
101
+
102
+ `yarn workspace @webex/internal-plugin-presence test` chains style, unit, integration, and browser
103
+ runs, and stops at `test:integration`, which is not defined in this package's `package.json`.
104
+
105
+ ## Configuration and secrets
106
+
107
+ - Required configuration: none. Defaults live under `webex.config.presence` (`batcherWait`,
108
+ `batcherMaxCalls`, `batcherMaxWait`); a host that wants the worker started at `ready` sets
109
+ `config.presence.initializeWorker`, which has no default (`src/config.js`)
110
+ - Environment overrides: none read by this package
111
+ - Secret source: N/A; the package holds no secret and requests go through `webex.request`
112
+ - Package or artifact access: N/A
113
+ - Required neighboring packages: `@webex/webex-core` and `@webex/internal-plugin-device` resolve
114
+ through the workspace; the host must also register `@webex/internal-plugin-feature` and
115
+ `@webex/internal-plugin-mercury`
116
+ - Platform, simulator, device, or SDK setup: none
117
+ - Never commit credentials or copy production secrets into a local config.
118
+
119
+ ## First-run verification
120
+
121
+ 1. Run `yarn workspace @webex/internal-plugin-presence build:src` and check that it reports
122
+ `Built internal-plugin-presence: 6 files`.
123
+ 2. Run `yarn workspace @webex/internal-plugin-presence test:unit`.
124
+ 3. Run `yarn workspace @webex/internal-plugin-presence test:style`.
125
+
126
+ Expected result: all three commands exit zero. The unit run reports 29 skipped tests and none run.
127
+ `test:style` prints warnings but no errors: four `require-jsdoc` warnings, three in `src/index.js` and
128
+ one in `src/presence.js`, and "File ignored" for `src/docs/README.md`.
129
+
130
+ ## Next steps
131
+
132
+ - [Package architecture](architecture.md)
133
+ - [Specification registry](specs/README.md)
134
+ - [Documentation index](index.md)
package/docs/index.md ADDED
@@ -0,0 +1,44 @@
1
+ ---
2
+ okf_version: '0.1'
3
+ ---
4
+ <!-- sdd-generated-metadata
5
+ doc_kind: standing-doc
6
+ generated_from: docs-index@0.3.0
7
+ generated_by: claude-code
8
+ approved_by: rarajes2@cisco.com
9
+ updated_at: 2026-11-12T13:05:26Z
10
+ validation_status: blocked
11
+ -->
12
+
13
+ # @webex/internal-plugin-presence documentation
14
+
15
+ Doc map for developers and agents working on the Presence plugin.
16
+
17
+ ## Start here
18
+
19
+ - [Getting started](getting-started.md)
20
+ - [Package architecture](architecture.md)
21
+
22
+ ## Decisions
23
+
24
+ - [adr/](adr/index.md) — architectural decision records
25
+
26
+ ## Specifications and contracts
27
+
28
+ - [architecture.md](architecture.md) — canonical package architecture and contract index
29
+ - [specs/README.md](specs/README.md) — manifest-backed module and contract registry
30
+ - [`src/docs/README.md`](../src/docs/README.md) — the Presence plugin specification beside its code
31
+ - [adr/](adr/index.md) — concrete architectural decisions; blank ADR templates remain under the
32
+ monorepo root `.sdd/`
33
+
34
+ This package is a library, so there is no service specification and no OpenAPI document. Exact
35
+ contract details live in the native sources linked from the architecture index: `package.json`,
36
+ `src/index.js`, and `src/config.js` for the package, its transform, and its defaults;
37
+ `src/presence.js` and `src/presence-batcher.js` for the API; and `src/presence-worker.js` and
38
+ `src/constants.js` for the worker and its events.
39
+
40
+ ## Related repository resources
41
+
42
+ - [`README.md`](../README.md) — retained npm page; context only, its Usage block is a placeholder, see
43
+ [ADR-0001](adr/0001-retain-product-readme.md)
44
+ - [`AGENTS.md`](../AGENTS.md) — agent instructions for this package
@@ -0,0 +1,70 @@
1
+ ---
2
+ type: Reference
3
+ title: Specification registry
4
+ description: Canonical specification registry and change-routing guide.
5
+ tags: [specifications, registry]
6
+ ---
7
+ <!-- sdd-generated-metadata
8
+ doc_kind: standing-doc
9
+ generated_from: spec-index@0.3.0
10
+ generated_by: claude-code
11
+ approved_by: rarajes2@cisco.com
12
+ updated_at: 2026-11-12T13:10:05Z
13
+ validation_status: blocked
14
+ -->
15
+
16
+ # Specification registry
17
+
18
+ Use this page to find the canonical package architecture and every instantiated module specification
19
+ plus native contract. Keep technical facts in one owning document and use this page only for
20
+ navigation, ownership, status, and change/test routing.
21
+
22
+ Start with the [package architecture](../architecture.md). No service specification exists because this
23
+ package is a library.
24
+
25
+ ## Document roles
26
+
27
+ | Document | Canonical ownership |
28
+ | -------- | ------------------- |
29
+ | [Package architecture](../architecture.md) | Package boundaries, resource inventory, interactions, dependency topology, and cross-cutting architecture |
30
+ | Module specifications | Stable behavior and design at each manifest-routed `<module-path>/docs/README.md` |
31
+ | [ADR](../adr/index.md) | A durable decision, its deciders, rationale, consequences, and supersession lineage |
32
+
33
+ ## Instantiated specification registry
34
+
35
+ | Resource | Role | Canonical path | Owner | Status | Last verified |
36
+ | -------- | ---- | -------------- | ----- | ------ | ------------- |
37
+ | Package | Architecture | `docs/architecture.md` | @webex/web-sdk | Draft | 2026-11-12 |
38
+ | Presence plugin | Module | `src/docs/README.md` | @webex/web-sdk | Draft | 2026-11-12 |
39
+ | Retain the product README | ADR | `docs/adr/0001-retain-product-readme.md` | @webex/web-sdk | Accepted | 2026-11-12 |
40
+
41
+ ### Module registry
42
+
43
+ | Module | Responsibility | Manifest coverage state | Start here |
44
+ | --- | --- | --- | --- |
45
+ | `src/` | `webex.internal.presence`: presence reads, subscriptions, and status on the presence service, the presence feature toggle, batched lookups, and the optional worker that keeps shown users' presence current through `updated` events | Partial | `src/docs/README.md` |
46
+
47
+ Generator-side field measurement for the module is complete (100%, assessed 2026-11-12).
48
+ Independent validation ran on 2026-11-12 and is blocked by one unresolved requirement rationale;
49
+ the maintainer does not know the reason for the `dnd` label exception, so A1-001 stays open. The
50
+ Important command-source traceability finding (IMP-001) is accepted as a warning. Every unit case is skipped, so
51
+ running tests and a characterization baseline remain pending before promotion past Partial.
52
+
53
+ ## Change and verification routing
54
+
55
+ | Change affects | Load and update | Verification route |
56
+ | -------------- | --------------- | ------------------ |
57
+ | Package boundaries or cross-cutting architecture | `docs/architecture.md` and applicable ADRs | `yarn workspace @webex/internal-plugin-presence build:src`, then `test:unit` and `test:style`, and the module spec |
58
+ | A stable code, package, or component boundary | `src/docs/README.md` | Build, unit tests, and lint |
59
+ | A public method, request body, resource, event or envelope type, worker timing, transform, or config default | The owning architecture section, `src/docs/README.md`, and the native definition in `src/presence.js`, `src/presence-batcher.js`, `src/presence-worker.js`, `src/constants.js`, `src/config.js`, `src/index.js`, or `package.json` | Build, unit tests, and lint; add a running unit case, because every existing case is skipped |
60
+
61
+ ## Module and contract registration
62
+
63
+ The module specification is generated at the exact `modules[].canonical_spec` path recorded in
64
+ `.sdd/manifest.json`. Register every module and submodule in the Module registry above in manifest tree
65
+ order.
66
+
67
+ Contracts are registered in `.sdd/manifest.json` `contract_catalog` and indexed in
68
+ [`docs/architecture.md`](../architecture.md#public-and-consumer-surfaces) with a stable ID, publication
69
+ state, native source, and owning module. This page provides navigation and ownership rather than a copied
70
+ contract.