@webex/contact-center 3.12.0-next.84 → 3.12.0-next.85

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.
Files changed (47) hide show
  1. package/.sdd/manifest.json +876 -0
  2. package/AGENTS.md +65 -409
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +46 -0
  5. package/ai-docs/GETTING_STARTED.md +168 -0
  6. package/ai-docs/GLOSSARY.md +43 -0
  7. package/ai-docs/README.md +25 -18
  8. package/ai-docs/REVIEW_CHECKLIST.md +41 -0
  9. package/ai-docs/RULES.md +187 -198
  10. package/ai-docs/SECURITY.md +52 -0
  11. package/ai-docs/SERVICE_STATE.md +48 -0
  12. package/ai-docs/SPEC_INDEX.md +65 -0
  13. package/ai-docs/adr/0001-spec-source-policy.md +55 -0
  14. package/ai-docs/adr/README.md +8 -0
  15. package/ai-docs/adr/_adr-template.md +31 -0
  16. package/ai-docs/contact-center-spec.md +341 -0
  17. package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
  18. package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
  19. package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
  20. package/ai-docs/templates/README.md +1 -1
  21. package/ai-docs/templates/new-method/04-validation.md +1 -1
  22. package/ai-docs/templates/new-service/05-validation.md +1 -1
  23. package/dist/webex.js +1 -1
  24. package/package.json +1 -1
  25. package/src/metrics/ai-docs/AGENTS.md +2 -0
  26. package/src/metrics/ai-docs/ARCHITECTURE.md +2 -0
  27. package/src/metrics/ai-docs/metrics-spec.md +854 -0
  28. package/src/services/agent/ai-docs/AGENTS.md +3 -1
  29. package/src/services/agent/ai-docs/ARCHITECTURE.md +2 -0
  30. package/src/services/agent/ai-docs/agent-spec.md +504 -0
  31. package/src/services/ai-docs/AGENTS.md +4 -2
  32. package/src/services/ai-docs/services-spec.md +492 -0
  33. package/src/services/config/ai-docs/AGENTS.md +3 -1
  34. package/src/services/config/ai-docs/ARCHITECTURE.md +2 -0
  35. package/src/services/config/ai-docs/config-spec.md +669 -0
  36. package/src/services/core/ai-docs/AGENTS.md +4 -2
  37. package/src/services/core/ai-docs/ARCHITECTURE.md +2 -0
  38. package/src/services/core/ai-docs/core-spec.md +783 -0
  39. package/src/services/task/ai-docs/AGENTS.md +2 -0
  40. package/src/services/task/ai-docs/ARCHITECTURE.md +11 -2
  41. package/src/services/task/ai-docs/task-spec.md +1319 -0
  42. package/src/services/task/state-machine/ai-docs/AGENTS.md +38 -75
  43. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +6 -4
  44. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2115 -0
  45. package/src/utils/AGENTS.md +3 -1
  46. package/src/utils/ai-docs/utils-spec.md +381 -0
  47. package/umd/contact-center.min.js +2 -2
@@ -1,5 +1,7 @@
1
1
  # Task State Machine - AI Agent Guide
2
2
 
3
+ > **Legacy/reference-only.** Canonical SDD: [`task-state-machine-spec.md`](task-state-machine-spec.md). Use the package [manifest](../../../../../.sdd/manifest.json) and [`SPEC_INDEX.md`](../../../../../ai-docs/SPEC_INDEX.md) for routing; code and tests remain the behavioral referee.
4
+
3
5
  ## Purpose
4
6
 
5
7
  Guide AI agents working on task lifecycle transitions, guard logic, executable actions and UI control computation in the XState-based task state machine.
@@ -25,6 +27,8 @@ Use this doc when implementing:
25
27
 
26
28
  ---
27
29
 
30
+
31
+
28
32
  ## File Structure
29
33
 
