@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.
Files changed (229) hide show
  1. package/.sdd/manifest.json +876 -0
  2. package/AGENTS.md +94 -0
  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 +138 -0
  8. package/ai-docs/REVIEW_CHECKLIST.md +41 -0
  9. package/ai-docs/RULES.md +444 -0
  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/patterns/event-driven-patterns.md +485 -0
  21. package/ai-docs/patterns/testing-patterns.md +480 -0
  22. package/ai-docs/patterns/typescript-patterns.md +365 -0
  23. package/ai-docs/templates/README.md +102 -0
  24. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  25. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  26. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  27. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  28. package/ai-docs/templates/new-method/00-master.md +80 -0
  29. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  30. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  31. package/ai-docs/templates/new-method/03-tests.md +201 -0
  32. package/ai-docs/templates/new-method/04-validation.md +141 -0
  33. package/ai-docs/templates/new-service/00-master.md +109 -0
  34. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  35. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  36. package/ai-docs/templates/new-service/03-integration.md +178 -0
  37. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  38. package/ai-docs/templates/new-service/05-validation.md +145 -0
  39. package/dist/cc.js +265 -29
  40. package/dist/cc.js.map +1 -1
  41. package/dist/config.js +6 -0
  42. package/dist/config.js.map +1 -1
  43. package/dist/constants.js +17 -1
  44. package/dist/constants.js.map +1 -1
  45. package/dist/index.js +20 -5
  46. package/dist/index.js.map +1 -1
  47. package/dist/metrics/behavioral-events.js +101 -0
  48. package/dist/metrics/behavioral-events.js.map +1 -1
  49. package/dist/metrics/constants.js +25 -4
  50. package/dist/metrics/constants.js.map +1 -1
  51. package/dist/services/ApiAiAssistant.js +153 -8
  52. package/dist/services/ApiAiAssistant.js.map +1 -1
  53. package/dist/services/UserPreference.js +427 -0
  54. package/dist/services/UserPreference.js.map +1 -0
  55. package/dist/services/config/Util.js +3 -3
  56. package/dist/services/config/Util.js.map +1 -1
  57. package/dist/services/config/constants.js +23 -2
  58. package/dist/services/config/constants.js.map +1 -1
  59. package/dist/services/config/types.js +49 -9
  60. package/dist/services/config/types.js.map +1 -1
  61. package/dist/services/core/Err.js.map +1 -1
  62. package/dist/services/core/Utils.js +107 -32
  63. package/dist/services/core/Utils.js.map +1 -1
  64. package/dist/services/core/websocket/WebSocketManager.js +2 -1
  65. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  66. package/dist/services/core/websocket/types.js.map +1 -1
  67. package/dist/services/index.js +1 -1
  68. package/dist/services/index.js.map +1 -1
  69. package/dist/services/task/Task.js +688 -0
  70. package/dist/services/task/Task.js.map +1 -0
  71. package/dist/services/task/TaskFactory.js +45 -0
  72. package/dist/services/task/TaskFactory.js.map +1 -0
  73. package/dist/services/task/TaskManager.js +728 -527
  74. package/dist/services/task/TaskManager.js.map +1 -1
  75. package/dist/services/task/TaskUtils.js +162 -26
  76. package/dist/services/task/TaskUtils.js.map +1 -1
  77. package/dist/services/task/constants.js +9 -2
  78. package/dist/services/task/constants.js.map +1 -1
  79. package/dist/services/task/dialer.js +78 -0
  80. package/dist/services/task/dialer.js.map +1 -1
  81. package/dist/services/task/digital/Digital.js +77 -0
  82. package/dist/services/task/digital/Digital.js.map +1 -0
  83. package/dist/services/task/state-machine/TaskStateMachine.js +837 -0
  84. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  85. package/dist/services/task/state-machine/actions.js +543 -0
  86. package/dist/services/task/state-machine/actions.js.map +1 -0
  87. package/dist/services/task/state-machine/constants.js +161 -0
  88. package/dist/services/task/state-machine/constants.js.map +1 -0
  89. package/dist/services/task/state-machine/guards.js +340 -0
  90. package/dist/services/task/state-machine/guards.js.map +1 -0
  91. package/dist/services/task/state-machine/index.js +53 -0
  92. package/dist/services/task/state-machine/index.js.map +1 -0
  93. package/dist/services/task/state-machine/types.js +54 -0
  94. package/dist/services/task/state-machine/types.js.map +1 -0
  95. package/dist/services/task/state-machine/uiControlsComputer.js +553 -0
  96. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  97. package/dist/services/task/taskDataNormalizer.js +99 -0
  98. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  99. package/dist/services/task/types.js +212 -4
  100. package/dist/services/task/types.js.map +1 -1
  101. package/dist/services/task/voice/Voice.js +1042 -0
  102. package/dist/services/task/voice/Voice.js.map +1 -0
  103. package/dist/services/task/voice/WebRTC.js +149 -0
  104. package/dist/services/task/voice/WebRTC.js.map +1 -0
  105. package/dist/types/cc.d.ts +94 -1
  106. package/dist/types/config.d.ts +6 -0
  107. package/dist/types/constants.d.ts +17 -1
  108. package/dist/types/index.d.ts +21 -6
  109. package/dist/types/metrics/constants.d.ts +21 -1
  110. package/dist/types/services/ApiAiAssistant.d.ts +22 -4
  111. package/dist/types/services/UserPreference.d.ts +118 -0
  112. package/dist/types/services/config/constants.d.ts +21 -0
  113. package/dist/types/services/config/types.d.ts +171 -10
  114. package/dist/types/services/core/Err.d.ts +4 -0
  115. package/dist/types/services/core/Utils.d.ts +33 -13
  116. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  117. package/dist/types/services/core/websocket/types.d.ts +1 -1
  118. package/dist/types/services/index.d.ts +1 -1
  119. package/dist/types/services/task/Task.d.ts +157 -0
  120. package/dist/types/services/task/TaskFactory.d.ts +12 -0
  121. package/dist/types/services/task/TaskUtils.d.ts +46 -2
  122. package/dist/types/services/task/constants.d.ts +7 -0
  123. package/dist/types/services/task/dialer.d.ts +30 -0
  124. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  125. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1144 -0
  126. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  127. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  128. package/dist/types/services/task/state-machine/guards.d.ts +90 -0
  129. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  130. package/dist/types/services/task/state-machine/types.d.ts +267 -0
  131. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  132. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  133. package/dist/types/services/task/types.d.ts +603 -66
  134. package/dist/types/services/task/voice/Voice.d.ts +184 -0
  135. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  136. package/dist/types/types.d.ts +135 -0
  137. package/dist/types/webex.d.ts +1 -0
  138. package/dist/types.js +118 -2
  139. package/dist/types.js.map +1 -1
  140. package/dist/webex.js +14 -2
  141. package/dist/webex.js.map +1 -1
  142. package/package.json +15 -12
  143. package/src/cc.ts +329 -30
  144. package/src/config.ts +6 -0
  145. package/src/constants.ts +17 -1
  146. package/src/index.ts +23 -5
  147. package/src/metrics/ai-docs/AGENTS.md +350 -0
  148. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  149. package/src/metrics/ai-docs/metrics-spec.md +854 -0
  150. package/src/metrics/behavioral-events.ts +106 -0
  151. package/src/metrics/constants.ts +27 -4
  152. package/src/services/ApiAiAssistant.ts +203 -8
  153. package/src/services/UserPreference.ts +509 -0
  154. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  155. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  156. package/src/services/agent/ai-docs/agent-spec.md +504 -0
  157. package/src/services/ai-docs/AGENTS.md +386 -0
  158. package/src/services/ai-docs/services-spec.md +492 -0
  159. package/src/services/config/Util.ts +3 -3
  160. package/src/services/config/ai-docs/AGENTS.md +255 -0
  161. package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
  162. package/src/services/config/ai-docs/config-spec.md +669 -0
  163. package/src/services/config/constants.ts +25 -1
  164. package/src/services/config/types.ts +174 -11
  165. package/src/services/core/Err.ts +2 -0
  166. package/src/services/core/Utils.ts +123 -37
  167. package/src/services/core/ai-docs/AGENTS.md +381 -0
  168. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  169. package/src/services/core/ai-docs/core-spec.md +783 -0
  170. package/src/services/core/websocket/WebSocketManager.ts +2 -0
  171. package/src/services/core/websocket/types.ts +1 -1
  172. package/src/services/index.ts +1 -1
  173. package/src/services/task/Task.ts +837 -0
  174. package/src/services/task/TaskFactory.ts +55 -0
  175. package/src/services/task/TaskManager.ts +739 -614
  176. package/src/services/task/TaskUtils.ts +205 -25
  177. package/src/services/task/ai-docs/AGENTS.md +457 -0
  178. package/src/services/task/ai-docs/ARCHITECTURE.md +594 -0
  179. package/src/services/task/ai-docs/task-spec.md +1319 -0
  180. package/src/services/task/constants.ts +7 -0
  181. package/src/services/task/dialer.ts +80 -0
  182. package/src/services/task/digital/Digital.ts +95 -0
  183. package/src/services/task/state-machine/TaskStateMachine.ts +1077 -0
  184. package/src/services/task/state-machine/actions.ts +685 -0
  185. package/src/services/task/state-machine/ai-docs/AGENTS.md +458 -0
  186. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1137 -0
  187. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2115 -0
  188. package/src/services/task/state-machine/constants.ts +172 -0
  189. package/src/services/task/state-machine/guards.ts +406 -0
  190. package/src/services/task/state-machine/index.ts +28 -0
  191. package/src/services/task/state-machine/types.ts +241 -0
  192. package/src/services/task/state-machine/uiControlsComputer.ts +867 -0
  193. package/src/services/task/taskDataNormalizer.ts +137 -0
  194. package/src/services/task/types.ts +710 -71
  195. package/src/services/task/voice/Voice.ts +1267 -0
  196. package/src/services/task/voice/WebRTC.ts +187 -0
  197. package/src/types.ts +166 -2
  198. package/src/utils/AGENTS.md +278 -0
  199. package/src/utils/ai-docs/utils-spec.md +381 -0
  200. package/src/webex.js +2 -0
  201. package/test/unit/spec/cc.ts +343 -23
  202. package/test/unit/spec/logger-proxy.ts +70 -0
  203. package/test/unit/spec/services/ApiAiAssistant.ts +178 -20
  204. package/test/unit/spec/services/UserPreference.ts +401 -0
  205. package/test/unit/spec/services/WebCallingService.ts +7 -1
  206. package/test/unit/spec/services/config/index.ts +30 -30
  207. package/test/unit/spec/services/core/Utils.ts +425 -8
  208. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
  209. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  210. package/test/unit/spec/services/task/Task.ts +477 -0
  211. package/test/unit/spec/services/task/TaskFactory.ts +62 -0
  212. package/test/unit/spec/services/task/TaskManager.ts +834 -1704
  213. package/test/unit/spec/services/task/TaskUtils.ts +206 -0
  214. package/test/unit/spec/services/task/dialer.ts +190 -0
  215. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  216. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +1825 -0
  217. package/test/unit/spec/services/task/state-machine/guards.ts +479 -0
  218. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  219. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2020 -0
  220. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  221. package/test/unit/spec/services/task/voice/Voice.ts +631 -0
  222. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  223. package/umd/contact-center.min.js +2 -2
  224. package/umd/contact-center.min.js.map +1 -1
  225. package/dist/services/task/index.js +0 -1525
  226. package/dist/services/task/index.js.map +0 -1
  227. package/dist/types/services/task/index.d.ts +0 -650
  228. package/src/services/task/index.ts +0 -1801
  229. package/test/unit/spec/services/task/index.ts +0 -2184
