@webex/contact-center 3.12.0-next.13 → 3.12.0-next.130

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 (312) hide show
  1. package/.sdd/manifest.json +884 -0
  2. package/AGENTS.md +94 -0
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +53 -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 +52 -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 +382 -0
  17. package/ai-docs/features/consult-transfer-list-policy/spec/feature-spec.md +362 -0
  18. package/ai-docs/features/contact-owner-change-refactor.md +78 -0
  19. package/ai-docs/features/generated-spec-conformance-fidelity-remediation/spec/feature-spec.md +117 -0
  20. package/ai-docs/features/residual-warning-coverage-completion/spec/feature-spec.md +203 -0
  21. package/ai-docs/features/validator-code-fidelity-drift-fix/spec/feature-spec.md +315 -0
  22. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  23. package/ai-docs/patterns/testing-patterns.md +480 -0
  24. package/ai-docs/patterns/typescript-patterns.md +365 -0
  25. package/ai-docs/templates/README.md +102 -0
  26. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  27. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  28. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  29. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  30. package/ai-docs/templates/new-method/00-master.md +80 -0
  31. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  32. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  33. package/ai-docs/templates/new-method/03-tests.md +201 -0
  34. package/ai-docs/templates/new-method/04-validation.md +141 -0
  35. package/ai-docs/templates/new-service/00-master.md +109 -0
  36. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  37. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  38. package/ai-docs/templates/new-service/03-integration.md +178 -0
  39. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  40. package/ai-docs/templates/new-service/05-validation.md +145 -0
  41. package/dist/cc.js +971 -42
  42. package/dist/cc.js.map +1 -1
  43. package/dist/config.js +13 -0
  44. package/dist/config.js.map +1 -1
  45. package/dist/constants.js +31 -3
  46. package/dist/constants.js.map +1 -1
  47. package/dist/index.js +45 -15
  48. package/dist/index.js.map +1 -1
  49. package/dist/metrics/MetricsManager.js +16 -0
  50. package/dist/metrics/MetricsManager.js.map +1 -1
  51. package/dist/metrics/behavioral-events.js +205 -0
  52. package/dist/metrics/behavioral-events.js.map +1 -1
  53. package/dist/metrics/constants.js +48 -4
  54. package/dist/metrics/constants.js.map +1 -1
  55. package/dist/services/AddressBook.js +18 -15
  56. package/dist/services/AddressBook.js.map +1 -1
  57. package/dist/services/AnswerCallOnWebexService.js +202 -0
  58. package/dist/services/AnswerCallOnWebexService.js.map +1 -0
  59. package/dist/services/ApiAiAssistant.js +269 -9
  60. package/dist/services/ApiAiAssistant.js.map +1 -1
  61. package/dist/services/EntryPoint.js +46 -68
  62. package/dist/services/EntryPoint.js.map +1 -1
  63. package/dist/services/Queue.js +27 -22
  64. package/dist/services/Queue.js.map +1 -1
  65. package/dist/services/UserPreference.js +427 -0
  66. package/dist/services/UserPreference.js.map +1 -0
  67. package/dist/services/WebexCrossClientService.js +222 -0
  68. package/dist/services/WebexCrossClientService.js.map +1 -0
  69. package/dist/services/WxAppTelephonyMercurySync.js +108 -0
  70. package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
  71. package/dist/services/config/Util.js +11 -4
  72. package/dist/services/config/Util.js.map +1 -1
  73. package/dist/services/config/constants.js +41 -7
  74. package/dist/services/config/constants.js.map +1 -1
  75. package/dist/services/config/index.js +51 -0
  76. package/dist/services/config/index.js.map +1 -1
  77. package/dist/services/config/types.js +57 -12
  78. package/dist/services/config/types.js.map +1 -1
  79. package/dist/services/core/Err.js.map +1 -1
  80. package/dist/services/core/Utils.js +111 -32
  81. package/dist/services/core/Utils.js.map +1 -1
  82. package/dist/services/core/WebexRequest.js +6 -2
  83. package/dist/services/core/WebexRequest.js.map +1 -1
  84. package/dist/services/core/aqm-reqs.js +28 -14
  85. package/dist/services/core/aqm-reqs.js.map +1 -1
  86. package/dist/services/core/types.js.map +1 -1
  87. package/dist/services/core/websocket/WebSocketManager.js +2 -1
  88. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  89. package/dist/services/core/websocket/types.js.map +1 -1
  90. package/dist/services/index.js +1 -1
  91. package/dist/services/index.js.map +1 -1
  92. package/dist/services/task/Task.js +754 -0
  93. package/dist/services/task/Task.js.map +1 -0
  94. package/dist/services/task/TaskFactory.js +49 -0
  95. package/dist/services/task/TaskFactory.js.map +1 -0
  96. package/dist/services/task/TaskManager.js +1172 -521
  97. package/dist/services/task/TaskManager.js.map +1 -1
  98. package/dist/services/task/TaskUtils.js +211 -27
  99. package/dist/services/task/TaskUtils.js.map +1 -1
  100. package/dist/services/task/WebexCallingUtils.js +70 -0
  101. package/dist/services/task/WebexCallingUtils.js.map +1 -0
  102. package/dist/services/task/constants.js +12 -2
  103. package/dist/services/task/constants.js.map +1 -1
  104. package/dist/services/task/contact.js +29 -0
  105. package/dist/services/task/contact.js.map +1 -1
  106. package/dist/services/task/dialer.js +78 -0
  107. package/dist/services/task/dialer.js.map +1 -1
  108. package/dist/services/task/digital/Digital.js +78 -0
  109. package/dist/services/task/digital/Digital.js.map +1 -0
  110. package/dist/services/task/state-machine/TaskStateMachine.js +982 -0
  111. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  112. package/dist/services/task/state-machine/actions.js +572 -0
  113. package/dist/services/task/state-machine/actions.js.map +1 -0
  114. package/dist/services/task/state-machine/constants.js +161 -0
  115. package/dist/services/task/state-machine/constants.js.map +1 -0
  116. package/dist/services/task/state-machine/guards.js +379 -0
  117. package/dist/services/task/state-machine/guards.js.map +1 -0
  118. package/dist/services/task/state-machine/index.js +53 -0
  119. package/dist/services/task/state-machine/index.js.map +1 -0
  120. package/dist/services/task/state-machine/types.js +54 -0
  121. package/dist/services/task/state-machine/types.js.map +1 -0
  122. package/dist/services/task/state-machine/uiControlsComputer.js +703 -0
  123. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  124. package/dist/services/task/taskDataNormalizer.js +99 -0
  125. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  126. package/dist/services/task/types.js +228 -5
  127. package/dist/services/task/types.js.map +1 -1
  128. package/dist/services/task/voice/Voice.js +1485 -0
  129. package/dist/services/task/voice/Voice.js.map +1 -0
  130. package/dist/services/task/voice/WebRTC.js +152 -0
  131. package/dist/services/task/voice/WebRTC.js.map +1 -0
  132. package/dist/services/task/voice/wxAppVoiceMethods.js +354 -0
  133. package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
  134. package/dist/services/wxAppDiagnosticLogging.js +122 -0
  135. package/dist/services/wxAppDiagnosticLogging.js.map +1 -0
  136. package/dist/services/wxAppTelephonyUtils.js +19 -0
  137. package/dist/services/wxAppTelephonyUtils.js.map +1 -0
  138. package/dist/types/cc.d.ts +193 -6
  139. package/dist/types/config.d.ts +13 -0
  140. package/dist/types/constants.d.ts +29 -1
  141. package/dist/types/index.d.ts +35 -8
  142. package/dist/types/metrics/MetricsManager.d.ts +6 -0
  143. package/dist/types/metrics/constants.d.ts +43 -1
  144. package/dist/types/services/AddressBook.d.ts +2 -1
  145. package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
  146. package/dist/types/services/ApiAiAssistant.d.ts +56 -5
  147. package/dist/types/services/EntryPoint.d.ts +7 -5
  148. package/dist/types/services/Queue.d.ts +5 -3
  149. package/dist/types/services/UserPreference.d.ts +118 -0
  150. package/dist/types/services/WebexCrossClientService.d.ts +32 -0
  151. package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
  152. package/dist/types/services/config/constants.d.ts +34 -5
  153. package/dist/types/services/config/types.d.ts +197 -12
  154. package/dist/types/services/core/Err.d.ts +6 -0
  155. package/dist/types/services/core/Utils.d.ts +35 -13
  156. package/dist/types/services/core/WebexRequest.d.ts +1 -0
  157. package/dist/types/services/core/types.d.ts +2 -0
  158. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  159. package/dist/types/services/core/websocket/types.d.ts +1 -1
  160. package/dist/types/services/index.d.ts +1 -1
  161. package/dist/types/services/task/Task.d.ts +175 -0
  162. package/dist/types/services/task/TaskFactory.d.ts +13 -0
  163. package/dist/types/services/task/TaskUtils.d.ts +48 -2
  164. package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
  165. package/dist/types/services/task/constants.d.ts +10 -0
  166. package/dist/types/services/task/contact.d.ts +4 -0
  167. package/dist/types/services/task/dialer.d.ts +30 -0
  168. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  169. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1442 -0
  170. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  171. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  172. package/dist/types/services/task/state-machine/guards.d.ts +103 -0
  173. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  174. package/dist/types/services/task/state-machine/types.d.ts +277 -0
  175. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  176. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  177. package/dist/types/services/task/types.d.ts +680 -66
  178. package/dist/types/services/task/voice/Voice.d.ts +227 -0
  179. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  180. package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +55 -0
  181. package/dist/types/services/wxAppDiagnosticLogging.d.ts +51 -0
  182. package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
  183. package/dist/types/types.d.ts +205 -9
  184. package/dist/types/utils/PageCache.d.ts +20 -3
  185. package/dist/types/webex.d.ts +1 -0
  186. package/dist/types.js +162 -4
  187. package/dist/types.js.map +1 -1
  188. package/dist/utils/PageCache.js +19 -5
  189. package/dist/utils/PageCache.js.map +1 -1
  190. package/dist/webex.js +22 -2
  191. package/dist/webex.js.map +1 -1
  192. package/package.json +16 -12
  193. package/src/cc.ts +1289 -112
  194. package/src/config.ts +13 -0
  195. package/src/constants.ts +29 -1
  196. package/src/index.ts +36 -5
  197. package/src/metrics/MetricsManager.ts +16 -0
  198. package/src/metrics/ai-docs/AGENTS.md +350 -0
  199. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  200. package/src/metrics/ai-docs/metrics-spec.md +921 -0
  201. package/src/metrics/behavioral-events.ts +212 -0
  202. package/src/metrics/constants.ts +52 -4
  203. package/src/services/AddressBook.ts +17 -6
  204. package/src/services/AnswerCallOnWebexService.ts +239 -0
  205. package/src/services/ApiAiAssistant.ts +356 -9
  206. package/src/services/EntryPoint.ts +59 -60
  207. package/src/services/Queue.ts +29 -12
  208. package/src/services/UserPreference.ts +509 -0
  209. package/src/services/WebexCrossClientService.ts +293 -0
  210. package/src/services/WxAppTelephonyMercurySync.ts +142 -0
  211. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  212. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  213. package/src/services/agent/ai-docs/agent-spec.md +505 -0
  214. package/src/services/ai-docs/AGENTS.md +386 -0
  215. package/src/services/ai-docs/services-spec.md +505 -0
  216. package/src/services/config/Util.ts +12 -3
  217. package/src/services/config/ai-docs/AGENTS.md +255 -0
  218. package/src/services/config/ai-docs/ARCHITECTURE.md +426 -0
  219. package/src/services/config/ai-docs/config-spec.md +686 -0
  220. package/src/services/config/constants.ts +46 -6
  221. package/src/services/config/index.ts +65 -0
  222. package/src/services/config/types.ts +197 -13
  223. package/src/services/core/Err.ts +3 -0
  224. package/src/services/core/Utils.ts +127 -37
  225. package/src/services/core/WebexRequest.ts +3 -1
  226. package/src/services/core/ai-docs/AGENTS.md +381 -0
  227. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  228. package/src/services/core/ai-docs/core-spec.md +787 -0
  229. package/src/services/core/aqm-reqs.ts +30 -15
  230. package/src/services/core/types.ts +2 -0
  231. package/src/services/core/websocket/WebSocketManager.ts +2 -0
  232. package/src/services/core/websocket/types.ts +1 -1
  233. package/src/services/index.ts +1 -1
  234. package/src/services/task/Task.ts +908 -0
  235. package/src/services/task/TaskFactory.ts +60 -0
  236. package/src/services/task/TaskManager.ts +1419 -608
  237. package/src/services/task/TaskUtils.ts +303 -25
  238. package/src/services/task/WebexCallingUtils.ts +136 -0
  239. package/src/services/task/ai-docs/AGENTS.md +457 -0
  240. package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
  241. package/src/services/task/ai-docs/task-spec.md +1474 -0
  242. package/src/services/task/constants.ts +10 -0
  243. package/src/services/task/contact.ts +30 -0
  244. package/src/services/task/dialer.ts +80 -0
  245. package/src/services/task/digital/Digital.ts +97 -0
  246. package/src/services/task/state-machine/TaskStateMachine.ts +1320 -0
  247. package/src/services/task/state-machine/actions.ts +741 -0
  248. package/src/services/task/state-machine/ai-docs/AGENTS.md +460 -0
  249. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1156 -0
  250. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2247 -0
  251. package/src/services/task/state-machine/constants.ts +172 -0
  252. package/src/services/task/state-machine/guards.ts +442 -0
  253. package/src/services/task/state-machine/index.ts +28 -0
  254. package/src/services/task/state-machine/types.ts +258 -0
  255. package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
  256. package/src/services/task/taskDataNormalizer.ts +137 -0
  257. package/src/services/task/types.ts +819 -70
  258. package/src/services/task/voice/Voice.ts +1851 -0
  259. package/src/services/task/voice/WebRTC.ts +191 -0
  260. package/src/services/task/voice/wxAppVoiceMethods.ts +516 -0
  261. package/src/services/wxAppDiagnosticLogging.ts +174 -0
  262. package/src/services/wxAppTelephonyUtils.ts +14 -0
  263. package/src/types.ts +262 -11
  264. package/src/utils/AGENTS.md +289 -0
  265. package/src/utils/PageCache.ts +38 -5
  266. package/src/utils/ai-docs/utils-spec.md +391 -0
  267. package/src/webex.js +10 -0
  268. package/test/unit/spec/cc.ts +2210 -119
  269. package/test/unit/spec/logger-proxy.ts +70 -0
  270. package/test/unit/spec/metrics/MetricsManager.ts +25 -0
  271. package/test/unit/spec/metrics/behavioral-events.ts +60 -0
  272. package/test/unit/spec/services/AddressBook.ts +37 -6
  273. package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
  274. package/test/unit/spec/services/ApiAiAssistant.ts +311 -21
  275. package/test/unit/spec/services/EntryPoint.ts +87 -40
  276. package/test/unit/spec/services/Queue.ts +123 -12
  277. package/test/unit/spec/services/UserPreference.ts +401 -0
  278. package/test/unit/spec/services/WebCallingService.ts +7 -1
  279. package/test/unit/spec/services/WebexCrossClientService.ts +467 -0
  280. package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
  281. package/test/unit/spec/services/config/Util.ts +129 -0
  282. package/test/unit/spec/services/config/index.ts +97 -29
  283. package/test/unit/spec/services/core/Utils.ts +425 -8
  284. package/test/unit/spec/services/core/WebexRequest.ts +3 -1
  285. package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
  286. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
  287. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  288. package/test/unit/spec/services/task/Task.ts +745 -0
  289. package/test/unit/spec/services/task/TaskFactory.ts +99 -0
  290. package/test/unit/spec/services/task/TaskManager.ts +2518 -1494
  291. package/test/unit/spec/services/task/TaskUtils.ts +235 -0
  292. package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
  293. package/test/unit/spec/services/task/contact.ts +33 -0
  294. package/test/unit/spec/services/task/dialer.ts +190 -0
  295. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  296. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +4060 -0
  297. package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
  298. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  299. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
  300. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  301. package/test/unit/spec/services/task/voice/Voice.ts +2061 -0
  302. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  303. package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +603 -0
  304. package/test/unit/spec/services/wxAppDiagnosticLogging.ts +143 -0
  305. package/test/unit/spec/wellnessSampleUtils.ts +288 -0
  306. package/umd/contact-center.min.js +2 -2
  307. package/umd/contact-center.min.js.map +1 -1
  308. package/dist/services/task/index.js +0 -1525
  309. package/dist/services/task/index.js.map +0 -1
  310. package/dist/types/services/task/index.d.ts +0 -650
  311. package/src/services/task/index.ts +0 -1801
  312. package/test/unit/spec/services/task/index.ts +0 -2184
