@webex/plugin-presence 0.0.0-next.26 → 0.0.0-next.261

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,448 @@
1
+ {
2
+ "manifest_version": 1,
3
+ "repository": {
4
+ "name": "@webex/plugin-presence",
5
+ "purpose": "Public TypeScript plugin registered as webex.presence for the presence service (catalog name apheleia). get() reads one user's composed presence; list() reads many through a Batcher that folds lookups into POST compositions; subscribe() POSTs subscriptions in batches of 50 and unsubscribe() sends subscriptionTtl 0; setStatus() POSTs events for the device user, without a label for dnd; enable(), disable(), and isEnabled() set and read the user-presence-enabled toggle through the feature plugin. Registration adds an inbound transform that copies body.eventType to body.status. An optional PresenceWorker, started by initializeWorker() or config.presence.initializeWorker, counts enqueue/dequeue watchers, fetches stale presence after a 300 ms debounce, subscribes users watched for a minute, renews watched subscriptions, listens to the Mercury event apheleia.subscription_update, expires update times after 10 minutes, and reports every change as an 'updated' event with a subscription, presence, or delete envelope. src/interface.ts types the surface; build emits declarations to dist/types. It stores nothing.",
6
+ "category": "cat2-legacy",
7
+ "primary_languages": [
8
+ "typescript"
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/plugin-presence build",
20
+ "source_file": "package.json",
21
+ "role": "compile",
22
+ "verified_at": "2026-11-12T13:30:28Z"
23
+ },
24
+ "build": {
25
+ "command": "yarn workspace @webex/plugin-presence build:src",
26
+ "source_file": "../../../AGENTS.md",
27
+ "role": "package",
28
+ "verified_at": "2026-11-12T13:30:25Z"
29
+ },
30
+ "unit-test": {
31
+ "command": "yarn workspace @webex/plugin-presence test:unit",
32
+ "source_file": "../../../AGENTS.md",
33
+ "role": "unit-test",
34
+ "verified_at": "2026-11-12T13:30:31Z"
35
+ },
36
+ "lint": {
37
+ "command": "yarn workspace @webex/plugin-presence test:style",
38
+ "source_file": "package.json",
39
+ "role": "lint"
40
+ },
41
+ "docs": {
42
+ "command": "yarn workspace @webex/plugin-presence build:docs",
43
+ "source_file": "package.json",
44
+ "role": "other"
45
+ },
46
+ "deploy": {
47
+ "command": "yarn workspace @webex/plugin-presence deploy:npm",
48
+ "source_file": "package.json",
49
+ "role": "deploy"
50
+ }
51
+ },
52
+ "toolchain": [
53
+ {
54
+ "name": "node",
55
+ "version": ">=18",
56
+ "origin": "repo-config",
57
+ "source_file": "package.json"
58
+ },
59
+ {
60
+ "name": "node",
61
+ "version": "22.14",
62
+ "origin": "repo-config",
63
+ "source_file": "../../../AGENTS.md"
64
+ },
65
+ {
66
+ "name": "node",
67
+ "version": "lts/jod",
68
+ "origin": "repo-config",
69
+ "source_file": "../../../.nvmrc"
70
+ },
71
+ {
72
+ "name": "node",
73
+ "version": "18.x",
74
+ "origin": "repo-config",
75
+ "source_file": "../../../package.json"
76
+ },
77
+ {
78
+ "name": "yarn",
79
+ "version": "3.4.1",
80
+ "origin": "repo-config",
81
+ "source_file": "../../../package.json"
82
+ },
83
+ {
84
+ "name": "babel",
85
+ "version": "7.17.10",
86
+ "origin": "repo-config",
87
+ "source_file": "package.json"
88
+ },
89
+ {
90
+ "name": "eslint",
91
+ "version": "8.24.0",
92
+ "origin": "repo-config",
93
+ "source_file": "package.json"
94
+ },
95
+ {
96
+ "name": "prettier",
97
+ "version": "2.7.1",
98
+ "origin": "repo-config",
99
+ "source_file": "package.json"
100
+ },
101
+ {
102
+ "name": "typescript",
103
+ "version": "^4.7.4",
104
+ "origin": "repo-config",
105
+ "source_file": "../../../package.json"
106
+ },
107
+ {
108
+ "name": "typedoc",
109
+ "version": "0.23.26",
110
+ "origin": "repo-config",
111
+ "source_file": "package.json"
112
+ }
113
+ ],
114
+ "tests": {
115
+ "unit": {
116
+ "command_ref": "unit-test",
117
+ "dir": "test/unit/spec",
118
+ "framework": "jest"
119
+ }
120
+ },
121
+ "quality_gates": {
122
+ "code_coverage": {
123
+ "origin": "none",
124
+ "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)"
125
+ }
126
+ },
127
+ "coverage_status_definitions": {
128
+ "specced": ">=80% public surface specced, drift <5% - spec is authoritative",
129
+ "partial": "40-80% specced - spec is a hint, cross-check code",
130
+ "untracked": "<40% specced - code is the source of truth"
131
+ },
132
+ "spec_source_policy": {
133
+ "mode": "keep-separate",
134
+ "migrated_source_disposition": "retain",
135
+ "disposition_decided_by": "rarajes2@cisco.com",
136
+ "disposition_decided_at": "2026-11-12T13:21:56Z",
137
+ "decided_by": "rarajes2@cisco.com",
138
+ "decided_at": "2026-11-12T13:21:56Z",
139
+ "decision_record": "docs/adr/0001-retain-product-readme.md"
140
+ },
141
+ "spec_sources": [
142
+ {
143
+ "path": "README.md",
144
+ "scope": "repo",
145
+ "role": "reference-only",
146
+ "canonical": false,
147
+ "use_by_agents": "context-only",
148
+ "post_migration_action": "retain",
149
+ "deletion_status": "not-applicable",
150
+ "notes": "npm page, kept unchanged under keep-separate. Its Usage block ends with the placeholder member webex.presence.WHATEVER and documents no method, type, event, or configuration; see docs/adr/0001-retain-product-readme.md."
151
+ }
152
+ ],
153
+ "modules": [
154
+ {
155
+ "path": "src",
156
+ "canonical_spec": "src/docs/README.md",
157
+ "coverage_status": "Partial",
158
+ "coverage_evidence": "Field coverage 100% (15/15) assessed 2026-11-12 by the generator; critical field coverage 8/8. test:unit runs test/unit/spec/presence.ts and test/unit/spec/presence-worker.ts under Node 22.14 after build:src on 2026-11-12: 29 of 29 passing, exit 0, with one unhandled TypeError printed after the suites from the real debounced fetch that the enqueue cases schedule. Running cases cover MOD-005, MOD-006, MOD-008 to MOD-010, MOD-012 to MOD-014, MOD-016, MOD-017, INV-001, INV-003, INV-004, and INV-006 (several on argument checks only). MOD-001, MOD-003, MOD-004, MOD-007, MOD-015, MOD-018, INV-002, and INV-005 have no running case. The integration spec test/integration/spec/presence.ts is describe.skip (SPARK-413317) and no script runs it. build:src and build exit 0. test:style exits 1 in this checkout because the package-local node_modules/@humanwhocodes/object-schema has no dist/; the workspace-root ESLint 8.57.1 with the package config reports 0 errors and 4 require-jsdoc warnings over src/, plus File ignored for src/docs/README.md when the file list is expanded. No characterization baseline exists. Independent validation passed with warnings on 2026-11-12 (validator runtime 01a1cff7-a8f6-7912-803f-b7cabdeaa0bf; 0 Blocking, 1 Important B11-cmd). VAL-B11-CMD-001 is an accepted warning (rarajes2@cisco.com, 2026-11-12T13:45:00Z): the workspace-qualified form (yarn workspace @webex/plugin-presence followed by the script name) stays recorded for compile, lint, docs, and deploy, whose cited package.json holds the scripts rather than the exact strings. Held at Partial pending a characterization baseline and promotion review.",
159
+ "last_assessed": "2026-11-12",
160
+ "contracts": {
161
+ "provides": [
162
+ "presence-public-sdk"
163
+ ],
164
+ "requires": [
165
+ "apheleia-presence-http",
166
+ "mercury-apheleia-subscription-update",
167
+ "webex-core-plugin-host",
168
+ "webex-core-batcher",
169
+ "webex-core-payload-transformer",
170
+ "webex-core-services",
171
+ "internal-plugin-feature-toggles",
172
+ "internal-plugin-mercury-connection",
173
+ "internal-plugin-device-identity",
174
+ "lodash",
175
+ "internal-plugin-presence-parallel"
176
+ ]
177
+ },
178
+ "section_profile": {
179
+ "has_tiers": false,
180
+ "has_ui": false,
181
+ "crosses_service_boundaries": true,
182
+ "holds_client_state": true,
183
+ "enforces_domain_rules": true,
184
+ "is_concurrent_async": true,
185
+ "owns_persistence": false,
186
+ "stateful_transitions": true,
187
+ "exposes_wire_protocol": true,
188
+ "ui_multi_screen": false,
189
+ "large_data_model": false,
190
+ "returns_caller_errors": true,
191
+ "module_specific_conventions": true,
192
+ "published_package": true,
193
+ "embedded_in_host": false,
194
+ "has_design_tradeoff": true,
195
+ "resolved_by": "claude-code (code evidence; bootstrap questionnaire)",
196
+ "resolved_at": "2026-11-12T13:21:56Z",
197
+ "has_submodules": false,
198
+ "has_submodules_computed_by": "scripts/module_tree.py",
199
+ "has_submodules_computed_at": "2026-11-12T13:21:56Z"
200
+ }
201
+ }
202
+ ],
203
+ "contract_catalog": {
204
+ "index_path": "docs/architecture.md",
205
+ "definitions": {
206
+ "presence-public-sdk": {
207
+ "kind": "sdk",
208
+ "publication": "published",
209
+ "source_kind": "repository-path",
210
+ "source": "package.json",
211
+ "summary": "Published npm package (public plugin). main is dist/index.js, types is dist/types/index.d.ts (written by build through tsc, not by build:src), and devMain is src/index.js. Importing it imports @webex/internal-plugin-device, then registers Presence as public plugin 'presence' with config {presence: {batcherWait: 50, batcherMaxCalls: 50, batcherMaxWait: 150}} and the inbound payloadTransformer predicate and transform normalizeSingleStatusResponse; the first registration of the name wins. The entry exports only the default Presence, declared as IPresence from src/interface.ts. webex.presence exposes enable, disable, isEnabled, get, list, subscribe, unsubscribe, setStatus, initializeWorker, enqueue, dequeue, emitEvent, and the 'updated' event with {type: subscription|presence|delete, payload}; specified in src/docs/README.md."
212
+ },
213
+ "apheleia-presence-http": {
214
+ "kind": "http",
215
+ "publication": "internal",
216
+ "source_kind": "external",
217
+ "source": "Presence service (catalog service name apheleia, reached through api: 'apheleia' and service: 'apheleia' in src/presence.ts and src/presence-batcher.ts; route definitions are not in this repository)",
218
+ "summary": "GET compositions?userId=<id> resolves one presence status object; POST compositions {subjects} resolves {statusList}; POST subscriptions {subjects, subscriptionTtl, includeStatus: true} resolves {responses: [{subject, responseCode, subscriptionTtl, status}]}, and subscriptionTtl 0 ends subscriptions; POST events {subject, eventType, label (absent for dnd), ttl} resolves a body with eventType and subject."
219
+ },
220
+ "mercury-apheleia-subscription-update": {
221
+ "kind": "event",
222
+ "publication": "internal",
223
+ "source_kind": "external",
224
+ "source": "Presence service push through Mercury (event name in src/constants.ts; payload definition is not in this repository)",
225
+ "summary": "Mercury envelope whose data.eventType is apheleia.subscription_update, emitted by Mercury as event:apheleia.subscription_update; the worker reads data.subject and forwards data unchanged."
226
+ },
227
+ "webex-core-plugin-host": {
228
+ "kind": "sdk",
229
+ "publication": "published",
230
+ "source_kind": "external",
231
+ "source": "@webex/webex-core (workspace package; module spec consulted: packages/@webex/webex-core/src/docs/README.md)",
232
+ "summary": "registerPlugin keys the plugin by its raw name on WebexCore (presence, first registration wins unless replace is set, MOD-013) and merges its config and payloadTransformer entries into the module-level default config (MOD-008); WebexPlugin supplies webex, namespaced config (config.presence), trigger, and request; webex.ready and the ready event fire once the SDK is ready."
233
+ },
234
+ "webex-core-batcher": {
235
+ "kind": "sdk",
236
+ "publication": "published",
237
+ "source_kind": "external",
238
+ "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)",
239
+ "summary": "request(item) shares one promise per fingerprint; a capped debounce flushes at most batcherMaxCalls items using batcherWait and batcherMaxWait from the subclass namespace; a WebexHttpError whose options.body has no map, or any other flush error, rejects every queued item; a response item with no pending fingerprint throws Could not find pending request for received response."
240
+ },
241
+ "webex-core-payload-transformer": {
242
+ "kind": "sdk",
243
+ "publication": "published",
244
+ "source_kind": "external",
245
+ "source": "@webex/webex-core transform pipeline (module spec consulted: packages/@webex/webex-core/src/docs/README.md MOD-037; interceptors spec consulted: packages/@webex/webex-core/src/interceptors/docs/README.md INT-018)",
246
+ "summary": "transform('inbound', response) runs on every inbound response and error unless the request sets disableTransform; every predicate whose direction matches is tested, and each match applies every transform with the predicate's name."
247
+ },
248
+ "webex-core-services": {
249
+ "kind": "sdk",
250
+ "publication": "published",
251
+ "source_kind": "external",
252
+ "source": "@webex/webex-core services plugin (services spec consulted: packages/@webex/webex-core/src/lib/services/docs/README.md SVC-022)",
253
+ "summary": "ServiceInterceptor maps api to service, requires resource and service, waits for the service, and joins its catalog URL with the resource."
254
+ },
255
+ "internal-plugin-feature-toggles": {
256
+ "kind": "sdk",
257
+ "publication": "published",
258
+ "source_kind": "external",
259
+ "source": "@webex/internal-plugin-feature (workspace package, not declared in package.json; module spec consulted: packages/@webex/internal-plugin-feature/src/docs/README.md MOD-003, MOD-004, MOD-006)",
260
+ "summary": "getFeature('user', key) resolves the record value or null; setFeature('user', key, value) POSTs {key, mutable: true, val} to features/users/<userId>/user and resolves the merged record."
261
+ },
262
+ "internal-plugin-mercury-connection": {
263
+ "kind": "sdk",
264
+ "publication": "published",
265
+ "source_kind": "external",
266
+ "source": "@webex/internal-plugin-mercury (workspace package; module spec consulted, stale on its session model: packages/@webex/internal-plugin-mercury/src/docs/README.md MOD-009; code consulted: packages/@webex/internal-plugin-mercury/src/mercury.js)",
267
+ "summary": "connected is a boolean; connect() resolves at once when connected, registers the device first otherwise, and shares one in-flight promise; an envelope with a dotted data.eventType is emitted as event, event:<namespace>, and event:<eventType>."
268
+ },
269
+ "internal-plugin-device-identity": {
270
+ "kind": "sdk",
271
+ "publication": "published",
272
+ "source_kind": "external",
273
+ "source": "@webex/internal-plugin-device (workspace package; module spec consulted: packages/@webex/internal-plugin-device/src/docs/README.md)",
274
+ "summary": "Imported for its registration side effect. userId is a registration DTO property set from the WDM body."
275
+ },
276
+ "lodash": {
277
+ "kind": "sdk",
278
+ "publication": "published",
279
+ "source_kind": "external",
280
+ "source": "lodash@4.17.21 (npm)",
281
+ "summary": "has tests the transform predicate path; debounce delays the worker fetch until 300 ms after the last enqueue that needs one."
282
+ },
283
+ "internal-plugin-presence-parallel": {
284
+ "kind": "sdk",
285
+ "publication": "published",
286
+ "source_kind": "external",
287
+ "source": "@webex/internal-plugin-presence (workspace package, not a dependency; module spec consulted: packages/@webex/internal-plugin-presence/src/docs/README.md)",
288
+ "summary": "Same requests, worker, config defaults, and transform name, registered as internal plugin presence; the webex bundle loads it. Both packages merge a normalizeSingleStatusResponse predicate and transform into the same default config, so a host that loads both runs the transform twice with the same result."
289
+ }
290
+ }
291
+ },
292
+ "spec_policy": {
293
+ "require_what_and_why": true,
294
+ "require_provenance": true,
295
+ "protected_specs": [
296
+ "src/docs/README.md"
297
+ ]
298
+ },
299
+ "validation": {
300
+ "generator_runtime": "claude-code",
301
+ "generator_model": "claude-opus-5-5",
302
+ "generator_runtime_source": "host-metadata",
303
+ "source_commit": "b8bc13e04237b0962ccb77bceee33a414ac0d6e0",
304
+ "minimum_independence": "different-runtime",
305
+ "blocking_severities": [
306
+ "Blocking"
307
+ ],
308
+ "validator_runtime": "01a1cff7-a8f6-7912-803f-b7cabdeaa0bf",
309
+ "validator_run_id": "01a1cff7-a8f6-7912-803f-b7cabdeaa0bf",
310
+ "validator_runtime_source": "host-metadata",
311
+ "runtime_fallback_tier": "different-runtime"
312
+ },
313
+ "layout": {
314
+ "sdd_root": ".sdd",
315
+ "docs_root": "docs",
316
+ "agent_entry_path": "AGENTS.md",
317
+ "standing_docs_root": "docs",
318
+ "spec_index_path": "docs/specs/README.md",
319
+ "module_docs_strategy": "source-local",
320
+ "module_docs_relative_path": "docs/README.md",
321
+ "module_docs_decision": {
322
+ "basis": "repo-standards-default",
323
+ "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 and tsconfig.json compiles TypeScript only, so Markdown under src/ does not enter dist/.",
324
+ "decided_by": "rarajes2@cisco.com (bootstrap questionnaire)",
325
+ "decided_at": "2026-11-12T13:21:56Z"
326
+ },
327
+ "repo_context_decision": {
328
+ "path": ".repo-context.json",
329
+ "schema_path": "schemas/repo-context.schema.json",
330
+ "action": "create",
331
+ "schema_action": "create",
332
+ "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.",
333
+ "decided_by": "rarajes2@cisco.com (bootstrap questionnaire)",
334
+ "decided_at": "2026-11-12T13:21:56Z"
335
+ },
336
+ "artifact_decisions": [
337
+ {
338
+ "path": "docs/service.md",
339
+ "action": "omit",
340
+ "reason": "Library package, not a deployable service. package.json has no start script, container, or deployment descriptor.",
341
+ "decided_by": "claude-code (code evidence)",
342
+ "decided_at": "2026-11-12T13:21:56Z"
343
+ },
344
+ {
345
+ "path": "mkdocs.yml",
346
+ "action": "omit",
347
+ "reason": "No package-level documentation site exists. Documentation publishing stays with the workspace.",
348
+ "decided_by": "claude-code (code evidence)",
349
+ "decided_at": "2026-11-12T13:21:56Z"
350
+ },
351
+ {
352
+ "path": "api-specs/openapi.yaml",
353
+ "action": "omit",
354
+ "reason": "The package serves no HTTP routes. It is a client of the presence service; its published surface is the npm export and declarations described by presence-public-sdk.",
355
+ "decided_by": "claude-code (code evidence)",
356
+ "decided_at": "2026-11-12T13:21:56Z"
357
+ },
358
+ {
359
+ "path": "SECURITY.md",
360
+ "action": "omit",
361
+ "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.",
362
+ "decided_by": "claude-code (code evidence)",
363
+ "decided_at": "2026-11-12T13:21:56Z"
364
+ },
365
+ {
366
+ "path": "CONTRIBUTING.md",
367
+ "action": "omit",
368
+ "reason": "Contribution instructions are owned at the workspace root CONTRIBUTING.md.",
369
+ "decided_by": "claude-code (code evidence)",
370
+ "decided_at": "2026-11-12T13:21:56Z"
371
+ },
372
+ {
373
+ "path": "CHANGELOG.md",
374
+ "action": "omit",
375
+ "reason": "Changelog generation is owned at the workspace root. This package has no changelog file.",
376
+ "decided_by": "claude-code (code evidence)",
377
+ "decided_at": "2026-11-12T13:21:56Z"
378
+ },
379
+ {
380
+ "path": "CTO_CHECKLIST.yml",
381
+ "action": "omit",
382
+ "reason": "The CTO readiness checklist applies to deployable services. This package is a library.",
383
+ "decided_by": "claude-code (code evidence)",
384
+ "decided_at": "2026-11-12T13:21:56Z"
385
+ },
386
+ {
387
+ "path": "schemas/cto-checklist.schema.json",
388
+ "action": "omit",
389
+ "reason": "Omitted together with CTO_CHECKLIST.yml.",
390
+ "decided_by": "claude-code (code evidence)",
391
+ "decided_at": "2026-11-12T13:21:56Z"
392
+ }
393
+ ],
394
+ "template_roots": {
395
+ "canonical": ".sdd/templates/repo-standards"
396
+ },
397
+ "contract_index_path": "docs/architecture.md",
398
+ "repo_skills_root": ".sdd/skills",
399
+ "monorepo_package": {
400
+ "package_path": "packages/@webex/plugin-presence",
401
+ "root_manifest_path": "../../../.sdd/manifest.json",
402
+ "templates_root_path": "../../../.sdd/templates/repo-standards"
403
+ }
404
+ },
405
+ "tooling": {
406
+ "sdlc_skills": {
407
+ "source_ref": "repo-annotation@2.3.1"
408
+ }
409
+ },
410
+ "coverage_ratchet": {
411
+ "enabled": true,
412
+ "waivers": []
413
+ },
414
+ "substrate": {
415
+ "source": "WebexTools/repo-standards@d89a7fe59126ae3ad9bac9ca352aa7f12b4c85dc",
416
+ "consumed": [
417
+ "@webex/eslint-config-legacy via .eslintrc.js",
418
+ "@webex/babel-config-legacy via babel.config.js",
419
+ "@webex/jest-config-legacy via jest.config.js",
420
+ "@webex/legacy-tools build and test runner via package.json",
421
+ "workspace TypeScript configuration via tsconfig.json extends",
422
+ "package README.md (context only)",
423
+ "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)"
424
+ ],
425
+ "compliance_tier": "baseline"
426
+ },
427
+ "section_profiles": {
428
+ "repo": {
429
+ "owns_datastore": false,
430
+ "holds_client_state": true,
431
+ "components_interact": true,
432
+ "domain_data_across_components": true,
433
+ "caches_data": false,
434
+ "observability_convention": false,
435
+ "deploys_to_infra": false,
436
+ "shared_base_libs": true,
437
+ "is_monorepo": false,
438
+ "multi_platform": false,
439
+ "published_package": true,
440
+ "embedded_in_host": false,
441
+ "cross_repo_deps_material": true,
442
+ "security_arch_warranted": true,
443
+ "exposes_commands_or_artifacts": true
444
+ },
445
+ "resolved_by": "claude-code (code evidence; bootstrap questionnaire)",
446
+ "resolved_at": "2026-11-12T13:21:56Z"
447
+ }
448
+ }
package/AGENTS.md ADDED
@@ -0,0 +1,213 @@
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-12T13:37:51Z
7
+ validation_status: pass-with-warnings
8
+ -->
9
+
10
+ # AI Agent Instructions
11
+
12
+ Package-scoped SDD entry for `@webex/plugin-presence`, the public `presence` plugin of the SDK,
13
+ written in TypeScript (it reads, subscribes to, and sets user presence on the presence service,
14
+ switches the presence feature toggle, and runs an optional worker that keeps shown users' presence
15
+ current). This file orients agents. The monorepo root `AGENTS.md` governs workspace-wide setup.
16
+
17
+ ## Working Method
18
+
19
+ - Read the relevant package files before editing. Do not edit blind.
20
+ - Understand the task and affected surfaces before writing code.
21
+ - Prefer focused edits over rewriting whole files.
22
+ - Do not invent commands, paths, exports, types, event names, or resource paths. Verify them from
23
+ this package's source.
24
+ - Test or validate before declaring done.
25
+ - Keep output concise. If something is uncertain, say so instead of guessing.
26
+
27
+ ## Canonical Repository Documentation
28
+
29
+ Before changing code or documentation, start with:
30
+
31
+ - [`docs/index.md`](docs/index.md) for package documentation navigation;
32
+ - [`docs/architecture.md`](docs/architecture.md) for package boundaries and interactions;
33
+ - [`docs/specs/README.md`](docs/specs/README.md) for the manifest-backed module and contract registry;
34
+ - the module specification at [`src/docs/README.md`](src/docs/README.md) (Presence plugin); and
35
+ - [`docs/adr/index.md`](docs/adr/index.md) plus applicable concrete ADRs.
36
+
37
+ Follow `.sdd/manifest.json` for each contract's publication state and canonical source. This package
38
+ publishes a public SDK surface, so its contract artifact is `package.json` plus the `src/index.ts`
39
+ entry and the types in `src/interface.ts`. It serves no HTTP, so no OpenAPI applies.
40
+
41
+ ## 1. Commands (Run First)
42
+
43
+ Use only documented commands. Do not invent alternatives when a command is missing. Run workspace
44
+ commands from the monorepo root.
45
+ Fresh-checkout workspace setup (building `webex-legacy-tools` and sibling `dist/`) is owned by the workspace root; see [Prebuilding](../../../CONTRIBUTING.md#prebuilding).
46
+
47
+ | Task | Command |
48
+ | ---------------------- | ------- |
49
+ | Install dependencies | `yarn` (workspace root; the deploy workflow runs the same command) |
50
+ | Start dev environment | N/A — library package with no start script in `package.json` |
51
+ | Run tests | `yarn workspace @webex/plugin-presence test:unit` (after `build:src`; the specs import the package by name, so they test `dist/`) |
52
+ | Run linters | `yarn workspace @webex/plugin-presence test:style` |
53
+ | Build/release artifact | `yarn workspace @webex/plugin-presence build:src` (JavaScript and source maps to `dist/`) |
54
+ | Format code | N/A — no format script; `prettier` is a devDependency used through eslint |
55
+
56
+ `yarn workspace @webex/plugin-presence build` also runs `tsc` and writes the declarations under
57
+ `dist/types/` that `package.json` `types` names; run it whenever you change a type or a method
58
+ signature. `yarn workspace @webex/plugin-presence build:docs` regenerates the typedoc pages in the
59
+ workspace `docs/presence/` folder.
60
+
61
+ Do not use the aggregate `test` script: it calls `test:integration` and `test:browser`, which this
62
+ package does not define. The live-service spec in `test/integration/spec/presence.ts` is skipped and
63
+ no script runs it. See [Getting started](docs/getting-started.md#tests) for the current state of
64
+ `test:style` in a checkout with a broken package-local `node_modules`.
65
+
66
+ If a required command is unknown, stop and ask for the exact command.
67
+
68
+ ## 2. Agent Persona and Scope
69
+
70
+ You are the Webex JS SDK engineering assistant for `@webex/plugin-presence`.
71
+
72
+ Primary outcomes:
73
+
74
+ - Deliver production-safe changes with build, unit tests, and lint passing.
75
+ - Preserve existing behavior unless a change request explicitly requires a behavior change.
76
+ - Keep docs, types, and configuration aligned with code changes.
77
+
78
+ Definition of done:
79
+
80
+ 1. Requested change is implemented.
81
+ 2. Build, unit tests, and lint pass locally.
82
+ 3. Updated docs cover new behavior, including the owning module spec.
83
+ 4. PR summary includes risks and rollback notes.
84
+
85
+ ## 3. Repository Knowledge
86
+
87
+ ### Tech Stack
88
+
89
+ | Area | Tooling | Version |
90
+ | ---------------- | ------- | ------- |
91
+ | Language runtime | node; TypeScript sources | 22.14 (workspace root `AGENTS.md`; `.nvmrc` `lts/jod`); package `engines` accepts `>=18`; the workspace root `package.json` `engines.node` reads `18.x` |
92
+ | Build tool | yarn workspaces and `@webex/legacy-tools` over babel; `tsc` for declarations; typedoc for API pages | yarn `3.4.1` (root `packageManager`), `@babel/core` `7.17.10`, typedoc `0.23.26` |
93
+ | Test framework | jest through `webex-legacy-tools` and `@webex/jest-config-legacy`, with sinon, `@webex/test-helper-chai`, and `@webex/test-helper-mock-webex` | sinon `9.2.4` |
94
+ | Lint/format | eslint via `@webex/eslint-config-legacy`, prettier | eslint `8.24.0`, prettier `2.7.1` |
95
+
96
+ ### Project Map
97
+
98
+ - `src/index.ts`: imports the device plugin, registers public plugin `presence` with its inbound
99
+ transform and config, and default-exports `Presence`.
100
+ - `src/presence.ts`: `Presence`, with the feature toggle, the presence service requests, `emitEvent`,
101
+ and the worker entry points. Spec: `src/docs/README.md`.
102
+ - `src/presence-batcher.ts`: `PresenceBatcher`, which batches `list` lookups.
103
+ - `src/presence-worker.ts`: `PresenceWorker`, the watch, fetch, subscribe, renew, and expiry upkeep.
104
+ - `src/interface.ts`: the TypeScript types and the typedoc entry.
105
+ - `src/constants.ts`: worker timings, event names, and envelope types.
106
+ - `src/config.ts`: `config.presence` batcher defaults.
107
+ - `test/unit/spec/presence.ts`, `test/unit/spec/presence-worker.ts`: unit cases, all running.
108
+ - `test/integration/spec/presence.ts`: live-service cases, skipped.
109
+ - `process`: package-root module exporting `{browser: true}`; not imported by `src/`.
110
+ - `dist/`: generated build output. Never edit by hand.
111
+ - `README.md`: retained npm page, context only; its Usage block is a placeholder; see
112
+ [ADR-0001](docs/adr/0001-retain-product-readme.md).
113
+
114
+ ### Critical Constraints
115
+
116
+ - The plugin is `webex.presence`; applications listen to its `updated` event and switch on the
117
+ envelope `type` (`subscription`, `presence`, `delete`).
118
+ - `subscribe` must keep at most 50 subjects per request, and `setStatus` must leave out `label` only
119
+ for `dnd`.
120
+ - The worker keeps times and counts only; presence objects belong to the client.
121
+ - The inbound transform runs on every SDK response; keep its predicate narrow.
122
+ - `src/interface.ts` is the published type surface; change it with the code it describes.
123
+
124
+ ## 4. Testing Workflow
125
+
126
+ Run checks in this order:
127
+
128
+ 1. `yarn workspace @webex/plugin-presence build:src`
129
+ 2. `yarn workspace @webex/plugin-presence test:unit`
130
+ 3. `yarn workspace @webex/plugin-presence test:style`
131
+
132
+ Testing rules:
133
+
134
+ - Add or update cases in `test/unit/spec/presence.ts` or `test/unit/spec/presence-worker.ts` for every
135
+ behavior you change. `@webex/test-helper-mock-webex` mounts a child named `presence` at
136
+ `webex.presence`, which is where these cases call it.
137
+ - Use sinon stubs for `webex.request`, `webex.internal.mercury`, and `webex.internal.feature`, and
138
+ assert with `@webex/test-helper-chai`.
139
+ - Use `sinon.useFakeTimers()` for the worker's debounce and interval, `assert.calledOnceWithExactly`
140
+ for call arguments, and parametrize when more than three cases are alike.
141
+ - Stub `presence.list` in any case that calls `enqueue`, or the real debounced fetch runs after the
142
+ case ends.
143
+ - Cover failure paths and edge cases, not only happy paths.
144
+ - Do not remove tests to make CI pass.
145
+
146
+ No coverage gate applies to this package; do not infer one.
147
+
148
+ ## 5. Code Style and Patterns
149
+
150
+ Coding expectations:
151
+
152
+ - Follow repository style rules and static analysis output. The local `.eslintrc.js` sets
153
+ `root: true` and extends the legacy config.
154
+ - Prefer small functions over large procedural blocks.
155
+ - Make error handling explicit; keep argument failures as rejected promises.
156
+ - Keep public interfaces stable unless a breaking change is requested.
157
+
158
+ Pattern example:
159
+
160
+ ```text
161
+ Preferred:
162
+ - Report a new worker change through emitEvent(PRESENCE_UPDATE, {type: ENVELOPE_TYPE.<type>, payload}).
163
+ - Put a new timing in src/constants.ts and reference it from the worker.
164
+ - Add a new method to IPresence in src/interface.ts in the same change.
165
+
166
+ Avoid:
167
+ - Storing presence objects in the worker.
168
+ - Starting another interval or Mercury listener without a way to stop it.
169
+ - Treating README.md as a usage reference.
170
+ ```
171
+
172
+ ## 6. Git Workflow
173
+
174
+ - Branch naming: no package convention is defined; follow the workspace `CONTRIBUTING.md`.
175
+ - Commit format: conventional commits (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`), which
176
+ the workspace `CONTRIBUTING.md` requires for pull requests.
177
+ - Keep commits focused and reversible.
178
+ - Rebase on the target branch before opening a pull request.
179
+
180
+ PR checklist:
181
+
182
+ - What changed and why.
183
+ - Tests run and results.
184
+ - Risk and impact on applications that call `webex.presence`, handle its `updated` event, or compile
185
+ against its types.
186
+ - Rollback approach.
187
+
188
+ ## 7. Boundaries and Escalation
189
+
190
+ ### Always
191
+
192
+ - Prefer existing patterns over introducing new architecture.
193
+ - Keep changes minimal for the requested scope.
194
+ - Call out assumptions and unknowns explicitly.
195
+ - Update the owning module spec in the same change that alters observable behavior.
196
+
197
+ ### Ask First
198
+
199
+ - Adding dependencies, including declaring `@webex/internal-plugin-feature`.
200
+ - Renaming or removing a method, a type, the `updated` event, an envelope type, a config default, or
201
+ the registered plugin name.
202
+ - Changing a resource, a request body, the subscribe batch size, or a worker timing.
203
+ - Changing or widening the inbound transform.
204
+ - Changing behavior that `@webex/internal-plugin-presence` duplicates; say whether it must change too.
205
+
206
+ ### Never
207
+
208
+ - Edit `dist/` by hand.
209
+ - Commit secrets, tokens, or credentials, including in test fixtures.
210
+ - Log presence data, statuses, or user ids.
211
+ - Add a `.sdd/templates` directory, a copy of the templates, or a link to them in this package. The
212
+ templates live once at the monorepo root, `../../../.sdd/templates/repo-standards`, and
213
+ `.sdd/manifest.json` refers to them through `layout.monorepo_package`.