@webex/internal-plugin-avatar 3.13.0-next.1 → 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,416 @@
1
+ {
2
+ "manifest_version": 1,
3
+ "repository": {
4
+ "name": "@webex/internal-plugin-avatar",
5
+ "purpose": "Internal plugin registered as webex.internal.avatar that resolves Webex users to avatar URLs. retrieveAvatarUrl(user, options) turns a uuid, email, or user object into a uuid through webex.internal.user.asUUID, answers from an in-memory store keyed by uuid and size, and on a miss requests the asked size plus every configured size (40, 50, 80, 110, 135, 192, 640, 1600; default 80) through a batcher that groups lookups into one POST profiles/urls to the avatar service; entries expire after cacheControl seconds (3600 by default), and hideDefaultAvatar makes a default avatar resolve null. setAvatar(file) resizes the image with @webex/helper-image, uploads it as the current user's avatar through the three-phase webex-core upload to profile sessions of the avatar service, clears that user's cached sizes, and resolves the new URL. Nothing is persisted.",
6
+ "category": "cat2-legacy",
7
+ "primary_languages": [
8
+ "javascript"
9
+ ]
10
+ },
11
+ "topology": "Orchestrator-plus-components",
12
+ "commands": {
13
+ "install": {
14
+ "command": "yarn",
15
+ "source_file": "../../../.github/workflows/deploy.yml",
16
+ "role": "install"
17
+ },
18
+ "compile": {
19
+ "command": "yarn workspace @webex/internal-plugin-avatar build",
20
+ "source_file": "package.json",
21
+ "role": "compile"
22
+ },
23
+ "build": {
24
+ "command": "yarn workspace @webex/internal-plugin-avatar build:src",
25
+ "source_file": "package.json",
26
+ "role": "package"
27
+ },
28
+ "unit-test": {
29
+ "command": "yarn workspace @webex/internal-plugin-avatar test:unit",
30
+ "source_file": "package.json",
31
+ "role": "unit-test"
32
+ },
33
+ "lint": {
34
+ "command": "yarn workspace @webex/internal-plugin-avatar test:style",
35
+ "source_file": "package.json",
36
+ "role": "lint"
37
+ },
38
+ "browser-test": {
39
+ "command": "yarn workspace @webex/internal-plugin-avatar test:browser",
40
+ "source_file": "package.json",
41
+ "role": "other"
42
+ },
43
+ "deploy": {
44
+ "command": "yarn workspace @webex/internal-plugin-avatar deploy:npm",
45
+ "source_file": "package.json",
46
+ "role": "deploy"
47
+ }
48
+ },
49
+ "toolchain": [
50
+ {
51
+ "name": "node",
52
+ "version": ">=16",
53
+ "origin": "repo-config",
54
+ "source_file": "package.json"
55
+ },
56
+ {
57
+ "name": "node",
58
+ "version": "22.14",
59
+ "origin": "repo-config",
60
+ "source_file": "../../../AGENTS.md"
61
+ },
62
+ {
63
+ "name": "node",
64
+ "version": "lts/jod",
65
+ "origin": "repo-config",
66
+ "source_file": "../../../.nvmrc"
67
+ },
68
+ {
69
+ "name": "node",
70
+ "version": "18.x",
71
+ "origin": "repo-config",
72
+ "source_file": "../../../package.json"
73
+ },
74
+ {
75
+ "name": "yarn",
76
+ "version": "3.4.1",
77
+ "origin": "repo-config",
78
+ "source_file": "../../../package.json"
79
+ },
80
+ {
81
+ "name": "babel",
82
+ "version": "^7.17.10",
83
+ "origin": "repo-config",
84
+ "source_file": "package.json"
85
+ },
86
+ {
87
+ "name": "eslint",
88
+ "version": "^8.24.0",
89
+ "origin": "repo-config",
90
+ "source_file": "package.json"
91
+ },
92
+ {
93
+ "name": "prettier",
94
+ "version": "^2.7.1",
95
+ "origin": "repo-config",
96
+ "source_file": "package.json"
97
+ }
98
+ ],
99
+ "tests": {
100
+ "unit": {
101
+ "command_ref": "unit-test",
102
+ "dir": "test/unit/spec",
103
+ "framework": "jest"
104
+ }
105
+ },
106
+ "quality_gates": {
107
+ "code_coverage": {
108
+ "origin": "none",
109
+ "declared_by": "rarajes2@cisco.com via the bootstrap questionnaire (generator check: test:unit runs webex-legacy-tools with --runner jest; jest.config.js re-exports @webex/jest-config-legacy, which sets no coverageThreshold; package.json defines no coverage script)"
110
+ }
111
+ },
112
+ "coverage_status_definitions": {
113
+ "specced": ">=80% public surface specced, drift <5% - spec is authoritative",
114
+ "partial": "40-80% specced - spec is a hint, cross-check code",
115
+ "untracked": "<40% specced - code is the source of truth"
116
+ },
117
+ "spec_source_policy": {
118
+ "mode": "keep-separate",
119
+ "migrated_source_disposition": "retain",
120
+ "disposition_decided_by": "rarajes2@cisco.com",
121
+ "disposition_decided_at": "2026-11-12T15:30:00Z",
122
+ "decided_by": "rarajes2@cisco.com",
123
+ "decided_at": "2026-11-12T15:30:00Z",
124
+ "decision_record": "docs/adr/0001-retain-product-readme.md"
125
+ },
126
+ "spec_sources": [
127
+ {
128
+ "path": "README.md",
129
+ "scope": "repo",
130
+ "role": "reference-only",
131
+ "canonical": false,
132
+ "use_by_agents": "context-only",
133
+ "post_migration_action": "retain",
134
+ "deletion_status": "not-applicable",
135
+ "notes": "npm page, kept unchanged under keep-separate. Its Usage block ends with the placeholder member webex.internal.avatar.WHATEVER and documents no method, option, or result; see docs/adr/0001-retain-product-readme.md."
136
+ }
137
+ ],
138
+ "modules": [
139
+ {
140
+ "path": "src",
141
+ "canonical_spec": "src/docs/README.md",
142
+ "coverage_status": "Partial",
143
+ "coverage_evidence": "Field coverage 100% (14/14) assessed 2026-11-12 by the generator; critical field coverage 7/7. test:unit runs test/unit/spec/avatar.js, test/unit/spec/avatar-url-batcher.js, and test/unit/spec/avatar-url-store.js, 23 passing and 1 skipped under Node 22.14 after build:src on 2026-11-12; they cover MOD-004 to MOD-008, MOD-010, MOD-011, INV-002, and INV-004 (retrieval, batching to one request, hideDefaultAvatar, fingerprints, the profiles/urls request, didItemFail, and the store guards). MOD-001, MOD-002, MOD-009, MOD-012, INV-001 (the expiry timer), INV-003 (the HTTP error and missing-size paths; the missing-size case is it.skip), and INV-005 have no unit case. The integration spec test/integration/spec/avatar.js has every case commented out, and test:browser bundles nothing (0 tests, exit 0). build:src, build, and test:style exit 0 (13 warnings, 0 errors before this spec existed). No characterization baseline exists; the module remains Partial pending a characterization baseline and promotion review. Independent validation on 2026-11-12 by the validator runtime passed with 0 Blocking and 0 Important findings. The prior two Important A16 command-catalog findings were fixed by the generator and rechecked in this run: browser-test is catalogued and the failing aggregate test script is described only as not to run. Runtime separation: different-runtime. A characterization baseline and promotion review remain pending.",
144
+ "last_assessed": "2026-11-12",
145
+ "contracts": {
146
+ "provides": [
147
+ "avatar-internal-sdk"
148
+ ],
149
+ "requires": [
150
+ "avatar-http",
151
+ "webex-core-plugin-host",
152
+ "webex-core-batcher",
153
+ "webex-core-upload",
154
+ "internal-plugin-user-uuid",
155
+ "internal-plugin-device-identity",
156
+ "helper-image-processing",
157
+ "common-one-flight",
158
+ "common-timers-safe-timeout"
159
+ ]
160
+ },
161
+ "section_profile": {
162
+ "has_tiers": false,
163
+ "has_ui": false,
164
+ "crosses_service_boundaries": true,
165
+ "holds_client_state": true,
166
+ "enforces_domain_rules": true,
167
+ "is_concurrent_async": true,
168
+ "owns_persistence": false,
169
+ "stateful_transitions": false,
170
+ "exposes_wire_protocol": true,
171
+ "ui_multi_screen": false,
172
+ "large_data_model": false,
173
+ "returns_caller_errors": true,
174
+ "module_specific_conventions": true,
175
+ "published_package": true,
176
+ "embedded_in_host": false,
177
+ "has_design_tradeoff": true,
178
+ "resolved_by": "claude-code (code evidence; bootstrap questionnaire)",
179
+ "resolved_at": "2026-11-12T15:35:00Z",
180
+ "has_submodules": false,
181
+ "has_submodules_computed_by": "scripts/module_tree.py",
182
+ "has_submodules_computed_at": "2026-11-12T15:35:00Z"
183
+ }
184
+ }
185
+ ],
186
+ "contract_catalog": {
187
+ "index_path": "docs/architecture.md",
188
+ "definitions": {
189
+ "avatar-internal-sdk": {
190
+ "kind": "sdk",
191
+ "publication": "published",
192
+ "source_kind": "repository-path",
193
+ "source": "package.json",
194
+ "summary": "Published npm package (internal plugin). main is dist/index.js and devMain is src/index.js; no type declarations are published. Importing it imports @webex/internal-plugin-user and @webex/internal-plugin-device, then registers Avatar as internal plugin 'avatar' with the avatar config from src/config.js; the first registration of the name wins. The entry exports only the default Avatar class. webex.internal.avatar exposes retrieveAvatarUrl(user, options) and setAvatar(file), the enableThumbnails session property, the store session property, the batcher child, and the underscore-prefixed _fetchAvatarUrl and _fetchAllAvatarUrlSizes; specified in src/docs/README.md."
195
+ },
196
+ "avatar-http": {
197
+ "kind": "http",
198
+ "publication": "internal",
199
+ "source_kind": "external",
200
+ "source": "Avatar service (catalog service name avatar, reached through api: 'avatar' in src/avatar-url-batcher.js and src/avatar.js; route definitions are not in this repository)",
201
+ "summary": "POST /profiles/urls with body [{uuid, sizes}] answering {<uuid>: {<size>: {size, url, defaultAvatar, cacheControl}}}; POST /profile/<userId>/session answering an upload session {id, url}; PUT to the session url with the image bytes; PUT /profile/<userId>/session/<sessionId> answering the new avatar url."
202
+ },
203
+ "webex-core-plugin-host": {
204
+ "kind": "sdk",
205
+ "publication": "published",
206
+ "source_kind": "external",
207
+ "source": "@webex/webex-core (workspace package; module spec consulted: packages/@webex/webex-core/src/docs/README.md MOD-008, MOD-013, MOD-044)",
208
+ "summary": "registerInternalPlugin keys the plugin by its raw name (avatar, first registration wins) and merges its config into the defaults; WebexPlugin supplies webex, children, session properties, namespaced config, logger, request, and upload."
209
+ },
210
+ "webex-core-batcher": {
211
+ "kind": "sdk",
212
+ "publication": "published",
213
+ "source_kind": "external",
214
+ "source": "@webex/webex-core Batcher (module spec consulted: packages/@webex/webex-core/src/docs/README.md MOD-050 to MOD-053; code consulted: packages/@webex/webex-core/src/lib/batcher.js)",
215
+ "summary": "Batcher.request de-duplicates by fingerprint, flushes through a capped debounce read from the subclass namespace config (batcherWait, batcherMaxWait, batcherMaxCalls), maps responses back through getDeferredForResponse, and on failure settles every queued deferred."
216
+ },
217
+ "webex-core-upload": {
218
+ "kind": "sdk",
219
+ "publication": "published",
220
+ "source_kind": "external",
221
+ "source": "@webex/webex-core upload (module spec consulted: packages/@webex/webex-core/src/docs/README.md MOD-038 to MOD-042)",
222
+ "summary": "upload rejects without options.file, runs initialize (POST), upload (PUT, no SDK authorization, retried), and finalize phases, replaces $-prefixed phase keys with functions of the initialize body, and resolves the finalize body merged with its headers."
223
+ },
224
+ "internal-plugin-user-uuid": {
225
+ "kind": "sdk",
226
+ "publication": "published",
227
+ "source_kind": "external",
228
+ "source": "@webex/internal-plugin-user (workspace package; module spec consulted: packages/@webex/internal-plugin-user/src/docs/README.md MOD-002, MOD-004)",
229
+ "summary": "asUUID(user) rejects a missing user, returns a uuid unchanged, and resolves an email through the user batcher."
230
+ },
231
+ "internal-plugin-device-identity": {
232
+ "kind": "sdk",
233
+ "publication": "published",
234
+ "source_kind": "external",
235
+ "source": "@webex/internal-plugin-device (workspace package; module spec consulted: packages/@webex/internal-plugin-device/src/docs/README.md)",
236
+ "summary": "Imported by src/index.js for registration. userId is a registration property read from webex.internal.device by setAvatar."
237
+ },
238
+ "helper-image-processing": {
239
+ "kind": "sdk",
240
+ "publication": "published",
241
+ "source_kind": "external",
242
+ "source": "@webex/helper-image (workspace package; module spec consulted: packages/@webex/helper-image/src/docs/README.md MOD-002, MOD-007 to MOD-009, MOD-013, MOD-014)",
243
+ "summary": "detectFileType(file, logger) resolves a MIME type or null; processImage resolves undefined for a non-image or the triple [thumbnail, fileDimensions, thumbnailDimensions], with an empty thumbnail when enableThumbnails is off; the bundler selects a Node (GraphicsMagick) or browser (canvas) implementation, and only the browser one honors isAvatar."
244
+ },
245
+ "common-one-flight": {
246
+ "kind": "sdk",
247
+ "publication": "published",
248
+ "source_kind": "external",
249
+ "source": "@webex/common (workspace package; module spec consulted: packages/@webex/common/src/docs/README.md; code consulted: packages/@webex/common/src/one-flight.js, src/patterns.js)",
250
+ "summary": "oneFlight keys a flight per instance by method name plus keyFactory(...args) and drops it on settle unless cacheSuccesses or cacheFailures is set; patterns.uuid matches lowercase hex uuids only."
251
+ },
252
+ "common-timers-safe-timeout": {
253
+ "kind": "sdk",
254
+ "publication": "published",
255
+ "source_kind": "external",
256
+ "source": "@webex/common-timers (workspace package; module spec consulted: packages/@webex/common-timers/src/docs/README.md MOD-001, MOD-002)",
257
+ "summary": "safeSetTimeout forwards to setTimeout and unrefs the handle where the platform supports it, so store expiry timers do not keep a Node process alive."
258
+ }
259
+ }
260
+ },
261
+ "spec_policy": {
262
+ "require_what_and_why": true,
263
+ "require_provenance": true,
264
+ "protected_specs": [
265
+ "src/docs/README.md"
266
+ ]
267
+ },
268
+ "validation": {
269
+ "generator_runtime": "claude-code",
270
+ "generator_model": "claude-opus-5-5",
271
+ "generator_runtime_source": "host-metadata",
272
+ "source_commit": "6a61caf21b1cd4f005a1013fa4fbe3c92f69abbf",
273
+ "minimum_independence": "different-runtime",
274
+ "blocking_severities": [
275
+ "Blocking"
276
+ ],
277
+ "validator_runtime": "Validate internal-plugin-avatar specs",
278
+ "validator_run_id": "01a1d06c-9064-7763-a1da-54a63ad26ec0",
279
+ "validator_runtime_source": "invocation-input",
280
+ "runtime_fallback_tier": "different-runtime"
281
+ },
282
+ "layout": {
283
+ "sdd_root": ".sdd",
284
+ "docs_root": "docs",
285
+ "agent_entry_path": "AGENTS.md",
286
+ "standing_docs_root": "docs",
287
+ "spec_index_path": "docs/specs/README.md",
288
+ "module_docs_strategy": "source-local",
289
+ "module_docs_relative_path": "docs/README.md",
290
+ "module_docs_decision": {
291
+ "basis": "repo-standards-default",
292
+ "reason": "No module-local documentation existed. The source-local default gives src/docs/README.md. test:style runs eslint ./src/**/*.*, and the shared @webex/eslint-config-legacy ignore patterns exclude docs/** and *.md; build:src processes -js -ts only, so Markdown under src/ does not enter dist/.",
293
+ "decided_by": "rarajes2@cisco.com (bootstrap questionnaire)",
294
+ "decided_at": "2026-11-12T15:35:00Z"
295
+ },
296
+ "repo_context_decision": {
297
+ "path": ".repo-context.json",
298
+ "schema_path": "schemas/repo-context.schema.json",
299
+ "action": "create",
300
+ "schema_action": "create",
301
+ "reason": "Neither the operational context nor its schema existed in this package. The context is created from package evidence and the schema is copied from the repository-root .sdd/templates/repo-standards/schemas/repo-context.schema.json.",
302
+ "decided_by": "rarajes2@cisco.com (bootstrap questionnaire)",
303
+ "decided_at": "2026-11-12T15:35:00Z"
304
+ },
305
+ "artifact_decisions": [
306
+ {
307
+ "path": "docs/service.md",
308
+ "action": "omit",
309
+ "reason": "Library package, not a deployable service. package.json has no start script, container, or deployment descriptor.",
310
+ "decided_by": "claude-code (code evidence)",
311
+ "decided_at": "2026-11-12T15:35:00Z"
312
+ },
313
+ {
314
+ "path": "mkdocs.yml",
315
+ "action": "omit",
316
+ "reason": "No package-level documentation site exists. Documentation publishing stays with the workspace.",
317
+ "decided_by": "claude-code (code evidence)",
318
+ "decided_at": "2026-11-12T15:35:00Z"
319
+ },
320
+ {
321
+ "path": "api-specs/openapi.yaml",
322
+ "action": "omit",
323
+ "reason": "The package serves no HTTP routes. It is a client of the avatar service; its published surface is the npm export described by avatar-internal-sdk.",
324
+ "decided_by": "claude-code (code evidence)",
325
+ "decided_at": "2026-11-12T15:35:00Z"
326
+ },
327
+ {
328
+ "path": "SECURITY.md",
329
+ "action": "omit",
330
+ "reason": "No package-level security policy exists. The workspace owns security policy, and a per-package copy would duplicate it; security architecture is described in docs/architecture.md.",
331
+ "decided_by": "claude-code (code evidence)",
332
+ "decided_at": "2026-11-12T15:35:00Z"
333
+ },
334
+ {
335
+ "path": "CONTRIBUTING.md",
336
+ "action": "omit",
337
+ "reason": "Contribution instructions are owned at the workspace root CONTRIBUTING.md.",
338
+ "decided_by": "claude-code (code evidence)",
339
+ "decided_at": "2026-11-12T15:35:00Z"
340
+ },
341
+ {
342
+ "path": "CHANGELOG.md",
343
+ "action": "omit",
344
+ "reason": "Changelog generation is owned at the workspace root. This package has no changelog file.",
345
+ "decided_by": "claude-code (code evidence)",
346
+ "decided_at": "2026-11-12T15:35:00Z"
347
+ },
348
+ {
349
+ "path": "CTO_CHECKLIST.yml",
350
+ "action": "omit",
351
+ "reason": "The CTO readiness checklist applies to deployable services. This package is a library.",
352
+ "decided_by": "claude-code (code evidence)",
353
+ "decided_at": "2026-11-12T15:35:00Z"
354
+ },
355
+ {
356
+ "path": "schemas/cto-checklist.schema.json",
357
+ "action": "omit",
358
+ "reason": "Omitted together with CTO_CHECKLIST.yml.",
359
+ "decided_by": "claude-code (code evidence)",
360
+ "decided_at": "2026-11-12T15:35:00Z"
361
+ }
362
+ ],
363
+ "template_roots": {
364
+ "canonical": ".sdd/templates/repo-standards"
365
+ },
366
+ "contract_index_path": "docs/architecture.md",
367
+ "repo_skills_root": ".sdd/skills",
368
+ "monorepo_package": {
369
+ "package_path": "packages/@webex/internal-plugin-avatar",
370
+ "root_manifest_path": "../../../.sdd/manifest.json",
371
+ "templates_root_path": "../../../.sdd/templates/repo-standards"
372
+ }
373
+ },
374
+ "tooling": {
375
+ "sdlc_skills": {
376
+ "source_ref": "repo-annotation@2.3.1"
377
+ }
378
+ },
379
+ "coverage_ratchet": {
380
+ "enabled": true,
381
+ "waivers": []
382
+ },
383
+ "substrate": {
384
+ "source": "WebexTools/repo-standards@d89a7fe59126ae3ad9bac9ca352aa7f12b4c85dc",
385
+ "consumed": [
386
+ "@webex/eslint-config-legacy via .eslintrc.js",
387
+ "@webex/babel-config-legacy via babel.config.js",
388
+ "@webex/jest-config-legacy via jest.config.js",
389
+ "@webex/legacy-tools build and test runner via package.json",
390
+ "package README.md (context only)",
391
+ "Repo Standards templates at the monorepo root .sdd/templates/repo-standards, referred to through layout.monorepo_package.templates_root_path (this package holds no templates)"
392
+ ],
393
+ "compliance_tier": "baseline"
394
+ },
395
+ "section_profiles": {
396
+ "repo": {
397
+ "owns_datastore": false,
398
+ "holds_client_state": true,
399
+ "components_interact": true,
400
+ "domain_data_across_components": true,
401
+ "caches_data": true,
402
+ "observability_convention": false,
403
+ "deploys_to_infra": false,
404
+ "shared_base_libs": true,
405
+ "is_monorepo": false,
406
+ "multi_platform": true,
407
+ "published_package": true,
408
+ "embedded_in_host": false,
409
+ "cross_repo_deps_material": true,
410
+ "security_arch_warranted": true,
411
+ "exposes_commands_or_artifacts": true
412
+ },
413
+ "resolved_by": "claude-code (code evidence; bootstrap questionnaire)",
414
+ "resolved_at": "2026-11-12T15:35:00Z"
415
+ }
416
+ }
package/AGENTS.md ADDED
@@ -0,0 +1,208 @@
1
+ <!-- sdd-generated-metadata
2
+ doc_kind: agent-entry
3
+ generated_from: agents@0.3.0
4
+ generated_by: claude-code
5
+ approved_by: rarajes2@cisco.com
6
+ updated_at: 2026-11-12T15:52:01Z
7
+ validation_status: pass
8
+ -->
9
+
10
+ # AI Agent Instructions
11
+
12
+ Package-scoped SDD entry for `@webex/internal-plugin-avatar`, the internal `avatar` plugin of the SDK
13
+ (it resolves users to avatar URLs through a batched, cached lookup and uploads the current user's new
14
+ avatar). This file orients agents. The monorepo root `AGENTS.md` governs workspace-wide setup.
15
+
16
+ ## Working Method
17
+
18
+ - Read the relevant package files before editing. Do not edit blind.
19
+ - Understand the task and affected surfaces before writing code.
20
+ - Prefer focused edits over rewriting whole files.
21
+ - Do not invent commands, paths, exports, method names, or request paths. Verify them from this
22
+ package's source.
23
+ - Test or validate before declaring done.
24
+ - Keep output concise. If something is uncertain, say so instead of guessing.
25
+
26
+ ## Canonical Repository Documentation
27
+
28
+ Before changing code or documentation, start with:
29
+
30
+ - [`docs/index.md`](docs/index.md) for package documentation navigation;
31
+ - [`docs/architecture.md`](docs/architecture.md) for package boundaries and interactions;
32
+ - [`docs/specs/README.md`](docs/specs/README.md) for the manifest-backed module and contract registry;
33
+ - the module specification at [`src/docs/README.md`](src/docs/README.md) (Avatar plugin); and
34
+ - [`docs/adr/index.md`](docs/adr/index.md) plus applicable concrete ADRs.
35
+
36
+ Follow `.sdd/manifest.json` for each contract's publication state and canonical source. This package
37
+ publishes an internal SDK surface, so its contract artifact is `package.json` plus the `src/index.js`
38
+ entry. It serves no HTTP, so no OpenAPI applies.
39
+
40
+ ## 1. Commands (Run First)
41
+
42
+ Use only documented commands. Do not invent alternatives when a command is missing. Run every command from the workspace root; package scripts run as `yarn workspace @webex/internal-plugin-avatar <script>`.
43
+ Fresh-checkout workspace setup (building `webex-legacy-tools` and sibling `dist/`) is owned by the workspace root; see [Prebuilding](../../../CONTRIBUTING.md#prebuilding).
44
+
45
+ | Task | Command |
46
+ | ---------------------- | ------- |
47
+ | Install dependencies | `yarn` (workspace root; the deploy workflow runs the same command) |
48
+ | Start dev environment | N/A — library package with no start script in `package.json` |
49
+ | Run tests | `yarn workspace @webex/internal-plugin-avatar test:unit` (after `build:src`; the specs import the package by name, so they test `dist/`) |
50
+ | Run linters | `yarn workspace @webex/internal-plugin-avatar test:style` |
51
+ | Build/release artifact | `yarn workspace @webex/internal-plugin-avatar build:src` (JavaScript and source maps to `dist/`) |
52
+ | Format code | N/A — no format script; `prettier` is a devDependency used through eslint |
53
+
54
+ `yarn workspace @webex/internal-plugin-avatar build` runs the `build:src` script and produces the same output; the package emits no type
55
+ declarations.
56
+
57
+ Do not use the aggregate `test` script: after lint and unit tests it calls `test:integration`, which
58
+ this package does not define, and exits 1. `yarn workspace @webex/internal-plugin-avatar test:browser` runs `test/integration/spec` through
59
+ karma but verifies nothing today; see [Getting started](docs/getting-started.md#tests) for its state.
60
+
61
+ If a required command is unknown, stop and ask for the exact command.
62
+
63
+ ## 2. Agent Persona and Scope
64
+
65
+ You are the Webex JS SDK engineering assistant for `@webex/internal-plugin-avatar`.
66
+
67
+ Primary outcomes:
68
+
69
+ - Deliver production-safe changes with build, unit tests, and lint passing.
70
+ - Preserve existing behavior unless a change request explicitly requires a behavior change.
71
+ - Keep docs and configuration aligned with code changes.
72
+
73
+ Definition of done:
74
+
75
+ 1. Requested change is implemented.
76
+ 2. Build, unit tests, and lint pass locally.
77
+ 3. Updated docs cover new behavior, including the owning module spec.
78
+ 4. PR summary includes risks and rollback notes.
79
+
80
+ ## 3. Repository Knowledge
81
+
82
+ ### Tech Stack
83
+
84
+ | Area | Tooling | Version |
85
+ | ---------------- | ------- | ------- |
86
+ | Language runtime | node; JavaScript sources | 22.14 (workspace root `AGENTS.md`; `.nvmrc` `lts/jod`); package `engines` accepts `>=16`; the workspace root `package.json` `engines.node` reads `18.x` |
87
+ | Build tool | yarn workspaces and `@webex/legacy-tools` over babel | yarn `3.4.1` (root `packageManager`), `@babel/core` `^7.17.10` |
88
+ | Test framework | jest through `webex-legacy-tools` and `@webex/jest-config-legacy`, with sinon, `@webex/test-helper-chai`, and `@webex/test-helper-mock-webex` | — |
89
+ | Lint/format | eslint via `@webex/eslint-config-legacy`, prettier | eslint `^8.24.0`, prettier `^2.7.1` |
90
+
91
+ ### Project Map
92
+
93
+ - `src/index.js`: imports the user and device plugins, registers internal plugin `avatar` with its
94
+ config, and exports `Avatar` (default only).
95
+ - `src/avatar.js`: `Avatar` — `retrieveAvatarUrl`, `setAvatar`, the `oneFlight` fetch helpers, the
96
+ `batcher` child, and the `store` and `enableThumbnails` session properties.
97
+ - `src/avatar-url-batcher.js`: `AvatarUrlBatcher` — groups lookups into one `POST profiles/urls` and
98
+ maps the response back to each caller.
99
+ - `src/avatar-url-store.js`: `AvatarUrlStore` — in-memory URL cache keyed by uuid and size, with
100
+ expiry timers.
101
+ - `src/config.js`: the `avatar` config (batcher timings, TTL, default size, size list, thumbnail
102
+ bounds).
103
+ - `test/unit/spec/`: unit cases (`avatar.js`, `avatar-url-batcher.js`, `avatar-url-store.js`) run by
104
+ `test:unit`.
105
+ - `test/integration/spec/avatar.js`: user and device setup only; every case is commented out.
106
+ - `process`: package-root module exporting `{browser: true}`; not imported by `src/`.
107
+ - `dist/`: generated build output. Never edit by hand.
108
+ - `README.md`: retained npm page, context only; its Usage block is a placeholder; see
109
+ [ADR-0001](docs/adr/0001-retain-product-readme.md).
110
+ - Spec for every file under `src/`: `src/docs/README.md`.
111
+
112
+ ### Critical Constraints
113
+
114
+ - The plugin is `webex.internal.avatar`; `@webex/webex-server` and `@webex/recipe-private-web-client`
115
+ register it by import.
116
+ - Every lookup goes through the batcher, so a burst of `retrieveAvatarUrl` calls sends one request per
117
+ flush (`INV-002` in the module spec).
118
+ - A store miss requests every size in `config.sizes`; one missing size rejects the requested one.
119
+ - Store entries expire on the client TTL (`cacheControl`, seconds), not on the service's cache field
120
+ (`INV-001`).
121
+ - `config.sizes` and the fixed size list in `AvatarUrlStore.remove` must change together.
122
+
123
+ ## 4. Testing Workflow
124
+
125
+ Run checks in this order, from the workspace root:
126
+
127
+ 1. `yarn workspace @webex/internal-plugin-avatar build:src`
128
+ 2. `yarn workspace @webex/internal-plugin-avatar test:unit`
129
+ 3. `yarn workspace @webex/internal-plugin-avatar test:style`
130
+
131
+ Testing rules:
132
+
133
+ - Add or update cases in `test/unit/spec/avatar.js`, `test/unit/spec/avatar-url-batcher.js`, or
134
+ `test/unit/spec/avatar-url-store.js` for every behavior you change.
135
+ - Use `@webex/test-helper-mock-webex` with sinon stubs for `webex.request`, and assert with
136
+ `@webex/test-helper-chai`; use `sinon.useFakeTimers()` for the store TTL.
137
+ - Use `assert.calledOnceWithExactly` for call arguments, and parametrize when more than three cases are
138
+ alike.
139
+ - Cover failure paths and edge cases, not only happy paths.
140
+ - Do not remove tests to make CI pass.
141
+
142
+ No coverage gate applies to this package; do not infer one.
143
+
144
+ ## 5. Code Style and Patterns
145
+
146
+ Coding expectations:
147
+
148
+ - Follow repository style rules and static analysis output. The local `.eslintrc.js` sets
149
+ `root: true` and extends the legacy config.
150
+ - Prefer small functions over large procedural blocks.
151
+ - Make error handling explicit; reject guard failures before touching the store or the network.
152
+ - Keep public interfaces stable unless a breaking change is requested.
153
+
154
+ Pattern example:
155
+
156
+ ```text
157
+ Preferred:
158
+ - Request a uuid and size through this.batcher.request so duplicates collapse.
159
+ - Guard store arguments with Promise.reject(new Error('`item.<field>` is required')).
160
+ - Settle every batched deferred, on success, missing size, or HTTP error.
161
+
162
+ Avoid:
163
+ - Calling webex.request for profiles/urls directly.
164
+ - Changing config.sizes without the list in AvatarUrlStore.remove.
165
+ - Treating README.md as a usage reference.
166
+ ```
167
+
168
+ ## 6. Git Workflow
169
+
170
+ - Branch naming: no package convention is defined; follow the workspace `CONTRIBUTING.md`.
171
+ - Commit format: conventional commits (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`), which
172
+ the workspace `CONTRIBUTING.md` requires for pull requests.
173
+ - Keep commits focused and reversible.
174
+ - Rebase on the target branch before opening a pull request.
175
+
176
+ PR checklist:
177
+
178
+ - What changed and why.
179
+ - Tests run and results.
180
+ - Risk and impact on first-party clients that call `webex.internal.avatar` and on the packages that
181
+ register it.
182
+ - Rollback approach.
183
+
184
+ ## 7. Boundaries and Escalation
185
+
186
+ ### Always
187
+
188
+ - Prefer existing patterns over introducing new architecture.
189
+ - Keep changes minimal for the requested scope.
190
+ - Call out assumptions and unknowns explicitly.
191
+ - Update the owning module spec in the same change that alters observable behavior.
192
+
193
+ ### Ask First
194
+
195
+ - Adding dependencies, or removing a declared one.
196
+ - Renaming or removing a method, the `batcher` child, a session property, or the registered plugin
197
+ name.
198
+ - Changing a request path or body, the size list, the default size, the TTL, or the batcher timings.
199
+ - Changing what `retrieveAvatarUrl` or `setAvatar` resolves, or when the cache is invalidated.
200
+
201
+ ### Never
202
+
203
+ - Edit `dist/` by hand.
204
+ - Commit secrets, tokens, or credentials, including in test fixtures.
205
+ - Log user ids, emails, or avatar URLs.
206
+ - Add a `.sdd/templates` directory, a copy of the templates, or a link to them in this package. The
207
+ templates live once at the monorepo root, `../../../.sdd/templates/repo-standards`, and
208
+ `.sdd/manifest.json` refers to them through `layout.monorepo_package`.
package/dist/avatar.js CHANGED
@@ -158,7 +158,7 @@ var Avatar = _webexCore.WebexPlugin.extend((_dec = (0, _common.oneFlight)({
158
158
  return res.url;
159
159
  });
160
160
  },
161
- version: "3.13.0-next.1"
161
+ version: "3.13.0-next.10"
162
162
  }, (0, _applyDecoratedDescriptor2.default)(_obj, "_fetchAllAvatarUrlSizes", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, "_fetchAllAvatarUrlSizes"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "_fetchAvatarUrl", [_dec2], (0, _getOwnPropertyDescriptor.default)(_obj, "_fetchAvatarUrl"), _obj), _obj));
163
163
  var _default2 = exports.default = Avatar;
164
164
  //# sourceMappingURL=avatar.js.map