package/AGENTS.md ADDED
@@ -0,0 +1,94 @@
1
+ # AGENTS.md — @webex/contact-center
2
+
3
+ > Read first. Next: [`SPEC_INDEX.md`](ai-docs/SPEC_INDEX.md) · [`ARCHITECTURE.md`](ai-docs/ARCHITECTURE.md). Load the target module spec on demand.
4
+
5
+ ## Repo Overview
6
+
7
+ `@webex/contact-center` is a published Webex SDK plugin for agent registration, configuration, realtime events, task/call control, data lookup, and telemetry.
8
+
9
+ **What it is:**
10
+ - A TypeScript SDK package embedded in the Webex SDK host.
11
+ - A client of Webex Contact Center REST, WebSocket, calling, and metrics services.
12
+
13
+ **What it is NOT:**
14
+ - It is not a standalone backend and owns no durable datastore.
15
+ - It does not render a UI; it exposes state and UI-control contracts to host applications.
16
+
17
+ ## Tech Stack
18
+
19
+ - TypeScript 5.4, Node.js 22.14 for workspace development (published package engine floor: Node >=20.x), Yarn 3.4.1, WebexPlugin, EventEmitter, XState 5, WebSocket/WebRTC.
20
+ - Jest 27 with 85% global branch/function/line/statement thresholds.
21
+
22
+ ## Architecture
23
+
24
+ ```text
25
+ Host Webex SDK → ContactCenter plugin → Services/Task/Metrics → REST + WebSocket + WebRTC backends
26
+ ```
27
+
28
+ → Full architecture: **[ai-docs/ARCHITECTURE.md](./ai-docs/ARCHITECTURE.md)**
29
+
30
+ ## Module / Package Structure
31
+
32
+ ```text
33
+ src/ public plugin/API orchestration
34
+ src/metrics/ telemetry
35
+ src/services/ service composition and integrations
36
+ src/services/{agent,config,core}/ agent, profile, and transport capabilities
37
+ src/services/task/ task/call lifecycle
38
+ src/services/task/state-machine/ typed XState lifecycle engine
39
+ src/utils/ pagination/page cache contracts
40
+ ```
41
+
42
+ → Router: **[ai-docs/SPEC_INDEX.md](./ai-docs/SPEC_INDEX.md)**
43
+
44
+ ## Critical Rules
45
+
46
+ 1. Code and tests are the behavioral referee; never invent APIs, paths, events, flags, or states.
47
+ 2. Ask before coding: present the affected files/contracts and wait for confirmation.
48
+ 3. Use LoggerProxy with module/method context; never use console logging in package implementation.
49
+ 4. Use MetricsManager timing/tracking patterns without blocking product behavior.
50
+ 5. Use typed event constants; preserve `trigger` versus `emit` ownership.
51
+ 6. Preserve AQM HTTP-plus-WebSocket correlation, timeout, and recovery semantics.
52
+ 7. Update the owning module spec and contract catalog in the same change as behavior.
53
+ 8. Run an independent validator runtime for generated or materially changed specs.
54
+
55
+ ## Essential Commands
56
+
57
+ | Task | Command |
58
+ |---|---|
59
+ | Install | `yarn install` |
60
+ | Build | `yarn workspace @webex/contact-center build:src` |
61
+ | Test | `yarn workspace @webex/contact-center test:unit` |
62
+ | Lint/format | `yarn workspace @webex/contact-center test:style` |
63
+
64
+ ## Developer Workflow
65
+
66
+ 1. Read this file for package rules, then use `ai-docs/SPEC_INDEX.md` to select the owning canonical module `*-spec.md`.
67
+ 2. Check the module spec's requirements, public surface, source paths, test evidence, and documented gaps against the relevant code/tests.
68
+ 3. Before coding, present the affected files and contracts and wait for confirmation.
69
+ 4. Implement the smallest approved change; update the owning module spec, `ai-docs/CONTRACTS.md`, and `.sdd/manifest.json` when public behavior or routing changes.
70
+ 5. Run the package commands above plus manifest/conformance checks; materially changed generated specs require validation on the configured independent runtime.
71
+ 6. Review the final diff for source/test fidelity, compatibility, secrets, and unrelated files before staging.
72
+
73
+ ## Common Gotchas
74
+
75
+ 1. AQM completion may arrive over WebSocket after an HTTP acknowledgement; do not treat the acknowledgement as completion.
76
+ 2. Listener cleanup requires the same function reference used at registration.
77
+ 3. Config aggregation is all-or-nothing; returning a partial profile creates inconsistent runtime behavior.
78
+ 4. Task transitions must go through typed TaskEvent mapping and guards.
79
+ 5. PageCache bypasses search/filter/attributes/sort queries to avoid stale or incorrect reuse.
80
+
81
+ ## Pre-Commit Checklist
82
+
83
+ - [ ] Unit tests and lint pass; the 85% coverage bar remains satisfied.
84
+ - [ ] Public types/events/methods remain compatible or include a migration plan.
85
+ - [ ] State, error, timeout, and cleanup paths are covered.
86
+ - [ ] Spec/docs and `.sdd/manifest.json` are updated with code changes.
87
+ - [ ] No secrets or sensitive data are committed or logged.
88
+
89
+ ## Strict Compliance Mode (automation)
90
+
91
+ - Load this file, the router, and only the affected module specs; stop on a blocking contract, security, source-fidelity, or validation finding.
92
+
93
+ ---
94
+ **SDD coverage:** `.sdd/manifest.json` is authoritative; `ai-docs/SPEC_INDEX.md` mirrors it.
@@ -0,0 +1,168 @@
1
+ # ARCHITECTURE — @webex/contact-center
2
+
3
+ > Start here → root [`AGENTS.md`](../AGENTS.md) · router [`SPEC_INDEX.md`](SPEC_INDEX.md). Per-module detail lives in source-local specifications.
4
+
5
+ ## Design Overview
6
+
7
+ The package is a host-embedded SDK plugin. `ContactCenter` owns the public façade and composes services for configuration, agent requests, tasks/calling, data lookup, realtime events, transport, and metrics. Remote Webex services own durable domain data.
8
+
9
+ Two interaction styles are deliberate: direct REST for immediate data/configuration responses, and AQM HTTP initiation followed by correlated WebSocket completion for event-driven agent/task operations. Typed events and XState isolate consumers from raw backend messages.
10
+
11
+ ## Component Inventory & Responsibilities
12
+
13
+ | Component | Responsibility (one line) | Docs |
14
+ |---|---|---|
15
+ | `src` | Own the published Webex Contact Center SDK plugin surface, registration lifecycle, public method delegation, and application-facing event routing. | `ai-docs/contact-center-spec.md` |
16
+ | `src/metrics` | Own timing, taxonomy, queuing, payload preparation, and submission for Contact Center behavioral, operational, and business telemetry. | `src/metrics/ai-docs/metrics-spec.md` |
17
+ | `src/services` | Own composition and bootstrap order for backend request, realtime, data, and WebRTC service collaborators. | `src/services/ai-docs/services-spec.md` |
18
+ | `src/services/agent` | Own agent login, logout, state-change, buddy-agent, device-update, and silent-relogin request contracts. | `src/services/agent/ai-docs/agent-spec.md` |
19
+ | `src/services/config` | Own retrieval and aggregation of remote organization, agent, team, profile, auxiliary-code, dial-plan, and feature configuration. | `src/services/config/ai-docs/config-spec.md` |
20
+ | `src/services/core` | Own authenticated HTTP, realtime WebSocket lifecycle, AQM request correlation, reconnect/keepalive behavior, and shared error normalization. | `src/services/core/ai-docs/core-spec.md` |
21
+ | `src/services/task` | Own task creation, media-specific behavior, call-control operations, lifecycle orchestration, task events, and integration with the task state machine. | `src/services/task/ai-docs/task-spec.md` |
22
+ | `src/services/task/state-machine` | Own deterministic task lifecycle states, transition guards/actions, typed internal events, and state-derived UI-control availability. | `src/services/task/state-machine/ai-docs/task-state-machine-spec.md` |
23
+ | `src/utils` | Own shared pagination contracts and the bounded in-memory page cache used by Contact Center data services. | `src/utils/ai-docs/utils-spec.md` |
24
+
25
+ ## Component Interaction
26
+
27
+ ```mermaid
28
+ flowchart LR
29
+ Host[Host Webex SDK] --> CC[ContactCenter]
30
+ CC --> Services
31
+ CC --> Task
32
+ CC --> Metrics
33
+ Services --> Agent
34
+ Services --> Config
35
+ Services --> Core
36
+ Services --> Utils
37
+ Task --> StateMachine[Task state machine]
38
+ Services --> REST[WCC REST]
39
+ Core <--> WS[WCC WebSocket]
40
+ Task --> Calling[Webex Calling/WebRTC]
41
+ Metrics --> Telemetry[Webex metrics]
42
+ ```
43
+
44
+ Public calls enter through `src/cc.ts`; direct REST returns through WebexRequest, while AQM operations resolve after matching WebSocket notifications. TaskManager converts backend events to task/state-machine events.
45
+
46
+ ## Execution & Flow
47
+
48
+ Registration initializes WebexRequest, Services, MetricsManager, WebCallingService, TaskManager, and data services in evidence-backed order. The plugin subscribes to realtime messages, obtains the remote agent profile, routes agent/task events, and tears down listeners/connections on deregistration.
49
+
50
+ ## Dependencies
51
+
52
+ | Dependency | Type (internal / external / peer) | How used | Failure / version handling |
53
+ |---|---|---|---|
54
+ | `@webex/webex-core` | external / peer | Runtime package dependency | Workspace/declared version; errors propagate through owning module |
55
+ | `@webex/calling` | external / peer | Runtime package dependency | Workspace/declared version; errors propagate through owning module |
56
+ | `@webex/internal-plugin-metrics` | external / peer | Runtime package dependency | Workspace/declared version; errors propagate through owning module |
57
+ | `@webex/internal-plugin-mercury` | external / peer | Runtime package dependency | Workspace/declared version; errors propagate through owning module |
58
+ | `wcc-api-gateway` | external Webex service | Service-catalog identifier resolved through the host Webex SDK; not an npm package dependency | Host service-catalog availability; routing errors propagate through the owning module |
59
+
60
+ ### State Model
61
+
62
+ - ContactCenter retains agent profile, task collections, WebSocket/reconnect flags, metrics queues/timers, page-cache entries, and task actors in memory.
63
+ - Remote systems remain authoritative for agent/task/configuration records.
64
+
65
+ ## Cross-Cutting Concerns
66
+
67
+ - **Security:** host-provided credentials and service routing; no tokens/secrets in source or logs; validate public inputs.
68
+ - **Observability:** LoggerProxy context/tracking ids plus MetricsManager success/failure/duration signals and diagnostic log upload.
69
+
70
+ ## Non-Functional Posture
71
+
72
+ Package compatibility and event-loop safety are primary: published exports/types are semver-sensitive, telemetry is non-blocking, listeners are cleaned up, and reconnect/timeouts are explicit.
73
+
74
+ ## Dependency / Interaction Topology
75
+
76
+ ```mermaid
77
+ flowchart TD
78
+ CC -->|calls| Services
79
+ Services -->|REST| Core
80
+ Core -->|events| CC
81
+ Core -->|events| Task
82
+ Task -->|typed events| StateMachine
83
+ StateMachine -->|actions/UI controls| Task
84
+ ```
85
+
86
+ | From | To | Kind (call / event) | Purpose |
87
+ |---|---|---|---|
88
+ | ContactCenter | Services | call | Backend/config/agent composition |
89
+ | WebSocketManager | ContactCenter/TaskManager/AqmReqs | event | Realtime routing and request completion |
90
+ | Task | Task state machine | call/event | Validate lifecycle transitions and emit task events |
91
+ | Data services | PageCache | call | Bounded pagination reuse |
92
+
93
+ ## Object / Data Ownership
94
+
95
+ | Domain object | System-of-record (owning component) | Read by |
96
+ |---|---|---|
97
+ | Agent/Profile | Remote WCC services; Config aggregates a local view | ContactCenter, Agent, Task |
98
+ | Task/Interaction | Remote WCC services; Task owns client representation | ContactCenter consumers |
99
+ | Metric event | Metrics module until submission; remote metrics backend after submit | Observability systems |
100
+ | Cached page | Utils PageCache (ephemeral only) | AddressBook, EntryPoint, Queue |
101
+
102
+ ## Caching Catalog
103
+
104
+ | Cache | Backend | What it holds | TTL | Invalidation trigger |
105
+ |---|---|---|---|---|
106
+ | PageCache | in-memory Map | simple paginated data-service pages | 5 minutes | expiry or explicit clear; parameterized queries bypass |
107
+
108
+ ## Observability Patterns
109
+
110
+ - **Logging:** LoggerProxy with module/method and tracking/interaction identifiers; no credentials or sensitive payloads.
111
+ - **Metrics:** METRIC_EVENT_NAMES plus behavioral taxonomy and `WXCC_SDK_` operational/business names.
112
+ - **Audit:** no local audit store; remote services own operational records.
113
+
114
+ ## Infrastructure Matrix
115
+
116
+ | Category | In use | Notes |
117
+ |---|---|---|
118
+ | Datastores | Remote WCC-owned stores | Package owns no durable store. |
119
+ | Messaging / streaming | WebSocket notification and RTD streams | Used for realtime events and AQM completion. |
120
+ | Cloud / platform services | Webex service catalog, WCC APIs, Calling/WebRTC, metrics | Host SDK supplies credentials/routing. |
121
+
122
+ ## Shared / Base Libraries
123
+
124
+ | Library | What every module inherits from it | Version floor |
125
+ |---|---|---|
126
+ | `@webex/webex-core` | plugin host, request/service routing | workspace version |
127
+ | `@webex/calling` | browser calling and line/call objects | workspace version |
128
+ | LoggerProxy/MetricsManager | package logging and telemetry conventions | package-local |
129
+
130
+ ## Package Map & Inter-Package Dependencies
131
+
132
+ - Workspace glob: root `package.json` `workspaces`; this scoped package is public and consumes internal/public sibling packages.
133
+ - `@webex/contact-center` depends on core, calling, metrics, mercury, support, authorization, and logger workspace packages; releases use the repository's synchronized package tooling.
134
+
135
+ ## Release & Versioning
136
+
137
+ - Published through the package's npm publish script to the configured registry. Public exports and declarations follow semver; breaking changes require a major-version consumer transition and changelog entry.
138
+
139
+ ## Host Integration & Theming
140
+
141
+ - Registered as WebexPlugin child `cc`; the host supplies credentials, configuration, request routing, logger, internal plugins, and lifecycle. The package renders no UI or theme.
142
+
143
+ ## Cross-Repo Dependency Graph
144
+
145
+ - **Internal:** sibling `@webex/*` workspace packages supply host, calling, telemetry, authorization, logging, and mercury capabilities.
146
+ - **External services:** WCC REST/WebSocket/RTD and Webex metrics backends.
147
+ - **External read-only:** GitHub/PR history may support rationale; code/tests remain the behavioral referee.
148
+
149
+ ## Security Architecture
150
+
151
+ The host Webex SDK establishes identity and injects authenticated service routing. Trust boundaries occur at exported SDK input, REST request construction, WebSocket parsing/event mapping, log upload, and metrics submission. Transport security is provided by host-resolved HTTPS/WSS services; durable encryption is remote-service owned.
152
+
153
+ ---
154
+ → Per-module design: `SPEC_INDEX.md`.
155
+
156
+ ## Architecture Reference Links
157
+
158
+ | Reference | Location | When to read |
159
+ |---|---|---|
160
+ | Architecture decisions | `adr/` | Durable design choices and supersession |
161
+ | Repo patterns | `patterns/` | Existing TypeScript, event, and testing conventions |
162
+ | Enforceable rules | `RULES.md` | Constraints for every change |
163
+
164
+ ## WS6 References
165
+
166
+ | WS6 artifact | Relevance to this repo | Link |
167
+ |---|---|---|
168
+ | None routed during onboarding | No separate WS6 artifact was provided. | N/A |
@@ -0,0 +1,46 @@
1
+ # Contracts Catalog — @webex/contact-center
2
+
3
+ > Start here → root [`AGENTS.md`](../AGENTS.md) · router [`SPEC_INDEX.md`](SPEC_INDEX.md) · system [`ARCHITECTURE.md`](ARCHITECTURE.md). Machine source: `.sdd/manifest.json`.
4
+
5
+ ### Exported API & Types
6
+ | Contract ID | Owner module/package | Symbol | Signature / shape | Stability / deprecation | Schema / detail link | Defined at |
7
+ |---|---|---|---|---|---|---|
8
+ | `contact-center.plugin` | Contact Center | `ContactCenter` / default plugin | WebexPlugin implementing `IContactCenter` | semver public | `ai-docs/contact-center-spec.md` | `src/index.ts` |
9
+ | `contact-center.routing-agent` | Agent/Core | `routingAgent` | `(routing: AqmReqs) => {stationLogin, logout, stateChange, buddyAgents, reload}` | semver public export; returned methods follow backend contracts | `src/services/agent/ai-docs/agent-spec.md` | `src/index.ts`, `src/services/agent/index.ts` |
10
+ | `contact-center.task` | Task | `Task`, `ITask`, task payload/control types | task instance and compatibility interface | semver public | `src/services/task/ai-docs/task-spec.md` | `src/index.ts` |
11
+ | `contact-center.events` | Agent/Task/Config | `AGENT_EVENTS`, `TASK_EVENTS`, `CC_AGENT_EVENTS`, `CC_TASK_EVENTS`, `CC_EVENTS` | typed string event contracts | additive; removals or semantic changes are breaking | owning module specs | `src/index.ts` |
12
+ | `contact-center.data` | Services/Utils | `AddressBook`, `ApiAIAssistant`, SDK data response/search types | SDK data and AI-assistant access | semver public | Services/Utils specs | `src/index.ts` |
13
+ | `contact-center.user-preference` | Services/Config | `UserPreference`, `cc.userPreference`, `UserPreferenceData`, request/response types | `getUserPreference(params?)`, `createUserPreference(data)`, `updateUserPreference(userId, data)`, `deleteUserPreference(userId)` | semver public | `src/services/ai-docs/services-spec.md` | `src/index.ts`, `src/cc.ts`, `src/services/UserPreference.ts`, `src/services/config/types.ts` |
14
+ | `contact-center.preview-campaign` | Contact Center/Task | `acceptPreviewContact`, `skipPreviewContact`, `removePreviewContact` | `(payload: PreviewContactPayload) => Promise<TaskResponse>` | semver public | `ai-docs/contact-center-spec.md`, `src/services/task/ai-docs/task-spec.md` | `src/cc.ts`, `src/services/task/dialer.ts`, `src/services/task/types.ts` |
15
+ | `contact-center.state-controls` | Task state machine | `getDefaultUIControls`, task state/control types | function is exported directly from `uiControlsComputer.ts` by package root | semver public | `src/services/task/state-machine/ai-docs/task-state-machine-spec.md` | `src/index.ts`, `src/services/task/state-machine/uiControlsComputer.ts` |
16
+
17
+ ### Events
18
+
19
+ | Contract ID | Owner module | Event / topic | Direction | Payload schema link | Delivery guarantees | Compatibility / deprecation | Defined at |
20
+ |---|---|---|---|---|---|---|---|
21
+ | `agent.events` | Agent | `agent:*` | publish to application | agent spec/types | realtime; backend ordering/correlation | additive constants | `src/services/agent/types.ts` |
22
+ | `task.events` | Task | `task:*` | publish to application/task | task spec/types | event-driven; state guarded | additive constants | `src/services/task/types.ts` |
23
+ | `cc.events` | Config/Core | backend CC_EVENTS | consume/map | config/core specs | remote WebSocket delivery; AQM correlation where configured | backend contract | `src/services/config/types.ts` |
24
+ | `rtd.events` | Task | realtime transcription/suggestion | consume then publish per task | task spec | websocket best-effort according to remote service | additive payloads | `src/services/task/TaskManager.ts` |
25
+
26
+ ## Requires — what this repo depends on
27
+
28
+ | Dependency | What is consumed | Schema / detail link | Availability assumption | Fallback on failure | Version floor |
29
+ |---|---|---|---|---|---|
30
+ | `@webex/webex-core` | plugin host, request/service routing | package declarations | required | fail operation | workspace version |
31
+ | WCC REST/WebSocket | agent/task/config/realtime contracts | module specs and source constants | required for runtime operations | structured error, reconnect, or timeout | remote compatible contract |
32
+ | `@webex/calling` | browser line/call lifecycle | Services/Task specs | required for BROWSER login | surface calling failure | workspace version |
33
+ | internal metrics/mercury/support/auth/logger | telemetry, realtime, support, identity, logging | package declarations | host-dependent | module-specific nonblocking/error path | workspace version |
34
+
35
+ ## Compatibility & Deprecation Policy
36
+
37
+ - **Breaking-change rule:** no removal, rename, payload reinterpretation, or semantic break without major-version migration and consumer notes.
38
+ - **Deprecation:** mark symbols/types in source/JSDoc, retain through an announced transition, and update changelog/spec/catalog together.
39
+
40
+ ## Detailed Interface Docs
41
+
42
+ - No OpenAPI/AsyncAPI/proto schema was found in scope; exact SDK and event contracts remain in TypeScript declarations and owning module specs.
43
+
44
+ ## Maintenance
45
+
46
+ - Update this catalog, the owning module spec, TypeScript declarations, and manifest in the same change as a contract.
@@ -0,0 +1,168 @@
1
+ # Getting Started — @webex/contact-center
2
+
3
+ > Start here → root [`AGENTS.md`](../AGENTS.md) · router [`SPEC_INDEX.md`](SPEC_INDEX.md) · system [`ARCHITECTURE.md`](ARCHITECTURE.md).
4
+
5
+ ## Prerequisites
6
+ - Node.js 22.14 for workspace development; the published package engine floor remains Node >=20.x. Use Yarn 3.4.1 from the workspace.
7
+ - Access to the workspace's npm registries and Webex backend environments is required for integration use.
8
+
9
+ The `@webex/contact-center` package is a Webex SDK plugin that provides a TypeScript/JavaScript API for building Contact Center agent applications. It enables:
10
+
11
+ - **Agent Session Management**: Register, login, logout, state changes
12
+
13
+ - **Task Handling**: Inbound/outbound calls, chat, transfers, conferences
14
+
15
+ - **Real-time Events**: WebSocket-based notifications for agent and task events
16
+
17
+ - **Browser-based Calling**: WebRTC integration for browser softphone
18
+
19
+ - **Metrics & Diagnostics**: Built-in telemetry and log upload
20
+
21
+ | Technology | Purpose |
22
+ |---|---|
23
+ | **TypeScript** | Primary language with strict mode |
24
+
25
+ | Technology | Purpose |
26
+ |---|---|
27
+ | **WebexPlugin** | Base class from `@webex/webex-core` |
28
+
29
+ | Technology | Purpose |
30
+ |---|---|
31
+ | **EventEmitter** | Event handling for real-time updates |
32
+
33
+ | Technology | Purpose |
34
+ |---|---|
35
+ | **WebSocket** | Real-time communication with Contact Center |
36
+
37
+ | Technology | Purpose |
38
+ |---|---|
39
+ | **WebRTC** | Browser-based calling (via WebCalling) |
40
+
41
+ | Technology | Purpose |
42
+ |---|---|
43
+ | **Jest** | Unit testing framework |
44
+
45
+ ## Clone & Install
46
+ ```bash
47
+ git clone https://github.com/webex/webex-js-sdk.git
48
+ cd webex-js-sdk
49
+ yarn install
50
+ ```
51
+
52
+ ## Build / Run / Test
53
+ | Task | Command |
54
+ |---|---|
55
+ | Build | `yarn workspace @webex/contact-center build:src` |
56
+ | Run locally | Consume through a Webex SDK host/application; this package has no standalone server. |
57
+ | Test | `yarn workspace @webex/contact-center test:unit` |
58
+ | Lint / format | `yarn workspace @webex/contact-center test:style` |
59
+
60
+ ```bash
61
+ yarn workspace @webex/contact-center build:src
62
+
63
+ yarn workspace @webex/contact-center test:unit
64
+
65
+ yarn workspace @webex/contact-center test:unit -- test/unit/spec/cc.ts
66
+
67
+ yarn workspace @webex/contact-center test:style
68
+ ```
69
+
70
+ ## First-Run Verification
71
+ - Run the unit suite and confirm Jest enforces the package's 85% global thresholds from `jest.config.js`.
72
+
73
+ > AI-focused documentation for the `@webex/contact-center` package to enable LLM agents to effectively create, modify, and fix SDK code.
74
+
75
+ Each service folder contains its own `ai-docs/` with:
76
+
77
+ - `AGENTS.md` - Usage examples, API reference, quick start
78
+
79
+ - `ARCHITECTURE.md` - Technical details, sequence diagrams, data flow
80
+
81
+ | Service | AGENTS.md | ARCHITECTURE.md |
82
+ |---|---|---|
83
+ | Agent | [`src/services/agent/ai-docs/agent-spec.md`](../src/services/agent/ai-docs/agent-spec.md) | [`src/services/agent/ai-docs/agent-spec.md`](../src/services/agent/ai-docs/agent-spec.md) |
84
+
85
+ | Service | AGENTS.md | ARCHITECTURE.md |
86
+ |---|---|---|
87
+ | Task | [`src/services/task/ai-docs/task-spec.md`](../src/services/task/ai-docs/task-spec.md) | [`src/services/task/ai-docs/task-spec.md`](../src/services/task/ai-docs/task-spec.md) |
88
+
89
+ | Service | AGENTS.md | ARCHITECTURE.md |
90
+ |---|---|---|
91
+ | Config | [`src/services/config/ai-docs/config-spec.md`](../src/services/config/ai-docs/config-spec.md) | [`src/services/config/ai-docs/config-spec.md`](../src/services/config/ai-docs/config-spec.md) |
92
+
93
+ | Service | AGENTS.md | ARCHITECTURE.md |
94
+ |---|---|---|
95
+ | Core | [`src/services/core/ai-docs/core-spec.md`](../src/services/core/ai-docs/core-spec.md) | [`src/services/core/ai-docs/core-spec.md`](../src/services/core/ai-docs/core-spec.md) |
96
+
97
+ ## Configuration & Secrets
98
+ - Runtime credentials and service routing come from the host Webex SDK and its environment configuration. Never hardcode or log tokens.
99
+
100
+ ## Dev Environment
101
+ - The package builds inside the Yarn workspace and consumes sibling `@webex/*` packages through workspace dependencies.
102
+
103
+ ```text
104
+ packages/@webex/contact-center/
105
+ ├── AGENTS.md # Main orchestrator (start here — at package root)
106
+ └── ai-docs/
107
+ ├── README.md # This file
108
+ ├── RULES.md # Coding standards
109
+ ├── patterns/ # Pattern documentation
110
+ │ ├── typescript-patterns.md
111
+ │ ├── testing-patterns.md
112
+ │ └── event-driven-patterns.md
113
+ └── templates/ # Code generation templates
114
+ ├── README.md
115
+ ├── new-service/ # Creating new services
116
+ ├── new-method/ # Adding methods
117
+ ├── existing-service/ # Bug fixes, features
118
+ └── documentation/ # Doc generation
119
+ ```
120
+
121
+ ```text
122
+ ContactCenter (cc.ts)
123
+ └── Services (singleton)
124
+ ├── agent/ → Agent operations (login, logout, state)
125
+ ├── task/ → Task operations (hold, transfer, wrapup)
126
+ │ └── TaskManager → Task lifecycle
127
+ ├── config/ → Configuration fetching
128
+ ├── core/ → WebSocket, HTTP, utilities
129
+ ├── AddressBook → Address book entries
130
+ ├── EntryPoint → Entry points
131
+ └── Queue → Queues
132
+ ```
133
+
134
+ ## Where to Go Next
135
+ - Agent entry: `../AGENTS.md` · System shape: `ARCHITECTURE.md` · Routing: `SPEC_INDEX.md`
136
+ - Conventions: `patterns/`, `RULES.md`, and the manifest-routed module specification for the target capability.
137
+
138
+ | Document | Purpose |
139
+ |---|---|
140
+ | [AGENTS.md](../AGENTS.md) | **Start here** - Main AI agent orchestrator (at package root) |
141
+
142
+ | Document | Purpose |
143
+ |---|---|
144
+ | [RULES.md](RULES.md) | Coding standards and conventions |
145
+
146
+ | Document | Purpose |
147
+ |---|---|
148
+ | [patterns/](patterns/) | Pattern documentation |
149
+
150
+ | Document | Purpose |
151
+ |---|---|
152
+ | [templates/](templates/) | Code generation templates |
153
+
154
+ Start with the root [`AGENTS.md`](../AGENTS.md) for critical repository rules and the developer workflow, then use [`SPEC_INDEX.md`](SPEC_INDEX.md) to classify the task by owning module and open its canonical `*-spec.md`.
155
+
156
+ When adding new features:
157
+
158
+ 1. Update the relevant service's docs (use the table above to find the right file):
159
+
160
+ - Service `AGENTS.md` — if usage/API surface changed
161
+
162
+ - Service `ARCHITECTURE.md` — if data flow or architecture changed
163
+
164
+ 2. Add new patterns to [`patterns/`](patterns/) if introducing new patterns
165
+
166
+ 3. Update [`templates/`](templates/) if the workflow changes
167
+
168
+ 4. Update the root [`AGENTS.md`](../AGENTS.md) if task routing or critical rules changed
@@ -0,0 +1,43 @@
1
+ # Glossary — @webex/contact-center
2
+
3
+ > Start here → root [`AGENTS.md`](../AGENTS.md) · router [`SPEC_INDEX.md`](SPEC_INDEX.md) · system [`ARCHITECTURE.md`](ARCHITECTURE.md).
4
+
5
+ ## Domain Terms
6
+
7
+ | Term | Definition (one or two sentences) | Authoritative location (file/type) | Notes / synonyms to avoid |
8
+ |---|---|---|---|
9
+ | ContactCenter | Host-embedded Webex plugin exposing the package API. | `src/cc.ts` | Registered as `cc`. |
10
+ | Agent Profile | Aggregated remote configuration used during an agent session. | `src/services/config/types.ts` | Do not call it durable local state. |
11
+ | Task | Client representation of a contact-center interaction and its operations. | `src/services/task/Task.ts` | Backed by remote interaction data. |
12
+ | AQM request | HTTP initiation whose success/failure may be delivered by correlated WebSocket notification. | `src/services/core/aqm-reqs.ts` | Not request-over-WebSocket. |
13
+ | TaskEvent | Typed internal state-machine event mapped from API calls or backend events. | `src/services/task/state-machine/constants.ts` | Distinct from raw CC_EVENTS. |
14
+ | PageCache | Five-minute in-memory cache for simple paginated data-service requests. | `src/utils/PageCache.ts` | Parameterized searches bypass it. |
15
+
16
+ ## Abbreviations & Acronyms
17
+
18
+ | Abbreviation | Expansion | Meaning in this repo |
19
+ |---|---|---|
20
+ | WCC | Webex Contact Center | Remote Contact Center service family. |
21
+ | AQM | Agent Queue Manager | Backend operation/correlation pattern. |
22
+ | RTD | Realtime data/transcription | Secondary realtime WebSocket stream. |
23
+ | RONA | Ring On No Answer | Offered-task failure state/event. |
24
+ | ANI | Automatic Number Identification | Outbound caller-id selection data. |
25
+
26
+ ## Context-Specific Meanings
27
+
28
+ | Term | Context / module | Meaning here |
29
+ |---|---|---|
30
+ | Event | Config/Core | Raw backend WebSocket event. |
31
+ | Event | Task state machine | Typed TaskEvent after mapping. |
32
+ | State | Agent | Backend agent availability/substatus. |
33
+ | State | Task | XState task lifecycle state. |
34
+
35
+ ## Deprecated / Renamed Terms
36
+
37
+ | Old term | Current term | Why renamed | Still appears in |
38
+ |---|---|---|---|
39
+ | plugin-cc | contact-center | Package rename recorded in history. | Older history and integrations. |
40
+
41
+ ## Maintenance
42
+
43
+ - Add new entities, events, states, or renamed concepts here in the same change.
@@ -0,0 +1,138 @@
1
+ # Contact Center SDK - AI Documentation
2
+
3
+ > AI-focused documentation for the `@webex/contact-center` package to enable LLM agents to effectively create, modify, and fix SDK code.
4
+
5
+ ---
6
+
7
+ ## Package Overview
8
+
9
+ The `@webex/contact-center` package is a Webex SDK plugin that provides a TypeScript/JavaScript API for building Contact Center agent applications. It enables:
10
+
11
+ - **Agent Session Management**: Register, login, logout, state changes
12
+ - **Task Handling**: Inbound/outbound calls, chat, transfers, conferences
13
+ - **Real-time Events**: WebSocket-based notifications for agent and task events
14
+ - **Browser-based Calling**: WebRTC integration for browser softphone
15
+ - **Metrics & Diagnostics**: Built-in telemetry and log upload
16
+
17
+ ---
18
+
19
+ ## Technologies
20
+
21
+ | Technology | Purpose |
22
+ |------------|---------|
23
+ | **TypeScript** | Primary language with strict mode |
24
+ | **WebexPlugin** | Base class from `@webex/webex-core` |
25
+ | **EventEmitter** | Event handling for real-time updates |
26
+ | **WebSocket** | Real-time communication with Contact Center |
27
+ | **WebRTC** | Browser-based calling (via WebCalling) |
28
+ | **Jest** | Unit testing framework |
29
+
30
+ ---
31
+
32
+ ## Quick Links
33
+
34
+ | Document | Purpose |
35
+ |----------|---------|
36
+ | [AGENTS.md](../AGENTS.md) | **Start here** - Main AI agent orchestrator (at package root) |
37
+ | [SPEC_INDEX.md](SPEC_INDEX.md) | Route work to the owning canonical module specification |
38
+ | [RULES.md](RULES.md) | Coding standards and conventions |
39
+ | [patterns/](patterns/) | Pattern documentation |
40
+ | [templates/](templates/) | Code generation templates |
41
+
42
+ ---
43
+
44
+ ## For AI Agents
45
+
46
+ ### Starting a Task
47
+
48
+ Start with the root [`AGENTS.md`](../AGENTS.md) for critical repository rules and the developer workflow, then use [`SPEC_INDEX.md`](SPEC_INDEX.md) to classify the task by owning module and open its canonical `*-spec.md`.
49
+
50
+ ---
51
+
52
+ ## Directory Structure
53
+
54
+ ```
55
+ packages/@webex/contact-center/
56
+ ├── AGENTS.md # Main orchestrator (start here — at package root)
57
+ └── ai-docs/
58
+ ├── README.md # This file
59
+ ├── SPEC_INDEX.md # Canonical module router
60
+ ├── contact-center-spec.md # Canonical public plugin specification
61
+ ├── CONTRACTS.md # Public contract catalog
62
+ ├── adr/ # Durable architecture decisions
63
+ ├── RULES.md # Coding standards
64
+ ├── patterns/ # Pattern documentation
65
+ │ ├── typescript-patterns.md
66
+ │ ├── testing-patterns.md
67
+ │ └── event-driven-patterns.md
68
+ └── templates/ # Code generation templates
69
+ ├── README.md
70
+ ├── new-service/ # Creating new services
71
+ ├── new-method/ # Adding methods
72
+ ├── existing-service/ # Bug fixes, features
73
+ └── documentation/ # Doc generation
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Package Commands
79
+
80
+ ```bash
81
+ # Build
82
+ yarn workspace @webex/contact-center build:src
83
+
84
+ # Test unit tests
85
+ yarn workspace @webex/contact-center test:unit
86
+
87
+ # Test specific file
88
+ yarn workspace @webex/contact-center test:unit -- <path_of_test_file>
89
+
90
+ # Lint
91
+ yarn workspace @webex/contact-center test:style
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Service Architecture
97
+
98
+ ```
99
+ ContactCenter (cc.ts)
100
+ └── Services (singleton)
101
+ ├── agent/ → Agent operations (login, logout, state)
102
+ ├── task/ → Task operations (hold, transfer, wrapup)
103
+ │ └── TaskManager → Task lifecycle
104
+ ├── config/ → Configuration fetching
105
+ ├── core/ → WebSocket, HTTP, utilities
106
+ ├── AddressBook → Address book entries
107
+ ├── EntryPoint → Entry points
108
+ └── Queue → Queues
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Canonical Module Specifications
114
+
115
+ Use [`SPEC_INDEX.md`](SPEC_INDEX.md) to select the owning module. Each manifest-routed module has one canonical `*-spec.md`; retained module-level `AGENTS.md` and `ARCHITECTURE.md` files are legacy/reference-only migration sources, as recorded in [`ADR-0001`](adr/0001-spec-source-policy.md).
116
+
117
+ | Module | Canonical specification |
118
+ |---|---|
119
+ | Contact Center public plugin | [`contact-center-spec.md`](contact-center-spec.md) |
120
+ | Metrics | [`metrics-spec.md`](../src/metrics/ai-docs/metrics-spec.md) |
121
+ | Services composition | [`services-spec.md`](../src/services/ai-docs/services-spec.md) |
122
+ | Agent | [`agent-spec.md`](../src/services/agent/ai-docs/agent-spec.md) |
123
+ | Config | [`config-spec.md`](../src/services/config/ai-docs/config-spec.md) |
124
+ | Core | [`core-spec.md`](../src/services/core/ai-docs/core-spec.md) |
125
+ | Task | [`task-spec.md`](../src/services/task/ai-docs/task-spec.md) |
126
+ | Task state machine | [`task-state-machine-spec.md`](../src/services/task/state-machine/ai-docs/task-state-machine-spec.md) |
127
+ | Utils | [`utils-spec.md`](../src/utils/ai-docs/utils-spec.md) |
128
+
129
+ ---
130
+
131
+ ## Contributing to AI Docs
132
+
133
+ When adding new features:
134
+ 1. Use [`SPEC_INDEX.md`](SPEC_INDEX.md) to select the owning canonical module specification.
135
+ 2. Update that `*-spec.md` with the behavior, source evidence, test evidence, and known gaps.
136
+ 3. For exported API, event, or type changes, also update [`CONTRACTS.md`](CONTRACTS.md), the Contact Center specification, and `.sdd/manifest.json` when its routing, coverage, or validation evidence changes.
137
+ 4. Add or update [`patterns/`](patterns/) and [`templates/`](templates/) only when their reusable guidance changes.
138
+ 5. Update the root [`AGENTS.md`](../AGENTS.md) when task routing or critical rules change. Do not update retained service `AGENTS.md` or `ARCHITECTURE.md` as an independent source of truth.