@@ -0,0 +1,686 @@
1
+ # Config — SPEC
2
+
3
+ > Start here → root [`AGENTS.md`](../../../../AGENTS.md) · router [`SPEC_INDEX.md`](../../../../ai-docs/SPEC_INDEX.md) · system [`ARCHITECTURE.md`](../../../../ai-docs/ARCHITECTURE.md). This is the module's canonical specification.
4
+
5
+ ## Metadata
6
+
7
+ | Field | Value |
8
+ |---|---|
9
+ | Module id | `config` |
10
+ | Source path(s) | `src/services/config` |
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 Agent Wellness Break delta / 2026-09-02 |
15
+ | Validation status | Agent Wellness Break v0.4 delta independently validated by claude-code on 2026-09-07; coverage remains Partial until the remaining baseline promotion criteria are satisfied |
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
+ Config is one of nine confirmed Contact Center SDK modules. Own retrieval and aggregation of remote organization, agent, team, profile, auxiliary-code, dial-plan, and feature configuration. Existing reviewed documentation is migrated by meaning and code/tests remain the behavioral referee.
27
+
28
+ The Config Service is an **internal service** that builds the comprehensive AgentProfile (`Profile` type) by:
29
+
30
+ 1. Fetching user data
31
+
32
+ 2. Fetching desktop profile
33
+
34
+ 3. Fetching teams
35
+
36
+ 4. Fetching aux codes (idle/wrapup codes)
37
+
38
+ 5. Fetching organization settings
39
+
40
+ 6. Aggregating all data into a single AgentProfile
41
+
42
+ The AgentProfile is the central configuration object required for an agent to operate within the contact center. It is built during the registration flow (`cc.register()`) and contains all the data an agent needs: identity, team assignments, dial plans, aux codes, login options, and feature flags. Once constructed, the AgentProfile is stored on the `ContactCenter` plugin instance as `this.agentConfig` and is used by other services (Agent, Task) throughout the session.
43
+
44
+ - **AgentProfile Aggregation**: Combines data from 8+ API endpoints
45
+
46
+ - **Aux Codes Fetching**: Gets all idle and wrapup codes with pagination
47
+
48
+ - **Team Data**: Retrieves agent's team assignments
49
+
50
+ - **Dial Plan**: Fetches number transformation rules
51
+
52
+ - **Outdial ANI**: Retrieves outbound caller ID options (standalone, publicly exposed via `cc.ts`)
53
+
54
+ - **Multimedia Profile**: Fetches channel capacity and blending config (standalone, not yet publicly exposed)
55
+
56
+ - **Paginated Data Access**: `getListOfTeams` and `getListOfAuxCodes` support custom pagination independent of profile building
57
+
58
+ ## Purpose / Responsibility
59
+ Own retrieval and aggregation of remote organization, agent, team, profile, auxiliary-code, dial-plan, and feature configuration.
60
+
61
+ ## Stack
62
+ TypeScript 5.4 REST client, Promise-based parallel aggregation, Jest 27.
63
+
64
+ ## Folder / Package Structure
65
+ ```text
66
+ src/services/config/
67
+ ├── Util.ts
68
+ ├── constants.ts
69
+ ├── index.ts
70
+ ├── types.ts
71
+ ```
72
+
73
+ ```text
74
+ services/config/
75
+ ├── index.ts # AgentConfigService class
76
+ ├── types.ts # Profile, CC_EVENTS, types
77
+ ├── constants.ts # API endpoints, defaults
78
+ ├── Util.ts # parseAgentConfigs helper
79
+ └── ai-docs/
80
+ ├── AGENTS.md # Usage documentation
81
+ └── ARCHITECTURE.md # Preserved legacy migration source (non-canonical)
82
+ ```
83
+
84
+ ## Key Files (source of truth)
85
+ | File | Holds |
86
+ |---|---|
87
+ | `src/services/config/index.ts` | Authoritative Config implementation or contract source. |
88
+ | `src/services/config/Util.ts` | Authoritative Config implementation or contract source. |
89
+ | `src/services/config/types.ts` | Authoritative Config implementation or contract source. |
90
+ | `src/services/config/constants.ts` | Authoritative Config implementation or contract source. |
91
+
92
+ ## Public Surface
93
+ | Surface | Contract | Source |
94
+ |---|---|---|
95
+ | `getAgentConfig(orgId, agentId)` | staged, all-or-nothing `Promise<Profile>` aggregation | `src/services/config/index.ts` |
96
+ | User/profile/site/team/aux-code fetches | typed REST methods including pagination helpers | `src/services/config/index.ts`, `src/services/config/types.ts` |
97
+ | `getAIFeatureFlags(orgId)` | `AIFeatureFlagsResponse` from `organization/{orgId}/v2/ai-feature?page=0&pageSize=100` | `src/services/config/index.ts`, `src/services/config/constants.ts` |
98
+ | `Profile.aiFeature` | optional first AI-feature row mapped by `parseAgentConfigs` | `src/services/config/Util.ts`, `src/services/config/types.ts` |
99
+ | Multimedia profile | `MultimediaProfileResponse` | `src/services/config/types.ts` |
100
+ | Organization masking | `OrgSettings.maskSensitiveData` | `src/services/config/types.ts`, `src/services/config/Util.ts` |
101
+ | Auxiliary-code list URL | includes `desktopProfileFilter=true` | `src/services/config/constants.ts` |
102
+ | Outdial ANI entries | public wrapper through ContactCenter | `src/services/config/index.ts`, `src/cc.ts` |
103
+ | `Profile.isWellnessBreakEnabled` | required effective flag derived from backend AI feature configuration and organization license quantity | `src/services/config/Util.ts`, `src/services/config/types.ts` |
104
+ | `getWellbeingBreakIdleCode(orgId)` | paginated exact lookup for the active system idle code named `WellbeingBreak`, exposed and registration-cached by ContactCenter | `src/services/config/index.ts`, `src/services/config/constants.ts`, `src/cc.ts` |
105
+
106
+ The service has no `TeamList.channelMap` contract. Exact package exports are indexed in root `CONTRACTS.md`.
107
+
108
+ ## Requires (dependencies)
109
+ - WebexRequest
110
+ - WCC organization/profile/team/site/tenant APIs
111
+ - ContactCenter registration flow
112
+
113
+ ## Requirements
114
+ | ID | WHAT | WHY | Source Evidence | Test / Example Evidence | Assumptions / Gaps | Confidence |
115
+ |---|---|---|---|---|---|---|
116
+ | CONFIG-R-001 | Fetch user config first, then aggregate ten dependent promises including AI feature flags, auxiliary codes, profile/site/team/dial-plan, organization, tenant, and URL data. | Dependent IDs and all-or-nothing consistency require staged orchestration. | `src/services/config/index.ts` | `test/unit/spec/services/config/index.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
117
+ | CONFIG-R-002 | Include `getAIFeatureFlags` response in `parseAgentConfigs` so `Profile.aiFeature` reflects `/v2/ai-feature`. | ApiAIAssistant behavior is gated by the remote organization feature contract. | `src/services/config/index.ts` | `test/unit/spec/services/config/index.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
118
+ | CONFIG-R-003 | Paginate teams and auxiliary codes until completion and include `desktopProfileFilter=true` for auxiliary-code requests. | A partial or unfiltered set yields invalid profile/team/auxiliary choices. | `src/services/config/constants.ts` | `test/unit/spec/services/config/index.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
119
+ | CONFIG-R-004 | Expose current response/field names: `MultimediaProfileResponse`, `OrgSettings.maskSensitiveData`, and real TeamList fields only. | Type-name drift causes invalid consumer code and incorrect privacy behavior. | `src/services/config/types.ts` | `test/unit/spec/services/config/index.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
120
+ | CONFIG-R-005 | Reject the entire profile aggregation when any required dependent request fails. | Consumers must never receive an internally inconsistent partial Profile. | `src/services/config/index.ts` | `test/unit/spec/services/config/index.ts` | None; source and test evidence rechecked during the 2026-07-09 remediation; independent document revalidation pending. | PRESENT |
121
+ | CONFIG-R-006 | Always populate `Profile.isWellnessBreakEnabled`; set it true only when `agentWellbeing.enable` is true, `wellnessBreakReminders` is `ENABLED`, and `OrgSettings.aiAssistantQuantity` is greater than zero. Missing or null inputs fail closed. | Hosts need one license-and-server-rollout-aware signal rather than reconstructing partial configuration. | `src/services/config/Util.ts`, `src/services/config/types.ts` | `test/unit/spec/services/config/Util.ts` | The supported SDK contracts expose no separate rollout response field; backend delivery of enabled `agentWellbeing` configuration is the rollout decision. | PRESENT |
122
+ | CONFIG-R-007 | Retrieve the wellness idle code from `/v2/auxiliary-code` using `workType=IDLE_CODE`, `customFilter=isSystemCode==true`, and `desktopProfileFilter=false`; follow pagination and accept only the exact active system code name `WellbeingBreak`. | The dedicated state must be independent of desktop-profile filtering and must never fall back to a similarly named or non-system code. | `src/services/config/index.ts`, `src/services/config/constants.ts` | `test/unit/spec/services/config/index.ts` | None. | PRESENT |
123
+
124
+ ## Design Overview
125
+ Config separates its stable consumption boundary from collaborators so ownership and failure behavior stay explicit. Profile creation is all-or-nothing across dependent API calls so consumers never receive internally inconsistent partial configuration.
126
+
127
+ > **Purpose**: Fetch and aggregate agent configuration data from multiple API endpoints to build the AgentProfile.
128
+ >
129
+ > **Scope Authority**: This is the authoritative documentation for the **Config** service scope. See [Root AGENTS.md](../../../../AGENTS.md) for the orchestrator and cross-scope rules.
130
+
131
+ ```typescript
132
+ // Config service is used internally during the registration flow.
133
+ // Inside cc.ts → connectWebsocket(), after WebSocket connection is established:
134
+ const agentId = data.agentId;
135
+ const orgId = this.$webex.credentials.getOrgId();
136
+ this.agentConfig = await this.services.config.getAgentConfig(orgId, agentId);
137
+
138
+ // The returned AgentProfile contains all agent configuration:
139
+ LoggerProxy.info(`Agent ID: ${this.agentConfig.agentId}`, {
140
+ module: 'cc',
141
+ method: 'connectWebsocket',
142
+ });
143
+ LoggerProxy.info(`Teams: ${this.agentConfig.teams}`, {
144
+ module: 'cc',
145
+ method: 'connectWebsocket',
146
+ });
147
+ ```
148
+
149
+ The AgentProfile is defined as the [`Profile`](../types.ts) type. This is not an exhaustive list — see [`types.ts`](../types.ts) for the full 50+ field definition. Key fields:
150
+
151
+ | Field | Type | Description |
152
+ |---|---|---|
153
+ | `agentId` | string | Unique agent identifier |
154
+ | `agentName` | string | Display name |
155
+ | `agentMailId` | string | Email address |
156
+ | `teams` | [`TeamList[]`](../types.ts) | Assigned teams (runtime data from `getAllTeams()` — `Profile` type declares `Team[]` but actual objects are `TeamList` with `id`, `name`, `teamType`, `siteId`, etc.) |
157
+ | `defaultDn` | string | Default dial number |
158
+ | `idleCodes` | [`Entity[]`](../types.ts) | Available idle codes |
159
+ | `wrapupCodes` | [`Entity[]`](../types.ts) | Available wrapup codes |
160
+ | `webRtcEnabled` | boolean | WebRTC calling enabled |
161
+ | `loginVoiceOptions` | [`LoginOption[]`](../types.ts) | Available login types |
162
+ | `dialPlan` | [`DialPlan`](../types.ts) | Number transformation rules |
163
+ | `isOutboundEnabledForAgent` | boolean | Outbound calling allowed |
164
+ | `outDialEp` | string | Outbound entry point ID |
165
+ | `allowConsultToQueue` | boolean | Whether consult-to-queue is enabled on the Desktop Profile |
166
+ | `accessQueue` | `'ALL' \| 'SPECIFIC' \| 'NONE'` | Collaboration tab queue access scope from Desktop Profile |
167
+ | `accessEntryPoint` | `'ALL' \| 'SPECIFIC' \| 'NONE'` | Collaboration tab entry-point access scope from Desktop Profile |
168
+ | `accessBuddyTeam` | `'ALL' \| 'SPECIFIC' \| 'NONE'` | Collaboration tab buddy-team access scope from Desktop Profile |
169
+ | `isWellnessBreakEnabled` | boolean | Effective wellness gate derived from backend enablement/reminder configuration and positive AI Assistant license quantity |
170
+
171
+ `parseAgentConfigs()` maps the three `access*` fields from `DesktopProfileResponse` onto the public `Profile` returned by `cc.register()`.
172
+
173
+ The following diagram shows how `getAgentConfig` orchestrates multiple API calls and combines their results into the AgentProfile via `parseAgentConfigs()`:
174
+
175
+ ```text
176
+ getUserUsingCI ────────────┐
177
+ │
178
+ getOrgInfo ────────────────┤
179
+ │
180
+ getOrganizationSetting ────┤
181
+ │
182
+ getTenantData ─────────────┤
183
+ │
184
+ getURLMapping ─────────────┼──► parseAgentConfigs() ──► AgentProfile
185
+ │
186
+ getAIFeatureFlags ─────────┤ (maps the first row to Profile.aiFeature)
187
+ │
188
+ getAllAuxCodes ─────────────┤
189
+ │
190
+ getDesktopProfileById ─────┤
191
+ │
192
+ getSiteInfo ───────────────┤ (computes multimediaProfileId)
193
+ │
194
+ getAllTeams ────────────────┤
195
+ │
196
+ getDialPlanData ───────────┘
197
+ ```
198
+
199
+ Types used by the config service, all defined in [`types.ts`](../types.ts):
200
+
201
+ | Type | Description |
202
+ |---|---|
203
+ | `Profile` | Final aggregated agent config returned by `getAgentConfig()` |
204
+ | `AgentResponse` | Raw response from `getUserUsingCI()` — agent metadata, teamIds, siteId, agentProfileId |
205
+ | `DesktopProfileResponse` | Desktop profile settings — layout, dial plan, login options |
206
+ | `TeamList` | Team record from API — `id`, `name`, `teamType`, `siteId`, `multiMediaProfileId` |
207
+ | `ListTeamsResponse` | Paginated wrapper around `TeamList[]` with `meta` for pagination |
208
+ | `OrgInfo` | Organization info — `tenantId`, timezone |
209
+ | `OrgSettings` | Org feature flags — `webRtcEnabled`, `maskSensitiveData` |
210
+ | `TenantData` | Tenant-level config — inactivity timeout, `forceDefaultDn`, `outdialEnabled` |
211
+ | `SiteInfo` | Site config — `id`, `name`, `multimediaProfileId` |
212
+ | `URLMapping` | External URL mapping — `id`, `name`, `url` |
213
+ | `MultimediaProfileResponse` | Multimedia profile — channel capacities and settings |
214
+ | `AuxCode` | Auxiliary code record — `id`, `name`, `description`, `workTypeCode` |
215
+ | `ListAuxCodesResponse` | Paginated wrapper around `AuxCode[]` with `meta` |
216
+ | `DialPlanEntity` | Dial plan rule — regex pattern, prefix, strip digits |
217
+ | `Entity` | Basic entity info — `isSystem`, `name`, `id`, `description` |
218
+ | `WrapupData` | Wrap-up config — auto-wrapup settings, available wrapup codes |
219
+ | `OutdialAniParams` | Parameters for `getOutdialAniEntries()` — ANI ID, pagination, filtering |
220
+ | `Team` | Simplified team shape in `Profile` — `teamId`, `teamName`, `desktopLayoutId` |
221
+
222
+ ```typescript
223
+ // In register() -> connectWebsocket()
224
+ const agentId = data.agentId;
225
+ const orgId = this.$webex.credentials.getOrgId();
226
+ this.agentConfig = await this.services.config.getAgentConfig(orgId, agentId);
227
+ ```
228
+
229
+ > **Purpose**: Technical documentation for agent configuration aggregation.
230
+
231
+ For endpoints with pagination (teams, aux codes):
232
+
233
+ ```typescript
234
+ import {DEFAULT_PAGE} from './constants'; // DEFAULT_PAGE = 0
235
+
236
+ public async getAllTeams(orgId, pageSize, filter): Promise<TeamList[]> {
237
+ let allTeams: TeamList[] = [];
238
+ let page = DEFAULT_PAGE;
239
+
240
+ // First request to get totalPages
241
+ const firstResponse = await this.getListOfTeams(orgId, page, pageSize, filter);
242
+ allTeams = allTeams.concat(firstResponse.data);
243
+ const totalPages = firstResponse.meta.totalPages;
244
+
245
+ // Parallel requests for remaining pages
246
+ const requests = [];
247
+ for (page = DEFAULT_PAGE + 1; page < totalPages; page += 1) {
248
+ requests.push(this.getListOfTeams(orgId, page, pageSize, filter));
249
+ }
250
+
251
+ const responses = await Promise.all(requests);
252
+ for (const response of responses) {
253
+ allTeams = allTeams.concat(response.data);
254
+ }
255
+
256
+ return allTeams;
257
+ }
258
+ ```
259
+
260
+ `parseAgentConfigs` in Util.ts combines all data into a unified `Profile` object. See [types.ts](../types.ts) for full type definitions.
261
+
262
+ The service fetches data from multiple APIs with these response structures:
263
+
264
+ | API Method | Response Type | Key Fields | Usage |
265
+ |---|---|---|---|
266
+ | `getUserUsingCI` | `AgentResponse` | `ciUserId`, `id`, `firstName`, `lastName`, `email`, `teamIds`, `agentProfileId`, `siteId` | Primary agent identity and profile references |
267
+ | `getDesktopProfileById` | `DesktopProfileResponse` | `dialPlanEnabled`, `autoAnswer`, `accessWrapUpCode`, `wrapUpCodes`, `accessIdleCode`, `idleCodes`, `loginVoiceOptions` | Agent desktop settings and feature enablement |
268
+ | `getAllTeams` | `TeamList[]` | real `TeamList` fields from `src/services/config/types.ts` | Team identity, name, type, and site assignment; channel capacities belong to `MultimediaProfileResponse` |
269
+ | `getTenantData` | `TenantData` | `outdialEnabled`, `forceDefaultDn`, `privacyShieldVisible`, `timeoutDesktopInactivityEnabled` | Tenant-level feature flags |
270
+ | `getOrgInfo` | `OrgInfo` | `tenantId`, `timezone` | Organization metadata |
271
+ | `getAllAuxCodes` | `AuxCode[]` | `id`, `name`, `workTypeCode`, `active`, `isSystemCode`, `defaultCode` | Auxiliary codes for idle/wrap-up states |
272
+ | `getOrganizationSetting` | `OrgSettings` | `webRtcEnabled`, `maskSensitiveData`, `campaignManagerEnabled`, `aiAssistantQuantity` | Organization-level feature flags and AI Assistant license quantity |
273
+ | `getDialPlanData` | `DialPlanEntity[]` | `id`, `name`, `regularExpression`, `prefix`, `strippedChars` | Dial plan rules for outbound calling |
274
+ | `getURLMapping` | `URLMapping[]` | `name`, `url` | External service URL mappings |
275
+ | `getSiteInfo` | `SiteInfo` | Site-specific configuration | Site details |
276
+
277
+ These responses are parsed and aggregated into a single `Profile` object by the `parseAgentConfigs` function.
278
+
279
+ ```typescript
280
+ // See full implementation in Util.ts
281
+ function parseAgentConfigs(profileData: {
282
+ userData: AgentResponse; // See types.ts:AgentResponse
283
+ teamData: Team[]; // NOTE: Declared as Team[] (teamId, teamName) but receives TeamList[] (id, name, + 12 more fields) at runtime
284
+ tenantData: TenantData; // See types.ts:TenantData
285
+ orgInfoData: OrgInfo; // See types.ts:OrgInfo
286
+ auxCodes: AuxCode[]; // See types.ts:AuxCode
287
+ orgSettingsData: OrgSettings; // See types.ts:OrgSettings
288
+ agentProfileData: DesktopProfileResponse; // See types.ts:DesktopProfileResponse
289
+ dialPlanData: DialPlanEntity[]; // See types.ts:DialPlanEntity
290
+ urlMapping: URLMapping[]; // See types.ts:URLMapping
291
+ multimediaProfileId: string;
292
+ aiFeatureFlags: AIFeatureFlagsResponse;
293
+ }): Profile { // See types.ts:Profile
294
+ const { userData, teamData, tenantData, orgInfoData, auxCodes,
295
+ orgSettingsData, agentProfileData, dialPlanData, urlMapping,
296
+ aiFeatureFlags } = profileData;
297
+
298
+ const aiFeature = aiFeatureFlags?.data?.length > 0
299
+ ? aiFeatureFlags.data[0]
300
+ : undefined;
301
+
302
+ // Aux code filtering via getFilterAuxCodes():
303
+ // - checks auxCode.active
304
+ // - checks specificCodes access level (ALL → no filter, SPECIFIC → include list)
305
+ // - maps to Entity {id, name, isSystem, isDefault}
306
+ const wrapupCodes = getFilterAuxCodes(auxCodes, WRAP_UP_CODE,
307
+ agentProfileData.accessWrapUpCode === 'ALL' ? [] : agentProfileData.wrapUpCodes);
308
+ const idleCodes = getFilterAuxCodes(auxCodes, IDLE_CODE,
309
+ agentProfileData.accessIdleCode === 'ALL' ? [] : agentProfileData.idleCodes);
310
+
311
+ // Hardcoded "Available" state always appended to idle codes
312
+ idleCodes.push({ id: '0', name: 'Available', isSystem: false, isDefault: false });
313
+
314
+ return {
315
+ agentId: userData.ciUserId, // NOTE: uses ciUserId for agent identification
316
+ analyserUserId: userData.id, // NOTE: userData.id is used for analytics/reporting
317
+ agentName: `${userData.firstName} ${userData.lastName}`,
318
+ teams: teamData, // NOTE: Raw TeamList[] passed directly without mapping
319
+ idleCodes, // NOTE: Filtered via getFilterAuxCodes() + hardcoded "Available" state
320
+ wrapupCodes, // NOTE: Filtered via getFilterAuxCodes()
321
+ webRtcEnabled: orgSettingsData.webRtcEnabled,
322
+ loginVoiceOptions: agentProfileData.loginVoiceOptions ?? [],
323
+ enterpriseId: orgInfoData.tenantId,
324
+ tenantTimezone: orgInfoData.timezone,
325
+ multimediaProfileId: profileData.multimediaProfileId,
326
+ aiFeature,
327
+ // ... 30+ more fields — see Util.ts for full implementation
328
+ };
329
+ }
330
+ ```
331
+
332
+ ## Data Flow
333
+ ```mermaid
334
+ flowchart TD
335
+ Start[getAgentConfig orgId + agentId] --> User[getUserUsingCI awaited first]
336
+ Start --> Org[getOrgInfo]
337
+ Start --> OrgSettings[getOrganizationSetting]
338
+ Start --> Tenant[getTenantData]
339
+ Start --> URL[getURLMapping]
340
+ Start --> AI[getAIFeatureFlags]
341
+ Start --> Aux[getAllAuxCodes]
342
+ User --> Profile[getDesktopProfileById]
343
+ User --> Site[getSiteInfo]
344
+ User --> Teams[getAllTeams or empty]
345
+ Profile --> Dial{dialPlanEnabled?}
346
+ Dial -->|yes| DialPlan[getDialPlanData]
347
+ Dial -->|no| Empty[empty dial plan]
348
+ Profile --> All[Promise.all of ten result promises]
349
+ Site --> All
350
+ Teams --> All
351
+ DialPlan --> All
352
+ Empty --> All
353
+ Org --> All
354
+ OrgSettings --> All
355
+ Tenant --> All
356
+ URL --> All
357
+ AI --> All
358
+ Aux --> All
359
+ All --> Parse[parseAgentConfigs including aiFeatureFlags]
360
+ Parse --> Result[Profile with aiFeature + maskSensitiveData]
361
+ ```
362
+
363
+ ## Sequence Diagram(s)
364
+ Sequence coverage:
365
+
366
+ | Operation group | Diagram | Failure / recovery coverage |
367
+ |---|---|---|
368
+ | Profile aggregation and AI feature flags | Profile aggregation | Any required request rejection rejects `getAgentConfig`; no partial Profile is returned. |
369
+ | Team/aux-code pagination | Pagination | Continue until page metadata is exhausted; any page rejection rejects the operation. |
370
+
371
+ AI-feature retrieval shares the same actors, ordering, Promise aggregation, and all-or-nothing failure outcome as the other profile dependencies, so it is represented in the Profile aggregation diagram rather than duplicated.
372
+
373
+ ### Profile aggregation
374
+
375
+ ```mermaid
376
+ sequenceDiagram
377
+ participant CC as ContactCenter
378
+ participant Cfg as AgentConfigService
379
+ participant API as WCC APIs
380
+ participant Util as parseAgentConfigs
381
+ CC->>Cfg: getAgentConfig(orgId, agentId)
382
+ par requests started before user data resolves
383
+ Cfg->>API: getUserUsingCI
384
+ Cfg->>API: org info + org settings + tenant + URL mapping
385
+ Cfg->>API: ai-feature flags + all aux codes
386
+ end
387
+ API-->>Cfg: user IDs/profile/site/team IDs
388
+ par user-dependent requests
389
+ Cfg->>API: desktop profile + site + teams
390
+ Cfg->>API: conditional dial plan chained from desktop profile
391
+ end
392
+ Note over Cfg,API: Promise.all awaits 10 result promises in total
393
+ alt all succeed
394
+ API-->>Cfg: ten results
395
+ Cfg->>Util: parseAgentConfigs(..., aiFeatureFlags)
396
+ Util-->>CC: Profile including aiFeature
397
+ else any fails
398
+ Cfg-->>CC: throw; no partial Profile
399
+ end
400
+ ```
401
+
402
+ ### Pagination
403
+
404
+ ```mermaid
405
+ sequenceDiagram
406
+ participant Caller
407
+ participant Cfg as AgentConfigService
408
+ participant WR as WebexRequest
409
+ participant API as WCC API
410
+ Caller->>Cfg: getAllTeams/getAllAuxCodes(orgId, pageSize, filters)
411
+ Cfg->>WR: request page 0
412
+ WR->>API: authenticated GET
413
+ alt first page succeeds
414
+ API-->>Cfg: page 0 data + meta.totalPages
415
+ par remaining pages 1..totalPages-1
416
+ Cfg->>WR: Promise.all(page requests)
417
+ WR->>API: authenticated GETs
418
+ API-->>Cfg: remaining page responses
419
+ end
420
+ alt every remaining page succeeds
421
+ Cfg->>Cfg: concatenate responses in request order
422
+ Cfg-->>Caller: complete accumulated list
423
+ else any remaining page rejects
424
+ Cfg-->>Caller: reject; do not return a partial list
425
+ end
426
+ else first page rejects
427
+ Cfg-->>Caller: reject
428
+ end
429
+ ```
430
+
431
+ ## Class / Component Relationships
432
+ ```mermaid
433
+ classDiagram
434
+ class ContactCenter
435
+ class AgentConfigService
436
+ class WebexRequest
437
+ class parseAgentConfigs
438
+ class Profile
439
+ ContactCenter --> AgentConfigService : getAgentConfig
440
+ AgentConfigService --> WebexRequest : ten dependent requests
441
+ AgentConfigService --> parseAgentConfigs : aggregate results
442
+ parseAgentConfigs --> Profile : aiFeature + maskSensitiveData
443
+ ```
444
+
445
+ | Component | File | Responsibility |
446
+ |---|---|---|
447
+ | `AgentConfigService` | `config/index.ts` | Main config service class |
448
+ | `parseAgentConfigs` | `config/Util.ts` | Profile parsing/aggregation |
449
+ | `endPointMap` | `config/constants.ts` | API endpoint definitions |
450
+ | `types` | `config/types.ts` | Types, events, interfaces |
451
+
452
+ ## Use Cases
453
+ - **UC-1 Two-wave profile aggregation:** retrieve the user first, run ten dependent promises including AI feature flags, then parse one complete Profile or reject the whole operation. Evidence: `src/services/config/index.ts`, `src/services/config/Util.ts`, `test/unit/spec/services/config/index.ts`.
454
+ - **UC-2 Paginated teams/aux codes:** follow backend page metadata to completion; auxiliary-code requests include `desktopProfileFilter=true`. Evidence: `src/services/config/index.ts`, `test/unit/spec/services/config/index.ts`.
455
+ - **UC-3 Dial plan and URL mapping:** request dial-plan data only when the desktop profile enables it while always including URL mapping in profile aggregation. Evidence: `src/services/config/index.ts`, `test/unit/spec/services/config/index.ts`.
456
+ - **UC-4 Outdial ANI retrieval:** return the organization-scoped ANI list through authenticated WebexRequest and propagate failures without a partial substitute. Evidence: `src/services/config/index.ts`, `test/unit/spec/services/config/index.ts`.
457
+ - **UC-5 Wellness configuration:** produce one fail-closed effective profile flag and retrieve the exact system wellness idle code across pages. Evidence: `src/services/config/Util.ts`, `src/services/config/index.ts`, `test/unit/spec/services/config/Util.ts`, `test/unit/spec/services/config/index.ts`.
458
+
459
+ ## Business Rules & Invariants
460
+ - `getAgentConfig` rejects when any required dependent request rejects; it never returns a partial Profile.
461
+ - `Profile.aiFeature` is derived from the AI-feature response, and sensitive-data masking uses the real `maskSensitiveData` field.
462
+ - Team data has no `channelMap` contract; multimedia profile responses use `MultimediaProfileResponse`.
463
+ - `isWellnessBreakEnabled` is always boolean and defaults false when any gate is absent, disabled, or unlicensed.
464
+ - The system wellness code lookup is separate from profile auxiliary-code aggregation and uses `desktopProfileFilter=false`.
465
+
466
+ ## Concurrency & Reactive Flow
467
+ - The initial user lookup supplies identifiers for a ten-promise `Promise.all`; pagination loops await pages in order and stop from returned metadata.
468
+
469
+ ## Protocol / Wire Format
470
+ All Config operations are authenticated REST calls through WebexRequest. Important current routes include:
471
+
472
+ | Operation | Resource shape |
473
+ |---|---|
474
+ | AI feature flags | `organization/{orgId}/v2/ai-feature?page=0&pageSize=100` |
475
+ | Auxiliary codes | pagination/filter/attributes plus `desktopProfileFilter=true` |
476
+ | Wellness system idle code | `organization/{orgId}/v2/auxiliary-code?page={page}&pageSize={pageSize}&workType=IDLE_CODE&customFilter=isSystemCode==true&desktopProfileFilter=false` |
477
+ | Multimedia profile | organization-scoped multimedia-profile resource |
478
+ | Dial plan | organization-scoped dial-plan resource when desktop profile enables it |
479
+
480
+ Exact resources live in `src/services/config/constants.ts`; response/profile fields live in `src/services/config/types.ts`.
481
+
482
+ ## Error Handling & Failure Modes
483
+ | Condition | Signal (error/code/result) | Caller recovery |
484
+ |---|---|---|
485
+ | Dependency rejection | Typed/rethrown error or failure event | Inspect structured details, preserve tracking id, and retry only when the operation is safe. |
486
+ | Timeout or missing async completion | Timeout/recovery state | Follow the module-specific recovery path; never synthesize success. |
487
+
488
+ All API methods within the config service throw errors on failure. After `getUserUsingCI`, `getAgentConfig` awaits ten dependent requests via `Promise.all`: desktop profile, site, teams, conditional dial plan, organization info, organization settings, tenant data, URL mapping, AI feature flags, and all auxiliary codes. A failure in any required request, including `getAIFeatureFlags`, causes the entire AgentProfile fetch to fail. There is no partial profile — either all data is successfully fetched and aggregated, or the operation throws.
489
+
490
+ ```typescript
491
+ try {
492
+ const profile = await this.services.config.getAgentConfig(orgId, agentId);
493
+ } catch (error) {
494
+ LoggerProxy.error(`Config fetch failed: ${error}`, {
495
+ module: 'ConfigService',
496
+ method: 'getAgentConfig',
497
+ });
498
+ throw error;
499
+ }
500
+ ```
501
+
502
+ Each method follows consistent error handling:
503
+
504
+ ```typescript
505
+ public async getUserUsingCI(orgId: string, agentId: string): Promise<AgentResponse> {
506
+ LoggerProxy.info('Fetching user data using CI', {
507
+ module: CONFIG_FILE_NAME,
508
+ method: METHODS.GET_USER_USING_CI,
509
+ });
510
+
511
+ try {
512
+ const resource = endPointMap.userByCI(orgId, agentId);
513
+ const response = await this.webexReq.request({
514
+ service: WCC_API_GATEWAY,
515
+ resource,
516
+ method: HTTP_METHODS.GET,
517
+ });
518
+
519
+ if (response.statusCode !== 200) {
520
+ throw new Error(`API call failed with ${response.statusCode}`);
521
+ }
522
+
523
+ LoggerProxy.log('getUserUsingCI api success.', {
524
+ module: CONFIG_FILE_NAME,
525
+ method: METHODS.GET_USER_USING_CI,
526
+ });
527
+
528
+ return Promise.resolve(response.body);
529
+ } catch (error) {
530
+ LoggerProxy.error(`getUserUsingCI API call failed with ${error}`, {
531
+ module: CONFIG_FILE_NAME,
532
+ method: METHODS.GET_USER_USING_CI,
533
+ });
534
+ throw error;
535
+ }
536
+ }
537
+ ```
538
+
539
+ **Cause**: One of the parallel API calls failed (network error, 401/403/404/500 response)
540
+
541
+ **Log patterns to search for:**
542
+
543
+ ```typescript
544
+ // General config failure
545
+ "getAgentConfig call failed"
546
+ "module": "config/index.ts", "method": "getAgentConfig"
547
+
548
+ // Specific API method failures
549
+ "getUserUsingCI API call failed"
550
+ "getDesktopProfileById API call failed"
551
+ "getAllTeams API call failed"
552
+ "getAllAuxCodes API call failed"
553
+
554
+ // Look for HTTP error codes
555
+ "API call failed with 401" // Authentication
556
+ "API call failed with 403" // Authorization
557
+ "API call failed with 404" // Not found
558
+ "API call failed with 500" // Server error
559
+ ```
560
+
561
+ **Solution**:
562
+
563
+ 1. Check logs for specific API that failed
564
+
565
+ 2. Verify orgId and agentId are correct
566
+
567
+ 3. Ensure authentication tokens are valid
568
+
569
+ 4. Check network connectivity to WCC API Gateway
570
+
571
+ **Cause**: Pagination not completing or filter parameters incorrect
572
+
573
+ **Log patterns:**
574
+
575
+ ```typescript
576
+ "getAllTeams API call failed"
577
+ "getAllAuxCodes API call failed"
578
+ "method": "getListOfTeams"
579
+ "method": "getListOfAuxCodes"
580
+ ```
581
+
582
+ **Solution**:
583
+
584
+ 1. Check `totalPages` in first response
585
+
586
+ 2. Verify filter array contains valid team/aux code IDs
587
+
588
+ 3. Check if pageSize is appropriate (default: 100)
589
+
590
+ 4. Ensure all pages are fetched in Promise.all()
591
+
592
+ **Cause**: Organization or tenant settings have feature disabled
593
+
594
+ **Log patterns:**
595
+
596
+ ```typescript
597
+ "getOrganizationSetting api success"
598
+ "getTenantData api success"
599
+ ```
600
+
601
+ **Solution**:
602
+
603
+ 1. Check `orgSettingsData.webRtcEnabled` in response
604
+
605
+ 2. Check `tenantData.outdialEnabled` for outbound features
606
+
607
+ 3. Verify feature is enabled in admin portal settings
608
+
609
+ 4. Confirm agentProfileData has correct feature flags
610
+
611
+ **Cause**: `dialPlanEnabled` is false in desktop profile
612
+
613
+ **Solution**:
614
+
615
+ 1. Check `agentProfileData.dialPlanEnabled` value
616
+
617
+ 2. Verify dial plans are assigned in agent profile configuration
618
+
619
+ 3. Note: dial plan fetch only happens if `dialPlanEnabled === true`
620
+
621
+ **Cause**: Access level set to 'SPECIFIC' but missing code IDs
622
+
623
+ **Log patterns:**
624
+
625
+ ```typescript
626
+ "method": "getFilterAuxCodes"
627
+ ```
628
+
629
+ **Solution**:
630
+
631
+ 1. Check `agentProfileData.accessWrapUpCode` (should be 'ALL' or 'SPECIFIC')
632
+
633
+ 2. Check `agentProfileData.accessIdleCode`
634
+
635
+ 3. If 'SPECIFIC', verify `wrapUpCodes` and `idleCodes` arrays contain valid IDs
636
+
637
+ 4. Ensure aux codes have `active: true` status
638
+
639
+ 5. Note: "Available" state is always appended to idle codes
640
+
641
+ ## Pitfalls
642
+ - `getUserUsingCI` must complete before profile/site/team-dependent requests are constructed, while the ten dependent promises remain all-or-nothing.
643
+ - AI feature flags are part of the ten-result aggregation and must be passed into `parseAgentConfigs`; omitting them silently removes `Profile.aiFeature`.
644
+ - Team responses do not own channel configuration, and auxiliary-code requests require `desktopProfileFilter=true` during profile construction.
645
+
646
+ ## Module Do's / Don'ts
647
+ - DO preserve the user-first dependency boundary and the exact ten-promise result order.
648
+ - DO paginate team and auxiliary-code endpoints until their metadata indicates completion.
649
+ - DON'T return a partially assembled Profile after any required dependency fails.
650
+ - DON'T invent TeamList fields such as `channelMap` or omit `maskSensitiveData`/`aiFeature` mappings.
651
+
652
+ ## Key Design Trade-off
653
+ - Profile creation is all-or-nothing across dependent API calls so consumers never receive internally inconsistent partial configuration.
654
+
655
+ ## Test-Case Strategy (module)
656
+ `test/unit/spec/services/config/index.ts` must cover staged user-first orchestration, ten-promise aggregation, AI-feature mapping, conditional dial plan, pagination, auxiliary-code URL filtering, real response field names, and whole-profile rejection on any required failure.
657
+
658
+ | Behavior / Requirement | Existing test evidence | Gap |
659
+ |---|---|---|
660
+ | `CONFIG-R-001` | `test/unit/spec/services/config/index.ts` | None. |
661
+ | `CONFIG-R-002` | `test/unit/spec/services/config/index.ts` | None. |
662
+ | `CONFIG-R-003` | `test/unit/spec/services/config/index.ts` | None. |
663
+ | `CONFIG-R-004` | `test/unit/spec/services/config/index.ts` | None. |
664
+ | `CONFIG-R-005` | `test/unit/spec/services/config/index.ts` | Keep an explicit rejection assertion for each required dependency category. |
665
+ | `CONFIG-R-006` | `test/unit/spec/services/config/Util.ts` | None. |
666
+ | `CONFIG-R-007` | `test/unit/spec/services/config/index.ts` | None. |
667
+
668
+ ## Traceability
669
+ - Repo architecture: `../../../../ai-docs/ARCHITECTURE.md` · Registry: `../../../../ai-docs/SPEC_INDEX.md`
670
+ - Coverage state and contracts baseline: `../../../../.sdd/manifest.json`
671
+
672
+ - [Root AGENTS.md](../../../../AGENTS.md) - Orchestrator and cross-scope rules
673
+
674
+ - [types.ts](../types.ts) - Type definitions
675
+
676
+ - [Util.ts](../Util.ts) - AgentProfile parsing utilities
677
+
678
+ - [constants.ts](../constants.ts) - API endpoints
679
+
680
+ - [index.ts](../index.ts) - Service implementation with all API methods
681
+
682
+ - [types.ts](../types.ts) - Complete type definitions and event constants
683
+
684
+ - [Util.ts](../Util.ts) - Profile parsing utilities (parseAgentConfigs, getFilterAuxCodes, etc.)
685
+
686
+ - [constants.ts](../constants.ts) - API endpoints, default values, and method names