@webex/internal-plugin-avatar 3.12.0 → 3.13.0-next.10

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,99 @@
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-12T15:30:00Z
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-12T15:45:09Z
15
+ validation_status: pass
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 Avatar service"), an internal-plugin notice, an install command, and a Usage block. No
32
+ 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.avatar.WHATEVER` | The plugin exposes `retrieveAvatarUrl` and `setAvatar`, an `enableThumbnails` property, a `store`, and a `batcher` child (`src/avatar.js`) |
39
+ | No method, option, or result is described | `retrieveAvatarUrl` takes a user and `size`, `cacheControl`, and `hideDefaultAvatar` options and resolves a URL or `null`; `setAvatar` takes a file and resolves the new URL (`src/avatar.js`) |
40
+ | Nothing about caching or batching | Lookups are batched into one request per flush and cached per uuid and size for one hour by default (`src/avatar-url-batcher.js`, `src/avatar-url-store.js`, `src/config.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 `retrieveAvatarUrl` and
85
+ `setAvatar` examples in a separate product-doc change.
86
+
87
+ ## Revisit when
88
+
89
+ - A maintainer rewrites the README to document the avatar methods.
90
+
91
+ ## References
92
+
93
+ - `README.md`
94
+ - `src/index.js`
95
+ - `src/config.js`
96
+ - `src/avatar.js`
97
+ - `src/avatar-url-batcher.js`
98
+ - `src/avatar-url-store.js`
99
+ - `.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-12T15:45:09Z
7
+ validation_status: pass
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,277 @@
1
+ ---
2
+ type: Architecture
3
+ title: '@webex/internal-plugin-avatar 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-12T15:45:09Z
13
+ validation_status: pass
14
+ -->
15
+
16
+ # @webex/internal-plugin-avatar architecture
17
+
18
+ Canonical architecture for this package. Flow behavior lives in the
19
+ [Avatar 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; `src/avatar-url-store.js` is an in-memory map | Repository data and schema |
30
+ | `repo.holds_client_state` | Applicable | `src/avatar-url-store.js` keeps avatar URLs per webex instance; `src/avatar.js` declares the store and enableThumbnails session properties | Client state model |
31
+ | `repo.components_interact` | Applicable | `src/avatar.js` mounts the batcher child and owns the store; it calls the user, device, and helper-image packages | Dependency and interaction topology |
32
+ | `repo.domain_data_across_components` | Applicable | Avatar items pass from the avatar service through `src/avatar-url-batcher.js` into `src/avatar-url-store.js` and back to callers | Object and data ownership |
33
+ | `repo.caches_data` | Applicable | `src/avatar-url-store.js` caches URLs with a TTL from `src/config.js` | Caching catalog |
34
+ | `repo.observability_convention` | N/A | One warning in `src/avatar-url-batcher.js` and the logger handed to helper-image in `src/avatar.js`; no metric, trace, or logging convention | 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 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` | Applicable | setAvatar in `src/avatar.js` runs a Node or a browser image pipeline, chosen by the helper-image package's browser field; `process` declares {browser: true} | Platform matrix |
39
+ | `repo.published_package` | Applicable | `package.json` name is @webex/internal-plugin-avatar and deploy:npm publishes it | Release and versioning |
40
+ | `repo.embedded_in_host` | N/A | No host theme or embed API in `src/avatar.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 avatar service and its upload sessions (`src/avatar-url-batcher.js`, `src/avatar.js`) | Cross-repository topology |
43
+ | `repo.security_arch_warranted` | Applicable | User identifiers and the current user id reach request bodies and paths, and the image bytes go to a session URL without the SDK token (`src/avatar.js`) | Security architecture |
44
+
45
+ ## Design overview
46
+
47
+ `@webex/internal-plugin-avatar` is a published JavaScript library with one module. Importing it
48
+ registers the user and device plugins and then `Avatar` as the internal plugin `avatar`, reached as
49
+ `webex.internal.avatar`. Inside this repository `@webex/webex-server` and
50
+ `@webex/recipe-private-web-client` import it to register it; no workspace package calls it, so its
51
+ callers are first-party clients.
52
+
53
+ An avatar is the picture the avatar service holds for a user, served at a URL per size. The plugin
54
+ answers "URL for this user at this size" from an in-memory store when it can, and otherwise through a
55
+ batcher that sends one lookup for every caller in a short window. A miss also prefetches every
56
+ standard size of that user. The store expires entries after a client-side TTL, one hour by default.
57
+ The plugin also uploads a new avatar for the current user and clears that user's cached sizes.
58
+
59
+ The package serves no routes and persists nothing.
60
+
61
+ ## Resource inventory and responsibilities
62
+
63
+ | Resource | Kind | Responsibility | Owner | Source | Detailed specification |
64
+ | -------- | ---- | -------------- | ----- | ------ | ---------------------- |
65
+ | Avatar plugin | package (one module) | Registration; URL lookup, batching, and caching; avatar upload | @webex/web-sdk | src | [`src/docs/README.md`](../src/docs/README.md) |
66
+
67
+ ## Interaction and execution flows
68
+
69
+ Representative end-to-end flow: a client renders a list of users, then the current user changes their
70
+ avatar.
71
+
72
+ ```mermaid
73
+ flowchart LR
74
+ Client[client] -->|retrieveAvatarUrl per user| Plugin[webex.internal.avatar]
75
+ Plugin -->|asUUID| User[webex.internal.user]
76
+ Plugin -->|get, add| Store[store]
77
+ Plugin -->|request uuid and size| Batcher[batcher]
78
+ Batcher -->|POST profiles/urls, one per flush| Svc[avatar service]
79
+ Client -->|setAvatar file| Plugin
80
+ Plugin -->|detectFileType, processImage| Image[helper-image]
81
+ Plugin -->|upload phases| Svc
82
+ Plugin -->|remove current user| Store
83
+ ```
84
+
85
+ | From | To | Interaction or transport | Purpose | Failure or compatibility behavior |
86
+ | ---- | -- | ------------------------ | ------- | --------------------------------- |
87
+ | Client | `webex.internal.avatar` | In-process calls | URL lookup and avatar upload | Rejections propagate |
88
+ | `Avatar` | User plugin | In-process call | uuid for an email or user object | Its rejection rejects the lookup |
89
+ | `Avatar` | Device plugin | Property read | Current user id for the upload path | Read at call time |
90
+ | `Avatar` | helper-image | In-process calls | File type and resized image | A non-image resolves undefined |
91
+ | `AvatarUrlBatcher`, `Avatar` | Avatar service | HTTPS through `webex.request` and `webex.upload` | Batched URL lookup; upload sessions | No retry here except the webex-core upload phase |
92
+
93
+ ## Dependency topology
94
+
95
+ | Dependency | Type | Used by | Purpose | Version, failure, or fallback policy |
96
+ | ---------- | ---- | ------- | ------- | ------------------------------------ |
97
+ | `@webex/webex-core` | Internal | `src/index.js`, `src/avatar.js`, `src/avatar-url-batcher.js` | Registration, plugin base, `Batcher`, `webex.request`, `webex.upload` | `workspace:*` in `package.json` |
98
+ | `@webex/internal-plugin-user` | Internal | `src/index.js`, `src/avatar.js` | `asUUID` | `workspace:*` |
99
+ | `@webex/internal-plugin-device` | Internal | `src/index.js`, `src/avatar.js` | `userId` | `workspace:*` |
100
+ | `@webex/helper-image` | Internal | `src/avatar.js` | `detectFileType`, `processImage` | `workspace:*` |
101
+ | `@webex/common` | Internal | `src/avatar.js`, `src/avatar-url-store.js` | `oneFlight`, `patterns.uuid` | `workspace:*` |
102
+ | `@webex/common-timers` | Internal | `src/avatar-url-store.js` | `safeSetTimeout` | `workspace:*` |
103
+ | `lodash` | External | `src/avatar.js`, `src/avatar-url-batcher.js` | `defaults`, `uniq` | `^4.17.21` |
104
+ | Avatar service | External service | `src/avatar-url-batcher.js`, `src/avatar.js` | URL lookup and upload sessions | Resolved through the service catalog as `avatar` |
105
+
106
+ Every dependency `package.json` declares is imported by `src/`. No import cycle exists: none of the
107
+ packages this one imports imports it back.
108
+
109
+ ## Public and consumer surfaces
110
+
111
+ | Surface | Type | Owner | Consumers | Compatibility policy | Source |
112
+ | ------- | ---- | ----- | --------- | -------------------- | ------ |
113
+ | `avatar-internal-sdk` — package @webex/internal-plugin-avatar, `webex.internal.avatar` with `retrieveAvatarUrl`, `setAvatar`, `enableThumbnails`, and the config | SDK, published to npm, internal | Avatar plugin | `@webex/webex-server` and `@webex/recipe-private-web-client`, which register it; first-party clients | The README states that internal plugins do not strictly follow semantic versioning; no deprecation rule is declared | `package.json`, `src/index.js`, `src/avatar.js`, `src/config.js` |
114
+
115
+ The batch lookup and upload-session requests are protocols this package speaks with the avatar
116
+ service, described under *Protocol and wire format* in the
117
+ [module specification](../src/docs/README.md#protocol-and-wire-format). The other contracts this
118
+ package requires are registered in `.sdd/manifest.json` `contract_catalog`.
119
+
120
+ ## Client state model
121
+
122
+ | State or slice | Owner | Transition triggers | Persistence or reset boundary |
123
+ | -------------- | ----- | ------------------- | ----------------------------- |
124
+ | Avatar URL store | Avatar plugin (`store` session property) | Lookup results add entries; TTL timers and `setAvatar` remove them | In memory per webex instance; never persisted; see the Caching catalog |
125
+ | `enableThumbnails` | Avatar plugin | Set by the host | In memory; default `true` |
126
+
127
+ Entry-level transitions, pending lookups, and in-flight de-duplication are specified in the module
128
+ specification's [Client state model](../src/docs/README.md#client-state-model).
129
+
130
+ ## Cross-cutting architecture
131
+
132
+ ### Security
133
+
134
+ - Trust boundaries and identity flow: see [Security architecture](#security-architecture).
135
+ - Sensitive surfaces and data classes: user uuids and emails, avatar URLs, and the uploaded image.
136
+ - Encryption and secret boundaries: see [Security architecture](#security-architecture).
137
+
138
+ ### Observability and operations
139
+
140
+ - Logging and correlation: one warning when the service substitutes a size; it prints the two sizes
141
+ only. Request tracking comes from the webex-core interceptors.
142
+ - Metrics, traces, and audit signals: none.
143
+ - Ownership and operational entry points: `.github/CODEOWNERS` at the workspace root has no line for
144
+ this package, so its default rule assigns it to `@webex/web-sdk`. No dashboards or runbooks are
145
+ recorded in this package.
146
+
147
+ ### Quality attributes
148
+
149
+ - Compatibility: clients rely on the registered name `avatar`, the two public methods and their
150
+ options, `null` for a hidden default avatar, the default size 80, and the one-hour TTL.
151
+ - Efficiency: lookups from all callers in a flush window become one request, and a miss caches every
152
+ standard size of the user (`INV-002` in the module specification).
153
+ - Test confidence: 23 unit cases cover retrieval, batching, the fingerprints, and the store guards;
154
+ registration, the HTTP error path, missing sizes, the TTL timer, and `setAvatar` have no unit case.
155
+ No coverage threshold is enforced.
156
+
157
+ ## Dependency and interaction topology
158
+
159
+ ```mermaid
160
+ flowchart LR
161
+ Index[src/index.js] -->|registerInternalPlugin avatar| Core[webex-core]
162
+ Index -->|import| UserP[internal-plugin-user]
163
+ Index -->|import| DevP[internal-plugin-device]
164
+ Index --> Config[src/config.js]
165
+ Index --> Avatar[src/avatar.js]
166
+ Avatar -->|children.batcher| Batcher[src/avatar-url-batcher.js]
167
+ Avatar -->|session.store| Store[src/avatar-url-store.js]
168
+ Avatar -->|oneFlight| Common[common]
169
+ Avatar -->|detectFileType, processImage| Img[helper-image]
170
+ Avatar -->|asUUID| UserP
171
+ Avatar -->|userId| DevP
172
+ Batcher -->|extends Batcher, request| Core
173
+ Store -->|safeSetTimeout| Timers[common-timers]
174
+ Store -->|patterns.uuid| Common
175
+ ```
176
+
177
+ | From | To | Kind | Purpose | Ordering or failure boundary |
178
+ | ---- | -- | ---- | ------- | ---------------------------- |
179
+ | `src/index.js` | webex-core | Call at import | Register `avatar` | First registration wins |
180
+ | `src/avatar.js` | `src/avatar-url-batcher.js` | `children` map | Mount `batcher` | Created with each `Avatar` instance |
181
+ | `src/avatar.js` | `src/avatar-url-store.js` | Session property default | One store per instance | Created with each `Avatar` instance |
182
+ | `src/avatar.js` | User plugin | Call | uuid resolution | Before any store or batcher call |
183
+ | `src/avatar-url-store.js` | common-timers | Call | Expiry timer per entry | Unref-ed on Node |
184
+
185
+ ## Object and data ownership
186
+
187
+ | Object or state | System of record | May write | May read | Movement or lifecycle |
188
+ | --------------- | ---------------- | --------- | -------- | --------------------- |
189
+ | Avatar image and its per-size URLs | Avatar service | The current user, through `setAvatar` | Any client, through `retrieveAvatarUrl` | Fetched per miss; cached here for the TTL |
190
+ | Avatar item `{uuid, size, url, hasDefaultAvatar, cacheControl}` | This package (derived from the service response) | `AvatarUrlBatcher`, then `AvatarUrlStore.add` | `retrieveAvatarUrl` | Lives in the store until its TTL ends or `setAvatar` removes it |
191
+ | User uuid | User service, through the user plugin | The user plugin | This package | Resolved per call |
192
+ | Current user id | Device plugin | The device plugin | `setAvatar` | Read per call |
193
+
194
+ ## Caching catalog
195
+
196
+ | Cache | Owner | Backend | Contents | TTL or bound | Invalidation trigger | Failure behavior |
197
+ | ----- | ----- | ------- | -------- | ------------ | -------------------- | ---------------- |
198
+ | Avatar URL store | `AvatarUrlStore` (`src/avatar-url-store.js`) | In-memory `Map` per webex instance | Avatar items keyed by uuid and size | `options.cacheControl` seconds, default `config.cacheControl` (3600); no size bound | The entry's timer; `setAvatar` removes the current user's eight standard sizes | A miss falls through to a batched lookup; a stale entry is served until its timer fires (`INV-001` in the module specification) |
199
+
200
+ ## Shared and base libraries
201
+
202
+ | Library | Inherited responsibility | Consumers | Version floor | Compatibility rule |
203
+ | ------- | ------------------------ | --------- | ------------- | ------------------ |
204
+ | `@webex/webex-core` `WebexPlugin` | `webex`, `children`, `session`, `config`, `logger`, `request`, `upload` | `Avatar` | `workspace:*` | Keep the registered name `avatar` and the namespace `Avatar` |
205
+ | `@webex/webex-core` `Batcher` | Fingerprint de-duplication, capped debounce, deferred bookkeeping | `AvatarUrlBatcher` | `workspace:*` | The `avatar` config must keep the three batcher timing keys |
206
+ | `@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 |
207
+
208
+ ## Platform matrix
209
+
210
+ | Platform | Shared versus platform-specific boundary | Entry or build | Support and compatibility constraints |
211
+ | -------- | ---------------------------------------- | -------------- | ------------------------------------- |
212
+ | Browser | `retrieveAvatarUrl` is shared. `setAvatar` gets the canvas `processImage` from `@webex/helper-image`, which squares the avatar dimensions (`isAvatar`) | `package.json` browserify transforms; the helper-image browser field | Needs `Image`, `Blob`, and canvas |
213
+ | Node | `retrieveAvatarUrl` is shared. `setAvatar` gets the GraphicsMagick `processImage`, which ignores `isAvatar`; store timers are unref-ed | `package.json` `main` (`dist/index.js`) | Needs GraphicsMagick for `setAvatar`; without it `setAvatar` rejects |
214
+
215
+ ## Release and versioning
216
+
217
+ | Artifact | Publish target | Versioning rule | Deprecation window | Changelog or migration obligation |
218
+ | -------- | -------------- | --------------- | ------------------ | --------------------------------- |
219
+ | @webex/internal-plugin-avatar | 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 |
220
+
221
+ ## Commands and generated artifacts
222
+
223
+ | Command or artifact | Owner | Inputs | Output or side effect | Compatibility boundary |
224
+ | ------------------- | ----- | ------ | --------------------- | ---------------------- |
225
+ | `yarn workspace @webex/internal-plugin-avatar build:src` | Package scripts | `src` | Writes `dist/` (JavaScript and source maps) through `webex-legacy-tools` | `dist/` is generated and never edited by hand |
226
+ | `yarn workspace @webex/internal-plugin-avatar build` | Package scripts | `src` | Runs `build:src` | Same output |
227
+ | `yarn workspace @webex/internal-plugin-avatar test:unit` | Package scripts | `test/unit/spec`, `dist/` | Jest run | Run `build:src` first |
228
+ | `yarn workspace @webex/internal-plugin-avatar test:style` | Package scripts | `src` | ESLint run | The shared config ignores `docs/**` and `*.md` |
229
+
230
+ ## Cross-repository topology
231
+
232
+ | Repository or external system | Relationship | Exchanged contract or artifact | Owner | Sequencing constraint |
233
+ | ----------------------------- | ------------- | ------------------------------ | ----- | --------------------- |
234
+ | `@webex/webex-core` (workspace sibling; module spec consulted) | Consumes | `registerInternalPlugin`, `WebexPlugin`, `Batcher`, `upload` | @webex/web-sdk | Registered before the first instance |
235
+ | `@webex/internal-plugin-user` (workspace sibling; module spec consulted) | Consumes | `asUUID` | @webex/web-sdk | Imported before registration |
236
+ | `@webex/internal-plugin-device` (workspace sibling; module spec consulted) | Consumes | `userId` | @webex/web-sdk | Device registered before `setAvatar` |
237
+ | `@webex/helper-image` (workspace sibling; module spec consulted) | Consumes | `detectFileType`, `processImage` | @webex/web-sdk | None |
238
+ | `@webex/common`, `@webex/common-timers` (workspace siblings; module specs consulted) | Consumes | `oneFlight`, `patterns`, `safeSetTimeout` | @webex/web-sdk | None |
239
+ | `@webex/webex-server`, `@webex/recipe-private-web-client` (workspace siblings) | Consumed by | The plugin registration | @webex/web-sdk | None |
240
+ | Avatar service | Consumes | Batch URL lookup; upload sessions | Not recorded in this repository | Initialize, upload, then finalize |
241
+
242
+ ## Security architecture
243
+
244
+ ```mermaid
245
+ flowchart LR
246
+ Client[Client] -->|uuid or email| UserP[user plugin]
247
+ Client -->|uuids and sizes in body| Svc[avatar service]
248
+ Client -->|userId in path| Svc
249
+ Client -->|image bytes, no SDK token| Up[session upload URL]
250
+ ```
251
+
252
+ - This package holds no credential and no key. Lookups and the session requests carry the SDK
253
+ authorization added by webex-core; the upload phase sends the image to the session URL without it
254
+ (webex-core MOD-039).
255
+ - `setAvatar` writes to the current user's profile only: the path is built from
256
+ `webex.internal.device.userId`, never from a caller argument.
257
+ - User uuids reach the lookup body, and emails reach the user plugin; the package logs neither.
258
+ - Avatar URLs are cached in memory only and dropped with the webex instance.
259
+
260
+ ## Domain language
261
+
262
+ | Term | Repository-specific meaning | Authoritative source |
263
+ | ---- | --------------------------- | -------------------- |
264
+ | Avatar item | The cached record `{uuid, size, url, hasDefaultAvatar, cacheControl}` for one user and size | `src/avatar-url-batcher.js` |
265
+ | Standard sizes | `config.sizes`: 40, 50, 80, 110, 135, 192, 640, and 1600 pixels, all prefetched on a miss | `src/config.js` |
266
+ | Default avatar | A service placeholder for a user with no picture, flagged `defaultAvatar` in the response and hidden by `hideDefaultAvatar` | `src/avatar.js` |
267
+ | Size substitution | The service answering a different size than requested; logged and accepted | `src/avatar-url-batcher.js` |
268
+ | Flush | One batcher send of every lookup queued since the last one | `src/avatar-url-batcher.js` |
269
+ | `cacheControl` | Client TTL in seconds for a store entry; not the service field of the same name | `src/config.js` |
270
+
271
+ ## References and maintenance
272
+
273
+ - Decisions: [adr/](adr/index.md)
274
+ - Instantiated specifications and routing: [specs/README.md](specs/README.md)
275
+ - Repository rules and patterns: [package agent instructions](../AGENTS.md)
276
+ - Update this document in the same change that alters package boundaries, resource ownership,
277
+ cross-resource interaction, or cross-cutting architecture.
@@ -0,0 +1,125 @@
1
+ ---
2
+ type: Getting Started
3
+ title: Getting started
4
+ description: Local setup, build, run, and test routing for @webex/internal-plugin-avatar.
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-12T15:52:01Z
13
+ validation_status: pass
14
+ -->
15
+
16
+ # Getting started
17
+
18
+ Onboarding for **@webex/internal-plugin-avatar**, a package inside the `webex-js-sdk` Yarn workspace.
19
+ Run every command from the workspace root; package scripts run as `yarn workspace @webex/internal-plugin-avatar <script>`.
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
+ 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/internal-plugin-avatar build:src
43
+ ```
44
+
45
+ `build:src` writes JavaScript and source maps for the five source files to `dist/` through
46
+ `webex-legacy-tools`. `dist/` is ignored by Git. The `build` script runs `build:src`; the package
47
+ emits no type declarations.
48
+
49
+ ```bash
50
+ yarn workspace @webex/internal-plugin-avatar build
51
+ ```
52
+
53
+ ## Run
54
+
55
+ N/A — this is a library with no start script. Importing `@webex/internal-plugin-avatar` registers
56
+ `webex.internal.avatar` together with the user and device plugins.
57
+
58
+ ## Tests
59
+
60
+ ```bash
61
+ yarn workspace @webex/internal-plugin-avatar test:unit
62
+ ```
63
+
64
+ ```bash
65
+ yarn workspace @webex/internal-plugin-avatar test:style
66
+ ```
67
+
68
+ | Tier | Command | Test location | Framework | External dependencies |
69
+ | ---- | ------- | ------------- | --------- | --------------------- |
70
+ | Unit | `yarn workspace @webex/internal-plugin-avatar test:unit` | `test/unit/spec` | jest through `webex-legacy-tools` and `@webex/jest-config-legacy` | None; `@webex/test-helper-mock-webex` and sinon stubs |
71
+
72
+ Run `build:src` before `test:unit`. The unit specs import `@webex/internal-plugin-avatar` by name,
73
+ which resolves to `dist/index.js`, so a stale build tests old code.
74
+
75
+ `test:style` lints `src/` with eslint through `@webex/eslint-config-legacy`.
76
+
77
+ - Coverage or quality gate: none; the package defines no coverage script, and the legacy Jest
78
+ configuration it re-exports sets no threshold
79
+ - Enforcement source: N/A
80
+ - Test environment or QA dependencies: none for unit tests and lint
81
+
82
+ `yarn workspace @webex/internal-plugin-avatar test:browser` (manifest command `browser-test`) runs `webex-legacy-tools test --integration
83
+ --runner karma` over `test/integration/spec/avatar.js`, which creates two test users and registers
84
+ their devices but has every case commented out. On 2026-11-12 under Node 22.14 the karma bundle also
85
+ failed to parse `isbot` (an ES module in the workspace `node_modules`), so the run reported "0 tests
86
+ completed" and still exited zero. It is not listed in the table above because it verifies nothing
87
+ today, and its exit code is not a test result.
88
+
89
+ Do not run the aggregate `test` script in `package.json`. It runs `test:style` and `test:unit`, then
90
+ exits 1 with `Couldn't find a script named "test:integration"` (checked 2026-11-12), so it never
91
+ reaches `test:browser`. It is deliberately not a manifest command; run the three commands above
92
+ instead.
93
+
94
+ ## Configuration and secrets
95
+
96
+ - Required configuration: none. `config.avatar` ships defaults for the batcher timings, the one-hour
97
+ store TTL (`cacheControl`, seconds), the default size 80, the eight standard sizes, and the thumbnail
98
+ bounds (`src/config.js`); a host can override them through the webex config
99
+ - Environment overrides: none read by this package
100
+ - Secret source: N/A; the package holds no secret
101
+ - Package or artifact access: N/A
102
+ - Required neighboring packages: `@webex/webex-core`, `@webex/common`, `@webex/common-timers`,
103
+ `@webex/helper-image`, `@webex/internal-plugin-user`, and `@webex/internal-plugin-device` resolve
104
+ through the workspace
105
+ - Platform, simulator, device, or SDK setup: none for unit tests; `setAvatar` on Node needs
106
+ GraphicsMagick through `@webex/helper-image`
107
+ - Never commit credentials or copy production secrets into a local config.
108
+
109
+ ## First-run verification
110
+
111
+ 1. Run `yarn workspace @webex/internal-plugin-avatar build:src` and check that it reports
112
+ `Built internal-plugin-avatar: 5 files`.
113
+ 2. Run `yarn workspace @webex/internal-plugin-avatar test:unit`.
114
+ 3. Run `yarn workspace @webex/internal-plugin-avatar test:style`.
115
+
116
+ Expected result: all three commands exit zero. The unit run reports 23 passing tests and 1 skipped in 3
117
+ suites. `test:style` prints warnings but no errors: 13 in `src/` (missing JSDoc in
118
+ `src/avatar-url-batcher.js` and `src/avatar.js`, and one unused variable in `src/avatar.js`) and "File
119
+ ignored" for `src/docs/README.md`.
120
+
121
+ ## Next steps
122
+
123
+ - [Package architecture](architecture.md)
124
+ - [Specification registry](specs/README.md)
125
+ - [Documentation index](index.md)
package/docs/index.md ADDED
@@ -0,0 +1,43 @@
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-12T15:45:09Z
10
+ validation_status: pass
11
+ -->
12
+
13
+ # @webex/internal-plugin-avatar documentation
14
+
15
+ Doc map for developers and agents working on the Avatar 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 Avatar 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 and its defaults, and `src/avatar.js`,
37
+ `src/avatar-url-batcher.js`, and `src/avatar-url-store.js` for the API.
38
+
39
+ ## Related repository resources
40
+
41
+ - [`README.md`](../README.md) — retained npm page; context only, its Usage block is a placeholder, see
42
+ [ADR-0001](adr/0001-retain-product-readme.md)
43
+ - [`AGENTS.md`](../AGENTS.md) — agent instructions for this package
@@ -0,0 +1,66 @@
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-12T15:52:01Z
13
+ validation_status: pass
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
+ | Avatar 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.avatar`: user-to-avatar-URL lookup through a batcher and a TTL store that prefetches every standard size; upload of the current user's avatar | Partial | `src/docs/README.md` |
46
+
47
+ Generator-side field measurement for the module is complete (100%, assessed 2026-11-12). Independent semantic validation rerun on 2026-11-12 passed with 0 Blocking and 0 Important findings; the prior A16 command catalog findings were rechecked as fixed in the manifest and docs. A characterization baseline and promotion past Partial remain pending.
48
+
49
+ ## Change and verification routing
50
+
51
+ | Change affects | Load and update | Verification route |
52
+ | -------------- | --------------- | ------------------ |
53
+ | Package boundaries or cross-cutting architecture | `docs/architecture.md` and applicable ADRs | `yarn workspace @webex/internal-plugin-avatar build:src`, then `test:unit` and `test:style`, and the module spec |
54
+ | A stable code, package, or component boundary | `src/docs/README.md` | Build, unit tests, and lint |
55
+ | A public method, request path or body, store key or TTL, size list, or config default | The owning architecture section, `src/docs/README.md`, and the native definition in `src/avatar.js`, `src/avatar-url-batcher.js`, `src/avatar-url-store.js`, `src/index.js`, `src/config.js`, or `package.json` | Build, unit tests, and lint; keep the one-request assertions in `test/unit/spec/avatar.js` passing |
56
+
57
+ ## Module and contract registration
58
+
59
+ The module specification is generated at the exact `modules[].canonical_spec` path recorded in
60
+ `.sdd/manifest.json`. Register every module and submodule in the Module registry above in manifest tree
61
+ order.
62
+
63
+ Contracts are registered in `.sdd/manifest.json` `contract_catalog` and indexed in
64
+ [`docs/architecture.md`](../architecture.md#public-and-consumer-surfaces) with a stable ID, publication
65
+ state, native source, and owning module. This page provides navigation and ownership rather than a copied
66
+ contract.