30
34
  ```text
@@ -43,6 +47,8 @@ state-machine/
43
47
 
44
48
  ---
45
49
 
50
+
51
+
46
52
  ## Source of Truth
47
53
 
48
54
  - Task lifecycle state machine: `TaskStateMachine.ts`
@@ -53,6 +59,8 @@ state-machine/
53
59
 
54
60
  ---
55
61
 
62
+
63
+
56
64
  ## Key Capabilities
57
65
 
58
66
  - **State Graph and Transition Rules**: `TaskStateMachine.ts` defines all states, transition tables, and event handlers that drive the task lifecycle.
@@ -64,6 +72,8 @@ state-machine/
64
72
 
65
73
  ---
66
74
 
75
+
76
+
67
77
  ## State Machine Overview
68
78
 
69
79
  **Transition Source**: `getTaskStateMachineConfig()` in `TaskStateMachine.ts`
@@ -91,6 +101,8 @@ if (eventPayload) {
91
101
 
92
102
  ---
93
103
 
104
+
105
+
94
106
  ### Transition Contract
95
107
 
96
108
  Backend CC events from WebSocket are mapped to `TaskEvent` in `TaskManager.mapEventToTaskStateMachineEvent`.
@@ -103,11 +115,15 @@ All new events must add a typed payload entry in `TaskEventPayloadMap`.
103
115
 
104
116
  ---
105
117
 
118
+
119
+
106
120
  ## Non-goals
107
121
 
108
122
  - API contracts for external services.
109
123
  - Mercury or CC WebSocket protocols (see `TaskManager.ts` mapping).
110
124
 
125
+
126
+
111
127
  ## Guards
112
128
 
113
129
  Guards are boolean conditions that determine determine if a state transition is allowed. These functions validate the current context before allowing transitions.
@@ -118,6 +134,8 @@ Guards are boolean conditions that determine determine if a state transition is
118
134
  - No mutation or side-effects.
119
135
  - Reuse helper accessors (e.g., `getTaskDataFromEvent`).
120
136
 
137
+
138
+
121
139
  ### State-Based Guards
122
140
 
123
141
  ```typescript
@@ -142,6 +160,8 @@ isInteractionConnected(context, event) {
142
160
  }
143
161
  ```
144
162
 
163
+
164
+
145
165
  ### Consult Guards
146
166
 
147
167
  ```typescript
@@ -154,6 +174,8 @@ didInitiateConsult(context, event) {
154
174
  }
155
175
  ```
156
176
 
177
+
178
+
157
179
  ### Conference Guards
158
180
 
159
181
  ```typescript
@@ -212,6 +234,8 @@ shouldDowngradeConferenceToConnected(context, event) {
212
234
  }
213
235
  ```
214
236
 
237
+
238
+
215
239
  ### Wrapup Guards
216
240
 
217
241
  ```typescript
@@ -253,6 +277,8 @@ didCurrentAgentLeaveConference(context, event) {
253
277
  }
254
278
  ```
255
279
 
280
+
281
+
256
282
  ### Server State Guards
257
283
 
258
284
  ```typescript
