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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,543 @@
1
+ {
2
+ "$schema": "./schemas/repo-context.schema.json",
3
+ "version": 1,
4
+ "repository": {
5
+ "name": "@webex/plugin-presence",
6
+ "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."
7
+ },
8
+ "commands": {
9
+ "install": "yarn",
10
+ "compile": "yarn workspace @webex/plugin-presence build",
11
+ "build": "yarn workspace @webex/plugin-presence build:src",
12
+ "unit-test": "yarn workspace @webex/plugin-presence test:unit",
13
+ "lint": "yarn workspace @webex/plugin-presence test:style",
14
+ "docs": "yarn workspace @webex/plugin-presence build:docs",
15
+ "deploy": "yarn workspace @webex/plugin-presence deploy:npm"
16
+ },
17
+ "public_interfaces": [
18
+ {
19
+ "name": "@webex/plugin-presence package entry",
20
+ "kind": "package_export",
21
+ "source": "src/index.ts",
22
+ "entrypoints": [
23
+ "import '@webex/plugin-presence'",
24
+ "import Presence from '@webex/plugin-presence'"
25
+ ],
26
+ "audience": "applications that install the package from npm beside @webex/webex-core",
27
+ "notes": "Importing the package imports the device plugin, then registers Presence as public plugin 'presence' with config.presence defaults {batcherWait: 50, batcherMaxCalls: 50, batcherMaxWait: 150} and the inbound transform normalizeSingleStatusResponse, which copies body.eventType to body.status on any response with body.eventType and body.subject; the first registration of the name wins. The default export is the only export; no workspace package imports this package."
28
+ },
29
+ {
30
+ "name": "webex.presence methods and events",
31
+ "kind": "plugin_api",
32
+ "source": "src/presence.ts",
33
+ "entrypoints": [
34
+ "webex.presence.get(personId)",
35
+ "webex.presence.list(personIds)",
36
+ "webex.presence.subscribe(personIds, subscriptionTtl)",
37
+ "webex.presence.unsubscribe(personIds)",
38
+ "webex.presence.setStatus(status, ttl)",
39
+ "webex.presence.enable()",
40
+ "webex.presence.disable()",
41
+ "webex.presence.isEnabled()",
42
+ "webex.presence.initializeWorker()",
43
+ "webex.presence.enqueue(id)",
44
+ "webex.presence.dequeue(id)",
45
+ "webex.presence.on('updated', handler)"
46
+ ],
47
+ "audience": "applications",
48
+ "notes": "Requests go to the apheleia service; list batches lookups into POST compositions; subscribe sends at most 50 subjects per request; setStatus leaves out label for dnd; unsubscribe resolves the whole response. enable, disable, and isEnabled need the host to register the feature plugin. The worker emits 'updated' with {type: 'subscription' | 'presence' | 'delete', payload}."
49
+ },
50
+ {
51
+ "name": "TypeScript declarations",
52
+ "kind": "type_declarations",
53
+ "source": "src/interface.ts",
54
+ "entrypoints": [
55
+ "dist/types/index.d.ts"
56
+ ],
57
+ "audience": "TypeScript applications",
58
+ "notes": "package.json types points to dist/types/index.d.ts, which only build (tsc) writes. It declares the default Presence as IPresence. IPresence omits initializeWorker and types unsubscribe as {responses: any}; the entry re-exports no type. typedoc (build:docs) renders src/interface.ts."
59
+ },
60
+ {
61
+ "name": "package scripts",
62
+ "kind": "npm_scripts",
63
+ "source": "package.json",
64
+ "entrypoints": [
65
+ "build",
66
+ "build:src",
67
+ "build:docs",
68
+ "test:unit",
69
+ "test:style",
70
+ "test:browser:broken",
71
+ "test",
72
+ "deploy:npm"
73
+ ],
74
+ "audience": "contributors and CI",
75
+ "notes": "build runs tsc for declarations, then build:src, which writes dist. test:unit runs the jest unit specs, which import the package by name and so test dist; run build:src first; 29 of 29 pass. test:style exits 1 in the onboarding checkout because the package-local node_modules ESLint cannot load @humanwhocodes/object-schema. There is no test:integration or test:browser script, so the aggregate test stops at test:integration; the karma script is named test:browser:broken."
76
+ }
77
+ ],
78
+ "source_of_truth": [
79
+ {
80
+ "surface": "Presence plugin implementation",
81
+ "paths": [
82
+ "src/index.ts",
83
+ "src/presence.ts",
84
+ "src/presence-batcher.ts",
85
+ "src/presence-worker.ts",
86
+ "src/interface.ts",
87
+ "src/constants.ts",
88
+ "src/config.ts"
89
+ ],
90
+ "generated_artifacts": [
91
+ "dist"
92
+ ],
93
+ "refresh_with": [
94
+ "yarn workspace @webex/plugin-presence build:src",
95
+ "yarn workspace @webex/plugin-presence build"
96
+ ],
97
+ "validate_with": [
98
+ "yarn workspace @webex/plugin-presence test:unit",
99
+ "yarn workspace @webex/plugin-presence test:style"
100
+ ]
101
+ },
102
+ {
103
+ "surface": "module specification",
104
+ "paths": [
105
+ "src/docs/README.md"
106
+ ],
107
+ "generated_artifacts": [],
108
+ "refresh_with": [
109
+ "update alongside the behavior change in the same commit"
110
+ ],
111
+ "validate_with": [
112
+ "spec-validator on an independent runtime"
113
+ ]
114
+ }
115
+ ],
116
+ "generated_artifacts": [
117
+ {
118
+ "path": "dist",
119
+ "generated_from": "src",
120
+ "refresh_with": "yarn workspace @webex/plugin-presence build:src"
121
+ },
122
+ {
123
+ "path": "dist/types",
124
+ "generated_from": "src",
125
+ "refresh_with": "yarn workspace @webex/plugin-presence build"
126
+ },
127
+ {
128
+ "path": "../../../.sdd/templates/repo-standards/template-map.json",
129
+ "generated_from": "WebexTools/repo-standards@d89a7fe59126ae3ad9bac9ca352aa7f12b4c85dc",
130
+ "refresh_with": "The package holds no templates. It refers to the monorepo root snapshot at ../../../.sdd/templates/repo-standards through layout.monorepo_package.templates_root_path in .sdd/manifest.json. Refresh the root snapshot, not this package."
131
+ }
132
+ ],
133
+ "validation_matrix": [
134
+ {
135
+ "paths": [
136
+ "src/**"
137
+ ],
138
+ "minimum": [
139
+ "yarn workspace @webex/plugin-presence build:src",
140
+ "yarn workspace @webex/plugin-presence test:unit",
141
+ "yarn workspace @webex/plugin-presence test:style"
142
+ ],
143
+ "recommended": [
144
+ "add or update a case in test/unit/spec/presence.ts or test/unit/spec/presence-worker.ts for the changed behavior"
145
+ ]
146
+ },
147
+ {
148
+ "paths": [
149
+ "src/presence-worker.ts",
150
+ "src/constants.ts"
151
+ ],
152
+ "minimum": [
153
+ "yarn workspace @webex/plugin-presence build:src",
154
+ "yarn workspace @webex/plugin-presence test:unit",
155
+ "yarn workspace @webex/plugin-presence test:style"
156
+ ],
157
+ "recommended": [
158
+ "use sinon.useFakeTimers() for the 300 ms debounce and the 20-second groundskeeper, and check the updated envelope types clients switch on"
159
+ ]
160
+ },
161
+ {
162
+ "paths": [
163
+ "src/index.ts",
164
+ "src/config.ts"
165
+ ],
166
+ "minimum": [
167
+ "yarn workspace @webex/plugin-presence build:src",
168
+ "yarn workspace @webex/plugin-presence test:unit",
169
+ "yarn workspace @webex/plugin-presence test:style"
170
+ ],
171
+ "recommended": [
172
+ "no workspace package registers this plugin; when a default, the transform, or the registered name changes, check @webex/internal-plugin-presence, which registers the same transform name and config"
173
+ ]
174
+ },
175
+ {
176
+ "paths": [
177
+ "src/interface.ts"
178
+ ],
179
+ "minimum": [
180
+ "yarn workspace @webex/plugin-presence build",
181
+ "yarn workspace @webex/plugin-presence test:unit",
182
+ "yarn workspace @webex/plugin-presence test:style"
183
+ ],
184
+ "recommended": [
185
+ "keep IPresence and the result types in step with src/presence.ts; build fails on a type error"
186
+ ]
187
+ }
188
+ ],
189
+ "change_impact": [
190
+ {
191
+ "paths": [
192
+ "src/presence.ts",
193
+ "src/presence-batcher.ts"
194
+ ],
195
+ "affects": [
196
+ "the compositions, subscriptions, and events request bodies",
197
+ "the resolved result shapes {statusList} and {responses}",
198
+ "the presence feature toggle",
199
+ "the IPresence declarations in src/interface.ts"
200
+ ],
201
+ "refresh_with": [
202
+ "yarn workspace @webex/plugin-presence build:src"
203
+ ],
204
+ "validate_with": [
205
+ "yarn workspace @webex/plugin-presence test:unit",
206
+ "yarn workspace @webex/plugin-presence test:style"
207
+ ],
208
+ "avoid_direct_edits": [
209
+ "dist"
210
+ ],
211
+ "notes": "Keep at most 50 subjects per subscribe request and the dnd label rule (INV-001, INV-003)."
212
+ },
213
+ {
214
+ "paths": [
215
+ "src/presence-worker.ts",
216
+ "src/constants.ts"
217
+ ],
218
+ "affects": [
219
+ "when the worker fetches, subscribes, renews, and expires",
220
+ "the 'updated' event and its envelope types"
221
+ ],
222
+ "refresh_with": [
223
+ "yarn workspace @webex/plugin-presence build:src"
224
+ ],
225
+ "validate_with": [
226
+ "yarn workspace @webex/plugin-presence test:unit",
227
+ "yarn workspace @webex/plugin-presence test:style"
228
+ ],
229
+ "avoid_direct_edits": [
230
+ "dist"
231
+ ],
232
+ "notes": "The worker keeps times and counts only; each start adds a listener and an interval that nothing removes."
233
+ },
234
+ {
235
+ "paths": [
236
+ "src/index.ts",
237
+ "src/config.ts"
238
+ ],
239
+ "affects": [
240
+ "config.presence batcher defaults",
241
+ "the SDK-wide inbound transform normalizeSingleStatusResponse"
242
+ ],
243
+ "refresh_with": [
244
+ "yarn workspace @webex/plugin-presence build:src"
245
+ ],
246
+ "validate_with": [
247
+ "yarn workspace @webex/plugin-presence test:unit",
248
+ "yarn workspace @webex/plugin-presence test:style"
249
+ ],
250
+ "avoid_direct_edits": [
251
+ "dist"
252
+ ],
253
+ "notes": "The transform runs on every inbound SDK response; no test asserts it or the defaults."
254
+ },
255
+ {
256
+ "paths": [
257
+ "src/interface.ts"
258
+ ],
259
+ "affects": [
260
+ "the published declarations at dist/types",
261
+ "the typedoc pages under the workspace docs/presence folder"
262
+ ],
263
+ "refresh_with": [
264
+ "yarn workspace @webex/plugin-presence build"
265
+ ],
266
+ "validate_with": [
267
+ "yarn workspace @webex/plugin-presence test:unit",
268
+ "yarn workspace @webex/plugin-presence test:style"
269
+ ],
270
+ "avoid_direct_edits": [
271
+ "dist"
272
+ ],
273
+ "notes": "Types are erased from dist/*.js; only build writes dist/types."
274
+ }
275
+ ],
276
+ "evidence_rules": [
277
+ {
278
+ "claim_category": "command_name",
279
+ "sources": [
280
+ "package.json"
281
+ ],
282
+ "requirement": "The script must exist in package.json scripts.",
283
+ "notes": "test:integration and test:browser do not exist, so the aggregate test script fails; the karma script is test:browser:broken and the integration spec is skipped."
284
+ },
285
+ {
286
+ "claim_category": "import_path",
287
+ "sources": [
288
+ "src/index.ts"
289
+ ],
290
+ "requirement": "A binding is public only if exported from src/index.ts.",
291
+ "notes": "The only export is the default Presence; the src/interface.ts types are not re-exported."
292
+ },
293
+ {
294
+ "claim_category": "behavior_claim",
295
+ "sources": [
296
+ "src",
297
+ "test/unit/spec"
298
+ ],
299
+ "requirement": "Ground every behavioral claim in source and unit-test evidence.",
300
+ "notes": "Commit history is not an evidence source for this package. README.md is context only (docs/adr/0001-retain-product-readme.md). The webex-core, internal-plugin-mercury, internal-plugin-feature, internal-plugin-device, and internal-plugin-presence specs were consulted; their code is the referee where a spec is silent or, as for Mercury's session model, stale. All 29 unit cases run."
301
+ }
302
+ ],
303
+ "negative_guidance": [
304
+ {
305
+ "rule": "Do not store presence objects in the worker.",
306
+ "why": "The client owns presence data and receives it through 'updated' envelopes."
307
+ },
308
+ {
309
+ "rule": "Do not send more than 50 subjects in one subscribe request.",
310
+ "why": "The code comment limits batches to 50 ids per request."
311
+ },
312
+ {
313
+ "rule": "Do not widen the inbound transform predicate.",
314
+ "why": "It runs on every inbound SDK response, not only presence responses."
315
+ },
316
+ {
317
+ "rule": "Do not start another interval or Mercury listener without a way to stop it.",
318
+ "why": "Nothing removes the existing ones; each start duplicates work and events."
319
+ },
320
+ {
321
+ "rule": "Do not log presence data, statuses, or user ids.",
322
+ "why": "They are other users' personal data; the package has no log line today."
323
+ },
324
+ {
325
+ "rule": "Do not treat README.md as a usage reference.",
326
+ "why": "Its Usage block names a placeholder member; see docs/adr/0001-retain-product-readme.md."
327
+ },
328
+ {
329
+ "rule": "Do not infer a coverage threshold for this package.",
330
+ "why": "No coverage script or threshold exists."
331
+ },
332
+ {
333
+ "rule": "Do not change a method signature without changing src/interface.ts.",
334
+ "why": "The published declarations come from it, and they already omit initializeWorker."
335
+ }
336
+ ],
337
+ "confidence_policy": {
338
+ "high": {
339
+ "action": "update",
340
+ "expectation": "Source and a running unit case agree, as for the argument checks, subscribe batching, the dnd label rule, initializeWorker, and the worker map rules."
341
+ },
342
+ "medium": {
343
+ "action": "narrow-scope",
344
+ "expectation": "Only source evidence, or a skipped integration case, exists, as for registration, the transform, the feature toggle, the batcher, and the Mercury update. Pin current behavior with a running unit case before modifying."
345
+ },
346
+ "low": {
347
+ "action": "noop",
348
+ "expectation": "Neither source, tests, nor a dependency's spec or code settles the question. Stop and report the gap."
349
+ }
350
+ },
351
+ "repository_topology": {
352
+ "main_entrypoints": [
353
+ {
354
+ "name": "package entry",
355
+ "path": "src/index.ts",
356
+ "purpose": "Registers the presence plugin and its transform, and default-exports the class",
357
+ "notes": "No subpath exports; package.json main is dist/index.js, types is dist/types/index.d.ts, and devMain is src/index.js."
358
+ }
359
+ ],
360
+ "workspace_packages": [
361
+ {
362
+ "name": "@webex/plugin-presence",
363
+ "paths": [
364
+ "src",
365
+ "test"
366
+ ],
367
+ "notes": "One module; this SDD root is the package directory inside the webex-js-sdk monorepo."
368
+ }
369
+ ],
370
+ "source_surfaces": [
371
+ {
372
+ "name": "Presence plugin",
373
+ "paths": [
374
+ "src"
375
+ ],
376
+ "notes": "index.ts, presence.ts, presence-batcher.ts, presence-worker.ts, interface.ts, constants.ts, config.ts. Specified at src/docs/README.md."
377
+ },
378
+ {
379
+ "name": "tests",
380
+ "paths": [
381
+ "test/unit/spec",
382
+ "test/integration/spec"
383
+ ],
384
+ "notes": "Unit specs run by test:unit, 29 of 29 passing; the live-service spec is skipped and no script runs it."
385
+ }
386
+ ],
387
+ "generated_surfaces": [
388
+ {
389
+ "name": "build output",
390
+ "paths": [
391
+ "dist"
392
+ ],
393
+ "generated_from": "src",
394
+ "refresh_with": "yarn workspace @webex/plugin-presence build:src",
395
+ "notes": "JavaScript and source maps from webex-legacy-tools; build also writes dist/types through tsc. Do not edit by hand."
396
+ },
397
+ {
398
+ "name": "repo-standards template map",
399
+ "paths": [
400
+ "../../../.sdd/templates/repo-standards"
401
+ ],
402
+ "generated_from": "WebexTools/repo-standards@d89a7fe59126ae3ad9bac9ca352aa7f12b4c85dc",
403
+ "refresh_with": "The package holds no templates. It refers to the monorepo root snapshot at ../../../.sdd/templates/repo-standards through layout.monorepo_package.templates_root_path in .sdd/manifest.json. Refresh the root snapshot, not this package.",
404
+ "notes": "The package holds no templates. It refers to the monorepo root snapshot at ../../../.sdd/templates/repo-standards through layout.monorepo_package.templates_root_path in .sdd/manifest.json. Refresh the root snapshot, not this package."
405
+ }
406
+ ],
407
+ "validation_entrypoints": [
408
+ {
409
+ "name": "compile",
410
+ "command": "yarn workspace @webex/plugin-presence build",
411
+ "scope": "src",
412
+ "notes": "Runs tsc for declarations into dist/types, then build:src."
413
+ },
414
+ {
415
+ "name": "unit-test",
416
+ "command": "yarn workspace @webex/plugin-presence test:unit",
417
+ "scope": "test/unit/spec",
418
+ "notes": "Run build:src first; the specs test dist. 29 of 29 cases pass."
419
+ },
420
+ {
421
+ "name": "lint",
422
+ "command": "yarn workspace @webex/plugin-presence test:style",
423
+ "scope": "src",
424
+ "notes": "eslint via the local .eslintrc.js; docs/** and *.md are ignored."
425
+ }
426
+ ],
427
+ "sync_paths": [
428
+ {
429
+ "source": "src/presence-worker.ts",
430
+ "targets": [
431
+ "src/docs/README.md"
432
+ ],
433
+ "mechanism": "Manual; update the module specification in the same change that alters observable behavior.",
434
+ "notes": "Keep the request, worker timing, envelope type, and transform rows of the specification aligned with the code."
435
+ },
436
+ {
437
+ "source": "src/presence.ts",
438
+ "targets": [
439
+ "src/interface.ts",
440
+ "src/docs/README.md"
441
+ ],
442
+ "mechanism": "Manual; change the IPresence declaration and the module specification in the same change as a method.",
443
+ "notes": "build fails on a type error but does not detect a method missing from IPresence."
444
+ },
445
+ {
446
+ "source": "WebexTools/repo-standards@d89a7fe59126ae3ad9bac9ca352aa7f12b4c85dc",
447
+ "targets": [
448
+ "../../../.sdd/templates/repo-standards"
449
+ ],
450
+ "mechanism": "The package holds no templates. It refers to the monorepo root snapshot at ../../../.sdd/templates/repo-standards through layout.monorepo_package.templates_root_path in .sdd/manifest.json. Refresh the root snapshot, not this package.",
451
+ "notes": "The package holds no templates. It refers to the monorepo root snapshot at ../../../.sdd/templates/repo-standards through layout.monorepo_package.templates_root_path in .sdd/manifest.json. Refresh the root snapshot, not this package."
452
+ }
453
+ ]
454
+ },
455
+ "folder_readme_contract": {
456
+ "required_sections": [
457
+ "purpose",
458
+ "boundaries",
459
+ "key-files",
460
+ "common-tasks"
461
+ ],
462
+ "rules": [
463
+ "Orient the reader before describing detail.",
464
+ "Link to the module specification rather than duplicating it."
465
+ ],
466
+ "example_policy": "Examples are allowed only when verified against src/ or test/.",
467
+ "fallback": "Omit a section rather than inventing content; report unresolved facts as gaps."
468
+ },
469
+ "regression_feedback_rules": [
470
+ {
471
+ "trigger": "A request method, body, resource, or result shape in src/presence.ts or src/presence-batcher.ts changes.",
472
+ "required_followups": [
473
+ "Add or update a case in test/unit/spec/presence.ts",
474
+ "Update src/interface.ts",
475
+ "Update MOD-004 to MOD-010 and INV-001, INV-002, INV-003, INV-006 in src/docs/README.md"
476
+ ],
477
+ "notes": "Clients read {statusList} and {responses}."
478
+ },
479
+ {
480
+ "trigger": "A worker timing, map rule, or envelope type changes.",
481
+ "required_followups": [
482
+ "Add or update a case in test/unit/spec/presence-worker.ts with fake timers",
483
+ "Update MOD-011 to MOD-017, INV-004, INV-005, and the State machine in src/docs/README.md"
484
+ ],
485
+ "notes": "Clients switch on the 'updated' envelope type."
486
+ },
487
+ {
488
+ "trigger": "The registration, transform, or config defaults change.",
489
+ "required_followups": [
490
+ "Add unit cases; none exist today",
491
+ "Update MOD-001 to MOD-003 in src/docs/README.md"
492
+ ],
493
+ "notes": "The transform applies to every inbound SDK response."
494
+ }
495
+ ],
496
+ "surface_owners": [
497
+ {
498
+ "surface": "module implementation and specifications",
499
+ "owner": "@webex/web-sdk",
500
+ "edit_boundary": "Owner per the default rule of the monorepo .github/CODEOWNERS; the file has no line for packages/@webex/plugin-presence."
501
+ }
502
+ ],
503
+ "do_not_edit": [
504
+ "dist",
505
+ "../../../.sdd/templates/repo-standards"
506
+ ],
507
+ "marker_scopes": {
508
+ "sdd": [
509
+ ".sdd/manifest.json",
510
+ "src/docs/README.md",
511
+ "docs"
512
+ ]
513
+ },
514
+ "fallback_rules": [
515
+ "When source and tests disagree, code is the referee and the disagreement is recorded rather than silently resolved.",
516
+ "When neither source nor tests settle a question, report it as a gap instead of inferring.",
517
+ "Commit history is not a valid rationale source for this package.",
518
+ "When a dependency's specification disagrees with that dependency's code, use the code and record the disagreement; when a dependency has no specification, use its code."
519
+ ],
520
+ "downstream_context_pack": {
521
+ "required_human_surfaces": [
522
+ "README.md",
523
+ "docs/index.md",
524
+ "docs/architecture.md",
525
+ "src/docs/README.md"
526
+ ],
527
+ "required_agent_operational_surfaces": [
528
+ "AGENTS.md",
529
+ "docs/specs/README.md"
530
+ ],
531
+ "required_machine_readable_surface": ".sdd/manifest.json",
532
+ "recommended_machine_readable_sections": [
533
+ "public_interfaces",
534
+ "change_impact",
535
+ "evidence_rules",
536
+ "negative_guidance",
537
+ "confidence_policy",
538
+ "repository_topology",
539
+ "folder_readme_contract",
540
+ "regression_feedback_rules"
541
+ ]
542
+ }
543
+ }