@webex/contact-center 3.12.0-next.9 → 3.12.0-next.91
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 +876 -0
- package/AGENTS.md +94 -0
- package/ai-docs/ARCHITECTURE.md +168 -0
- package/ai-docs/CONTRACTS.md +46 -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 +341 -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 +265 -29
- package/dist/cc.js.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/constants.js +17 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.js +20 -5
- package/dist/index.js.map +1 -1
- package/dist/metrics/behavioral-events.js +101 -0
- package/dist/metrics/behavioral-events.js.map +1 -1
- package/dist/metrics/constants.js +25 -4
- package/dist/metrics/constants.js.map +1 -1
- package/dist/services/ApiAiAssistant.js +153 -8
- package/dist/services/ApiAiAssistant.js.map +1 -1
- package/dist/services/UserPreference.js +427 -0
- package/dist/services/UserPreference.js.map +1 -0
- package/dist/services/config/Util.js +3 -3
- package/dist/services/config/Util.js.map +1 -1
- package/dist/services/config/constants.js +23 -2
- package/dist/services/config/constants.js.map +1 -1
- package/dist/services/config/types.js +49 -9
- package/dist/services/config/types.js.map +1 -1
- package/dist/services/core/Err.js.map +1 -1
- package/dist/services/core/Utils.js +107 -32
- package/dist/services/core/Utils.js.map +1 -1
- package/dist/services/core/websocket/WebSocketManager.js +2 -1
- package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
- package/dist/services/core/websocket/types.js.map +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/task/Task.js +688 -0
- package/dist/services/task/Task.js.map +1 -0
- package/dist/services/task/TaskFactory.js +45 -0
- package/dist/services/task/TaskFactory.js.map +1 -0
- package/dist/services/task/TaskManager.js +728 -527
- package/dist/services/task/TaskManager.js.map +1 -1
- package/dist/services/task/TaskUtils.js +162 -26
- package/dist/services/task/TaskUtils.js.map +1 -1
- package/dist/services/task/constants.js +9 -2
- package/dist/services/task/constants.js.map +1 -1
- package/dist/services/task/dialer.js +78 -0
- package/dist/services/task/dialer.js.map +1 -1
- package/dist/services/task/digital/Digital.js +77 -0
- package/dist/services/task/digital/Digital.js.map +1 -0
- package/dist/services/task/state-machine/TaskStateMachine.js +837 -0
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
- package/dist/services/task/state-machine/actions.js +543 -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 +340 -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 +553 -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 +212 -4
- package/dist/services/task/types.js.map +1 -1
- package/dist/services/task/voice/Voice.js +1042 -0
- package/dist/services/task/voice/Voice.js.map +1 -0
- package/dist/services/task/voice/WebRTC.js +149 -0
- package/dist/services/task/voice/WebRTC.js.map +1 -0
- package/dist/types/cc.d.ts +94 -1
- package/dist/types/config.d.ts +6 -0
- package/dist/types/constants.d.ts +17 -1
- package/dist/types/index.d.ts +21 -6
- package/dist/types/metrics/constants.d.ts +21 -1
- package/dist/types/services/ApiAiAssistant.d.ts +22 -4
- package/dist/types/services/UserPreference.d.ts +118 -0
- package/dist/types/services/config/constants.d.ts +21 -0
- package/dist/types/services/config/types.d.ts +171 -10
- package/dist/types/services/core/Err.d.ts +4 -0
- package/dist/types/services/core/Utils.d.ts +33 -13
- package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
- package/dist/types/services/core/websocket/types.d.ts +1 -1
- package/dist/types/services/index.d.ts +1 -1
- package/dist/types/services/task/Task.d.ts +157 -0
- package/dist/types/services/task/TaskFactory.d.ts +12 -0
- package/dist/types/services/task/TaskUtils.d.ts +46 -2
- package/dist/types/services/task/constants.d.ts +7 -0
- package/dist/types/services/task/dialer.d.ts +30 -0
- package/dist/types/services/task/digital/Digital.d.ts +22 -0
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1144 -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 +90 -0
- package/dist/types/services/task/state-machine/index.d.ts +13 -0
- package/dist/types/services/task/state-machine/types.d.ts +267 -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 +603 -66
- package/dist/types/services/task/voice/Voice.d.ts +184 -0
- package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
- package/dist/types/types.d.ts +135 -0
- package/dist/types/webex.d.ts +1 -0
- package/dist/types.js +118 -2
- package/dist/types.js.map +1 -1
- package/dist/webex.js +14 -2
- package/dist/webex.js.map +1 -1
- package/package.json +15 -12
- package/src/cc.ts +329 -30
- package/src/config.ts +6 -0
- package/src/constants.ts +17 -1
- package/src/index.ts +23 -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 +854 -0
- package/src/metrics/behavioral-events.ts +106 -0
- package/src/metrics/constants.ts +27 -4
- package/src/services/ApiAiAssistant.ts +203 -8
- package/src/services/UserPreference.ts +509 -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/ai-docs/AGENTS.md +386 -0
- package/src/services/ai-docs/services-spec.md +492 -0
- package/src/services/config/Util.ts +3 -3
- 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 +669 -0
- package/src/services/config/constants.ts +25 -1
- package/src/services/config/types.ts +174 -11
- package/src/services/core/Err.ts +2 -0
- package/src/services/core/Utils.ts +123 -37
- 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 +783 -0
- package/src/services/core/websocket/WebSocketManager.ts +2 -0
- package/src/services/core/websocket/types.ts +1 -1
- package/src/services/index.ts +1 -1
- package/src/services/task/Task.ts +837 -0
- package/src/services/task/TaskFactory.ts +55 -0
- package/src/services/task/TaskManager.ts +739 -614
- package/src/services/task/TaskUtils.ts +205 -25
- package/src/services/task/ai-docs/AGENTS.md +457 -0
- package/src/services/task/ai-docs/ARCHITECTURE.md +594 -0
- package/src/services/task/ai-docs/task-spec.md +1319 -0
- package/src/services/task/constants.ts +7 -0
- package/src/services/task/dialer.ts +80 -0
- package/src/services/task/digital/Digital.ts +95 -0
- package/src/services/task/state-machine/TaskStateMachine.ts +1077 -0
- package/src/services/task/state-machine/actions.ts +685 -0
- package/src/services/task/state-machine/ai-docs/AGENTS.md +458 -0
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1137 -0
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2115 -0
- package/src/services/task/state-machine/constants.ts +172 -0
- package/src/services/task/state-machine/guards.ts +406 -0
- package/src/services/task/state-machine/index.ts +28 -0
- package/src/services/task/state-machine/types.ts +241 -0
- package/src/services/task/state-machine/uiControlsComputer.ts +867 -0
- package/src/services/task/taskDataNormalizer.ts +137 -0
- package/src/services/task/types.ts +710 -71
- package/src/services/task/voice/Voice.ts +1267 -0
- package/src/services/task/voice/WebRTC.ts +187 -0
- package/src/types.ts +166 -2
- package/src/utils/AGENTS.md +278 -0
- package/src/utils/ai-docs/utils-spec.md +381 -0
- package/src/webex.js +2 -0
- package/test/unit/spec/cc.ts +343 -23
- package/test/unit/spec/logger-proxy.ts +70 -0
- package/test/unit/spec/services/ApiAiAssistant.ts +178 -20
- package/test/unit/spec/services/UserPreference.ts +401 -0
- package/test/unit/spec/services/WebCallingService.ts +7 -1
- package/test/unit/spec/services/config/index.ts +30 -30
- package/test/unit/spec/services/core/Utils.ts +425 -8
- package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
- package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
- package/test/unit/spec/services/task/Task.ts +477 -0
- package/test/unit/spec/services/task/TaskFactory.ts +62 -0
- package/test/unit/spec/services/task/TaskManager.ts +834 -1704
- package/test/unit/spec/services/task/TaskUtils.ts +206 -0
- package/test/unit/spec/services/task/dialer.ts +190 -0
- package/test/unit/spec/services/task/digital/Digital.ts +105 -0
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +1825 -0
- package/test/unit/spec/services/task/state-machine/guards.ts +479 -0
- package/test/unit/spec/services/task/state-machine/types.ts +18 -0
- package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2020 -0
- package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
- package/test/unit/spec/services/task/voice/Voice.ts +631 -0
- package/test/unit/spec/services/task/voice/WebRTC.ts +235 -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/dist/types/services/task/index.d.ts +0 -650
- package/src/services/task/index.ts +0 -1801
- package/test/unit/spec/services/task/index.ts +0 -2184
|
@@ -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,341 @@
|
|
|
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-07-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
|
+
## Purpose / Responsibility
|
|
41
|
+
Own the published Webex Contact Center SDK plugin surface, registration lifecycle, public method delegation, and application-facing event routing.
|
|
42
|
+
|
|
43
|
+
## Stack
|
|
44
|
+
TypeScript 5.4, WebexPlugin, Node EventEmitter, WebSocket/WebRTC integrations, Jest 27, Yarn 3.4.1.
|
|
45
|
+
|
|
46
|
+
## Folder / Package Structure
|
|
47
|
+
```text
|
|
48
|
+
src/
|
|
49
|
+
├── index.ts package exports and plugin registration
|
|
50
|
+
├── cc.ts ContactCenter façade and lifecycle orchestration
|
|
51
|
+
├── types.ts package-level public contracts
|
|
52
|
+
├── metrics/ telemetry manager and taxonomy
|
|
53
|
+
├── services/ transport, agent, config, data, and calling collaborators
|
|
54
|
+
│ ├── UserPreference.ts user-preference CRUD REST client
|
|
55
|
+
│ └── task/ task objects, manager, media implementations, state machine
|
|
56
|
+
└── utils/PageCache.ts shared pagination cache
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Key Files (source of truth)
|
|
60
|
+
| File | Holds |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `src/index.ts` | Authoritative Contact Center implementation or contract source. |
|
|
63
|
+
| `src/cc.ts` | Authoritative Contact Center implementation or contract source. |
|
|
64
|
+
| `src/types.ts` | Authoritative Contact Center implementation or contract source. |
|
|
65
|
+
| `src/constants.ts` | Authoritative Contact Center implementation or contract source. |
|
|
66
|
+
| `src/config.ts` | Authoritative Contact Center implementation or contract source. |
|
|
67
|
+
| `src/services/UserPreference.ts` | User-preference CRUD implementation exposed through `cc.userPreference`. |
|
|
68
|
+
| `src/services/task/dialer.ts` | Preview-campaign AQM request implementations. |
|
|
69
|
+
| `src/services/task/types.ts` | `PreviewContactPayload`, `TaskResponse`, and task contract types. |
|
|
70
|
+
|
|
71
|
+
## Public Surface
|
|
72
|
+
| Contract ID | Type | Surface | Purpose | Compatibility / deprecation | Schema / detail link | Root index |
|
|
73
|
+
|---|---|---|---|---|---|---|
|
|
74
|
+
| `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` |
|
|
75
|
+
| `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` |
|
|
76
|
+
| `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` |
|
|
77
|
+
|
|
78
|
+
Compatibility notes:
|
|
79
|
+
- Do not remove or reinterpret exported symbols/events without a documented consumer migration.
|
|
80
|
+
|
|
81
|
+
## Requires (dependencies)
|
|
82
|
+
- Webex SDK host/plugin lifecycle
|
|
83
|
+
- Contact Center REST and WebSocket backends
|
|
84
|
+
- Services, TaskManager, MetricsManager, WebCallingService, UserPreference, and data-service modules
|
|
85
|
+
|
|
86
|
+
## Requirements
|
|
87
|
+
| ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
|
|
88
|
+
|---|---|---|---|---|---|---|
|
|
89
|
+
| 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 |
|
|
90
|
+
| 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 |
|
|
91
|
+
| 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. Before preview delegation, reject disabled skip/remove actions from task campaign flags. | A stable façade keeps consumer compatibility while specialized modules retain transport and lifecycle ownership; campaign controls must prevent prohibited backend operations. | `src/cc.ts`, `src/services/UserPreference.ts`, `src/services/task/dialer.ts` | `test/unit/spec/cc.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 |
|
|
92
|
+
| 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 |
|
|
93
|
+
| 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 |
|
|
94
|
+
|
|
95
|
+
## Design Overview
|
|
96
|
+
`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.
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
Durable agent, task, and configuration records remain remote-system owned. The package owns only in-memory profile/task/listener/cache/connection state.
|
|
101
|
+
|
|
102
|
+
## Data Flow
|
|
103
|
+
```mermaid
|
|
104
|
+
flowchart TD
|
|
105
|
+
Host[Host Webex SDK READY] --> Validate[Validate plugin config]
|
|
106
|
+
Validate --> WR[Initialize WebexRequest]
|
|
107
|
+
WR --> Services[Services singleton: agent/config/contact/dialer + primary/RTD WebSockets]
|
|
108
|
+
Services --> Collaborators[Create WebCalling, ApiAIAssistant, Metrics, TaskManager, UserPreference, data services]
|
|
109
|
+
Collaborators --> Register[Application calls register]
|
|
110
|
+
Register --> Listeners[Attach connection and message listeners]
|
|
111
|
+
Listeners --> Connect[Subscribe/connect primary WebSocket]
|
|
112
|
+
Connect --> Profile[Fetch/return Profile]
|
|
113
|
+
Profile --> App[Application invokes typed cc methods]
|
|
114
|
+
App --> Direct[Direct REST data/config]
|
|
115
|
+
App --> AQM[AQM HTTP initiation]
|
|
116
|
+
AQM --> WS[Correlated WebSocket completion]
|
|
117
|
+
Direct --> App
|
|
118
|
+
WS --> App
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Sequence Diagram(s)
|
|
122
|
+
Sequence coverage:
|
|
123
|
+
|
|
124
|
+
| Operation group | Diagram | Failure / recovery coverage |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| READY-time bootstrap | Bootstrap | Invalid configuration or collaborator initialization rejects readiness-dependent use. |
|
|
127
|
+
| Registration | Register | Connection/subscription failure is logged, metrics record failure, logs upload, and the error is rethrown. |
|
|
128
|
+
| Deregistration | Deregister | Cleanup failure is measured, logged, and rethrown; no synthetic success. |
|
|
129
|
+
| Connection recovery | Recovery | ConnectionService emits state; ContactCenter chooses silent relogin or preserves failure state. |
|
|
130
|
+
|
|
131
|
+
### Bootstrap
|
|
132
|
+
|
|
133
|
+
```mermaid
|
|
134
|
+
sequenceDiagram
|
|
135
|
+
participant Host as Host Webex SDK
|
|
136
|
+
participant CC as ContactCenter
|
|
137
|
+
participant S as Services
|
|
138
|
+
participant TM as TaskManager
|
|
139
|
+
Host-->>CC: READY
|
|
140
|
+
CC->>CC: validatePluginConfig()
|
|
141
|
+
alt configuration valid
|
|
142
|
+
CC->>CC: WebexRequest.getInstance(webex)
|
|
143
|
+
CC->>S: Services.getInstance(webex, connectionConfig)
|
|
144
|
+
CC->>CC: create WebCallingService + ApiAIAssistant + MetricsManager
|
|
145
|
+
CC->>TM: getTaskManager(aiAssistant, contact, calling, primaryWS, rtdWS)
|
|
146
|
+
CC->>CC: create EntryPoint + AddressBook + Queue; initialize LoggerProxy
|
|
147
|
+
else invalid configuration or initialization failure
|
|
148
|
+
CC-->>Host: readiness-dependent use rejects
|
|
149
|
+
end
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Register
|
|
153
|
+
|
|
154
|
+
```mermaid
|
|
155
|
+
sequenceDiagram
|
|
156
|
+
participant App
|
|
157
|
+
participant CC as ContactCenter
|
|
158
|
+
participant WS as Primary WebSocketManager
|
|
159
|
+
participant Cfg as AgentConfigService
|
|
160
|
+
participant Agent as Services.agent
|
|
161
|
+
participant Metrics
|
|
162
|
+
App->>CC: register()
|
|
163
|
+
CC->>CC: setupEventListeners(); listen for WS messages
|
|
164
|
+
CC->>Metrics: time register success/failure
|
|
165
|
+
CC->>WS: initWebSocket({body, resource: SUBSCRIBE_API})
|
|
166
|
+
WS-->>CC: Welcome data containing agentId
|
|
167
|
+
CC->>Cfg: getAgentConfig(orgId, agentId)
|
|
168
|
+
alt profile fetched
|
|
169
|
+
Cfg-->>CC: Profile
|
|
170
|
+
CC->>CC: set TaskManager/config/AI flags
|
|
171
|
+
opt applicable AI feature enabled
|
|
172
|
+
CC->>CC: start RTD WebSocket; log but contain RTD failure
|
|
173
|
+
end
|
|
174
|
+
opt browser calling applicable
|
|
175
|
+
CC->>CC: mercury.connect(); log but contain failure
|
|
176
|
+
end
|
|
177
|
+
opt allowAutomatedRelogin
|
|
178
|
+
CC->>Agent: reload()
|
|
179
|
+
Agent-->>CC: relogin result, AGENT_NOT_FOUND, or error
|
|
180
|
+
end
|
|
181
|
+
CC->>Metrics: track registration success
|
|
182
|
+
CC-->>App: Profile
|
|
183
|
+
else primary subscription/profile/relogin failure
|
|
184
|
+
CC->>Metrics: track registration failure
|
|
185
|
+
CC->>CC: uploadLogs(correlationId)
|
|
186
|
+
CC-->>App: throw error
|
|
187
|
+
end
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Deregister
|
|
191
|
+
|
|
192
|
+
```mermaid
|
|
193
|
+
sequenceDiagram
|
|
194
|
+
participant App
|
|
195
|
+
participant CC as ContactCenter
|
|
196
|
+
participant Host as Mercury/device
|
|
197
|
+
participant WS as Primary + RTD WebSockets
|
|
198
|
+
App->>CC: deregister()
|
|
199
|
+
CC->>CC: remove TaskManager/message/connection listeners
|
|
200
|
+
opt browser calling resources active
|
|
201
|
+
CC->>Host: disconnect Mercury; unregister device
|
|
202
|
+
end
|
|
203
|
+
CC->>WS: close(false, reason)
|
|
204
|
+
CC->>CC: agentConfig = null
|
|
205
|
+
alt cleanup succeeds
|
|
206
|
+
CC-->>App: void
|
|
207
|
+
else cleanup fails
|
|
208
|
+
CC-->>App: throw error
|
|
209
|
+
end
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Recovery
|
|
213
|
+
|
|
214
|
+
```mermaid
|
|
215
|
+
sequenceDiagram
|
|
216
|
+
participant CS as ConnectionService
|
|
217
|
+
participant CC as ContactCenter
|
|
218
|
+
participant Agent as Services.agent
|
|
219
|
+
CS-->>CC: connectionLost(details)
|
|
220
|
+
CC->>CC: handleConnectionLost(details)
|
|
221
|
+
alt allowAutomatedRelogin
|
|
222
|
+
CC->>CC: silentRelogin()
|
|
223
|
+
CC->>Agent: reload()
|
|
224
|
+
alt relogin succeeds
|
|
225
|
+
Agent-->>CC: relogin result; update agent config/device state
|
|
226
|
+
else AGENT_NOT_FOUND
|
|
227
|
+
Agent-->>CC: handled silently
|
|
228
|
+
else other failure
|
|
229
|
+
Agent--xCC: throw detailed error
|
|
230
|
+
end
|
|
231
|
+
else disabled
|
|
232
|
+
CC->>CC: make no relogin call; retain reported transport state
|
|
233
|
+
end
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Class / Component Relationships
|
|
237
|
+
```mermaid
|
|
238
|
+
classDiagram
|
|
239
|
+
class ContactCenter
|
|
240
|
+
class Services
|
|
241
|
+
class WebexRequest
|
|
242
|
+
class MetricsManager
|
|
243
|
+
class TaskManager
|
|
244
|
+
class WebCallingService
|
|
245
|
+
class ApiAIAssistant
|
|
246
|
+
class EntryPoint
|
|
247
|
+
class AddressBook
|
|
248
|
+
class Queue
|
|
249
|
+
ContactCenter --> WebexRequest : initializes/uses for log upload
|
|
250
|
+
ContactCenter --> Services : agent/config/contact/dialer + WebSockets
|
|
251
|
+
ContactCenter --> MetricsManager : timings and tracking
|
|
252
|
+
ContactCenter --> TaskManager : task lifecycle/events
|
|
253
|
+
ContactCenter --> WebCallingService : browser calling
|
|
254
|
+
ContactCenter --> ApiAIAssistant : transcript/suggestion API
|
|
255
|
+
ContactCenter --> EntryPoint
|
|
256
|
+
ContactCenter --> AddressBook
|
|
257
|
+
ContactCenter --> Queue
|
|
258
|
+
TaskManager --> ApiAIAssistant
|
|
259
|
+
TaskManager --> WebCallingService
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Use Cases
|
|
263
|
+
- **UC-1 Host bootstrap:** after host READY, initialize the complete collaborator graph exactly once. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
264
|
+
- **UC-2 Register:** attach listeners and establish the primary WebSocket subscription before returning Profile. Evidence: `src/cc.ts`, `test/unit/spec/cc.ts`.
|
|
265
|
+
- **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`.
|
|
266
|
+
- **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`.
|
|
267
|
+
- **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`.
|
|
268
|
+
|
|
269
|
+
## State Model
|
|
270
|
+
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.
|
|
271
|
+
|
|
272
|
+
## Business Rules & Invariants
|
|
273
|
+
- Collaborators are initialized after host READY and before their use; `register()` must not be documented as their constructor boundary. Evidence: `src/cc.ts`.
|
|
274
|
+
- AQM promises complete only from correlated WebSocket success/failure or timeout, not from HTTP acknowledgement. Evidence: `src/services/core/aqm-reqs.ts`.
|
|
275
|
+
- `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`.
|
|
276
|
+
- ContactCenter owns automated relogin policy; ConnectionService owns transport-state detection/emission. Evidence: `src/cc.ts`, `src/services/core/websocket/connection-service.ts`.
|
|
277
|
+
- Deregistration does not station-logout the agent. Evidence: `src/cc.ts`.
|
|
278
|
+
- Published methods/types/events remain semver-sensitive through `src/index.ts`.
|
|
279
|
+
|
|
280
|
+
## Concurrency & Reactive Flow
|
|
281
|
+
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.
|
|
282
|
+
|
|
283
|
+
## State Machine
|
|
284
|
+
```mermaid
|
|
285
|
+
stateDiagram-v2
|
|
286
|
+
[*] --> AwaitingHostReady
|
|
287
|
+
AwaitingHostReady --> Initialized: host READY + collaborators created
|
|
288
|
+
Initialized --> Registering: register()
|
|
289
|
+
Registering --> Registered: WebSocket/profile success
|
|
290
|
+
Registering --> Initialized: registration failure
|
|
291
|
+
Registered --> Recovering: connectionLost
|
|
292
|
+
Recovering --> Registered: reconnect/relogin succeeds
|
|
293
|
+
Recovering --> Registered: relogin disabled; transport state reported
|
|
294
|
+
Registered --> Deregistering: deregister()
|
|
295
|
+
Deregistering --> Initialized: listeners/resources cleared
|
|
296
|
+
Deregistering --> Registered: cleanup throws before completion
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Protocol / Wire Format
|
|
300
|
+
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`.
|
|
301
|
+
|
|
302
|
+
## Error Handling & Failure Modes
|
|
303
|
+
| Condition | Signal (error/code/result) | Caller recovery |
|
|
304
|
+
|---|---|---|
|
|
305
|
+
| Dependency rejection | Typed/rethrown error or failure event | Inspect structured details, preserve tracking id, and retry only when the operation is safe. |
|
|
306
|
+
| Timeout or missing async completion | Timeout/recovery state | Follow the module-specific recovery path; never synthesize success. |
|
|
307
|
+
|
|
308
|
+
## Pitfalls
|
|
309
|
+
- READY-time construction and `register()` are different lifecycle boundaries; moving collaborator creation into `register()` can duplicate listeners and use uninitialized host services.
|
|
310
|
+
- AQM HTTP responses are acknowledgements, not operation completion; only a correlated WebSocket notification or timeout settles the operation.
|
|
311
|
+
- Listener cleanup must use the same bound function identities registered during setup or repeated register/deregister cycles will leak handlers.
|
|
312
|
+
|
|
313
|
+
## Module Do's / Don'ts
|
|
314
|
+
- DO construct the collaborator graph only after host READY and keep registration focused on listeners, subscription, and profile retrieval.
|
|
315
|
+
- DO route agent recovery decisions through ContactCenter because it owns profile/config policy.
|
|
316
|
+
- DON'T synthesize successful register/deregister results after a dependency or cleanup failure.
|
|
317
|
+
- DON'T let transport services call `silentRelogin()` directly.
|
|
318
|
+
|
|
319
|
+
## Export Stability
|
|
320
|
+
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.
|
|
321
|
+
|
|
322
|
+
## Host Integration & Theming
|
|
323
|
+
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.
|
|
324
|
+
|
|
325
|
+
## Key Design Trade-off
|
|
326
|
+
- A single plugin surface centralizes compatibility and event routing, while specialized modules retain implementation ownership; this costs careful bootstrap and cleanup ordering.
|
|
327
|
+
|
|
328
|
+
## Test-Case Strategy (module)
|
|
329
|
+
`test/unit/spec/cc.ts` is the characterization baseline. Cover READY-time construction, registration success/failure, listener identity, public 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 `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.
|
|
330
|
+
|
|
331
|
+
| Requirement | Existing evidence | Required revalidation |
|
|
332
|
+
|---|---|---|
|
|
333
|
+
| CONTACT_CENTER-R-001 | `test/unit/spec/cc.ts` | READY-time ownership and initialization order |
|
|
334
|
+
| CONTACT_CENTER-R-002 | `test/unit/spec/cc.ts` | register success/failure and log-upload path |
|
|
335
|
+
| 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. |
|
|
336
|
+
| CONTACT_CENTER-R-004 | `test/unit/spec/cc.ts` | listener/resource cleanup and error propagation |
|
|
337
|
+
| CONTACT_CENTER-R-005 | `test/unit/spec/cc.ts` | relogin policy ownership |
|
|
338
|
+
|
|
339
|
+
## Traceability
|
|
340
|
+
- Repo architecture: `ARCHITECTURE.md` · Registry: `SPEC_INDEX.md`
|
|
341
|
+
- Coverage state and contracts baseline: `../.sdd/manifest.json`
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Feature Spec — Generated Spec Conformance and Fidelity Remediation
|
|
2
|
+
|
|
3
|
+
> Start here → package root [`AGENTS.md`](../../../../AGENTS.md) · router [`SPEC_INDEX.md`](../../../SPEC_INDEX.md) · system [`ARCHITECTURE.md`](../../../ARCHITECTURE.md). This is a documentation-only protected-spec delta. It authorizes canonical documentation corrections but no runtime, test, or manifest change.
|
|
4
|
+
|
|
5
|
+
## Metadata
|
|
6
|
+
|
|
7
|
+
| Field | Value |
|
|
8
|
+
|---|---|
|
|
9
|
+
| Feature / ticket key | `CC-SDD-CONFORMANCE-FIDELITY-20260709` |
|
|
10
|
+
| Title | Generated module-spec conformance and source-fidelity remediation |
|
|
11
|
+
| Status | applied; generator-side source fidelity, conformance, and coverage pass; independent validation pending |
|
|
12
|
+
| Change class | documentation-only MODIFIED conformance and fidelity correction |
|
|
13
|
+
| created_by / approved_by / date | Codex generator / developer / 2026-07-09 |
|
|
14
|
+
| Generated from | `feature-spec` @ SDLC template library `0.2.1` |
|
|
15
|
+
|
|
16
|
+
## Problem & Goal
|
|
17
|
+
|
|
18
|
+
The prior deterministic conformance pass checked section presence but did not verify that sequence-inventory rows mapped to actual operation-specific diagrams, that migrated diagrams appeared in the canonical section selected by meaning, or that every required section remained concrete after migration. A read-only brownfield audit found cross-module structural and source-fidelity gaps despite clean semantic validation metadata.
|
|
19
|
+
|
|
20
|
+
The goal is to make all nine module specs satisfy the full module-spec output contract while preserving current source behavior and routed legacy detail.
|
|
21
|
+
|
|
22
|
+
## Scope
|
|
23
|
+
|
|
24
|
+
In scope:
|
|
25
|
+
|
|
26
|
+
- Repair sequence inventories, diagram placement, operation coverage, and error/timeout/retry/recovery branches.
|
|
27
|
+
- Correct Task AQM completion semantics and Utils cache-key scope semantics from current source.
|
|
28
|
+
- Add complete requirement-to-test mappings.
|
|
29
|
+
- Replace generic pitfalls and module conventions with code-grounded module-specific content.
|
|
30
|
+
- Remove stale validation-pending text and superseded local-doc routing artifacts.
|
|
31
|
+
- Normalize mechanically fragmented tables without dropping rows.
|
|
32
|
+
- Reconcile diagram dispositions in source-fidelity inventories and rerun generator-side gates.
|
|
33
|
+
|
|
34
|
+
Out of scope:
|
|
35
|
+
|
|
36
|
+
- Runtime source or test changes.
|
|
37
|
+
- Public API, event, behavior, transport, timeout, or compatibility changes.
|
|
38
|
+
- `.sdd/manifest.json` edits or coverage-status promotion.
|
|
39
|
+
- Independent validator acceptance on the generator runtime.
|
|
40
|
+
|
|
41
|
+
## Requirements
|
|
42
|
+
|
|
43
|
+
| ID | WHAT | WHY | Acceptance | State |
|
|
44
|
+
|---|---|---|---|---|
|
|
45
|
+
| REMEDIATION-R-001 | Every Sequence Diagram(s) inventory must map each distinct operation group to an actual titled diagram or an explicitly justified shared diagram. | A table that advertises uncovered flows is not actionable documentation. | Coverage rows and diagrams agree; distinct failure/state outcomes are diagrammed. | Approved |
|
|
46
|
+
| REMEDIATION-R-002 | Migrated flow, sequence, class, and state diagrams must appear in the canonical section selected by meaning and remain one-for-one unless code requires a recorded correction. | Source fidelity cannot be satisfied by retaining valid detail only in superseded documents. | Diagram inventory targets/statuses and canonical placement agree. | Approved |
|
|
47
|
+
| REMEDIATION-R-003 | Every module test strategy must map every requirement ID to concrete test files and an explicit remaining gap. | Prose-only testing guidance cannot prove requirement coverage. | Nine complete requirement-to-test matrices. | Approved |
|
|
48
|
+
| REMEDIATION-R-004 | Pitfalls and module conventions must name module-specific failure modes, ownership boundaries, constants, events, or lifecycle constraints. | Generic boilerplate is not evidence-backed maintenance guidance. | No repeated generic ownership/raw-string boilerplate remains. | Approved |
|
|
49
|
+
| REMEDIATION-R-005 | Correct Task AQM and Utils cache-key descriptions to current source behavior. | The existing Task diagram treats HTTP acknowledgement as completion, and Utils overstates `orgId` as the only runtime scope key. | AQM resolves on matched WebSocket completion; cache scope records `orgId` or `bookId` by consumer. | Approved |
|
|
50
|
+
| REMEDIATION-R-006 | Remove stale validation-pending cells and legacy “this file”/superseded-doc navigation from canonical specs. | Canonical docs must describe their current status and route readers to canonical surfaces. | Metadata and requirement gap cells agree; no module-local legacy doc is presented as canonical. | Approved |
|
|
51
|
+
| REMEDIATION-R-007 | Preserve all current table rows while consolidating repeated one-row table fragments. | Mechanical migration fragmentation harms reviewability and can conceal omissions. | Repeated adjacent identical table headers are consolidated without data loss. | Approved |
|
|
52
|
+
|
|
53
|
+
## MODIFIED Requirements
|
|
54
|
+
|
|
55
|
+
### MOD-001 — Contact Center
|
|
56
|
+
|
|
57
|
+
Name and map its four lifecycle sequence diagrams, add the bootstrap rejection branch, complete concrete pitfalls/conventions, and retain its full requirement-to-test matrix.
|
|
58
|
+
|
|
59
|
+
### MOD-002 — Metrics
|
|
60
|
+
|
|
61
|
+
Preserve the two legacy sequences, add explicit disabled/submission-error coverage, complete the test matrix, and normalize event/taxonomy tables.
|
|
62
|
+
|
|
63
|
+
### MOD-003 — Services
|
|
64
|
+
|
|
65
|
+
Add the missing direct-REST sequence, use the three-column sequence inventory, complete the test matrix, and remove copied legacy-file identity text.
|
|
66
|
+
|
|
67
|
+
### MOD-004 — Agent
|
|
68
|
+
|
|
69
|
+
Restore code-supported station-login, state-change, WebSocket-event, and relogin detail; add logout/buddy coverage; correct legacy diagram dispositions; and complete the test matrix.
|
|
70
|
+
|
|
71
|
+
### MOD-005 — Config
|
|
72
|
+
|
|
73
|
+
Keep the corrected ten-result profile aggregation, add pagination coverage, complete the test matrix, and normalize API/type tables.
|
|
74
|
+
|
|
75
|
+
### MOD-006 — Core
|
|
76
|
+
|
|
77
|
+
Add authenticated REST coverage, diagram duplicate-pending/offline retry behavior, identify private helpers as internal, correct diagram dispositions, and complete the test matrix.
|
|
78
|
+
|
|
79
|
+
### MOD-007 — Task
|
|
80
|
+
|
|
81
|
+
Move legacy sequences from Data Flow to Sequence Diagram(s), correct AQM completion, add all five operation-group diagrams, and complete the test matrix.
|
|
82
|
+
|
|
83
|
+
### MOD-008 — Task state machine
|
|
84
|
+
|
|
85
|
+
Add group-specific sequences for offer/assignment, hold/resume, consult, conference/transfer, wrapup/termination, and hydration; preserve exact state diagrams; complete the test matrix.
|
|
86
|
+
|
|
87
|
+
### MOD-009 — Utils
|
|
88
|
+
|
|
89
|
+
Describe the caller-supplied cache scope accurately, add lookup/store and clear sequences with backend failure behavior, correct legacy diagram disposition, and complete the test matrix.
|
|
90
|
+
|
|
91
|
+
### MOD-010 — Cross-module audit state
|
|
92
|
+
|
|
93
|
+
Refresh source-fidelity dispositions, conformance evidence, validation metadata/gap wording, local navigation, and decision logs without modifying the manifest.
|
|
94
|
+
|
|
95
|
+
## Acceptance Criteria
|
|
96
|
+
|
|
97
|
+
- All nine specs pass template/profile/heading/link/placeholder checks.
|
|
98
|
+
- Every sequence inventory maps to actual diagrams with applicable failure/recovery behavior.
|
|
99
|
+
- No sequence diagram remains in Task Data Flow.
|
|
100
|
+
- Task AQM diagrams distinguish HTTP acknowledgement from WebSocket settlement.
|
|
101
|
+
- Utils documents the real consumer scope (`orgId` for EntryPoint/Queue; `bookId` for AddressBook).
|
|
102
|
+
- Every requirement ID appears in its module's test-strategy matrix.
|
|
103
|
+
- No runtime/test file changes and manifest hash remains unchanged.
|
|
104
|
+
- Generator-side source-fidelity and conformance pass before independent validator handoff.
|
|
105
|
+
|
|
106
|
+
## Change Log
|
|
107
|
+
|
|
108
|
+
| Date | Change | By | Why |
|
|
109
|
+
|---|---|---|---|
|
|
110
|
+
| 2026-07-09 | Created and approved MOD-001 through MOD-010 | Codex + developer | Repair all-module brownfield conformance and source-fidelity gaps found by read-only audit |
|
|
111
|
+
| 2026-07-09 | Applied remediation and completed generator-side gates | Codex | 12/12 fidelity inventories, 9/9 module conformance, and 9/9 coverage pass; manifest unchanged |
|
|
112
|
+
|
|
113
|
+
## References
|
|
114
|
+
|
|
115
|
+
- Current behavior: `src/` and `test/`
|
|
116
|
+
- Canonical routing: [`SPEC_INDEX.md`](../../../SPEC_INDEX.md)
|
|
117
|
+
- Public contract index: [`CONTRACTS.md`](../../../CONTRACTS.md)
|