@webex/contact-center 3.11.0 → 3.12.0-auth-prejoin-fetch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.sdd/manifest.json +883 -0
- package/AGENTS.md +94 -0
- package/ai-docs/ARCHITECTURE.md +168 -0
- package/ai-docs/CONTRACTS.md +50 -0
- package/ai-docs/GETTING_STARTED.md +168 -0
- package/ai-docs/GLOSSARY.md +43 -0
- package/ai-docs/README.md +138 -0
- package/ai-docs/REVIEW_CHECKLIST.md +41 -0
- package/ai-docs/RULES.md +444 -0
- package/ai-docs/SECURITY.md +52 -0
- package/ai-docs/SERVICE_STATE.md +48 -0
- package/ai-docs/SPEC_INDEX.md +65 -0
- package/ai-docs/adr/0001-spec-source-policy.md +55 -0
- package/ai-docs/adr/README.md +8 -0
- package/ai-docs/adr/_adr-template.md +31 -0
- package/ai-docs/contact-center-spec.md +359 -0
- package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
- package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
- package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
- package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
- package/ai-docs/patterns/event-driven-patterns.md +485 -0
- package/ai-docs/patterns/testing-patterns.md +480 -0
- package/ai-docs/patterns/typescript-patterns.md +365 -0
- package/ai-docs/templates/README.md +102 -0
- package/ai-docs/templates/documentation/create-agents-md.md +240 -0
- package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
- package/ai-docs/templates/existing-service/bug-fix.md +254 -0
- package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
- package/ai-docs/templates/new-method/00-master.md +80 -0
- package/ai-docs/templates/new-method/01-requirements.md +232 -0
- package/ai-docs/templates/new-method/02-implementation.md +295 -0
- package/ai-docs/templates/new-method/03-tests.md +201 -0
- package/ai-docs/templates/new-method/04-validation.md +141 -0
- package/ai-docs/templates/new-service/00-master.md +109 -0
- package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
- package/ai-docs/templates/new-service/02-code-generation.md +346 -0
- package/ai-docs/templates/new-service/03-integration.md +178 -0
- package/ai-docs/templates/new-service/04-test-generation.md +205 -0
- package/ai-docs/templates/new-service/05-validation.md +145 -0
- package/dist/cc.js +818 -59
- package/dist/cc.js.map +1 -1
- package/dist/config.js +13 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +31 -3
- package/dist/constants.js.map +1 -1
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +127 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +34 -3
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/AddressBook.js +18 -15
- package/dist/services/AddressBook.js.map +1 -1
- package/dist/services/AnswerCallOnWebexService.js +174 -0
- package/dist/services/AnswerCallOnWebexService.js.map +1 -0
- package/dist/services/ApiAiAssistant.js +318 -0
- package/dist/services/ApiAiAssistant.js.map +1 -0
- package/dist/services/EntryPoint.js +46 -68
- package/dist/services/EntryPoint.js.map +1 -1
- package/dist/services/Queue.js +27 -22
- package/dist/services/Queue.js.map +1 -1
- package/dist/services/UserPreference.js +427 -0
- package/dist/services/UserPreference.js.map +1 -0
- package/dist/services/WebexCrossClientService.js +171 -0
- package/dist/services/WebexCrossClientService.js.map +1 -0
- package/dist/services/WxAppTelephonyMercurySync.js +93 -0
- package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
- package/dist/services/agent/types.js.map +1 -1
- package/dist/services/config/Util.js +11 -4
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +45 -8
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/index.js +41 -2
- package/dist/services/config/index.js.map +1 -1
- package/dist/services/config/types.js +70 -8
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/constants.js +27 -1
- package/dist/services/constants.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +122 -25
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/WebexRequest.js +6 -2
- package/dist/services/core/WebexRequest.js.map +1 -1
- package/dist/services/core/aqm-reqs.js +119 -30
- package/dist/services/core/aqm-reqs.js.map +1 -1
- package/dist/services/core/types.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +22 -6
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/core/websocket/connection-service.js +3 -1
- package/dist/services/core/websocket/connection-service.js.map +1 -1
- package/dist/services/core/websocket/types.js.map +1 -1
- package/dist/services/index.js +6 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/Task.js +754 -0
- package/dist/services/task/Task.js.map +1 -0
- package/dist/services/task/TaskFactory.js +49 -0
- package/dist/services/task/TaskFactory.js.map +1 -0
- package/dist/services/task/TaskManager.js +1073 -447
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +220 -23
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/WebexCallingUtils.js +70 -0
- package/dist/services/task/WebexCallingUtils.js.map +1 -0
- package/dist/services/task/constants.js +26 -2
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/contact.js +29 -0
- package/dist/services/task/contact.js.map +1 -1
- package/dist/services/task/dialer.js +129 -0
- package/dist/services/task/dialer.js.map +1 -1
- package/dist/services/task/digital/Digital.js +78 -0
- package/dist/services/task/digital/Digital.js.map +1 -0
- package/dist/services/task/state-machine/TaskStateMachine.js +971 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +572 -0
- package/dist/services/task/state-machine/actions.js.map +1 -0
- package/dist/services/task/state-machine/constants.js +161 -0
- package/dist/services/task/state-machine/constants.js.map +1 -0
- package/dist/services/task/state-machine/guards.js +409 -0
- package/dist/services/task/state-machine/guards.js.map +1 -0
- package/dist/services/task/state-machine/index.js +53 -0
- package/dist/services/task/state-machine/index.js.map +1 -0
- package/dist/services/task/state-machine/types.js +54 -0
- package/dist/services/task/state-machine/types.js.map +1 -0
- package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
- package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
- package/dist/services/task/taskDataNormalizer.js +99 -0
- package/dist/services/task/taskDataNormalizer.js.map +1 -0
- package/dist/services/task/types.js +243 -5
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1380 -0
- package/dist/services/task/voice/Voice.js.map +1 -0
- package/dist/services/task/voice/WebRTC.js +152 -0
- package/dist/services/task/voice/WebRTC.js.map +1 -0
- package/dist/services/task/voice/wxAppVoiceMethods.js +201 -0
- package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
- package/dist/services/wxAppTelephonyUtils.js +19 -0
- package/dist/services/wxAppTelephonyUtils.js.map +1 -0
- package/dist/types/cc.d.ts +967 -0
- package/dist/types/config.d.ts +79 -0
- package/dist/types/constants.d.ts +74 -0
- package/dist/types/index.d.ts +201 -0
- package/dist/types/logger-proxy.d.ts +71 -0
- package/dist/types/metrics/MetricsManager.d.ts +223 -0
- package/dist/types/metrics/behavioral-events.d.ts +29 -0
- package/dist/types/metrics/constants.d.ts +183 -0
- package/dist/types/services/AddressBook.d.ts +75 -0
- package/dist/types/services/AnswerCallOnWebexService.d.ts +37 -0
- package/dist/types/services/ApiAiAssistant.d.ts +49 -0
- package/dist/types/services/EntryPoint.d.ts +69 -0
- package/dist/types/services/Queue.d.ts +78 -0
- package/dist/types/services/UserPreference.d.ts +118 -0
- package/dist/types/services/WebCallingService.d.ts +1 -0
- package/dist/types/services/WebexCrossClientService.d.ts +28 -0
- package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
- package/dist/types/services/agent/index.d.ts +46 -0
- package/dist/types/services/agent/types.d.ts +413 -0
- package/dist/types/services/config/Util.d.ts +20 -0
- package/dist/types/services/config/constants.d.ts +273 -0
- package/dist/types/services/config/index.d.ts +177 -0
- package/dist/types/services/config/types.d.ts +1381 -0
- package/dist/types/services/constants.d.ts +110 -0
- package/dist/types/services/core/Err.d.ts +127 -0
- package/dist/types/services/core/GlobalTypes.d.ts +58 -0
- package/dist/types/services/core/Utils.d.ts +121 -0
- package/dist/types/services/core/WebexRequest.d.ts +23 -0
- package/dist/types/services/core/aqm-reqs.d.ts +65 -0
- package/dist/types/services/core/constants.d.ts +99 -0
- package/dist/types/services/core/types.d.ts +49 -0
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +36 -0
- package/dist/types/services/core/websocket/connection-service.d.ts +27 -0
- package/dist/types/services/core/websocket/keepalive.worker.d.ts +2 -0
- package/dist/types/services/core/websocket/types.d.ts +37 -0
- package/dist/types/services/index.d.ts +54 -0
- package/dist/types/services/task/AutoWrapup.d.ts +40 -0
- package/dist/types/services/task/Task.d.ts +175 -0
- package/dist/types/services/task/TaskFactory.d.ts +13 -0
- package/dist/types/services/task/TaskManager.d.ts +1 -0
- package/dist/types/services/task/TaskUtils.d.ts +138 -0
- package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
- package/dist/types/services/task/constants.d.ts +94 -0
- package/dist/types/services/task/contact.d.ts +73 -0
- package/dist/types/services/task/dialer.d.ts +73 -0
- package/dist/types/services/task/digital/Digital.d.ts +22 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1398 -0
- package/dist/types/services/task/state-machine/actions.d.ts +10 -0
- package/dist/types/services/task/state-machine/constants.d.ts +107 -0
- package/dist/types/services/task/state-machine/guards.d.ts +103 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +277 -0
- package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
- package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
- package/dist/types/services/task/types.d.ts +1933 -0
- package/dist/types/services/task/voice/Voice.d.ts +223 -0
- package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
- package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +52 -0
- package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
- package/dist/types/types.d.ts +784 -0
- package/dist/types/utils/PageCache.d.ts +190 -0
- package/dist/types/webex-config.d.ts +53 -0
- package/dist/types/webex.d.ts +8 -0
- package/dist/types.js +137 -3
- package/dist/types.js.map +1 -1
- package/dist/utils/PageCache.js +19 -5
- package/dist/utils/PageCache.js.map +1 -1
- package/dist/webex.js +14 -2
- package/dist/webex.js.map +1 -1
- package/package.json +16 -12
- package/src/cc.ts +983 -60
- package/src/config.ts +13 -0
- package/src/constants.ts +29 -1
- package/src/index.ts +26 -5
- package/src/metrics/ai-docs/AGENTS.md +350 -0
- package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
- package/src/metrics/ai-docs/metrics-spec.md +860 -0
- package/src/metrics/behavioral-events.ts +134 -0
- package/src/metrics/constants.ts +39 -3
- package/src/services/AddressBook.ts +17 -6
- package/src/services/AnswerCallOnWebexService.ts +206 -0
- package/src/services/ApiAiAssistant.ts +412 -0
- package/src/services/EntryPoint.ts +59 -60
- package/src/services/Queue.ts +29 -12
- package/src/services/UserPreference.ts +509 -0
- package/src/services/WebexCrossClientService.ts +212 -0
- package/src/services/WxAppTelephonyMercurySync.ts +115 -0
- package/src/services/agent/ai-docs/AGENTS.md +240 -0
- package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
- package/src/services/agent/ai-docs/agent-spec.md +504 -0
- package/src/services/agent/types.ts +1 -1
- package/src/services/ai-docs/AGENTS.md +386 -0
- package/src/services/ai-docs/services-spec.md +497 -0
- package/src/services/config/Util.ts +13 -2
- package/src/services/config/ai-docs/AGENTS.md +255 -0
- package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
- package/src/services/config/ai-docs/config-spec.md +675 -0
- package/src/services/config/constants.ts +47 -7
- package/src/services/config/index.ts +45 -1
- package/src/services/config/types.ts +253 -11
- package/src/services/constants.ts +29 -0
- package/src/services/core/Err.ts +4 -0
- package/src/services/core/Utils.ts +143 -30
- package/src/services/core/WebexRequest.ts +3 -1
- package/src/services/core/ai-docs/AGENTS.md +381 -0
- package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
- package/src/services/core/ai-docs/core-spec.md +787 -0
- package/src/services/core/aqm-reqs.ts +125 -32
- package/src/services/core/types.ts +2 -0
- package/src/services/core/websocket/WebSocketManager.ts +23 -6
- package/src/services/core/websocket/connection-service.ts +5 -1
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/index.ts +4 -0
- package/src/services/task/Task.ts +908 -0
- package/src/services/task/TaskFactory.ts +60 -0
- package/src/services/task/TaskManager.ts +1291 -513
- package/src/services/task/TaskUtils.ts +314 -24
- package/src/services/task/WebexCallingUtils.ts +136 -0
- package/src/services/task/ai-docs/AGENTS.md +457 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
- package/src/services/task/ai-docs/task-spec.md +1469 -0
- package/src/services/task/constants.ts +26 -0
- package/src/services/task/contact.ts +30 -0
- package/src/services/task/dialer.ts +136 -1
- package/src/services/task/digital/Digital.ts +97 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +1313 -0
- package/src/services/task/state-machine/actions.ts +741 -0
- package/src/services/task/state-machine/ai-docs/AGENTS.md +462 -0
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1146 -0
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2209 -0
- package/src/services/task/state-machine/constants.ts +172 -0
- package/src/services/task/state-machine/guards.ts +498 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +258 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +843 -70
- package/src/services/task/voice/Voice.ts +1720 -0
- package/src/services/task/voice/WebRTC.ts +191 -0
- package/src/services/task/voice/wxAppVoiceMethods.ts +307 -0
- package/src/services/wxAppTelephonyUtils.ts +14 -0
- package/src/types.ts +238 -11
- package/src/utils/AGENTS.md +289 -0
- package/src/utils/PageCache.ts +38 -5
- package/src/utils/ai-docs/utils-spec.md +391 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +1856 -122
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/metrics/behavioral-events.ts +18 -0
- package/test/unit/spec/services/AddressBook.ts +37 -6
- package/test/unit/spec/services/AnswerCallOnWebexService.ts +223 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +273 -0
- package/test/unit/spec/services/EntryPoint.ts +87 -40
- package/test/unit/spec/services/Queue.ts +123 -12
- package/test/unit/spec/services/UserPreference.ts +401 -0
- package/test/unit/spec/services/WebCallingService.ts +7 -1
- package/test/unit/spec/services/WebexCrossClientService.ts +261 -0
- package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +113 -0
- package/test/unit/spec/services/config/Util.ts +85 -0
- package/test/unit/spec/services/config/index.ts +85 -29
- package/test/unit/spec/services/core/Utils.ts +481 -2
- package/test/unit/spec/services/core/WebexRequest.ts +3 -1
- package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +137 -41
- package/test/unit/spec/services/core/websocket/connection-service.ts +3 -1
- package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
- package/test/unit/spec/services/task/Task.ts +677 -0
- package/test/unit/spec/services/task/TaskFactory.ts +99 -0
- package/test/unit/spec/services/task/TaskManager.ts +2209 -918
- package/test/unit/spec/services/task/TaskUtils.ts +235 -0
- package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
- package/test/unit/spec/services/task/contact.ts +33 -0
- package/test/unit/spec/services/task/dialer.ts +372 -96
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +3433 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +1523 -0
- package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
- package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +459 -0
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
- package/dist/services/task/index.js +0 -1525
- package/dist/services/task/index.js.map +0 -1
- package/src/services/task/index.ts +0 -1801
- package/test/unit/spec/services/task/index.ts +0 -2184
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Service State (living) — @webex/contact-center
|
|
2
|
+
|
|
3
|
+
> Start here → root [`AGENTS.md`](../AGENTS.md) · router [`SPEC_INDEX.md`](SPEC_INDEX.md) · system [`ARCHITECTURE.md`](ARCHITECTURE.md). Read before adding a surface.
|
|
4
|
+
|
|
5
|
+
## Current Events
|
|
6
|
+
|
|
7
|
+
| Event / topic | Direction | Producer/consumer | Payload ref |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| `agent:*` | publish | ContactCenter → application | `src/services/agent/types.ts` |
|
|
10
|
+
| `task:*` | publish | Task/TaskManager → application | `src/services/task/types.ts` |
|
|
11
|
+
| `CC_EVENTS` | consume | WCC WebSocket → Core/ContactCenter/Task/AqmReqs | `src/services/config/types.ts` |
|
|
12
|
+
| realtime transcript/suggestion | consume/publish | RTD WebSocket → owning Task | `src/services/task/TaskManager.ts` |
|
|
13
|
+
|
|
14
|
+
## Data Stores
|
|
15
|
+
|
|
16
|
+
| Store | Purpose | Owned by this service? |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| In-memory PageCache Map | temporary paginated lookup reuse | ephemeral only; yes for cache entries |
|
|
19
|
+
| Remote WCC stores | agent/task/config domain state | no |
|
|
20
|
+
|
|
21
|
+
## External Dependencies
|
|
22
|
+
|
|
23
|
+
| Dependency | Used for | Timeout / retry | Circuit breaker / fallback |
|
|
24
|
+
|---|---|---|---|
|
|
25
|
+
| WCC API gateway | agent/task/config/data operations | operation/AQM timeouts | propagate structured failure |
|
|
26
|
+
| WCC WebSocket/RTD | realtime events and completion | reconnect and recovery timers | reconnect/silent relogin/restore failure |
|
|
27
|
+
| Webex Calling | BROWSER call lifecycle | async registration/call timeouts | emit/rethrow calling failure |
|
|
28
|
+
| Webex metrics | telemetry | nonblocking queued submission | log/drop without breaking product flow |
|
|
29
|
+
|
|
30
|
+
## Key Metrics & Performance Targets
|
|
31
|
+
|
|
32
|
+
| Signal | Target | Where measured |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| Unit coverage | 85% branches/functions/lines/statements | package Jest configuration |
|
|
35
|
+
| Operation duration/success/failure | no local numeric SLO routed | MetricsManager event taxonomy |
|
|
36
|
+
| Connection recovery | explicit 8s disconnect, 5s retry, configured restore timeout | Core constants/ConnectionService |
|
|
37
|
+
|
|
38
|
+
## Feature Flags (current)
|
|
39
|
+
|
|
40
|
+
| Flag/config | Gates | Current default | Owner | Safe to remove when |
|
|
41
|
+
|---|---|---|---|---|
|
|
42
|
+
| `allowAutomatedRelogin` | silent relogin after recovery | config-defined | ContactCenter | replacement recovery contract exists |
|
|
43
|
+
| `webRtcEnabled` / login option | browser calling path | remote profile | Config/WCC | remote contract removed |
|
|
44
|
+
| task UI/config flags | task controls and operations | profile/config-defined | Task/Config | owning behavior removed |
|
|
45
|
+
|
|
46
|
+
## Maintenance
|
|
47
|
+
|
|
48
|
+
- Update the relevant row in the same change as any surface, dependency, timeout, metric, or flag.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Spec Index — @webex/contact-center
|
|
2
|
+
|
|
3
|
+
> Start here → root [`AGENTS.md`](../AGENTS.md). This router mirrors `.sdd/manifest.json`; system overview: [`ARCHITECTURE.md`](ARCHITECTURE.md).
|
|
4
|
+
|
|
5
|
+
## Module Registry
|
|
6
|
+
|
|
7
|
+
| Module | Responsibility | Manifest coverage state | Start here |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| `src` | Own the published Webex Contact Center SDK plugin surface, registration lifecycle, public method delegation, and application-facing event routing. | Partial | `ai-docs/contact-center-spec.md` |
|
|
10
|
+
| `src/metrics` | Own timing, taxonomy, queuing, payload preparation, and submission for Contact Center behavioral, operational, and business telemetry. | Partial | `src/metrics/ai-docs/metrics-spec.md` |
|
|
11
|
+
| `src/services` | Own composition and bootstrap order for backend request, realtime, data, and WebRTC service collaborators. | Partial | `src/services/ai-docs/services-spec.md` |
|
|
12
|
+
| `src/services/agent` | Own agent login, logout, state-change, buddy-agent, device-update, and silent-relogin request contracts. | Partial | `src/services/agent/ai-docs/agent-spec.md` |
|
|
13
|
+
| `src/services/config` | Own retrieval and aggregation of remote organization, agent, team, profile, auxiliary-code, dial-plan, and feature configuration. | Partial | `src/services/config/ai-docs/config-spec.md` |
|
|
14
|
+
| `src/services/core` | Own authenticated HTTP, realtime WebSocket lifecycle, AQM request correlation, reconnect/keepalive behavior, and shared error normalization. | Partial | `src/services/core/ai-docs/core-spec.md` |
|
|
15
|
+
| `src/services/task` | Own task creation, media-specific behavior, call-control operations, lifecycle orchestration, task events, and integration with the task state machine. | Partial | `src/services/task/ai-docs/task-spec.md` |
|
|
16
|
+
| `src/services/task/state-machine` | Own deterministic task lifecycle states, transition guards/actions, typed internal events, and state-derived UI-control availability. | Partial | `src/services/task/state-machine/ai-docs/task-state-machine-spec.md` |
|
|
17
|
+
| `src/utils` | Own shared pagination contracts and the bounded in-memory page cache used by Contact Center data services. | Partial | `src/utils/ai-docs/utils-spec.md` |
|
|
18
|
+
|
|
19
|
+
## Task Routing
|
|
20
|
+
|
|
21
|
+
| If the task is… | Load |
|
|
22
|
+
|---|---|
|
|
23
|
+
| Understanding the package | `ARCHITECTURE.md` |
|
|
24
|
+
| Working in a module | That module's specification from the registry |
|
|
25
|
+
| Changing exported APIs/events/types | `CONTRACTS.md`, Contact Center spec, and owning module spec |
|
|
26
|
+
| Changing task state | Task and Task State Machine specs |
|
|
27
|
+
| Changing transport/recovery | Core spec and `SECURITY.md` |
|
|
28
|
+
| New feature or defect | Run lifecycle intake against the affected module specs |
|
|
29
|
+
|
|
30
|
+
## Intake Routing
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
New feature / bug / contract change → lifecycle intake questionnaire → feature spec/design
|
|
34
|
+
New module → update module registry + module spec + contracts
|
|
35
|
+
Doc/spec backfill → reconcile target → conformance → coverage → independent validation
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Incident History
|
|
39
|
+
|
|
40
|
+
| INC id | Date | Module | One-line | Link |
|
|
41
|
+
|---|---|---|---|---|
|
|
42
|
+
| None routed | 2026-07-07 | N/A | No incident/RCA source was supplied during onboarding. | N/A |
|
|
43
|
+
|
|
44
|
+
## Phase-Based Loading Protocol
|
|
45
|
+
|
|
46
|
+
| Phase | Load |
|
|
47
|
+
|---|---|
|
|
48
|
+
| Orient | AGENTS.md + this file |
|
|
49
|
+
| Specify | relevant module specs + questionnaire |
|
|
50
|
+
| Build | selected module specs + RULES/patterns |
|
|
51
|
+
| Verify | independent validation and coverage evidence |
|
|
52
|
+
|
|
53
|
+
## Spec Registry
|
|
54
|
+
|
|
55
|
+
| Doc | Location | Purpose |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| Patterns | `patterns/` | Existing implementation conventions |
|
|
58
|
+
| Rules | `RULES.md` | Enforceable do/don't constraints |
|
|
59
|
+
| Glossary | `GLOSSARY.md` | Domain language |
|
|
60
|
+
| Security | `SECURITY.md` | Trust boundaries and sensitive-data rules |
|
|
61
|
+
| Contracts | `CONTRACTS.md` | Public/export/event/dependency index |
|
|
62
|
+
| Service state | `SERVICE_STATE.md` | Current as-built surfaces/dependencies/flags |
|
|
63
|
+
| Getting started | `GETTING_STARTED.md` | Build/test loop |
|
|
64
|
+
| Decision records | `adr/` | Durable architecture decisions |
|
|
65
|
+
| Review catalog | `REVIEW_CHECKLIST.md` | Review gates |
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# ADR-0001 — Migrate legacy Contact Center AI docs into canonical SDD specs
|
|
2
|
+
|
|
3
|
+
| Field | Value |
|
|
4
|
+
|---|---|
|
|
5
|
+
| Status | Accepted |
|
|
6
|
+
| Date | 2026-07-07 |
|
|
7
|
+
| Deciders | Package maintainer / user |
|
|
8
|
+
| Supersedes / Superseded by | none |
|
|
9
|
+
|
|
10
|
+
## Context
|
|
11
|
+
|
|
12
|
+
The Contact Center package already contained module-local `AGENTS.md`, `ARCHITECTURE.md`, pattern, and workflow documents before canonical SDD specifications were introduced. Those files contain useful intent and examples, but allowing them to remain co-equal with the generated `*-spec.md` files would make documentation routing ambiguous and could preserve statements that have drifted from `src/**` and `test/**`.
|
|
13
|
+
|
|
14
|
+
The source inventory and canonical targets are recorded in `packages/@webex/contact-center/.sdd/manifest.json`. Code and tests remain the behavioral referee for every migrated statement.
|
|
15
|
+
|
|
16
|
+
## Decision
|
|
17
|
+
|
|
18
|
+
Use the `migrate-existing` source policy.
|
|
19
|
+
|
|
20
|
+
- Preserve relevant legacy content by meaning in the canonical SDD specification for each module.
|
|
21
|
+
- Treat manifest-routed legacy documents as reference-only migration sources, not canonical specifications.
|
|
22
|
+
- Route agents through `.sdd/manifest.json` and `ai-docs/SPEC_INDEX.md` to the canonical target.
|
|
23
|
+
- Retain legacy files with a banner pointing to their canonical target; if documentation conflicts with code or tests, code and tests win.
|
|
24
|
+
|
|
25
|
+
The SDD route replaces the former package-local workflow, classification summary, specification-summary gate, and service-routing tables with one sequence: read package `AGENTS.md`, select the owning spec through `SPEC_INDEX.md`, verify requirements against source/tests, obtain approval for the affected files/contracts, update code and its owning spec together, and run generator-side conformance plus independent semantic validation before staging.
|
|
26
|
+
|
|
27
|
+
| Module | Canonical target |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `src` | `ai-docs/contact-center-spec.md` |
|
|
30
|
+
| `src/metrics` | `src/metrics/ai-docs/metrics-spec.md` |
|
|
31
|
+
| `src/services` | `src/services/ai-docs/services-spec.md` |
|
|
32
|
+
| `src/services/agent` | `src/services/agent/ai-docs/agent-spec.md` |
|
|
33
|
+
| `src/services/config` | `src/services/config/ai-docs/config-spec.md` |
|
|
34
|
+
| `src/services/core` | `src/services/core/ai-docs/core-spec.md` |
|
|
35
|
+
| `src/services/task` | `src/services/task/ai-docs/task-spec.md` |
|
|
36
|
+
| `src/services/task/state-machine` | `src/services/task/state-machine/ai-docs/task-state-machine-spec.md` |
|
|
37
|
+
| `src/utils` | `src/utils/ai-docs/utils-spec.md` |
|
|
38
|
+
|
|
39
|
+
## Alternatives Considered
|
|
40
|
+
|
|
41
|
+
| Alternative | Pros | Cons | Why rejected |
|
|
42
|
+
|---|---|---|---|
|
|
43
|
+
| Keep legacy and SDD docs separate and co-equal | No migration work | Agents must choose between competing authorities; drift remains likely | Does not establish deterministic routing |
|
|
44
|
+
| Reconcile every legacy document in place | Preserves familiar paths | Keeps multiple canonical shapes and complicates validation | The package needs one template-compatible SDD surface |
|
|
45
|
+
| Delete legacy documents after migration | Removes ambiguity | Loses useful historical examples and context | Reference material remains valuable when clearly marked noncanonical |
|
|
46
|
+
|
|
47
|
+
## Consequences
|
|
48
|
+
|
|
49
|
+
- **Positive:** Each module has one machine-routed canonical specification and a durable, reviewable policy record.
|
|
50
|
+
- **Negative / cost:** Retained legacy documents require reference-only banners and must not be updated as independent authorities.
|
|
51
|
+
- **Agents must:** Read the manifest and `SPEC_INDEX.md`, open the canonical `*-spec.md`, and cross-check behavior against source and tests.
|
|
52
|
+
|
|
53
|
+
## Revisit When
|
|
54
|
+
|
|
55
|
+
- A module is promoted from `Partial` to `Specced`, a canonical target is relocated, or a legacy file is proposed for removal.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Architecture Decision Records
|
|
2
|
+
|
|
3
|
+
Use this append-only directory for durable decisions that constrain future Contact Center SDK work.
|
|
4
|
+
|
|
5
|
+
- One decision per `NNNN-short-title.md` file.
|
|
6
|
+
- Accepted ADRs are immutable; supersede them with a new ADR.
|
|
7
|
+
- Record Context, Decision, Alternatives Considered, Consequences, and Revisit When.
|
|
8
|
+
- Link ADRs from the affected module specs and `ARCHITECTURE.md`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# ADR-NNNN — Short decision title
|
|
2
|
+
|
|
3
|
+
| Field | Value |
|
|
4
|
+
|---|---|
|
|
5
|
+
| Status | Proposed |
|
|
6
|
+
| Date | YYYY-MM-DD |
|
|
7
|
+
| Deciders | roles |
|
|
8
|
+
| Supersedes / Superseded by | none |
|
|
9
|
+
|
|
10
|
+
## Context
|
|
11
|
+
|
|
12
|
+
State the code-grounded forces and evidence paths.
|
|
13
|
+
|
|
14
|
+
## Decision
|
|
15
|
+
|
|
16
|
+
State the directive.
|
|
17
|
+
|
|
18
|
+
## Alternatives Considered
|
|
19
|
+
|
|
20
|
+
| Alternative | Pros | Cons | Why rejected |
|
|
21
|
+
|---|---|---|---|
|
|
22
|
+
|
|
23
|
+
## Consequences
|
|
24
|
+
|
|
25
|
+
- **Positive:**
|
|
26
|
+
- **Negative / cost:**
|
|
27
|
+
- **Agents must:**
|
|
28
|
+
|
|
29
|
+
## Revisit When
|
|
30
|
+
|
|
31
|
+
- Define a measurable reconsideration trigger.
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
# Contact Center — SPEC
|
|
2
|
+
|
|
3
|
+
> Start here → root [`AGENTS.md`](../AGENTS.md) · router [`SPEC_INDEX.md`](SPEC_INDEX.md) · system [`ARCHITECTURE.md`](ARCHITECTURE.md). This is the module's canonical specification.
|
|
4
|
+
|
|
5
|
+
## Metadata
|
|
6
|
+
|
|
7
|
+
| Field | Value |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Module id | `contact-center` |
|
|
10
|
+
| Source path(s) | `src` |
|
|
11
|
+
| Doc kind | Module spec |
|
|
12
|
+
| Coverage score | Partial (manifest-authoritative); 15/15 required document fields present |
|
|
13
|
+
| Generated from | `module-spec` @ SDLC template library `0.2.1` |
|
|
14
|
+
| generated_by / approved_by / updated_at | Codex generator / developer-approved follow-up review remediation / 2026-08-21 |
|
|
15
|
+
| Validation status | Follow-up validation passed (independent Claude fallback, 2026-07-21); 1 existing test-coverage gap; coverage remains Partial |
|
|
16
|
+
|
|
17
|
+
## Evidence Rules
|
|
18
|
+
Every requirement cites stable source and test file paths. Code/tests are the behavioral referee; routed source text supplies explicit intent and rationale. Missing or contradictory evidence blocks promotion.
|
|
19
|
+
|
|
20
|
+
## Source Material Register
|
|
21
|
+
| Source material | Scope | Decision | Detail location or disposition |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| Reviewed prior module guides and architecture material | overview / architecture / API / tests | used and code-checked | Content is placed by meaning throughout this specification; exact routing remains in the manifest. |
|
|
24
|
+
|
|
25
|
+
## Overview
|
|
26
|
+
Contact Center is one of nine confirmed Contact Center SDK modules. Own the published Webex Contact Center SDK plugin surface, registration lifecycle, public method delegation, and application-facing event routing. Existing reviewed documentation is migrated by meaning and code/tests remain the behavioral referee.
|
|
27
|
+
|
|
28
|
+
The `@webex/contact-center` package is a Webex SDK plugin that provides a TypeScript/JavaScript API for building Contact Center agent applications. It enables:
|
|
29
|
+
|
|
30
|
+
- **Agent Session Management**: Register, login, logout, state changes
|
|
31
|
+
|
|
32
|
+
- **Task Handling**: Inbound/outbound calls, chat, transfers, conferences
|
|
33
|
+
|
|
34
|
+
- **Real-time Events**: WebSocket-based notifications for agent and task events
|
|
35
|
+
|
|
36
|
+
- **Browser-based Calling**: WebRTC integration for browser softphone
|
|
37
|
+
|
|
38
|
+
- **Metrics & Diagnostics**: Built-in telemetry and log upload
|
|
39
|
+
|
|
40
|
+
- **Answer on Webex**: Accept, Decline, Mute, and DTMF for voice offers when the agent uses Webex App desktop calling (`enableWxBetterTogether`).
|
|
41
|
+
|
|
42
|
+
## Purpose / Responsibility
|
|
43
|
+
Own the published Webex Contact Center SDK plugin surface, registration lifecycle, public method delegation, and application-facing event routing.
|
|
44
|
+
|
|
45
|
+
## Stack
|
|
46
|
+
TypeScript 5.4, WebexPlugin, Node EventEmitter, WebSocket/WebRTC integrations, Jest 27, Yarn 3.4.1.
|
|
47
|
+
|
|
48
|
+
## Folder / Package Structure
|
|
49
|
+
```text
|
|
50
|
+
src/
|
|
51
|
+
├── index.ts package exports and plugin registration
|
|
52
|
+
├── cc.ts ContactCenter façade and lifecycle orchestration
|
|
53
|
+
├── types.ts package-level public contracts
|
|
54
|
+
├── metrics/ telemetry manager and taxonomy
|
|
55
|
+
├── services/ transport, agent, config, data, and calling collaborators
|
|
56
|
+
│ ├── UserPreference.ts user-preference CRUD REST client
|
|
57
|
+
│ └── task/ task objects, manager, media implementations, state machine
|
|
58
|
+
└── utils/PageCache.ts shared pagination cache
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Key Files (source of truth)
|
|
62
|
+
| File | Holds |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `src/index.ts` | Authoritative Contact Center implementation or contract source. |
|
|
65
|
+
| `src/cc.ts` | Authoritative Contact Center implementation or contract source. |
|
|
66
|
+
| `src/types.ts` | Authoritative Contact Center implementation or contract source. |
|
|
67
|
+
| `src/constants.ts` | Authoritative Contact Center implementation or contract source. |
|
|
68
|
+
| `src/config.ts` | Authoritative Contact Center implementation or contract source. |
|
|
69
|
+
| `src/services/UserPreference.ts` | User-preference CRUD implementation exposed through `cc.userPreference`. |
|
|
70
|
+
| `src/services/task/dialer.ts` | Preview-campaign AQM request implementations. |
|
|
71
|
+
| `src/services/task/types.ts` | `PreviewContactPayload`, `DropConferenceParticipantPayload`, `TaskResponse`, and task contract types. |
|
|
72
|
+
|
|
73
|
+
## Public Surface
|
|
74
|
+
| Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
|
|
75
|
+
|---|---|---|---|---|---|---|
|
|
76
|
+
| `contact-center.surface` | SDK / event / internal API | Published `@webex/contact-center` exports and the `ContactCenter` (`cc`) WebexPlugin API. | Stable module consumption boundary. | Additive changes by default; breaking package exports require a major-version transition. | `src/index.ts` | `CONTRACTS.md` |
|
|
77
|
+
| `contact-center.consult-transfer-lists` | SDK data API | Existing `getQueues` and `getEntryPoints` methods, their existing search/response types, and full `ContactServiceQueue` / `EntryPointRecord` rows. | Provide consult/transfer telephony defaults without adding a parallel list API or projected destination model. | Behavioral default correction; explicit existing filter/sort/profile inputs remain overrides and full record types remain the response contract. | `src/cc.ts`, `src/services/Queue.ts`, `src/services/EntryPoint.ts`, `src/types.ts` | `CONTRACTS.md` |
|
|
78
|
+
| `contact-center.consult-transfer-controls` | SDK task control API | Ordered `TaskUIControls.consultTransferDestinations` arrays using the existing destination values. | Give all Task consumers the same ordered, action-specific destination visibility without a second policy call. | Additive public field; consumers may hide SDK-allowed categories but must not enable omitted categories. | `src/cc.ts`, `src/services/task/types.ts`, `src/services/task/state-machine/uiControlsComputer.ts`, `src/index.ts` | `CONTRACTS.md` |
|
|
79
|
+
| `contact-center.user-preference` | SDK data API | Exported `UserPreference`, `cc.userPreference`, and user-preference request/response types. | Read and mutate user preferences through authenticated REST operations. | Additive public API; removals or signature changes are breaking. | `src/services/UserPreference.ts`, `src/services/config/types.ts` | `CONTRACTS.md` |
|
|
80
|
+
| `contact-center.preview-campaign` | SDK task API | `acceptPreviewContact`, `skipPreviewContact`, `removePreviewContact`. | Resolve campaign preview reservations through typed AQM operations. | Additive public API; removals or signature changes are breaking. | `src/cc.ts`, `src/services/task/dialer.ts`, `src/services/task/types.ts` | `CONTRACTS.md` |
|
|
81
|
+
| `contact-center.conference-participant-drop` | SDK task API | Exported `DropConferenceParticipantPayload` and `ITask.dropConferenceParticipant`. | Remove a conference participant through the media-specific task implementation and correlated AQM completion. | Additive public API; removals or signature changes are breaking. | `src/index.ts`, `src/services/task/types.ts`, `src/services/task/voice/Voice.ts` | `CONTRACTS.md` |
|
|
82
|
+
|
|
83
|
+
Compatibility notes:
|
|
84
|
+
- Do not remove or reinterpret exported symbols/events without a documented consumer migration.
|
|
85
|
+
|
|
86
|
+
## Requires (dependencies)
|
|
87
|
+
- Webex SDK host/plugin lifecycle
|
|
88
|
+
- Contact Center REST and WebSocket backends
|
|
89
|
+
- Services, TaskManager, MetricsManager, WebCallingService, UserPreference, and data-service modules
|
|
90
|
+
|
|
91
|
+
## Requirements
|
|
92
|
+
| ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
|
|
93
|
+
|---|---|---|---|---|---|---|
|
|
94
|
+
| CONTACT_CENTER-R-001 | Construct the service graph once after the host Webex SDK emits READY, before `register()` is invoked. | Collaborators require initialized host request, logger, and plugin configuration state. | `src/cc.ts` | `test/unit/spec/cc.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
|
|
95
|
+
| CONTACT_CENTER-R-002 | `register()` must attach connection/message listeners, connect the primary WebSocket, and return the fetched Profile or rethrow a logged failure. | Applications need an explicit readiness boundary and must never observe a synthetic successful registration. | `src/cc.ts` | `test/unit/spec/cc.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
|
|
96
|
+
| CONTACT_CENTER-R-003 | Delegate agent, task, data, user-preference, preview-campaign, AI-assistant, calling, and telemetry behavior to their owning collaborators while preserving typed package methods and events. Existing `getQueues` and `getEntryPoints` delegate to their services with unchanged signatures and full-record responses; the services own consult/transfer telephony filter, profile-view, ordering, and cache defaults while honoring explicit existing-parameter overrides. Before preview delegation, reject disabled skip/remove actions from task campaign flags. | A thin stable façade avoids parallel consumer APIs while service-owned defaults keep ordinary widget calls consistent and preserve an override path for other consumers. | `src/cc.ts`, `src/types.ts`, `src/services/Queue.ts`, `src/services/EntryPoint.ts`, `src/services/UserPreference.ts`, `src/services/task/dialer.ts` | `test/unit/spec/cc.ts`, `test/unit/spec/services/Queue.ts`, `test/unit/spec/services/EntryPoint.ts`, `test/unit/spec/services/UserPreference.ts`, `test/unit/spec/services/task/dialer.ts` | Public preview delegation is covered; the `campaignPreviewSkipDisabled` and `campaignPreviewRemoveDisabled` early-exit guards lack direct unit coverage. Independent review identified this gap on 2026-07-15. | PRESENT |
|
|
97
|
+
| CONTACT_CENTER-R-004 | `deregister()` must remove registered listeners, stop applicable host/calling resources, close primary and RTD WebSockets, clear agent configuration, and surface cleanup failures. | Listener or connection leaks create duplicate events and stale authenticated sessions in long-lived hosts. | `src/cc.ts` | `test/unit/spec/cc.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
|
|
98
|
+
| CONTACT_CENTER-R-005 | On `connectionLost`, ContactCenter must own recovery policy and invoke private `silentRelogin()` only when automated relogin is allowed. | ConnectionService reports transport state; only ContactCenter has agent profile and policy context for authentication recovery. | `src/cc.ts` | `test/unit/spec/cc.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
|
|
99
|
+
|
|
100
|
+
## Design Overview
|
|
101
|
+
`ContactCenter` is the package façade and lifecycle owner. Its constructor waits for the host Webex SDK `READY` event, validates plugin configuration, initializes `WebexRequest`, obtains the singleton `Services` graph, and constructs calling, AI-assistant, metrics, task-management, `UserPreference`, and data-service collaborators. `register()` is deliberately narrower: it attaches runtime listeners and establishes the primary Contact Center WebSocket subscription.
|
|
102
|
+
|
|
103
|
+
Direct data/configuration and user-preference operations return authenticated REST responses. Enabled agent/task AQM operations, including preview-campaign accept/skip/remove, send authenticated HTTP requests but resolve or reject only after a matching WebSocket notification. Before delegating preview skip/remove, ContactCenter checks the task's campaign-disable flags and throws locally when the corresponding flag is `'true'`. TaskManager converts backend task events into Task instances and typed state-machine events. ContactCenter maps package-facing events through WebexPlugin `trigger` or its internal EventEmitter according to the published contract.
|
|
104
|
+
|
|
105
|
+
Durable agent, task, and configuration records remain remote-system owned. The package owns only in-memory profile/task/listener/cache/connection state.
|
|
106
|
+
|
|
107
|
+
### wxApp Better Together (WXCC-6026)
|
|
108
|
+
|
|
109
|
+
Contract id: `contact-center.wxapp-answer` ([CONTRACTS.md](./CONTRACTS.md)). Task telephony routing, UI controls, and mute events are specified in [task-spec.md](../src/services/task/ai-docs/task-spec.md). Service collaborators: [services-spec.md](../src/services/ai-docs/services-spec.md).
|
|
110
|
+
|
|
111
|
+
- **Init flag:** `webex.init({ cc: { enableWxBetterTogether: boolean } })` — default `false`. When `true`, ContactCenter enables wxApp telephony routing on tasks after supported station login. **Compatible with `allowMultiLogin: true`** (multiple SDK sessions may receive offers; wxApp telephony is routed per active task instance). **Phase 1 is init-only** — to change the flag after SDK init, re-init with updated config.
|
|
112
|
+
- **Read API:** `cc.isWxBetterTogetherEnabled()` returns the current init flag value.
|
|
113
|
+
- **Phase 2 (internal/private):** `setManageWebexCallingInWxcc(enabled)` remains as a private implementation for future runtime toggle; hosts must not call it in Phase 1.
|
|
114
|
+
- **Post-login hooks:** `ensureWxAppPostStationLogin()` runs after successful `stationLogin()` and after `silentRelogin()` on socket reconnect. When the init flag is ON, it publishes usersub `true`, connects Mercury/device for mute sync, and backfills mute state on active tasks. Failures roll back wxApp config and release partial Mercury/device resources without failing station login. When OFF, it force-publishes usersub `false` (clears stale suppression after page refresh) and tears down wxApp Mercury resources.
|
|
115
|
+
- **Teardown:** `deregister()`, station logout, and wxApp teardown paths call `teardownWxAppLocalState()` — publish usersub `false`, unsubscribe Mercury, release CC-owned device/Mercury connections, and reset **session runtime** state (usersub active flag, Mercury subscriptions, task-manager wxApp routing) so stale session flags do not apply on relogin. The host init flag (`enableWxBetterTogether`) is **not** cleared on station logout — it persists until `deregister()` or re-init per Phase 1 contract. Local cleanup runs even when usersub publish fails.
|
|
116
|
+
- **Host telephony surface:** Hosts call unified `task.accept()`, `task.decline()`, `task.toggleMute({ muted? })`, and `task.transmitDtmf({ dtmf })`; SDK `Voice` routes wxApp legs internally when the flag is active. Shared-line `lineOwnerId` defaults from the wxApp agent participant when omitted.
|
|
117
|
+
|
|
118
|
+
Evidence: `src/cc.ts`, `src/config.ts`, `src/services/WebexCrossClientService.ts`, `src/services/WxAppTelephonyMercurySync.ts`, `test/unit/spec/cc.ts`.
|
|
119
|
+
|
|
120
|
+
## Data Flow
|
|
121
|
+
```mermaid
|
|
122
|
+
flowchart TD
|
|
123
|
+
Host[Host Webex SDK READY] --> Validate[Validate plugin config]
|
|
124
|
+
Validate --> WR[Initialize WebexRequest]
|
|
125
|
+
WR --> Services[Services singleton: agent/config/contact/dialer + primary/RTD WebSockets]
|
|
126
|
+
Services --> Collaborators[Create WebCalling, ApiAIAssistant, Metrics, TaskManager, UserPreference, data services]
|
|
127
|
+
Collaborators --> Register[Application calls register]
|
|
128
|
+
Register --> Listeners[Attach connection and message listeners]
|
|
129
|
+
Listeners --> Connect[Subscribe/connect primary WebSocket]
|
|
130
|
+
Connect --> Profile[Fetch/return Profile]
|
|
131
|
+
Profile --> App[Application invokes typed cc methods]
|
|
132
|
+
App --> Direct[Direct REST data/config]
|
|
133
|
+
App --> AQM[AQM HTTP initiation]
|
|
134
|
+
AQM --> WS[Correlated WebSocket completion]
|
|
135
|
+
Direct --> App
|
|
136
|
+
WS --> App
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Sequence Diagram(s)
|
|
140
|
+
Sequence coverage:
|
|
141
|
+
|
|
142
|
+
| Operation group | Diagram | Failure / recovery coverage |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| READY-time bootstrap | Bootstrap | Invalid configuration or collaborator initialization rejects readiness-dependent use. |
|
|
145
|
+
| Registration | Register | Connection/subscription failure is logged, metrics record failure, logs upload, and the error is rethrown. |
|
|
146
|
+
| Deregistration | Deregister | Cleanup failure is measured, logged, and rethrown; no synthetic success. |
|
|
147
|
+
| Connection recovery | Recovery | ConnectionService emits state; ContactCenter chooses silent relogin or preserves failure state. |
|
|
148
|
+
|
|
149
|
+
### Bootstrap
|
|
150
|
+
|
|
151
|
+
```mermaid
|
|
152
|
+
sequenceDiagram
|
|
153
|
+
participant Host as Host Webex SDK
|
|
154
|
+
participant CC as ContactCenter
|
|
155
|
+
participant S as Services
|
|
156
|
+
participant TM as TaskManager
|
|
157
|
+
Host-->>CC: READY
|
|
158
|
+
CC->>CC: validatePluginConfig()
|
|
159
|
+
alt configuration valid
|
|
160
|
+
CC->>CC: WebexRequest.getInstance(webex)
|
|
161
|
+
CC->>S: Services.getInstance(webex, connectionConfig)
|
|
162
|
+
CC->>CC: create WebCallingService + ApiAIAssistant + MetricsManager
|
|
163
|
+
CC->>TM: getTaskManager(aiAssistant, contact, calling, primaryWS, rtdWS)
|
|
164
|
+
CC->>CC: create EntryPoint + AddressBook + Queue; initialize LoggerProxy
|
|
165
|
+
else invalid configuration or initialization failure
|
|
166
|
+
CC-->>Host: readiness-dependent use rejects
|
|
167
|
+
end
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Register
|
|
171
|
+
|
|
172
|
+
```mermaid
|
|
173
|
+
sequenceDiagram
|
|
174
|
+
participant App
|
|
175
|
+
participant CC as ContactCenter
|
|
176
|
+
participant WS as Primary WebSocketManager
|
|
177
|
+
participant Cfg as AgentConfigService
|
|
178
|
+
participant Agent as Services.agent
|
|
179
|
+
participant Metrics
|
|
180
|
+
App->>CC: register()
|
|
181
|
+
CC->>CC: setupEventListeners(); listen for WS messages
|
|
182
|
+
CC->>Metrics: time register success/failure
|
|
183
|
+
CC->>WS: initWebSocket({body, resource: SUBSCRIBE_API})
|
|
184
|
+
WS-->>CC: Welcome data containing agentId
|
|
185
|
+
CC->>Cfg: getAgentConfig(orgId, agentId)
|
|
186
|
+
alt profile fetched
|
|
187
|
+
Cfg-->>CC: Profile
|
|
188
|
+
CC->>CC: set TaskManager/config/AI flags
|
|
189
|
+
opt applicable AI feature enabled
|
|
190
|
+
CC->>CC: start RTD WebSocket; log but contain RTD failure
|
|
191
|
+
end
|
|
192
|
+
opt browser calling applicable
|
|
193
|
+
CC->>CC: mercury.connect(); log but contain failure
|
|
194
|
+
end
|
|
195
|
+
opt allowAutomatedRelogin
|
|
196
|
+
CC->>Agent: reload()
|
|
197
|
+
Agent-->>CC: relogin result, AGENT_NOT_FOUND, or error
|
|
198
|
+
end
|
|
199
|
+
CC->>Metrics: track registration success
|
|
200
|
+
CC-->>App: Profile
|
|
201
|
+
else primary subscription/profile/relogin failure
|
|
202
|
+
CC->>Metrics: track registration failure
|
|
203
|
+
CC->>CC: uploadLogs(correlationId)
|
|
204
|
+
CC-->>App: throw error
|
|
205
|
+
end
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Deregister
|
|
209
|
+
|
|
210
|
+
```mermaid
|
|
211
|
+
sequenceDiagram
|
|
212
|
+
participant App
|
|
213
|
+
participant CC as ContactCenter
|
|
214
|
+
participant Host as Mercury/device
|
|
215
|
+
participant WS as Primary + RTD WebSockets
|
|
216
|
+
App->>CC: deregister()
|
|
217
|
+
CC->>CC: remove TaskManager/message/connection listeners
|
|
218
|
+
opt browser calling resources active
|
|
219
|
+
CC->>Host: disconnect Mercury; unregister device
|
|
220
|
+
end
|
|
221
|
+
CC->>WS: close(false, reason)
|
|
222
|
+
CC->>CC: agentConfig = null
|
|
223
|
+
alt cleanup succeeds
|
|
224
|
+
CC-->>App: void
|
|
225
|
+
else cleanup fails
|
|
226
|
+
CC-->>App: throw error
|
|
227
|
+
end
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Recovery
|
|
231
|
+
|
|
232
|
+
```mermaid
|
|
233
|
+
sequenceDiagram
|
|
234
|
+
participant CS as ConnectionService
|
|
235
|
+
participant CC as ContactCenter
|
|
236
|
+
participant Agent as Services.agent
|
|
237
|
+
CS-->>CC: connectionLost(details)
|
|
238
|
+
CC->>CC: handleConnectionLost(details)
|
|
239
|
+
alt allowAutomatedRelogin
|
|
240
|
+
CC->>CC: silentRelogin()
|
|
241
|
+
CC->>Agent: reload()
|
|
242
|
+
alt relogin succeeds
|
|
243
|
+
Agent-->>CC: relogin result; update agent config/device state
|
|
244
|
+
else AGENT_NOT_FOUND
|
|
245
|
+
Agent-->>CC: handled silently
|
|
246
|
+
else other failure
|
|
247
|
+
Agent--xCC: throw detailed error
|
|
248
|
+
end
|
|
249
|
+
else disabled
|
|
250
|
+
CC->>CC: make no relogin call; retain reported transport state
|
|
251
|
+
end
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Class / Component Relationships
|
|
255
|
+
```mermaid
|
|
256
|
+
classDiagram
|
|
257
|
+
class ContactCenter
|
|
258
|
+
class Services
|
|
259
|
+
class WebexRequest
|
|
260
|
+
class MetricsManager
|
|
261
|
+
class TaskManager
|
|
262
|
+
class WebCallingService
|
|
263
|
+
class ApiAIAssistant
|
|
264
|
+
class EntryPoint
|
|
265
|
+
class AddressBook
|
|
266
|
+
class Queue
|
|
267
|
+
ContactCenter --> WebexRequest : initializes/uses for log upload
|
|
268
|
+
ContactCenter --> Services : agent/config/contact/dialer + WebSockets
|
|
269
|
+
ContactCenter --> MetricsManager : timings and tracking
|
|
270
|
+
ContactCenter --> TaskManager : task lifecycle/events
|
|
271
|
+
ContactCenter --> WebCallingService : browser calling
|
|
272
|
+
ContactCenter --> ApiAIAssistant : transcript/suggestion API
|
|
273
|
+
ContactCenter --> EntryPoint
|
|
274
|
+
ContactCenter --> AddressBook
|
|
275
|
+
ContactCenter --> Queue
|
|
276
|
+
TaskManager --> ApiAIAssistant
|
|
277
|
+
TaskManager --> WebCallingService
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Use Cases
|
|
281
|
+
- **UC-1 Host bootstrap:** after host READY, initialize the complete collaborator graph exactly once. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
282
|
+
- **UC-2 Register:** attach listeners and establish the primary WebSocket subscription before returning Profile. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
283
|
+
- **UC-3 Delegate SDK operations:** validate/map public inputs, call the owning collaborator, track metrics, and return or emit typed results. Evidence: `src/cc.ts`, `src/index.ts`, `test/unit/spec/cc.ts`.
|
|
284
|
+
- **UC-4 Recover connection:** consume ConnectionService state and conditionally reload the agent session through ContactCenter policy. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
285
|
+
- **UC-5 Deregister:** remove the same listener identities, shut down applicable host/WebSocket resources, and clear in-memory profile state. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
286
|
+
|
|
287
|
+
## State Model
|
|
288
|
+
ContactCenter retains in-memory `agentConfig`, collaborator references, event listeners, task collections through TaskManager, and connection/recovery state. Remote Webex services remain authoritative for agent, task, and organization data. Registration establishes runtime connectivity but does not imply station login; deregistration tears down SDK resources but does not itself perform station logout.
|
|
289
|
+
|
|
290
|
+
## Business Rules & Invariants
|
|
291
|
+
- Collaborators are initialized after host READY and before their use; `register()` must not be documented as their constructor boundary. Evidence: `src/cc.ts`.
|
|
292
|
+
- AQM promises complete only from correlated WebSocket success/failure or timeout, not from HTTP acknowledgement. Evidence: `src/services/core/aqm-reqs.ts`.
|
|
293
|
+
- `skipPreviewContact` checks `campaignPreviewSkipDisabled` and `removePreviewContact` checks `campaignPreviewRemoveDisabled` on the matching task. When the applicable value is `'true'`, ContactCenter throws before initiating an HTTP or WebSocket-correlated AQM operation; `acceptPreviewContact` has no equivalent pre-guard. Evidence: `src/cc.ts`.
|
|
294
|
+
- ContactCenter owns automated relogin policy; ConnectionService owns transport-state detection/emission. Evidence: `src/cc.ts`, `src/services/core/websocket/connection-service.ts`.
|
|
295
|
+
- Deregistration does not station-logout the agent. Evidence: `src/cc.ts`.
|
|
296
|
+
- Published methods/types/events remain semver-sensitive through `src/index.ts`.
|
|
297
|
+
|
|
298
|
+
## Concurrency & Reactive Flow
|
|
299
|
+
READY initialization, REST promises, AQM WebSocket correlation, TaskManager events, calling events, and connection timers execute asynchronously. Listener cleanup must use the registered function identity. Message listeners are independent: AqmReqs correlates pending requests, ContactCenter maps package events, TaskManager owns task lifecycle, and ConnectionService tracks liveness/reconnect state.
|
|
300
|
+
|
|
301
|
+
## State Machine
|
|
302
|
+
```mermaid
|
|
303
|
+
stateDiagram-v2
|
|
304
|
+
[*] --> AwaitingHostReady
|
|
305
|
+
AwaitingHostReady --> Initialized: host READY + collaborators created
|
|
306
|
+
Initialized --> Registering: register()
|
|
307
|
+
Registering --> Registered: WebSocket/profile success
|
|
308
|
+
Registering --> Initialized: registration failure
|
|
309
|
+
Registered --> Recovering: connectionLost
|
|
310
|
+
Recovering --> Registered: reconnect/relogin succeeds
|
|
311
|
+
Recovering --> Registered: relogin disabled; transport state reported
|
|
312
|
+
Registered --> Deregistering: deregister()
|
|
313
|
+
Deregistering --> Initialized: listeners/resources cleared
|
|
314
|
+
Deregistering --> Registered: cleanup throws before completion
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Protocol / Wire Format
|
|
318
|
+
Authenticated REST initiates direct data/config operations and AQM agent/task operations. For AQM, the HTTP response is acknowledgement only; `notifSuccess.bind`/`notifFail.bind` match WebSocket payloads that settle the promise. The primary WebSocket carries Contact Center notifications; the RTD WebSocket carries transcript/suggestion traffic. Payload and event names are owned by `src/types.ts`, `src/services/config/types.ts`, `src/services/agent/types.ts`, and `src/services/task/types.ts`.
|
|
319
|
+
|
|
320
|
+
## Error Handling & Failure Modes
|
|
321
|
+
| Condition | Signal (error/code/result) | Caller recovery |
|
|
322
|
+
|---|---|---|
|
|
323
|
+
| Dependency rejection | Typed/rethrown error or failure event | Inspect structured details, preserve tracking id, and retry only when the operation is safe. |
|
|
324
|
+
| Timeout or missing async completion | Timeout/recovery state | Follow the module-specific recovery path; never synthesize success. |
|
|
325
|
+
|
|
326
|
+
## Pitfalls
|
|
327
|
+
- READY-time construction and `register()` are different lifecycle boundaries; moving collaborator creation into `register()` can duplicate listeners and use uninitialized host services.
|
|
328
|
+
- AQM HTTP responses are acknowledgements, not operation completion; only a correlated WebSocket notification or timeout settles the operation.
|
|
329
|
+
- Listener cleanup must use the same bound function identities registered during setup or repeated register/deregister cycles will leak handlers.
|
|
330
|
+
|
|
331
|
+
## Module Do's / Don'ts
|
|
332
|
+
- DO construct the collaborator graph only after host READY and keep registration focused on listeners, subscription, and profile retrieval.
|
|
333
|
+
- DO route agent recovery decisions through ContactCenter because it owns profile/config policy.
|
|
334
|
+
- DON'T synthesize successful register/deregister results after a dependency or cleanup failure.
|
|
335
|
+
- DON'T let transport services call `silentRelogin()` directly.
|
|
336
|
+
|
|
337
|
+
## Export Stability
|
|
338
|
+
The npm export/type-declaration surface is semver-sensitive. Additive optional types are compatible; removals, renames, or semantic changes require a major-version migration and changelog entry.
|
|
339
|
+
|
|
340
|
+
## Host Integration & Theming
|
|
341
|
+
The module registers as `cc` through the Webex SDK plugin system and depends on host-provided Webex credentials, configuration, request routing, and lifecycle events. It renders no UI and defines no theme contract.
|
|
342
|
+
|
|
343
|
+
## Key Design Trade-off
|
|
344
|
+
- A single plugin surface centralizes compatibility and event routing, while specialized modules retain implementation ownership; this costs careful bootstrap and cleanup ordering.
|
|
345
|
+
|
|
346
|
+
## Test-Case Strategy (module)
|
|
347
|
+
`test/unit/spec/cc.ts` is the characterization baseline. Cover READY-time construction, registration success/failure, listener identity, existing queue/entry-point method delegation, WebSocket event mapping, preview-campaign operations (including disabled skip/remove pre-guards), automated-relogin enabled/disabled branches, browser-calling conditions, and deregistration cleanup/error paths. Use Queue and EntryPoint service tests for default policy and explicit existing-parameter overrides, `test/unit/spec/services/UserPreference.ts` for user-preference CRUD, and `test/unit/spec/services/task/dialer.ts` for preview AQM request contracts. Preserve the package-wide 85% branch/function/line/statement threshold.
|
|
348
|
+
|
|
349
|
+
| Requirement | Existing evidence | Required revalidation |
|
|
350
|
+
|---|---|---|
|
|
351
|
+
| CONTACT_CENTER-R-001 | `test/unit/spec/cc.ts` | READY-time ownership and initialization order |
|
|
352
|
+
| CONTACT_CENTER-R-002 | `test/unit/spec/cc.ts` | register success/failure and log-upload path |
|
|
353
|
+
| CONTACT_CENTER-R-003 | `test/unit/spec/cc.ts`, `test/unit/spec/services/UserPreference.ts`, `test/unit/spec/services/task/dialer.ts` | Add direct tests proving disabled skip/remove flags throw before dialer invocation; revalidate typed delegation, user-preference CRUD, preview-campaign AQM operations, and event routing. |
|
|
354
|
+
| CONTACT_CENTER-R-004 | `test/unit/spec/cc.ts` | listener/resource cleanup and error propagation |
|
|
355
|
+
| CONTACT_CENTER-R-005 | `test/unit/spec/cc.ts` | relogin policy ownership |
|
|
356
|
+
|
|
357
|
+
## Traceability
|
|
358
|
+
- Repo architecture: `ARCHITECTURE.md` · Registry: `SPEC_INDEX.md`
|
|
359
|
+
- Coverage state and contracts baseline: `../.sdd/manifest.json`
|