@@ -267,6 +293,8 @@ isPrimaryMediaOnHold(context, event) {
267
293
 
268
294
  ---
269
295
 
296
+
297
+
270
298
  ## Actions
271
299
 
272
300
  Actions are side effects executed during state machine transitions from current state to target state(next state).
@@ -276,12 +304,16 @@ Actions contain:
276
304
  - Lifecycle mutations (`clearConsultState`, `markEnded`, consult/conference flags)
277
305
  - Integration hooks (`requestAutoAnswer`, `requestCleanup`, emitter placeholders)
278
306
 
307
+
308
+
279
309
  ### Principles
280
310
 
281
311
  - Context mutations should be centralized in `assign(...)` actions
282
312
  - Emitter actions intentionally no-op defaults and overridden by `Task` to bridge machine transitions to SDK events.
283
313
  - Deterministic updates from `taskData`.
284
314
 
315
+
316
+
285
317
  ### Context Update Actions
286
318
 
287
319
  ```typescript
@@ -359,6 +391,8 @@ markEnded() {
359
391
  > Note: `forceConsultInitiator`, `handleConferenceFailed`, `handleSwitchToMainCall`, and
360
392
  > `handleSwitchToConsult` are not present in current `actions.ts`/`TaskStateMachine.ts`.
361
393
 
394
+
395
+
362
396
  ### Event Emission Actions
363
397
 
364
398
  ```typescript
@@ -387,6 +421,8 @@ emitTaskWrapup(context, event) {
387
421
  // ... more emission actions for each event type
388
422
  ```
389
423
 
424
+
425
+
390
426
  ### Cleanup Actions
391
427
 
392
428
  ```typescript
@@ -403,6 +439,8 @@ cleanupResources(context, event) {
403
439
  }
404
440
  ```
405
441
 
442
+
443
+
406
444
  ### Auto-Answer Actions
407
445
 
408
446
  ```typescript
@@ -418,78 +456,3 @@ requestAutoAnswer(context, event) {
418
456
  ```
419
457
 
420
458
  ---
421
-
422
- ## UI Controls
423
-
424
- `uiControlsComputer.ts` computes `TaskUIControls` from:
425
-
426
- - current machine state
427
- - current context
428
- - channel type (voice vs digital)
429
- - call/participant metadata from `taskData`
430
- - config flags (`isEndTaskEnabled`, recording toggles, voice variant)
431
-
432
- This keeps all control enablement/visibility logic centralized and testable.
433
-
434
- ### Source of truth
435
-
436
- `computeUIControls()` in `uiControlsComputer.ts`.
437
-
438
- ### Inputs
439
-
440
- - `TaskState`
441
- - `TaskContext` (including `taskData`)
442
- - `UIControlConfig` (channel type, agentId, voice variant, recording flags)
443
-
444
- ### Output
445
-
446
- - `TaskUIControls` with per-control visibility and enabled state.
447
-
448
- ---
449
-
450
- ## Common Workflows
451
-
452
- ### Add New Event
453
-
454
- 1. Add event in `TaskEvent` (`constants.ts`)
455
- 2. Add typed payload in `TaskEventPayloadMap` (`types.ts`)
456
- 3. Wire transitions in `TaskStateMachine.ts`
457
- 4. Add/adjust actions in `actions.ts`
458
- 5. Add guard(s) in `guards.ts` if needed
459
- 6. Update `TaskManager` event mapping and unit tests
460
-
461
- ### Add New Transition Rule
462
-
463
- 1. Implement pure guard in `guards.ts`
464
- 2. Use guard in `TaskStateMachine.ts` transition array
465
- 3. Keep side-effects in actions only (no side-effects in guards)
466
- 4. Add tests for positive and negative transition paths
467
-
468
- ### Update UI Controls
469
-
470
- 1. Update control logic in `computeVoiceUIControls()` or `computeDigitalUIControls()`
471
- 2. Preserve `getDefaultUIControls()` shape compatibility
472
- 3. Verify behavior across `CONNECTED`, `HELD`, `CONSULTING`, `CONFERENCING`, `WRAPPING_UP`
473
- 4. Add or update UI-control unit coverage
474
-
475
- ---
476
-
477
- ## Testing Checklist
478
-
479
- - [ ] Added event is defined in `TaskEvent`
480
- - [ ] Added payload is typed in `TaskEventPayloadMap`
481
- - [ ] Add transition(s) in `TaskStateMachine.ts` and validate it for success and failure
482
- - [ ] Update mapping in `TaskManager.mapEventToTaskStateMachineEvent`
483
- - [ ] Add/update guards and actions
484
- - [ ] Update UI controls if state impacts UX and validate them for voice and digital where applicable
485
- - [ ] Reconnect/hydrate behavior validated
486
- - [ ] Add/adjust unit tests.
487
- - [ ] Update diagrams + mapping tables in `ARCHITECTURE.md`.
488
-
489
- ---
490
-
491
- ## Related Docs
492
-
493
- - [ARCHITECTURE.md](ARCHITECTURE.md) - State machine internals and flow diagrams
494
- - [../../ai-docs/AGENTS.md](../../ai-docs/AGENTS.md) - Task service usage guide
495
- - [../../ai-docs/ARCHITECTURE.md](../../ai-docs/ARCHITECTURE.md) - Task service architecture
@@ -1,5 +1,7 @@
1
1
  # Task State Machine - Architecture
2
2
 
3
+ > **Legacy/reference-only.** Canonical SDD: [`task-state-machine-spec.md`](task-state-machine-spec.md). Use the package [manifest](../../../../../.sdd/manifest.json) and [`SPEC_INDEX.md`](../../../../../ai-docs/SPEC_INDEX.md) for routing; code and tests remain the behavioral referee.
4
+
3
5
  ## Purpose
4
6
 
5
7
  Technical reference for the complete state machine using XState to drive state transitions and UI control behavior. It orchestrates state transitions, guards, and actions for task lifecycle management.
@@ -1129,7 +1131,7 @@ The HYDRATE event restores state machine state after page refresh or reconnectio
1129
1131
  - `../TaskManager.ts` - maps backend events to state-machine events
1130
1132
  - `../types.ts` - shared task data structures
1131
1133
  - `../../ai-docs/ARCHITECTURE.md` - broader task service architecture
1132
- - [TaskStateMachine.ts](../state-machine/TaskStateMachine.ts) - Implementation
1133
- - [guards.ts](../state-machine/guards.ts) - Guard functions
1134
- - [actions.ts](../state-machine/actions.ts) - Action functions
1135
- - [constants.ts](../state-machine/constants.ts) - State and event enums
1134
+ - [TaskStateMachine.ts](../TaskStateMachine.ts) - Implementation
1135
+ - [guards.ts](../guards.ts) - Guard functions
1136
+ - [actions.ts](../actions.ts) - Action functions
1137
+ - [constants.ts](../constants.ts) - State and event enums