@webex/contact-center 3.11.0 → 3.12.0-auth-prejoin-fetch.1

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