@webex/plugin-presence 0.0.0-next.26 → 0.0.0-next.260
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 +543 -0
- package/.sdd/manifest.json +448 -0
- package/AGENTS.md +213 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interface.js.map +1 -1
- package/dist/presence-batcher.js.map +1 -1
- package/dist/presence-worker.js +1 -2
- package/dist/presence-worker.js.map +1 -1
- package/dist/presence.js +34 -11
- package/dist/presence.js.map +1 -1
- package/docs/adr/0001-retain-product-readme.md +100 -0
- package/docs/adr/index.md +25 -0
- package/docs/architecture.md +270 -0
- package/docs/getting-started.md +132 -0
- package/docs/index.md +44 -0
- package/docs/specs/README.md +69 -0
- package/package.json +13 -13
- package/schemas/repo-context.schema.json +796 -0
- package/src/docs/README.md +544 -0
- package/src/presence.ts +16 -1
- package/test/integration/spec/presence.ts +2 -0
- package/test/unit/spec/presence.ts +62 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Architecture
|
|
3
|
+
title: '@webex/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:37:51Z
|
|
13
|
+
validation_status: pass-with-warnings
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# @webex/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.ts` or `src/presence.ts` | Repository data and schema |
|
|
30
|
+
| `repo.holds_client_state` | Applicable | `src/presence-worker.ts` keeps per-user watch, fetch, and subscription maps; defaults in `src/config.ts` | Client state model |
|
|
31
|
+
| `repo.components_interact` | Applicable | `src/presence.ts` drives the batcher and the worker, and the worker calls back into the plugin (`src/presence-worker.ts`) | 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.ts`, `src/presence-worker.ts`) | Object and data ownership |
|
|
33
|
+
| `repo.caches_data` | N/A | `src/presence-worker.ts` stores times and counts, not presence objects; the client keeps the data | Caching catalog |
|
|
34
|
+
| `repo.observability_convention` | N/A | `src/presence.ts`, `src/presence-worker.ts`, and `src/presence-batcher.ts` 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.ts` uses only timers; `process` declares only {browser: true} | Platform matrix |
|
|
39
|
+
| `repo.published_package` | Applicable | `package.json` name is @webex/plugin-presence, it declares types, and deploy:npm publishes it | Release and versioning |
|
|
40
|
+
| `repo.embedded_in_host` | N/A | No host theme or embed API in `src/presence.ts` | Host integration and theming |
|
|
41
|
+
| `repo.exposes_commands_or_artifacts` | Applicable | build:src and build in `package.json` write dist, and build:docs writes typedoc pages | Commands and generated artifacts |
|
|
42
|
+
| `repo.cross_repo_deps_material` | Applicable | Behavior depends on the presence service, Mercury, and the feature plugin (`src/presence.ts`, `src/presence-worker.ts`) | 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.ts`) | Security architecture |
|
|
44
|
+
|
|
45
|
+
## Design overview
|
|
46
|
+
|
|
47
|
+
`@webex/plugin-presence` is a published TypeScript library with one module. Importing it registers
|
|
48
|
+
the device plugin and then `Presence` as the public plugin `presence`, reached as `webex.presence`.
|
|
49
|
+
No workspace package imports it; the `webex` bundle loads the separate internal plugin
|
|
50
|
+
`@webex/internal-plugin-presence` instead, so this package's callers are npm applications that add
|
|
51
|
+
it beside `@webex/webex-core`.
|
|
52
|
+
|
|
53
|
+
The plugin talks to the presence service, catalog name `apheleia`. It reads one user's presence or
|
|
54
|
+
many users' through a batcher that folds lookups into one `compositions` request, subscribes to and
|
|
55
|
+
unsubscribes from presence updates, and sets the current user's status. It turns the presence
|
|
56
|
+
feature on and off through the feature plugin. Registration also adds an inbound transform to the
|
|
57
|
+
SDK's global pipeline that copies `eventType` to `status` on events responses.
|
|
58
|
+
|
|
59
|
+
An optional worker, started on request, tracks which users the client is showing. It fetches their
|
|
60
|
+
presence, subscribes after a minute, renews while they are shown, receives updates from Mercury, and
|
|
61
|
+
tells the client about every change through `updated` events. `src/interface.ts` types the surface
|
|
62
|
+
for TypeScript callers and is the typedoc entry. The package serves no routes and persists nothing.
|
|
63
|
+
|
|
64
|
+
## Resource inventory and responsibilities
|
|
65
|
+
|
|
66
|
+
| Resource | Kind | Responsibility | Owner | Source | Detailed specification |
|
|
67
|
+
| -------- | ---- | -------------- | ----- | ------ | ---------------------- |
|
|
68
|
+
| Presence plugin | package (one module) | Registration, transform, and config defaults; presence service requests; feature toggle; batcher; worker; TypeScript types | @webex/web-sdk | src/ | [`src/docs/README.md`](../src/docs/README.md) |
|
|
69
|
+
|
|
70
|
+
## Interaction and execution flows
|
|
71
|
+
|
|
72
|
+
Representative end-to-end flow: an application shows a person, and the worker keeps that person's
|
|
73
|
+
presence current.
|
|
74
|
+
|
|
75
|
+
```mermaid
|
|
76
|
+
flowchart LR
|
|
77
|
+
Client[application] -->|enqueue id| Plugin[webex.presence]
|
|
78
|
+
Plugin --> Worker[PresenceWorker]
|
|
79
|
+
Worker -->|list| Batcher[PresenceBatcher]
|
|
80
|
+
Batcher -->|POST compositions| Svc[presence service]
|
|
81
|
+
Worker -->|subscribe after 1 min| Svc
|
|
82
|
+
Svc -->|apheleia.subscription_update| Mercury[Mercury]
|
|
83
|
+
Mercury --> Worker
|
|
84
|
+
Worker -->|updated envelopes| Client
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
| From | To | Interaction or transport | Purpose | Failure or compatibility behavior |
|
|
88
|
+
| ---- | -- | ------------------------ | ------- | --------------------------------- |
|
|
89
|
+
| Application | `webex.presence` | In-process calls and `updated` events | Presence reads, writes, and worker control | Request rejections propagate |
|
|
90
|
+
| `Presence` | `PresenceBatcher` | In-process calls | Batched lookups | A failed flush rejects each lookup |
|
|
91
|
+
| `PresenceWorker` | `Presence` | In-process calls | `list`, `subscribe`, `emitEvent` | Rejections are not caught |
|
|
92
|
+
| `Presence`, `PresenceBatcher` | Presence service | HTTPS through `webex.request` | Compositions, subscriptions, events | No retry here |
|
|
93
|
+
| `PresenceWorker` | Mercury | Event listener | Subscription updates | Mercury owns the socket |
|
|
94
|
+
| `Presence` | Feature plugin | In-process calls | Presence feature toggle | Requires the host to register it |
|
|
95
|
+
|
|
96
|
+
## Dependency topology
|
|
97
|
+
|
|
98
|
+
| Dependency | Type | Used by | Purpose | Version, failure, or fallback policy |
|
|
99
|
+
| ---------- | ---- | ------- | ------- | ------------------------------------ |
|
|
100
|
+
| `@webex/webex-core` | Internal | `src/index.ts`, `src/presence.ts`, `src/presence-batcher.ts` | Registration, plugin base, `Batcher`, `webex.request`, transform pipeline | `workspace:*` in `package.json` |
|
|
101
|
+
| `@webex/internal-plugin-device` | Internal | `src/index.ts`, `src/presence.ts` | Registration side effect; `userId` | `workspace:*` |
|
|
102
|
+
| `@webex/internal-plugin-mercury` | Internal | `src/presence-worker.ts` | `connect`, `connected`, the subscription update event | `workspace:*`; reached as `webex.internal.mercury`, not imported by `src/` |
|
|
103
|
+
| `@webex/internal-plugin-feature` | Internal, not declared | `src/presence.ts` | `setFeature`, `getFeature` | Provided by the host |
|
|
104
|
+
| `lodash` | External | `src/index.ts`, `src/presence-worker.ts` | `has`, `debounce` | `4.17.21` in `package.json` |
|
|
105
|
+
| `@webex/test-helper-*` packages | Internal, declared under dependencies | Specs only | Test setup | `workspace:*`; not used by `src/` |
|
|
106
|
+
| Presence service | External service | `src/presence.ts`, `src/presence-batcher.ts` | Compositions, subscriptions, events | Resolved through the service catalog |
|
|
107
|
+
|
|
108
|
+
No import cycle exists: neither webex-core, Mercury, the device plugin, nor the feature plugin imports
|
|
109
|
+
this package.
|
|
110
|
+
|
|
111
|
+
## Public and consumer surfaces
|
|
112
|
+
|
|
113
|
+
| Surface | Type | Owner | Consumers | Compatibility policy | Source |
|
|
114
|
+
| ------- | ---- | ----- | --------- | -------------------- | ------ |
|
|
115
|
+
| `presence-public-sdk` — package @webex/plugin-presence, `webex.presence`, its request, toggle, and worker methods, the `updated` event, the config defaults, the inbound transform, and the declarations at `dist/types/index.d.ts` | SDK, published to npm, public | Presence plugin | npm applications; no workspace package | No versioning or deprecation rule is declared in the package | `package.json`, `src/index.ts`, `src/presence.ts`, `src/interface.ts` |
|
|
116
|
+
|
|
117
|
+
The compositions, subscriptions, and events requests, the Mercury event, and the `updated` envelope
|
|
118
|
+
are protocols this package speaks with other parties, described under *Protocol and wire format* in
|
|
119
|
+
the [module specification](../src/docs/README.md#protocol-and-wire-format). The other contracts this
|
|
120
|
+
package requires are registered in `.sdd/manifest.json` `contract_catalog`.
|
|
121
|
+
|
|
122
|
+
## Client state model
|
|
123
|
+
|
|
124
|
+
| State or slice | Owner | Transition triggers | Persistence or reset boundary |
|
|
125
|
+
| -------------- | ----- | ------------------- | ----------------------------- |
|
|
126
|
+
| Worker maps (watchers, campers, fetchers, flights, subscribers, presences) | `PresenceWorker` | `enqueue`, `dequeue`, fetches, the groundskeeper, Mercury events | In memory for the life of the plugin |
|
|
127
|
+
| Batcher queue and pending lookups | `PresenceBatcher` | `list` and flushes | Settled lookups are removed |
|
|
128
|
+
| `config.presence` | webex-core config | Host config at construction | SDK instance lifetime |
|
|
129
|
+
|
|
130
|
+
Full detail is in the module specification's *Client state model* and *State machine*.
|
|
131
|
+
|
|
132
|
+
## Cross-cutting architecture
|
|
133
|
+
|
|
134
|
+
### Security
|
|
135
|
+
|
|
136
|
+
- Trust boundaries and identity flow: see [Security architecture](#security-architecture).
|
|
137
|
+
- Sensitive surfaces and data classes: other users' presence (status, last activity, last device
|
|
138
|
+
URL), the current user's id sent as `subject` and `label`, and the presence feature toggle.
|
|
139
|
+
- Encryption and secret boundaries: see [Security architecture](#security-architecture).
|
|
140
|
+
|
|
141
|
+
### Observability and operations
|
|
142
|
+
|
|
143
|
+
- Logging and correlation: the package writes no log line; the webex-core `Batcher` base logs a failed
|
|
144
|
+
flush through the plugin logger, and webex-core adds tracking ids to every request.
|
|
145
|
+
- Metrics, traces, and audit signals: none in this package.
|
|
146
|
+
- Ownership and operational entry points: `.github/CODEOWNERS` at the workspace root has no line for
|
|
147
|
+
this package, so its default rule assigns it to `@webex/web-sdk`. No dashboards or runbooks are
|
|
148
|
+
recorded in this package.
|
|
149
|
+
|
|
150
|
+
### Quality attributes
|
|
151
|
+
|
|
152
|
+
- Compatibility: applications rely on the registered name `presence`, the method names and argument
|
|
153
|
+
order, the `updated` event and its envelope types, the result shapes `{statusList}` and
|
|
154
|
+
`{responses}`, and the declared types.
|
|
155
|
+
- Footprint: seven source files; runtime imports are webex-core, the device plugin, and lodash. The
|
|
156
|
+
worker adds one 20-second interval per start.
|
|
157
|
+
- Test confidence: all 29 unit cases run and pass; registration, the transform, the feature toggle,
|
|
158
|
+
the batcher, and the Mercury update have no running case. No coverage threshold is enforced.
|
|
159
|
+
|
|
160
|
+
## Dependency and interaction topology
|
|
161
|
+
|
|
162
|
+
```mermaid
|
|
163
|
+
flowchart LR
|
|
164
|
+
Index[src/index.ts] -->|registerPlugin presence| Core[webex-core]
|
|
165
|
+
Index -->|import| Device[internal-plugin-device]
|
|
166
|
+
Index --> Config[src/config.ts]
|
|
167
|
+
Index --> Plugin[src/presence.ts]
|
|
168
|
+
Plugin -->|child batcher| Batcher[src/presence-batcher.ts]
|
|
169
|
+
Plugin -->|session worker| Worker[src/presence-worker.ts]
|
|
170
|
+
Plugin --> Types[src/interface.ts]
|
|
171
|
+
Worker --> Constants[src/constants.ts]
|
|
172
|
+
Batcher -->|extends Batcher| Core
|
|
173
|
+
Plugin -->|extends WebexPlugin, request| Core
|
|
174
|
+
Plugin -.->|webex.internal.feature, not imported| Feature[internal-plugin-feature]
|
|
175
|
+
Worker -.->|webex.internal.mercury, not imported| Mercury[internal-plugin-mercury]
|
|
176
|
+
Worker -.->|list, subscribe, emitEvent| Plugin
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
| From | To | Kind | Purpose | Ordering or failure boundary |
|
|
180
|
+
| ---- | -- | ---- | ------- | ---------------------------- |
|
|
181
|
+
| `src/index.ts` | webex-core | Call at import | Register `presence` and its transform | First registration wins |
|
|
182
|
+
| `src/presence.ts` | `src/presence-batcher.ts` | Child plugin | Batched `list` lookups | Flush timing from `config.presence` |
|
|
183
|
+
| `src/presence.ts` | `src/presence-worker.ts` | Session property, created per instance | Watch upkeep | Started only on request |
|
|
184
|
+
| `src/presence-worker.ts` | `src/presence.ts` | Calls through `webex.presence` | Lookups, subscriptions, events | Rejections are not caught |
|
|
185
|
+
| `src/presence-worker.ts` | Mercury | Property reads and a listener, no import | Subscription updates | The host must provide Mercury |
|
|
186
|
+
| `src/presence.ts` | Feature plugin | Calls, no import | Feature toggle | The host must provide the feature plugin |
|
|
187
|
+
| `src/presence.ts`, `src/presence-batcher.ts`, `src/presence-worker.ts` | `src/interface.ts` | Type imports | Declarations | Erased at build |
|
|
188
|
+
|
|
189
|
+
## Object and data ownership
|
|
190
|
+
|
|
191
|
+
| Object or state | System of record | May write | May read | Movement or lifecycle |
|
|
192
|
+
| --------------- | ---------------- | --------- | -------- | --------------------- |
|
|
193
|
+
| Presence status objects | Presence service | The service | This package, then the client | Returned per request or Mercury event; not kept here |
|
|
194
|
+
| The current user's status | Presence service | This package through `setStatus` | The service and subscribers | Sent per call with a TTL |
|
|
195
|
+
| Presence subscriptions | Presence service | This package | The service | Created, renewed, or ended by TTL |
|
|
196
|
+
| `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 |
|
|
197
|
+
| Worker times and counts | `PresenceWorker` | The worker | The worker | In memory |
|
|
198
|
+
|
|
199
|
+
## Shared and base libraries
|
|
200
|
+
|
|
201
|
+
| Library | Inherited responsibility | Consumers | Version floor | Compatibility rule |
|
|
202
|
+
| ------- | ------------------------ | --------- | ------------- | ------------------ |
|
|
203
|
+
| `@webex/webex-core` `WebexPlugin` | `webex`, `config`, `trigger`, `request` | `Presence` | `workspace:*` | Keep the registered name `presence` |
|
|
204
|
+
| `@webex/webex-core` `Batcher` | Fingerprint de-duplication, capped-debounce flush, failure fan-out | `PresenceBatcher` | `workspace:*` | Keep `batcherWait`, `batcherMaxCalls`, `batcherMaxWait` in `config.presence` |
|
|
205
|
+
| `@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 |
|
|
206
|
+
|
|
207
|
+
## Release and versioning
|
|
208
|
+
|
|
209
|
+
| Artifact | Publish target | Versioning rule | Deprecation window | Changelog or migration obligation |
|
|
210
|
+
| -------- | -------------- | --------------- | ------------------ | --------------------------------- |
|
|
211
|
+
| @webex/plugin-presence | npm through `deploy:npm` | None declared in the package | None declared | None declared in the package; the workspace owns changelog generation |
|
|
212
|
+
| Typedoc pages "Presence (@webex/plugin-presence)" | The workspace `docs/presence/` site folder through `build:docs` | Regenerated by the workspace `build:docs` script | None declared | None |
|
|
213
|
+
|
|
214
|
+
## Commands and generated artifacts
|
|
215
|
+
|
|
216
|
+
| Command or artifact | Owner | Inputs | Output or side effect | Compatibility boundary |
|
|
217
|
+
| ------------------- | ----- | ------ | --------------------- | ---------------------- |
|
|
218
|
+
| `yarn workspace @webex/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 |
|
|
219
|
+
| `yarn workspace @webex/plugin-presence build` | Package scripts | `src`, `tsconfig.json` | Runs `tsc` to write `dist/types/`, then `build:src` | The only command that writes the declarations named by `types` |
|
|
220
|
+
| `yarn workspace @webex/plugin-presence test:unit` | Package scripts | `test/unit/spec`, `dist/` | Jest run; 29 cases | Run `build:src` first |
|
|
221
|
+
| `yarn workspace @webex/plugin-presence test:style` | Package scripts | `src` | ESLint run | The shared config ignores `docs/**` and `*.md` |
|
|
222
|
+
| `yarn workspace @webex/plugin-presence build:docs` | Package scripts | `src/interface.ts`, `tsconfig.json` | Typedoc HTML under the workspace `docs/presence/` | Run by the workspace `build:docs` script; output is committed |
|
|
223
|
+
|
|
224
|
+
## Cross-repository topology
|
|
225
|
+
|
|
226
|
+
| Repository or external system | Relationship | Exchanged contract or artifact | Owner | Sequencing constraint |
|
|
227
|
+
| ----------------------------- | ------------- | ------------------------------ | ----- | --------------------- |
|
|
228
|
+
| `@webex/webex-core` (workspace sibling; module, interceptors, and services specs consulted) | Consumes | `registerPlugin`, `WebexPlugin`, `Batcher`, `transform`, `webex.request` | @webex/web-sdk | Registration at import |
|
|
229
|
+
| `@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 |
|
|
230
|
+
| `@webex/internal-plugin-feature` (workspace sibling; module spec consulted) | Consumes | `setFeature`, `getFeature` | @webex/web-sdk | Device registered before a toggle is set |
|
|
231
|
+
| `@webex/internal-plugin-device` (workspace sibling; spec consulted) | Consumes | `userId` | @webex/web-sdk | Device registered before `setStatus` |
|
|
232
|
+
| `@webex/internal-plugin-presence` (workspace sibling; module spec consulted) | Parallel internal package | Same service requests, worker, config, and transform name, registered as internal plugin `presence` | @webex/web-sdk | The `webex` bundle loads it, not this package |
|
|
233
|
+
| Presence service | Consumes | Compositions, subscriptions, events | Not recorded in this repository | Subscribe before expecting Mercury updates |
|
|
234
|
+
|
|
235
|
+
## Security architecture
|
|
236
|
+
|
|
237
|
+
```mermaid
|
|
238
|
+
flowchart LR
|
|
239
|
+
Client[application] -->|ids, status| Plugin[Presence]
|
|
240
|
+
Plugin -->|user token via webex-core| Svc[presence service]
|
|
241
|
+
Svc -->|other users' presence| Plugin
|
|
242
|
+
Svc -->|subscription updates| Mercury[Mercury socket]
|
|
243
|
+
Mercury --> Plugin
|
|
244
|
+
Plugin -->|updated envelopes| Client
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
- This package holds no credential. Every request goes through `webex.request`, so the webex-core auth
|
|
248
|
+
interceptor adds the user's authorization.
|
|
249
|
+
- `setStatus` sends the device `userId` as `subject` and, except for `dnd`, as `label`.
|
|
250
|
+
- Responses and Mercury events carry other users' presence; the worker passes them to the client
|
|
251
|
+
unchanged and keeps only times and counts. The package logs none of it.
|
|
252
|
+
|
|
253
|
+
## Domain language
|
|
254
|
+
|
|
255
|
+
| Term | Repository-specific meaning | Authoritative source |
|
|
256
|
+
| ---- | --------------------------- | -------------------- |
|
|
257
|
+
| apheleia | The catalog name of the presence service | `src/presence.ts` |
|
|
258
|
+
| Composition | The presence service's composed presence of one user, read through `compositions` | `src/presence.ts` |
|
|
259
|
+
| Watcher | A count of the client's `enqueue` calls for a user, less its `dequeue` calls | `src/presence-worker.ts` |
|
|
260
|
+
| Camper | A watched user waiting a minute before the worker subscribes | `src/presence-worker.ts` |
|
|
261
|
+
| Groundskeeper | The worker's 20-second upkeep: subscribe, renew, expire, clean | `src/presence-worker.ts` |
|
|
262
|
+
| Envelope | The `{type, payload}` object of an `updated` event | `src/constants.ts` |
|
|
263
|
+
|
|
264
|
+
## References and maintenance
|
|
265
|
+
|
|
266
|
+
- Decisions: [adr/](adr/index.md)
|
|
267
|
+
- Instantiated specifications and routing: [specs/README.md](specs/README.md)
|
|
268
|
+
- Repository rules and patterns: [package agent instructions](../AGENTS.md)
|
|
269
|
+
- Update this document in the same change that alters package boundaries, resource ownership,
|
|
270
|
+
cross-resource interaction, or cross-cutting architecture.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Getting Started
|
|
3
|
+
title: Getting started
|
|
4
|
+
description: Local setup, build, run, and test routing for @webex/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:37:51Z
|
|
13
|
+
validation_status: pass-with-warnings
|
|
14
|
+
-->
|
|
15
|
+
|
|
16
|
+
# Getting started
|
|
17
|
+
|
|
18
|
+
Onboarding for **@webex/plugin-presence**, a package inside the `webex-js-sdk` Yarn workspace. Run
|
|
19
|
+
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 `>=18`. The workspace root `package.json` `engines.node` reads `18.x`, which conflicts with the other pins; the build and unit tests 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
|
+
Fresh-checkout workspace setup (building `webex-legacy-tools` and sibling `dist/`) is owned by the workspace root; see [Prebuilding](../../../../CONTRIBUTING.md#prebuilding).
|
|
38
|
+
|
|
39
|
+
## Build
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
yarn workspace @webex/plugin-presence build:src
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`build:src` writes JavaScript and source maps for the seven source files to `dist/` through
|
|
46
|
+
`webex-legacy-tools`. `dist/` is ignored by Git. It writes no type declarations.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
yarn workspace @webex/plugin-presence build
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`build` first runs `tsc` with declarations into `dist/types/`, the folder that `package.json` `types`
|
|
53
|
+
points to, and then `build:src`.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
yarn workspace @webex/plugin-presence build:docs
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`build:docs` renders `src/interface.ts` with typedoc into the workspace `docs/presence/` folder, which
|
|
60
|
+
is committed; the workspace `build:docs` script runs it.
|
|
61
|
+
|
|
62
|
+
## Run
|
|
63
|
+
|
|
64
|
+
N/A — this is a library with no start script. Importing `@webex/plugin-presence` registers
|
|
65
|
+
`webex.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/plugin-presence test:unit
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
yarn workspace @webex/plugin-presence test:style
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| Tier | Command | Test location | Framework | External dependencies |
|
|
79
|
+
| ---- | ------- | ------------- | --------- | --------------------- |
|
|
80
|
+
| Unit | `yarn workspace @webex/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/plugin-presence` by name, which
|
|
83
|
+
resolves to `dist/index.js`, so a stale build tests old code. The run reports 2 suites and 29 passing
|
|
84
|
+
cases and exits zero; it also prints one unhandled `TypeError` from a background fetch, explained in
|
|
85
|
+
the [module specification](../src/docs/README.md#verification).
|
|
86
|
+
|
|
87
|
+
`test:style` lints `src/` with eslint through `@webex/eslint-config-legacy`. In the onboarding
|
|
88
|
+
checkout it exited 1 without linting, because the package-local
|
|
89
|
+
`node_modules/@humanwhocodes/object-schema` has no `dist/`; reinstalling the workspace with `yarn` is
|
|
90
|
+
the usual repair, which onboarding did not run.
|
|
91
|
+
|
|
92
|
+
- Coverage or quality gate: none; the package defines no coverage script, and the legacy Jest
|
|
93
|
+
configuration it re-exports sets no threshold
|
|
94
|
+
- Enforcement source: N/A
|
|
95
|
+
- Test environment or QA dependencies: none for unit tests and lint
|
|
96
|
+
|
|
97
|
+
`test/integration/spec/presence.ts` needs live test users and the presence service, is
|
|
98
|
+
`describe.skip`, and no script runs it: `package.json` names the karma script `test:browser:broken`
|
|
99
|
+
and defines no `test:browser` or `test:integration`. `yarn workspace @webex/plugin-presence test`
|
|
100
|
+
chains style, unit, integration, and browser runs, and stops at the missing `test:integration`.
|
|
101
|
+
|
|
102
|
+
## Configuration and secrets
|
|
103
|
+
|
|
104
|
+
- Required configuration: none. Defaults live under `webex.config.presence` (`batcherWait`,
|
|
105
|
+
`batcherMaxCalls`, `batcherMaxWait`); an application that wants the worker started at `ready` sets
|
|
106
|
+
`config.presence.initializeWorker`, which has no default (`src/config.ts`)
|
|
107
|
+
- Environment overrides: none read by this package
|
|
108
|
+
- Secret source: N/A; the package holds no secret and requests go through `webex.request`
|
|
109
|
+
- Package or artifact access: N/A
|
|
110
|
+
- Required neighboring packages: `@webex/webex-core` and `@webex/internal-plugin-device` resolve
|
|
111
|
+
through the workspace; the host must also register `@webex/internal-plugin-feature` and
|
|
112
|
+
`@webex/internal-plugin-mercury`
|
|
113
|
+
- Platform, simulator, device, or SDK setup: none
|
|
114
|
+
- Never commit credentials or copy production secrets into a local config.
|
|
115
|
+
|
|
116
|
+
## First-run verification
|
|
117
|
+
|
|
118
|
+
1. Run `yarn workspace @webex/plugin-presence build:src` and check that it reports
|
|
119
|
+
`Built plugin-presence: 7 files`.
|
|
120
|
+
2. Run `yarn workspace @webex/plugin-presence test:unit`.
|
|
121
|
+
3. Run `yarn workspace @webex/plugin-presence test:style`.
|
|
122
|
+
|
|
123
|
+
Expected result: the build and the unit run exit zero, with 29 of 29 cases passing. A working
|
|
124
|
+
`test:style` should print warnings but no errors: the workspace-root ESLint, run with this package's
|
|
125
|
+
config over the expanded `src/` file list, reported four `require-jsdoc` warnings, three in
|
|
126
|
+
`src/index.ts` and one in `src/presence.ts`, and "File ignored" for `src/docs/README.md`.
|
|
127
|
+
|
|
128
|
+
## Next steps
|
|
129
|
+
|
|
130
|
+
- [Package architecture](architecture.md)
|
|
131
|
+
- [Specification registry](specs/README.md)
|
|
132
|
+
- [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:37:51Z
|
|
10
|
+
validation_status: pass-with-warnings
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
# @webex/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.ts`, and `src/config.ts` for the package, its transform, and its defaults;
|
|
37
|
+
`src/presence.ts`, `src/presence-batcher.ts`, and `src/interface.ts` for the API and its types; and
|
|
38
|
+
`src/presence-worker.ts` and `src/constants.ts` 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,69 @@
|
|
|
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:45:00Z
|
|
13
|
+
validation_status: pass-with-warnings
|
|
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.presence`: presence reads, subscriptions, and status on the presence service, the presence feature toggle, batched lookups, the optional worker that keeps shown users' presence current through `updated` events, and the published TypeScript types | Partial | `src/docs/README.md` |
|
|
46
|
+
|
|
47
|
+
Generator-side field measurement for the module is complete (100%, assessed 2026-11-12). All 29 unit
|
|
48
|
+
cases run and pass. Independent validation passed with warnings on 2026-11-12 (0 Blocking,
|
|
49
|
+
1 Important); the Important command-source traceability finding (VAL-B11-CMD-001) is accepted as a
|
|
50
|
+
warning. A characterization baseline and promotion review remain pending, so coverage stays Partial.
|
|
51
|
+
|
|
52
|
+
## Change and verification routing
|
|
53
|
+
|
|
54
|
+
| Change affects | Load and update | Verification route |
|
|
55
|
+
| -------------- | --------------- | ------------------ |
|
|
56
|
+
| Package boundaries or cross-cutting architecture | `docs/architecture.md` and applicable ADRs | `yarn workspace @webex/plugin-presence build:src`, then `test:unit` and `test:style`, and the module spec |
|
|
57
|
+
| A stable code, package, or component boundary | `src/docs/README.md` | Build, unit tests, and lint |
|
|
58
|
+
| A public method, type, 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.ts`, `src/interface.ts`, `src/presence-batcher.ts`, `src/presence-worker.ts`, `src/constants.ts`, `src/config.ts`, `src/index.ts`, or `package.json` | Build, unit tests, and lint; run `build` as well when a type changes, so the declarations compile |
|
|
59
|
+
|
|
60
|
+
## Module and contract registration
|
|
61
|
+
|
|
62
|
+
The module specification is generated at the exact `modules[].canonical_spec` path recorded in
|
|
63
|
+
`.sdd/manifest.json`. Register every module and submodule in the Module registry above in manifest tree
|
|
64
|
+
order.
|
|
65
|
+
|
|
66
|
+
Contracts are registered in `.sdd/manifest.json` `contract_catalog` and indexed in
|
|
67
|
+
[`docs/architecture.md`](../architecture.md#public-and-consumer-surfaces) with a stable ID, publication
|
|
68
|
+
state, native source, and owning module. This page provides navigation and ownership rather than a copied
|
|
69
|
+
contract.
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/@webex/plugin-presence"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">=18"
|
|
15
15
|
},
|
|
16
16
|
"browserify": {
|
|
17
17
|
"transform": [
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
26
26
|
"@webex/jest-config-legacy": "0.0.0",
|
|
27
27
|
"@webex/legacy-tools": "0.0.0",
|
|
28
|
-
"@webex/test-helper-chai": "3.
|
|
29
|
-
"@webex/test-helper-mocha": "3.
|
|
30
|
-
"@webex/test-helper-mock-webex": "3.
|
|
31
|
-
"@webex/test-helper-test-users": "3.
|
|
28
|
+
"@webex/test-helper-chai": "3.13.0-next.3",
|
|
29
|
+
"@webex/test-helper-mocha": "3.13.0-next.3",
|
|
30
|
+
"@webex/test-helper-mock-webex": "3.13.0-next.3",
|
|
31
|
+
"@webex/test-helper-test-users": "3.13.0-next.3",
|
|
32
32
|
"eslint": "8.24.0",
|
|
33
33
|
"prettier": "2.7.1",
|
|
34
34
|
"sinon": "9.2.4",
|
|
35
35
|
"typedoc": "0.23.26"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@webex/internal-plugin-device": "3.
|
|
39
|
-
"@webex/internal-plugin-mercury": "3.
|
|
40
|
-
"@webex/test-helper-chai": "3.
|
|
41
|
-
"@webex/test-helper-mocha": "3.
|
|
42
|
-
"@webex/test-helper-mock-webex": "3.
|
|
43
|
-
"@webex/test-helper-test-users": "3.
|
|
44
|
-
"@webex/webex-core": "3.
|
|
38
|
+
"@webex/internal-plugin-device": "3.13.0-next.7",
|
|
39
|
+
"@webex/internal-plugin-mercury": "3.13.0-next.7",
|
|
40
|
+
"@webex/test-helper-chai": "3.13.0-next.3",
|
|
41
|
+
"@webex/test-helper-mocha": "3.13.0-next.3",
|
|
42
|
+
"@webex/test-helper-mock-webex": "3.13.0-next.3",
|
|
43
|
+
"@webex/test-helper-test-users": "3.13.0-next.3",
|
|
44
|
+
"@webex/webex-core": "3.13.0-next.7",
|
|
45
45
|
"lodash": "4.17.21"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"test:style": "eslint ./src/**/*.*",
|
|
55
55
|
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
56
56
|
},
|
|
57
|
-
"version": "0.0.0-next.
|
|
57
|
+
"version": "0.0.0-next.260"
|
|
58
58
|
}
|