@webex/contact-center 3.12.0-next.15 → 3.12.0-next.151

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 (322) hide show
  1. package/.sdd/manifest.json +887 -0
  2. package/AGENTS.md +94 -0
  3. package/ai-docs/ARCHITECTURE.md +168 -0
  4. package/ai-docs/CONTRACTS.md +62 -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 +1010 -47
  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 +40 -3
  46. package/dist/constants.js.map +1 -1
  47. package/dist/index.js +54 -17
  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 +211 -0
  52. package/dist/metrics/behavioral-events.js.map +1 -1
  53. package/dist/metrics/constants.js +58 -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 +351 -14
  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 +225 -0
  68. package/dist/services/WebexCrossClientService.js.map +1 -0
  69. package/dist/services/WxAppTelephonyMercurySync.js +111 -0
  70. package/dist/services/WxAppTelephonyMercurySync.js.map +1 -0
  71. package/dist/services/config/Util.js +48 -48
  72. package/dist/services/config/Util.js.map +1 -1
  73. package/dist/services/config/constants.js +56 -78
  74. package/dist/services/config/constants.js.map +1 -1
  75. package/dist/services/config/index.js +100 -226
  76. package/dist/services/config/index.js.map +1 -1
  77. package/dist/services/config/types.js +97 -24
  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 +955 -0
  93. package/dist/services/task/Task.js.map +1 -0
  94. package/dist/services/task/TaskFactory.js +50 -0
  95. package/dist/services/task/TaskFactory.js.map +1 -0
  96. package/dist/services/task/TaskManager.js +1272 -523
  97. package/dist/services/task/TaskManager.js.map +1 -1
  98. package/dist/services/task/TaskUtils.js +221 -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 +21 -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 +259 -5
  127. package/dist/services/task/types.js.map +1 -1
  128. package/dist/services/task/voice/Voice.js +1504 -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/wxAppOfferObservability.js +145 -0
  133. package/dist/services/task/voice/wxAppOfferObservability.js.map +1 -0
  134. package/dist/services/task/voice/wxAppVoiceMethods.js +395 -0
  135. package/dist/services/task/voice/wxAppVoiceMethods.js.map +1 -0
  136. package/dist/services/wxAppDiagnosticLogging.js +159 -0
  137. package/dist/services/wxAppDiagnosticLogging.js.map +1 -0
  138. package/dist/services/wxAppTelephonyUtils.js +19 -0
  139. package/dist/services/wxAppTelephonyUtils.js.map +1 -0
  140. package/dist/types/cc.d.ts +196 -9
  141. package/dist/types/config.d.ts +13 -0
  142. package/dist/types/constants.d.ts +38 -1
  143. package/dist/types/index.d.ts +54 -20
  144. package/dist/types/metrics/MetricsManager.d.ts +6 -0
  145. package/dist/types/metrics/constants.d.ts +52 -1
  146. package/dist/types/services/AddressBook.d.ts +2 -1
  147. package/dist/types/services/AnswerCallOnWebexService.d.ts +38 -0
  148. package/dist/types/services/ApiAiAssistant.d.ts +58 -5
  149. package/dist/types/services/EntryPoint.d.ts +7 -5
  150. package/dist/types/services/Queue.d.ts +5 -3
  151. package/dist/types/services/UserPreference.d.ts +118 -0
  152. package/dist/types/services/WebexCrossClientService.d.ts +32 -0
  153. package/dist/types/services/WxAppTelephonyMercurySync.d.ts +28 -0
  154. package/dist/types/services/config/Util.d.ts +4 -8
  155. package/dist/types/services/config/constants.d.ts +49 -76
  156. package/dist/types/services/config/index.d.ts +16 -64
  157. package/dist/types/services/config/types.d.ts +248 -114
  158. package/dist/types/services/core/Err.d.ts +6 -0
  159. package/dist/types/services/core/Utils.d.ts +35 -13
  160. package/dist/types/services/core/WebexRequest.d.ts +1 -0
  161. package/dist/types/services/core/types.d.ts +2 -0
  162. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  163. package/dist/types/services/core/websocket/types.d.ts +1 -1
  164. package/dist/types/services/index.d.ts +1 -1
  165. package/dist/types/services/task/Task.d.ts +186 -0
  166. package/dist/types/services/task/TaskFactory.d.ts +14 -0
  167. package/dist/types/services/task/TaskUtils.d.ts +54 -2
  168. package/dist/types/services/task/WebexCallingUtils.d.ts +11 -0
  169. package/dist/types/services/task/constants.d.ts +19 -0
  170. package/dist/types/services/task/contact.d.ts +4 -0
  171. package/dist/types/services/task/dialer.d.ts +30 -0
  172. package/dist/types/services/task/digital/Digital.d.ts +23 -0
  173. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1442 -0
  174. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  175. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  176. package/dist/types/services/task/state-machine/guards.d.ts +103 -0
  177. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  178. package/dist/types/services/task/state-machine/types.d.ts +277 -0
  179. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  180. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  181. package/dist/types/services/task/types.d.ts +790 -66
  182. package/dist/types/services/task/voice/Voice.d.ts +241 -0
  183. package/dist/types/services/task/voice/WebRTC.d.ts +54 -0
  184. package/dist/types/services/task/voice/wxAppOfferObservability.d.ts +39 -0
  185. package/dist/types/services/task/voice/wxAppVoiceMethods.d.ts +68 -0
  186. package/dist/types/services/wxAppDiagnosticLogging.d.ts +63 -0
  187. package/dist/types/services/wxAppTelephonyUtils.d.ts +5 -0
  188. package/dist/types/types.d.ts +213 -11
  189. package/dist/types/utils/PageCache.d.ts +20 -3
  190. package/dist/types/webex.d.ts +1 -0
  191. package/dist/types.js +168 -6
  192. package/dist/types.js.map +1 -1
  193. package/dist/utils/PageCache.js +19 -5
  194. package/dist/utils/PageCache.js.map +1 -1
  195. package/dist/webex.js +22 -2
  196. package/dist/webex.js.map +1 -1
  197. package/package.json +16 -12
  198. package/src/cc.ts +1338 -121
  199. package/src/config.ts +13 -0
  200. package/src/constants.ts +41 -1
  201. package/src/index.ts +62 -15
  202. package/src/metrics/MetricsManager.ts +16 -0
  203. package/src/metrics/ai-docs/AGENTS.md +350 -0
  204. package/src/metrics/ai-docs/ARCHITECTURE.md +338 -0
  205. package/src/metrics/ai-docs/metrics-spec.md +971 -0
  206. package/src/metrics/behavioral-events.ts +218 -0
  207. package/src/metrics/constants.ts +63 -4
  208. package/src/services/AddressBook.ts +17 -6
  209. package/src/services/AnswerCallOnWebexService.ts +239 -0
  210. package/src/services/ApiAiAssistant.ts +470 -15
  211. package/src/services/EntryPoint.ts +59 -60
  212. package/src/services/Queue.ts +29 -12
  213. package/src/services/UserPreference.ts +509 -0
  214. package/src/services/WebexCrossClientService.ts +298 -0
  215. package/src/services/WxAppTelephonyMercurySync.ts +142 -0
  216. package/src/services/agent/ai-docs/AGENTS.md +240 -0
  217. package/src/services/agent/ai-docs/ARCHITECTURE.md +304 -0
  218. package/src/services/agent/ai-docs/agent-spec.md +505 -0
  219. package/src/services/ai-docs/AGENTS.md +386 -0
  220. package/src/services/ai-docs/services-spec.md +505 -0
  221. package/src/services/config/Util.ts +54 -84
  222. package/src/services/config/ai-docs/AGENTS.md +250 -0
  223. package/src/services/config/ai-docs/ARCHITECTURE.md +413 -0
  224. package/src/services/config/ai-docs/config-spec.md +669 -0
  225. package/src/services/config/constants.ts +63 -85
  226. package/src/services/config/index.ts +116 -277
  227. package/src/services/config/types.ts +233 -125
  228. package/src/services/core/Err.ts +3 -0
  229. package/src/services/core/Utils.ts +127 -37
  230. package/src/services/core/WebexRequest.ts +3 -1
  231. package/src/services/core/ai-docs/AGENTS.md +381 -0
  232. package/src/services/core/ai-docs/ARCHITECTURE.md +698 -0
  233. package/src/services/core/ai-docs/core-spec.md +787 -0
  234. package/src/services/core/aqm-reqs.ts +30 -15
  235. package/src/services/core/types.ts +33 -1
  236. package/src/services/core/websocket/WebSocketManager.ts +2 -0
  237. package/src/services/core/websocket/types.ts +1 -1
  238. package/src/services/index.ts +1 -1
  239. package/src/services/task/Task.ts +1211 -0
  240. package/src/services/task/TaskFactory.ts +82 -0
  241. package/src/services/task/TaskManager.ts +1584 -643
  242. package/src/services/task/TaskUtils.ts +316 -25
  243. package/src/services/task/WebexCallingUtils.ts +136 -0
  244. package/src/services/task/ai-docs/AGENTS.md +457 -0
  245. package/src/services/task/ai-docs/ARCHITECTURE.md +595 -0
  246. package/src/services/task/ai-docs/task-spec.md +1501 -0
  247. package/src/services/task/constants.ts +20 -0
  248. package/src/services/task/contact.ts +30 -0
  249. package/src/services/task/dialer.ts +80 -0
  250. package/src/services/task/digital/Digital.ts +102 -0
  251. package/src/services/task/state-machine/TaskStateMachine.ts +1320 -0
  252. package/src/services/task/state-machine/actions.ts +741 -0
  253. package/src/services/task/state-machine/ai-docs/AGENTS.md +460 -0
  254. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1156 -0
  255. package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +2247 -0
  256. package/src/services/task/state-machine/constants.ts +172 -0
  257. package/src/services/task/state-machine/guards.ts +442 -0
  258. package/src/services/task/state-machine/index.ts +28 -0
  259. package/src/services/task/state-machine/types.ts +258 -0
  260. package/src/services/task/state-machine/uiControlsComputer.ts +1135 -0
  261. package/src/services/task/taskDataNormalizer.ts +137 -0
  262. package/src/services/task/types.ts +974 -70
  263. package/src/services/task/voice/Voice.ts +1878 -0
  264. package/src/services/task/voice/WebRTC.ts +194 -0
  265. package/src/services/task/voice/wxAppOfferObservability.ts +204 -0
  266. package/src/services/task/voice/wxAppVoiceMethods.ts +575 -0
  267. package/src/services/wxAppDiagnosticLogging.ts +286 -0
  268. package/src/services/wxAppTelephonyUtils.ts +14 -0
  269. package/src/types.ts +272 -13
  270. package/src/utils/AGENTS.md +289 -0
  271. package/src/utils/PageCache.ts +38 -5
  272. package/src/utils/ai-docs/utils-spec.md +391 -0
  273. package/src/webex.js +10 -0
  274. package/test/unit/fixtures/aiSummaryTestUtils.ts +40 -0
  275. package/test/unit/spec/cc.ts +3705 -150
  276. package/test/unit/spec/index.ts +885 -0
  277. package/test/unit/spec/logger-proxy.ts +70 -0
  278. package/test/unit/spec/metrics/MetricsManager.ts +25 -0
  279. package/test/unit/spec/metrics/behavioral-events.ts +60 -0
  280. package/test/unit/spec/services/AddressBook.ts +37 -6
  281. package/test/unit/spec/services/AnswerCallOnWebexService.ts +264 -0
  282. package/test/unit/spec/services/ApiAiAssistant.ts +429 -23
  283. package/test/unit/spec/services/EntryPoint.ts +87 -40
  284. package/test/unit/spec/services/Queue.ts +123 -12
  285. package/test/unit/spec/services/UserPreference.ts +401 -0
  286. package/test/unit/spec/services/WebCallingService.ts +7 -1
  287. package/test/unit/spec/services/WebexCrossClientService.ts +509 -0
  288. package/test/unit/spec/services/WxAppTelephonyMercurySync.ts +136 -0
  289. package/test/unit/spec/services/config/Util.ts +501 -0
  290. package/test/unit/spec/services/config/index.ts +317 -547
  291. package/test/unit/spec/services/core/Utils.ts +425 -8
  292. package/test/unit/spec/services/core/WebexRequest.ts +8 -7
  293. package/test/unit/spec/services/core/aqm-reqs.ts +113 -1
  294. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
  295. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  296. package/test/unit/spec/services/task/Task.ts +2723 -0
  297. package/test/unit/spec/services/task/TaskFactory.ts +116 -0
  298. package/test/unit/spec/services/task/TaskManager.ts +4781 -1585
  299. package/test/unit/spec/services/task/TaskUtils.ts +307 -0
  300. package/test/unit/spec/services/task/WebexCallingUtils.ts +153 -0
  301. package/test/unit/spec/services/task/contact.ts +33 -0
  302. package/test/unit/spec/services/task/dialer.ts +190 -0
  303. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  304. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +4060 -0
  305. package/test/unit/spec/services/task/state-machine/guards.ts +839 -0
  306. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  307. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +3101 -0
  308. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  309. package/test/unit/spec/services/task/voice/Voice.ts +2355 -0
  310. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  311. package/test/unit/spec/services/task/voice/wxAppOfferObservability.ts +361 -0
  312. package/test/unit/spec/services/task/voice/wxAppVoiceMethods.ts +719 -0
  313. package/test/unit/spec/services/wxAppDiagnosticLogging.ts +179 -0
  314. package/test/unit/spec/wellnessSampleUtils.ts +288 -0
  315. package/typedoc.md +1 -1
  316. package/umd/contact-center.min.js +2 -2
  317. package/umd/contact-center.min.js.map +1 -1
  318. package/dist/services/task/index.js +0 -1530
  319. package/dist/services/task/index.js.map +0 -1
  320. package/dist/types/services/task/index.d.ts +0 -650
  321. package/src/services/task/index.ts +0 -1806
  322. package/test/unit/spec/services/task/index.ts +0 -2205
@@ -1,7 +1,9 @@
1
- import {CallId} from '@webex/calling/dist/types/common/types';
2
- import EventEmitter from 'events';
1
+ /* eslint-disable import/no-cycle */
2
+ import type {AnyActorRef} from 'xstate';
3
+ import {TaskEventPayload} from './state-machine';
3
4
  import {Msg} from '../core/GlobalTypes';
4
5
  import AutoWrapup from './AutoWrapup';
6
+ import type {CollaborationAccess} from '../config/types';
5
7
 
6
8
  /**
7
9
  * Unique identifier for a task in the contact center system
@@ -9,6 +11,11 @@ import AutoWrapup from './AutoWrapup';
9
11
  */
10
12
  export type TaskId = string;
11
13
 
14
+ /**
15
+ * Unique identifier for a call in the Webex calling system
16
+ */
17
+ export type CallId = string;
18
+
12
19
  /**
13
20
  * Helper type for creating enum-like objects with type safety
14
21
  * @internal
@@ -27,7 +34,7 @@ export const DESTINATION_TYPE = {
27
34
  DIALNUMBER: 'dialNumber',
28
35
  /** Route task to a specific agent */
29
36
  AGENT: 'agent',
30
- /** Route task to an entry point (supported only for consult operations) */
37
+ /** Route task to an entry point */
31
38
  ENTRYPOINT: 'entryPoint',
32
39
  };
33
40
 
@@ -61,6 +68,17 @@ export const CONSULT_TRANSFER_DESTINATION_TYPE = {
61
68
  */
62
69
  export type ConsultTransferDestinationType = Enum<typeof CONSULT_TRANSFER_DESTINATION_TYPE>;
63
70
 
71
+ /**
72
+ * Agent-profile policy used by the task state machine to derive consult/transfer destinations.
73
+ * @internal
74
+ */
75
+ export type ConsultTransferDestinationConfig = {
76
+ allowConsultToQueue: boolean;
77
+ accessQueue?: CollaborationAccess;
78
+ accessEntryPoint?: CollaborationAccess;
79
+ accessBuddyTeam?: CollaborationAccess;
80
+ };
81
+
64
82
  /**
65
83
  * Defines all supported media channel types for customer interactions
66
84
  * These represent the different ways customers can communicate with agents
@@ -90,6 +108,26 @@ export const MEDIA_CHANNEL = {
90
108
  */
91
109
  export type MEDIA_CHANNEL = Enum<typeof MEDIA_CHANNEL>;
92
110
 
111
+ /**
112
+ * Supported task channel types for UI control configuration
113
+ */
114
+ export const TASK_CHANNEL_TYPE = {
115
+ VOICE: 'voice',
116
+ DIGITAL: 'digital',
117
+ } as const;
118
+
119
+ export type TaskChannelType = Enum<typeof TASK_CHANNEL_TYPE>;
120
+
121
+ /**
122
+ * Voice channel variants that toggle PSTN/WebRTC specific behaviors
123
+ */
124
+ export const VOICE_VARIANT = {
125
+ PSTN: 'pstn',
126
+ WEBRTC: 'webrtc',
127
+ } as const;
128
+
129
+ export type VoiceVariant = Enum<typeof VOICE_VARIANT>;
130
+
93
131
  /**
94
132
  * Enumeration of all task-related events that can occur in the contact center system
95
133
  * These events represent different states and actions in the task lifecycle
@@ -203,6 +241,16 @@ export enum TASK_EVENTS {
203
241
  */
204
242
  TASK_CONSULT_QUEUE_FAILED = 'task:consultQueueFailed',
205
243
 
244
+ /**
245
+ * Triggered whenever task UI controls are recalculated
246
+ */
247
+ TASK_UI_CONTROLS_UPDATED = 'task:ui-controls-updated',
248
+
249
+ /**
250
+ * Triggered when wxApp mute state changes from Webex App (Mercury sync or call details).
251
+ */
252
+ TASK_WXAPP_MUTE_STATE_UPDATED = 'task:wxapp-mute-state-updated',
253
+
206
254
  /**
207
255
  * Triggered when a consultation request is accepted
208
256
  * @example
@@ -287,6 +335,24 @@ export enum TASK_EVENTS {
287
335
  */
288
336
  TASK_WRAPPEDUP = 'task:wrappedup',
289
337
 
338
+ /**
339
+ * Triggered when the task state machine reaches a final state and resources should be cleaned up.
340
+ * Used internally by TaskManager to perform collection/call cleanup.
341
+ * @internal
342
+ */
343
+ TASK_CLEANUP = 'task:cleanup',
344
+
345
+ /**
346
+ * Triggered when recording is started
347
+ * @example
348
+ * ```typescript
349
+ * task.on(TASK_EVENTS.TASK_RECORDING_STARTED, (task: ITask) => {
350
+ * console.log('Recording started:', task.data.interactionId);
351
+ * });
352
+ * ```
353
+ */
354
+ TASK_RECORDING_STARTED = 'task:recordingStarted',
355
+
290
356
  /**
291
357
  * Triggered when recording is paused
292
358
  * @example
@@ -519,6 +585,43 @@ export enum TASK_EVENTS {
519
585
  */
520
586
  TASK_PARTICIPANT_LEFT_FAILED = 'task:participantLeftFailed',
521
587
 
588
+ /**
589
+ * Triggered when agent initiates exit from conference
590
+ * @example
591
+ * ```typescript
592
+ * task.on(TASK_EVENTS.TASK_EXIT_CONFERENCE, (task: ITask) => {
593
+ * console.log('Exiting conference:', task.data.interactionId);
594
+ * // Handle conference exit initiation
595
+ * });
596
+ * ```
597
+ */
598
+ TASK_EXIT_CONFERENCE = 'task:exitConference',
599
+
600
+ /**
601
+ * Triggered when agent initiates conference transfer
602
+ * @example
603
+ * ```typescript
604
+ * task.on(TASK_EVENTS.TASK_TRANSFER_CONFERENCE, (task: ITask) => {
605
+ * console.log('Transferring conference:', task.data.interactionId);
606
+ * // Handle conference transfer initiation
607
+ * });
608
+ * ```
609
+ */
610
+ TASK_TRANSFER_CONFERENCE = 'task:transferConference',
611
+
612
+ /**
613
+ * Triggered when agent switches between consult call and main call.
614
+ * Use task.uiControls to determine current state and button visibility.
615
+ * @example
616
+ * ```typescript
617
+ * task.on(TASK_EVENTS.TASK_SWITCH_CALL, (task: ITask) => {
618
+ * console.log('Call switched:', task.data.interactionId);
619
+ * // Update UI based on task.uiControls.main.switch / task.uiControls.consult.switch
620
+ * });
621
+ * ```
622
+ */
623
+ TASK_SWITCH_CALL = 'task:switchCall',
624
+
522
625
  /**
523
626
  * Triggered when a contact is merged
524
627
  * @example
@@ -543,6 +646,17 @@ export enum TASK_EVENTS {
543
646
  */
544
647
  TASK_POST_CALL_ACTIVITY = 'task:postCallActivity',
545
648
 
649
+ /**
650
+ * Triggered when a multi-login task update should hydrate SDK instances without Mobius registration.
651
+ * @example
652
+ * ```typescript
653
+ * task.on(TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, (task: ITask) => {
654
+ * console.log('Multi-login hydrate:', task.data.interactionId);
655
+ * });
656
+ * ```
657
+ */
658
+ TASK_MULTI_LOGIN_HYDRATE = 'task:multiLoginHydrate',
659
+
546
660
  /**
547
661
  * Triggered when a campaign preview contact is offered to the agent
548
662
  * @example
@@ -554,6 +668,75 @@ export enum TASK_EVENTS {
554
668
  * ```
555
669
  */
556
670
  TASK_CAMPAIGN_PREVIEW_RESERVATION = 'task:campaignPreviewReservation',
671
+
672
+ /**
673
+ * Triggered when accepting a campaign preview contact fails
674
+ * @example
675
+ * ```typescript
676
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_ACCEPT_FAILED, (task: ITask) => {
677
+ * console.log('Campaign preview accept failed:', task.data.interactionId);
678
+ * // Handle accept failure
679
+ * });
680
+ * ```
681
+ */
682
+ TASK_CAMPAIGN_PREVIEW_ACCEPT_FAILED = 'task:campaignPreviewAcceptFailed',
683
+
684
+ /**
685
+ * Triggered when skipping a campaign preview contact fails
686
+ * @example
687
+ * ```typescript
688
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_SKIP_FAILED, (task: ITask) => {
689
+ * console.log('Campaign preview skip failed:', task.data.interactionId);
690
+ * // Handle skip failure
691
+ * });
692
+ * ```
693
+ */
694
+ TASK_CAMPAIGN_PREVIEW_SKIP_FAILED = 'task:campaignPreviewSkipFailed',
695
+
696
+ /**
697
+ * Triggered when removing a campaign preview contact fails
698
+ * @example
699
+ * ```typescript
700
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_PREVIEW_REMOVE_FAILED, (task: ITask) => {
701
+ * console.log('Campaign preview remove failed:', task.data.interactionId);
702
+ * // Handle remove failure
703
+ * });
704
+ * ```
705
+ */
706
+ TASK_CAMPAIGN_PREVIEW_REMOVE_FAILED = 'task:campaignPreviewRemoveFailed',
707
+
708
+ /**
709
+ * Triggered when a campaign contact is updated (e.g., after skip or remove, when the next contact is offered)
710
+ * @example
711
+ * ```typescript
712
+ * task.on(TASK_EVENTS.TASK_CAMPAIGN_CONTACT_UPDATED, (task: ITask) => {
713
+ * console.log('Campaign contact updated:', task.data.interactionId);
714
+ * // Handle updated campaign contact (e.g., display next contact)
715
+ * });
716
+ * ```
717
+ */
718
+ TASK_CAMPAIGN_CONTACT_UPDATED = 'task:campaignContactUpdated',
719
+
720
+ /**
721
+ * Triggered when a mid-call summary is received for the task.
722
+ */
723
+ TASK_MID_CALL_SUMMARY_RECEIVED = 'task:midCallSummaryReceived',
724
+
725
+ /**
726
+ * Triggered on the task object when AI feature enablement flags arrive for that task's interaction.
727
+ * Fires immediately if the frame arrived after the task was registered, or at registration time
728
+ * if the frame arrived before the task (orphan retention). Consumers should use this event
729
+ * instead of the cc-level `FEATURE_ENABLEMENT` event so they do not need to maintain an
730
+ * interactionId → flags map manually.
731
+ * @example
732
+ * ```typescript
733
+ * task.on(TASK_EVENTS.TASK_FEATURE_ENABLEMENT, (enablement: AISummaryFeatureEnablement) => {
734
+ * const { midCallEnabled, postCallEnabled } = enablement;
735
+ * // gate summary UI on these flags
736
+ * });
737
+ * ```
738
+ */
739
+ TASK_FEATURE_ENABLEMENT = 'task:featureEnablement',
557
740
  }
558
741
 
559
742
  /**
@@ -561,6 +744,146 @@ export enum TASK_EVENTS {
561
744
  * Contains comprehensive details about an ongoing customer interaction
562
745
  * @public
563
746
  */
747
+ export interface CallAssociatedDatum {
748
+ /** Whether the field can be edited by the agent */
749
+ agentEditable: boolean;
750
+ /** Whether the field is visible to the agent */
751
+ agentViewable: boolean;
752
+ /** Display name for the field */
753
+ displayName: string;
754
+ /** Whether the field is global */
755
+ global: boolean;
756
+ /** Whether the field is secure */
757
+ isSecure: boolean;
758
+ /** Internal field name */
759
+ name: string;
760
+ /** Whether the field is reportable */
761
+ reportable: boolean;
762
+ /** Secure key identifier */
763
+ secureKeyId: string;
764
+ /** Secure key version */
765
+ secureKeyVersion: number;
766
+ /** Data type of the field */
767
+ type: string;
768
+ /** Field value */
769
+ value: string;
770
+ }
771
+
772
+ export type CallAssociatedData = Record<string, CallAssociatedDatum>;
773
+
774
+ export type CallAssociatedDetails = Record<string, string>;
775
+
776
+ export interface FlowParameter {
777
+ /** Parameter name */
778
+ name?: string;
779
+ /** Additional qualifier */
780
+ qualifier?: string;
781
+ /** Description of the parameter */
782
+ description?: string;
783
+ /** Data type of the value */
784
+ valueDataType?: string;
785
+ /** Value associated with the parameter */
786
+ value?: string;
787
+ }
788
+
789
+ export interface InteractionParticipant {
790
+ /** Unique participant identifier */
791
+ id: string;
792
+ /** Participant type label used by backend */
793
+ pType: string;
794
+ /** Friendly participant type */
795
+ type: string;
796
+ /** Whether the participant has joined */
797
+ hasJoined: boolean;
798
+ /** Whether the participant has left */
799
+ hasLeft: boolean;
800
+ /** Whether the participant is still in pre-dial */
801
+ isInPredial: boolean;
802
+ /** Optional caller identifier */
803
+ callerId?: string | null;
804
+ /** Whether auto-answer is enabled */
805
+ autoAnswerEnabled?: boolean;
806
+ /** Backchannel/bnr details */
807
+ bnrDetails?: unknown;
808
+ /** Channel identifier for the participant */
809
+ channelId?: string;
810
+ /** Current consult state */
811
+ consultState?: string | null;
812
+ /** Timestamp when consult started */
813
+ consultTimestamp?: number | null;
814
+ /** Current participant state */
815
+ currentState?: string | null;
816
+ /** Timestamp of the current state */
817
+ currentStateTimestamp?: number | null;
818
+ /** Device call identifier */
819
+ deviceCallId?: string | null;
820
+ /** Device identifier */
821
+ deviceId?: string | null;
822
+ /** Device type (AGENT_DN, BROWSER, etc.) */
823
+ deviceType?: string | null;
824
+ /** Dial number associated with participant */
825
+ dn?: string | null;
826
+ /** Whether participant is currently consulted */
827
+ isConsulted?: boolean;
828
+ /** Whether participant offer is active */
829
+ isOffered?: boolean;
830
+ /** Whether participant is in wrap-up */
831
+ isWrapUp?: boolean;
832
+ /** Whether participant completed wrap-up */
833
+ isWrappedUp?: boolean;
834
+ /** Timestamp of when participant joined */
835
+ joinTimestamp?: number | null;
836
+ /** Last updated timestamp */
837
+ lastUpdated?: number | null;
838
+ /** Friendly name of participant */
839
+ name?: string | null;
840
+ /** Queue identifier associated with participant */
841
+ queueId?: string;
842
+ /** Queue manager identifier */
843
+ queueMgrId?: string;
844
+ /** Session identifier */
845
+ sessionId?: string;
846
+ /** Site identifier */
847
+ siteId?: string;
848
+ /** Skill identifier */
849
+ skillId?: string | null;
850
+ /** Skill name */
851
+ skillName?: string | null;
852
+ /** Skill list for participant */
853
+ skills?: string[];
854
+ /** Team identifier */
855
+ teamId?: string;
856
+ /** Team name */
857
+ teamName?: string;
858
+ /** Timestamp for wrap-up */
859
+ wrapUpTimestamp?: number | null;
860
+ /** Additional metadata */
861
+ [key: string]: unknown;
862
+ }
863
+
864
+ export type InteractionParticipants = Record<string, InteractionParticipant>;
865
+
866
+ /**
867
+ * Media entry type from interaction.media
868
+ * Used for media state tracking in consult and conference scenarios
869
+ */
870
+ export type MediaEntry = {
871
+ /** Unique identifier for the media resource */
872
+ mediaResourceId: string;
873
+ /** Type of media channel */
874
+ mediaType: MEDIA_CHANNEL;
875
+ /** Media manager handling this media */
876
+ mediaMgr: string;
877
+ /** List of participant identifiers */
878
+ participants: string[];
879
+ /** Type of media (e.g., 'mainCall', 'consult') */
880
+ mType: string;
881
+ /** Indicates if media is on hold */
882
+ isHold: boolean;
883
+ /** Timestamp when media was put on hold */
884
+ holdTimestamp: number | null;
885
+ };
886
+
564
887
  export type Interaction = {
565
888
  /** Indicates if the interaction is managed by Flow Control */
566
889
  isFcManaged: boolean;
@@ -575,7 +898,11 @@ export type Interaction = {
575
898
  /** Current virtual team handling the interaction */
576
899
  currentVTeam: string;
577
900
  /** List of participants in the interaction */
578
- participants: any; // TODO: Define specific participant type
901
+ participants: InteractionParticipants;
902
+ /** Detailed call associated data */
903
+ callAssociatedData?: CallAssociatedData;
904
+ /** Simplified call associated key/value pairs */
905
+ callAssociatedDetails?: CallAssociatedDetails;
579
906
  /** Unique identifier for the interaction */
580
907
  interactionId: string;
581
908
  /** Organization identifier */
@@ -584,7 +911,18 @@ export type Interaction = {
584
911
  createdTimestamp?: number;
585
912
  /** Indicates if wrap-up assistance is enabled */
586
913
  isWrapUpAssist?: boolean;
587
- /** Detailed call processing information and metadata */
914
+ /** Identifier of parent interaction if applicable */
915
+ parentInteractionId?: string;
916
+ /** Indicates if media is forked for this interaction */
917
+ isMediaForked?: boolean;
918
+ /** Retroactive flow properties returned by backend */
919
+ flowProperties?: Record<string, unknown> | null;
920
+ /** Media specific properties returned by backend */
921
+ mediaProperties?: Record<string, unknown> | null;
922
+ /**
923
+ * Detailed call processing information and metadata.
924
+ * Mirrors the callProcessingDetails section described in Webex Contact Center Agent Contact payloads.
925
+ */
588
926
  callProcessingDetails: {
589
927
  /** Name of the Queue Manager handling this interaction */
590
928
  QMgrName: string;
@@ -602,20 +940,24 @@ export type Interaction = {
602
940
  QueueId: string;
603
941
  /** Virtual team identifier */
604
942
  vteamId: string;
605
- /** Indicates if pause/resume functionality is enabled */
606
- pauseResumeEnabled?: string;
943
+ /** Agent capability for pause/resume on this interaction */
944
+ pauseResumeEnabled?: boolean;
607
945
  /** Duration of pause in seconds */
608
946
  pauseDuration?: string;
609
- /** Indicates if the interaction is currently paused */
610
- isPaused?: string;
611
- /** Indicates if recording is in progress */
612
- recordInProgress?: string;
613
- /** Indicates if recording has started */
614
- recordingStarted?: string;
947
+ /** Legacy pause indicator (recordInProgress=false is the active pause signal) */
948
+ isPaused?: boolean;
949
+ /** Recording is actively capturing audio right now */
950
+ recordInProgress?: boolean;
951
+ /** Recording was started for this interaction (may be paused) */
952
+ recordingStarted?: boolean;
953
+ /** Customer geographic region */
954
+ customerRegion?: string;
955
+ /** Flow tag identifier */
956
+ flowTagId?: string;
615
957
  /** Indicates if Consult to Queue is in progress */
616
- ctqInProgress?: string;
958
+ ctqInProgress?: boolean;
617
959
  /** Indicates if outdial transfer to queue is enabled */
618
- outdialTransferToQueueEnabled?: string;
960
+ outdialTransferToQueueEnabled?: boolean;
619
961
  /** IVR conversation transcript */
620
962
  convIvrTranscript?: string;
621
963
  /** Customer's name */
@@ -702,64 +1044,67 @@ export type Interaction = {
702
1044
  fcDesktopView?: string;
703
1045
  /** Agent ID who initiated the outdial call */
704
1046
  outdialAgentId?: string;
1047
+ /** Indicates if the customer has left the call during an active consult */
1048
+ hasCustomerLeft?: string;
1049
+ /** Indicates if the skip action is disabled for campaign preview contacts */
1050
+ campaignPreviewSkipDisabled?: string;
1051
+ /** Indicates if the remove action is disabled for campaign preview contacts */
1052
+ campaignPreviewRemoveDisabled?: string;
1053
+ /** Auto-action to perform when campaign preview offer times out (ACCEPT, SKIP, REMOVE) */
1054
+ campaignPreviewAutoAction?: string;
1055
+ /** Timestamp (ms) when the campaign preview offer expires */
1056
+ campaignPreviewOfferTimeout?: string;
705
1057
  };
706
1058
  /** Main interaction identifier for related interactions */
707
1059
  mainInteractionId?: string;
1060
+ /** Timestamp when interaction entered queue */
1061
+ queuedTimestamp?: number | null;
708
1062
  /** Media-specific information for the interaction */
709
- media: Record<
710
- string,
711
- {
712
- /** Unique identifier for the media resource */
713
- mediaResourceId: string;
714
- /** Type of media channel */
715
- mediaType: MEDIA_CHANNEL;
716
- /** Media manager handling this media */
717
- mediaMgr: string;
718
- /** List of participant identifiers */
719
- participants: string[];
720
- /** Type of media */
721
- mType: string;
722
- /** Indicates if media is on hold */
723
- isHold: boolean;
724
- /** Timestamp when media was put on hold */
725
- holdTimestamp: number | null;
726
- }
727
- >;
1063
+ media: Record<string, MediaEntry>;
728
1064
  /** Owner of the interaction */
729
1065
  owner: string;
730
1066
  /** Primary media channel for the interaction */
731
- mediaChannel: MEDIA_CHANNEL;
1067
+ mediaChannel: string;
732
1068
  /** Direction information for the contact */
733
1069
  contactDirection: {type: string};
734
1070
  /** Type of outbound interaction */
735
1071
  outboundType?: string;
1072
+ /** Optional workflow manager identifier */
1073
+ workflowManager?: string | null;
736
1074
  /** Parameters passed through the call flow */
737
- callFlowParams: Record<
738
- string,
739
- {
740
- /** Name of the parameter */
741
- name: string;
742
- /** Qualifier for the parameter */
743
- qualifier: string;
744
- /** Description of the parameter */
745
- description: string;
746
- /** Data type of the parameter value */
747
- valueDataType: string;
748
- /** Value of the parameter */
749
- value: string;
750
- }
751
- >;
1075
+ callFlowParams?: Record<string, FlowParameter>;
752
1076
  };
753
1077
 
754
1078
  /**
755
- * Task payload containing detailed information about a contact center task
756
- * This structure encapsulates all relevant data for task management
1079
+ * Task payload mirroring the Agent Contact event payload from Webex Contact Center
1080
+ * (developer.webex.com). Arrives on AGENT_* websocket events and is the source of truth
1081
+ * for UI/state machine updates.
757
1082
  * @public
758
1083
  */
1084
+ export type RealtimeTranscription = {
1085
+ agentId: string;
1086
+ orgId: string;
1087
+ notifType: string;
1088
+ notifDetails: {
1089
+ actionEvent: string;
1090
+ };
1091
+ data: {
1092
+ role: 'AGENT' | 'CALLER';
1093
+ utteranceId: string;
1094
+ conversationId: string;
1095
+ publishTimestamp: number;
1096
+ messageId: string;
1097
+ isFinal: boolean;
1098
+ languageCode: string;
1099
+ orgId: string;
1100
+ content: string;
1101
+ };
1102
+ };
1103
+
759
1104
  export type TaskData = {
760
- /** Unique identifier for the media resource handling this task */
1105
+ /** Primary media resource identifier for the active leg (matches interaction.media[].mediaResourceId) */
761
1106
  mediaResourceId: string;
762
- /** Type of event that triggered this task data */
1107
+ /** Agent event name from the websocket stream (e.g., AGENT_CONTACT_ASSIGNED) */
763
1108
  eventType: string;
764
1109
  /** Timestamp when the event occurred */
765
1110
  eventTime?: number;
@@ -769,7 +1114,7 @@ export type TaskData = {
769
1114
  destAgentId: string;
770
1115
  /** Unique tracking identifier for the task */
771
1116
  trackingId: string;
772
- /** Media resource identifier for consultation operations */
1117
+ /** Media resource identifier for consultation leg when present */
773
1118
  consultMediaResourceId: string;
774
1119
  /** Detailed interaction information */
775
1120
  interaction: Interaction;
@@ -781,7 +1126,7 @@ export type TaskData = {
781
1126
  toOwner?: boolean;
782
1127
  /** Identifier for child interaction in consult/transfer scenarios */
783
1128
  childInteractionId?: string;
784
- /** Unique identifier for the interaction */
1129
+ /** Interaction/contact identifier from backend (same as interaction.interactionId) */
785
1130
  interactionId: string;
786
1131
  /** Organization identifier */
787
1132
  orgId: string;
@@ -791,7 +1136,7 @@ export type TaskData = {
791
1136
  queueMgr: string;
792
1137
  /** Name of the queue where task is queued */
793
1138
  queueName?: string;
794
- /** Type of the task */
1139
+ /** Task/interaction type returned by the platform (routing/monitoring/etc.) */
795
1140
  type: string;
796
1141
  /** Timeout value for RONA (Redirection on No Answer) in seconds */
797
1142
  ronaTimeout?: number;
@@ -827,12 +1172,130 @@ export type TaskData = {
827
1172
  reservedAgentChannelId?: string;
828
1173
  /** Indicates if wrap-up is required for this task */
829
1174
  wrapUpRequired?: boolean;
1175
+ /** SDK-internal: skip task:outdialFailed when non-wxApp agent-terminated outdial still needs wrapup */
1176
+ suppressOutdialFailedPopup?: boolean;
1177
+
1178
+ /**
1179
+ * Current consultation status derived from state machine
1180
+ * Values: CONSULT_INITIATED, CONSULT_ACCEPTED, BEING_CONSULTED,
1181
+ * BEING_CONSULTED_ACCEPTED, CONNECTED, CONFERENCE, CONSULT_COMPLETED
1182
+ */
1183
+ consultStatus?: string;
1184
+
1185
+ /**
1186
+ * Indicates if consultation is in progress (state machine: CONSULTING)
1187
+ */
1188
+ isConsultInProgress?: boolean;
1189
+
1190
+ /**
1191
+ * Indicates if the task is incoming for the active agent
1192
+ */
1193
+ isIncomingTask?: boolean;
1194
+
1195
+ /**
1196
+ * Indicates if the task is on hold (state machine: HELD)
1197
+ */
1198
+ isOnHold?: boolean;
1199
+
1200
+ /**
1201
+ * Indicates if customer is currently in the call
1202
+ * Derived from participants in main media
1203
+ */
1204
+ isCustomerInCall?: boolean;
1205
+
1206
+ /**
1207
+ * Count of conference participants (agents only)
1208
+ * Used for determining if max participants reached
1209
+ */
1210
+ conferenceParticipantsCount?: number;
1211
+
1212
+ /**
1213
+ * Indicates if this is a secondary agent (consulted party)
1214
+ */
1215
+ isSecondaryAgent?: boolean;
1216
+
1217
+ /**
1218
+ * Indicates if this is a secondary EP-DN agent (telephony consult to external)
1219
+ */
1220
+ isSecondaryEpDnAgent?: boolean;
1221
+
1222
+ /**
1223
+ * Task state for MPC (Multi-Party Conference) scenarios
1224
+ * Maps participant consultState to task state
1225
+ */
1226
+ mpcState?: string;
830
1227
  /** Indicates if auto-answer is in progress for this task */
831
1228
  isAutoAnswering?: boolean;
832
1229
  /** Indicates if wrap-up is required for this task */
833
1230
  agentsPendingWrapUp?: string[];
834
1231
  };
835
1232
 
1233
+ export type TaskUIControlState = {
1234
+ isVisible: boolean;
1235
+ isEnabled: boolean;
1236
+ };
1237
+
1238
+ /**
1239
+ * UI control representation for a single interaction leg.
1240
+ */
1241
+ export type InteractionUIControls = {
1242
+ accept: TaskUIControlState;
1243
+ decline: TaskUIControlState;
1244
+ hold: TaskUIControlState;
1245
+ transfer: TaskUIControlState;
1246
+ consult: TaskUIControlState;
1247
+ end: TaskUIControlState;
1248
+ recording: TaskUIControlState;
1249
+ mute: TaskUIControlState;
1250
+ consultTransfer: TaskUIControlState;
1251
+ endConsult: TaskUIControlState;
1252
+ conference: TaskUIControlState;
1253
+ exitConference: TaskUIControlState;
1254
+ transferConference: TaskUIControlState;
1255
+ mergeToConference: TaskUIControlState;
1256
+ wrapup: TaskUIControlState;
1257
+ switch: TaskUIControlState;
1258
+ keypad?: TaskUIControlState;
1259
+ };
1260
+
1261
+ /** Options for {@link ITask.toggleMute} — wxApp engaged calls use `muted` for target state. */
1262
+ export type TaskToggleMuteOptions = {
1263
+ muted?: boolean;
1264
+ lineOwnerId?: string;
1265
+ };
1266
+
1267
+ /** Options for {@link ITask.transmitDtmf} — wxApp engaged in-call DTMF. */
1268
+ export type TaskTransmitDtmfOptions = {
1269
+ dtmf: string;
1270
+ lineOwnerId?: string;
1271
+ };
1272
+
1273
+ export type TaskUILeg = 'main' | 'consult';
1274
+
1275
+ /**
1276
+ * UI controls surfaced to task consumers.
1277
+ * Consumers should read controls from the per-leg surfaces and use `activeLeg`
1278
+ * to determine which one is currently interactive.
1279
+ */
1280
+ export type TaskUIControls = {
1281
+ main: InteractionUIControls;
1282
+ consult: InteractionUIControls;
1283
+ activeLeg: TaskUILeg;
1284
+ /**
1285
+ * Ordered destination categories available for each action.
1286
+ * The first category is the default for consumers that render a destination picker.
1287
+ */
1288
+ consultTransferDestinations: {
1289
+ consult: ConsultTransferDestinationType[];
1290
+ transfer: ConsultTransferDestinationType[];
1291
+ };
1292
+ };
1293
+
1294
+ /**
1295
+ * Helper class for managing task action control state
1296
+ * Tracks visibility and enabled state for task actions that can be executed
1297
+ * @public
1298
+ */
836
1299
  /**
837
1300
  * Type representing an agent contact message within the contact center system
838
1301
  * Contains comprehensive interaction and task related details for agent operations
@@ -1054,6 +1517,15 @@ export type TransferPayload = {
1054
1517
  destinationType: DestinationType;
1055
1518
  };
1056
1519
 
1520
+ /**
1521
+ * Options for configuring transfer behavior
1522
+ * @public
1523
+ */
1524
+ export type TransferOptions = {
1525
+ /** Additional transfer configuration options */
1526
+ [key: string]: unknown;
1527
+ };
1528
+
1057
1529
  /**
1058
1530
  * API payload for ending a consultation
1059
1531
  * This is the actual payload that is sent to the developer API
@@ -1175,6 +1647,41 @@ export type ContactCleanupData = {
1175
1647
  };
1176
1648
  };
1177
1649
 
1650
+ /**
1651
+ * Boolean-like fields in callProcessingDetails that may arrive as strings.
1652
+ * Used by taskDataNormalizer to coerce payloads to actual booleans.
1653
+ */
1654
+ export type CallProcessingBooleanKey =
1655
+ | 'recordingStarted'
1656
+ | 'recordInProgress'
1657
+ | 'isPaused'
1658
+ | 'pauseResumeEnabled'
1659
+ | 'ctqInProgress'
1660
+ | 'outdialTransferToQueueEnabled'
1661
+ | 'taskToBeSelfServiced'
1662
+ | 'CONTINUE_RECORDING_ON_TRANSFER'
1663
+ | 'isParked'
1664
+ | 'participantInviteTimeout'
1665
+ | 'checkAgentAvailability';
1666
+
1667
+ /**
1668
+ * Interaction-level boolean fields that may arrive as strings from backend payloads.
1669
+ */
1670
+ export type InteractionBooleanKey = 'isFcManaged' | 'isMediaForked' | 'isTerminated';
1671
+
1672
+ /**
1673
+ * Participant boolean fields that may arrive as strings and need normalization.
1674
+ */
1675
+ export type ParticipantBooleanKey =
1676
+ | 'autoAnswerEnabled'
1677
+ | 'hasJoined'
1678
+ | 'hasLeft'
1679
+ | 'isConsulted'
1680
+ | 'isInPredial'
1681
+ | 'isOffered'
1682
+ | 'isWrapUp'
1683
+ | 'isWrappedUp';
1684
+
1178
1685
  /**
1179
1686
  * Response type for task public methods
1180
1687
  * Can be an {@link AgentContact} object containing updated task state,
@@ -1183,11 +1690,119 @@ export type ContactCleanupData = {
1183
1690
  */
1184
1691
  export type TaskResponse = AgentContact | Error | void;
1185
1692
 
1693
+ /** AI-assisted mid-call summary action. @public */
1694
+ export type AISummaryAction = 'CONSULT' | 'TRANSFER';
1695
+
1696
+ /** Feedback value sent with an AI summary response. @public */
1697
+ export type AISummaryFeedback = 'none' | 'thumbs_up' | 'thumbs_down';
1698
+
1699
+ /** AI summary response state for post-call and mid-call flows. @public */
1700
+ export type AISummaryState =
1701
+ | 'DEFAULT'
1702
+ | 'EXCLUDED'
1703
+ | 'IGNORED'
1704
+ | 'MID_CALL_CANCELLED'
1705
+ | 'NOT_RECEIVED';
1706
+
1707
+ /** Structured fields shared by post-call and mid-call summaries. @public */
1708
+ export type AISummarySections = {
1709
+ initialContactReason?: string;
1710
+ additionalContactReasons?: string;
1711
+ additionalContext?: string;
1712
+ keyActionsTaken?: string;
1713
+ nextSteps?: string;
1714
+ reasonForTransferOrConsult?: string;
1715
+ };
1716
+
1717
+ /** RTD payload returned or delivered for an AI summary. @public */
1718
+ export type AISummary = {
1719
+ conversationId: string;
1720
+ adaptiveCard?: Record<string, unknown>;
1721
+ adaptiveCardId?: string;
1722
+ editAdaptiveCard?: Record<string, unknown>;
1723
+ editAdaptiveCardId?: string;
1724
+ areTranscriptsAvailable?: boolean;
1725
+ languageCode?: string;
1726
+ resolution?: string;
1727
+ sections?: AISummarySections;
1728
+ suggestedWrapUpCodes?: Array<{name: string; [key: string]: unknown}>;
1729
+ suggestedWrapUpCodesMessage?: string;
1730
+ summaryText?: string;
1731
+ timestamp?: number;
1732
+ [key: string]: unknown;
1733
+ };
1734
+
1735
+ /** RTD payload describing AI-summary feature enablement for an interaction. @public */
1736
+ export type AISummaryFeatureEnablement = {
1737
+ interactionId: string;
1738
+ midCallEnabled?: boolean;
1739
+ postCallEnabled?: boolean;
1740
+ actionTimestamp?: number;
1741
+ [key: string]: unknown;
1742
+ };
1743
+
1744
+ /** Current AI-summary capabilities for a task. @public */
1745
+ export type AISummaryCapabilities = Required<
1746
+ Pick<AISummaryFeatureEnablement, 'midCallEnabled' | 'postCallEnabled'>
1747
+ >;
1748
+
1749
+ /**
1750
+ * Payload sent when reporting a post-call or mid-call summary result.
1751
+ * Transport timestamps are generated by the SDK when the response is sent.
1752
+ * @public
1753
+ */
1754
+ export type AISummaryResponse = {
1755
+ summary: AISummarySections | string;
1756
+ feedback: AISummaryFeedback;
1757
+ state: AISummaryState;
1758
+ numberOfTimesViewed: number;
1759
+ numberOfTimesEdited: number;
1760
+ numberOfTimesCopied: number;
1761
+ summaryReceived?: boolean;
1762
+ wrapUpCode?: string;
1763
+ };
1764
+
1765
+ /**
1766
+ * Request payload for removing a supported participant from an active conference.
1767
+ * @public
1768
+ */
1769
+ export type DropConferenceParticipantPayload = {
1770
+ /** Participant identifier supplied by the current task roster. */
1771
+ participantId: string;
1772
+ };
1773
+
1774
+ /**
1775
+ * Payload shape used by consult conference helper utilities.
1776
+ */
1777
+ export type consultConferencePayloadData = {
1778
+ agentId?: string;
1779
+ destinationType?: string;
1780
+ destAgentId?: string;
1781
+ };
1782
+
1783
+ /**
1784
+ * Minimal event-emitter contract exposed to SDK consumers.
1785
+ * Defined here so that consumers do NOT need `@types/node` in their tsconfig.
1786
+ * The runtime Task class still extends Node's EventEmitter (via ampersand-events),
1787
+ * which satisfies this interface at runtime.
1788
+ * @public
1789
+ */
1790
+ export interface IEventEmitter {
1791
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1792
+ on(event: string, listener: (...args: any[]) => void): this;
1793
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1794
+ off(event: string, listener: (...args: any[]) => void): this;
1795
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1796
+ once(event: string, listener: (...args: any[]) => void): this;
1797
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1798
+ emit(event: string, ...args: any[]): boolean;
1799
+ }
1800
+
1186
1801
  /**
1187
1802
  * Interface for managing task-related operations in the contact center
1188
- * Extends EventEmitter to support event-driven task updates
1803
+ * Extends IEventEmitter to support event-driven task updates
1189
1804
  */
1190
- export interface ITask extends EventEmitter {
1805
+ export interface ITask extends IEventEmitter {
1191
1806
  /**
1192
1807
  * Event data received in the Contact Center events.
1193
1808
  * Contains detailed task information including interaction details, media resources,
@@ -1195,6 +1810,12 @@ export interface ITask extends EventEmitter {
1195
1810
  */
1196
1811
  data: TaskData;
1197
1812
 
1813
+ /**
1814
+ * Current AI-summary capabilities for this task. Both flags are false until
1815
+ * the matching feature-enablement event is received.
1816
+ */
1817
+ readonly aiSummaryCapabilities: Readonly<AISummaryCapabilities>;
1818
+
1198
1819
  /**
1199
1820
  * Map associating tasks with their corresponding call identifiers.
1200
1821
  */
@@ -1207,6 +1828,73 @@ export interface ITask extends EventEmitter {
1207
1828
  */
1208
1829
  autoWrapup?: AutoWrapup;
1209
1830
 
1831
+ /**
1832
+ * Latest UI controls derived from the state machine.
1833
+ * Each control has `isVisible` and `isEnabled` flags computed from current task state.
1834
+ * Subscribe to {@link TASK_EVENTS.TASK_UI_CONTROLS_UPDATED} for change notifications.
1835
+ */
1836
+ readonly uiControls: TaskUIControls;
1837
+
1838
+ /**
1839
+ * Update wxApp thick-client answer flag at runtime.
1840
+ * Voice tasks override to refresh uiControls; other channel types no-op.
1841
+ * @internal
1842
+ */
1843
+ setEnableWxBetterTogether(enabled: boolean): void;
1844
+
1845
+ /**
1846
+ * Apply wxApp mute state from Mercury sync or call-details fetch.
1847
+ * @internal
1848
+ */
1849
+ applyWxAppMuteStateFromSync(incomingCallId: string, muted: boolean): void;
1850
+
1851
+ /**
1852
+ * Current wxApp mute state for engaged telephony (Voice tasks only).
1853
+ */
1854
+ getWxAppMuted?(): boolean;
1855
+
1856
+ /**
1857
+ * Re-seed wxApp mute from GET telephony/calls/{callId}. Resolves to muted state when known.
1858
+ */
1859
+ syncWxAppMuteFromCallDetails?(): Promise<boolean | undefined>;
1860
+
1861
+ /**
1862
+ * Re-run OFFERED wxApp offer diagnostics without emitting UI controls.
1863
+ * Voice tasks implement this; other channel types omit it.
1864
+ * @internal
1865
+ */
1866
+ refreshWxAppOfferObservability?(): void;
1867
+
1868
+ /**
1869
+ * Cancel pending wxApp offer observability timers (participant-mismatch grace).
1870
+ * Voice tasks implement this; other channel types omit it.
1871
+ * @internal
1872
+ */
1873
+ disposeWxAppOfferObservability?(): void;
1874
+
1875
+ /**
1876
+ * State machine instance for managing task state transitions and derived properties.
1877
+ * The state machine handles:
1878
+ * - State transitions (IDLE → OFFERED → CONNECTED → HELD, etc.)
1879
+ * - Derived properties (canHold, canResume, isConsulted, etc.)
1880
+ * - Action availability based on current state
1881
+ *
1882
+ * This is part of the migration from manual state management to centralized state machine.
1883
+ * During the transition period, both the old setUIControls() and state machine coexist.
1884
+ *
1885
+ * @see createTaskStateMachine
1886
+ * @internal
1887
+ */
1888
+ stateMachineService?: AnyActorRef;
1889
+ state?: any;
1890
+
1891
+ /**
1892
+ * Helper method to send events to the state machine.
1893
+ * This is part of the migration to XState.
1894
+ * @internal
1895
+ */
1896
+ sendStateMachineEvent: (event: TaskEventPayload) => void;
1897
+
1210
1898
  /**
1211
1899
  * Cancels the auto-wrapup timer for the task.
1212
1900
  * This method stops the auto-wrapup process if it is currently active.
@@ -1215,6 +1903,46 @@ export interface ITask extends EventEmitter {
1215
1903
  */
1216
1904
  cancelAutoWrapupTimer(): void;
1217
1905
 
1906
+ /**
1907
+ * Applies the AI-summary feature flags received for this task's interaction.
1908
+ * @internal
1909
+ */
1910
+ setFeatureEnablement?(enablement: AISummaryFeatureEnablement): void;
1911
+
1912
+ /**
1913
+ * Clears the task-local AI-summary feature flags on task removal or session cleanup.
1914
+ * @internal
1915
+ */
1916
+ clearFeatureEnablement?(): void;
1917
+
1918
+ /**
1919
+ * Requests an AI-generated post-call summary for this task.
1920
+ * @returns Promise resolving with the matching post-call summary payload.
1921
+ */
1922
+ requestPostCallSummary(): Promise<AISummary>;
1923
+
1924
+ /**
1925
+ * Sends the consumer's post-call summary response.
1926
+ * @param response - Validated post-call response observations and summary state.
1927
+ * @returns Promise resolving when AI Assistant acknowledges the response.
1928
+ */
1929
+ sendPostCallSummaryResponse(response: AISummaryResponse): Promise<void>;
1930
+
1931
+ /**
1932
+ * Requests an AI-generated mid-call summary for a consult or transfer flow.
1933
+ * @param action - The consult or transfer flow requesting the summary.
1934
+ * @returns Promise resolving with the matching mid-call summary payload.
1935
+ */
1936
+ requestMidCallSummary(action: AISummaryAction): Promise<AISummary>;
1937
+
1938
+ /**
1939
+ * Sends the consumer's mid-call summary response for a consult or transfer flow.
1940
+ * @param response - Validated mid-call response observations and summary state.
1941
+ * @param action - The consult or transfer flow responding to the summary.
1942
+ * @returns Promise resolving when AI Assistant acknowledges the response.
1943
+ */
1944
+ sendMidCallSummaryResponse(response: AISummaryResponse, action: AISummaryAction): Promise<void>;
1945
+
1218
1946
  /**
1219
1947
  * Deregisters all web call event listeners.
1220
1948
  * Used when cleaning up task resources.
@@ -1228,7 +1956,7 @@ export interface ITask extends EventEmitter {
1228
1956
  * @returns Updated task instance
1229
1957
  * @ignore
1230
1958
  */
1231
- updateTaskData(newData: TaskData): ITask;
1959
+ updateTaskData(newData: TaskData): void;
1232
1960
 
1233
1961
  /**
1234
1962
  * Answers or accepts an incoming task.
@@ -1360,28 +2088,29 @@ export interface ITask extends EventEmitter {
1360
2088
  * await task.transfer({ to: "queueId", destinationType: "queue" });
1361
2089
  * ```
1362
2090
  */
1363
- transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
2091
+ transfer(transferPayload: TransferPayLoad, options?: TransferOptions): Promise<TaskResponse>;
1364
2092
 
1365
2093
  /**
1366
- * Transfers the task after consultation.
1367
- * @param consultTransferPayload - Details for consult transfer (optional)
2094
+ * Initiates a consult conference (merge consult call with main call).
1368
2095
  * @returns Promise<TaskResponse>
1369
2096
  * @example
1370
2097
  * ```typescript
1371
- * await task.consultTransfer({ to: "agentId", destinationType: "agent" });
2098
+ * await task.consultConference();
1372
2099
  * ```
1373
2100
  */
1374
- consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
2101
+ consultConference(): Promise<TaskResponse>;
1375
2102
 
1376
2103
  /**
1377
- * Initiates a consult conference (merge consult call with main call).
2104
+ * Removes a supported participant from the active conference.
2105
+ * Resolves after the correlated ParticipantLeftConference routing event.
2106
+ * @param payload - Participant identifier to remove
1378
2107
  * @returns Promise<TaskResponse>
1379
2108
  * @example
1380
2109
  * ```typescript
1381
- * await task.consultConference();
2110
+ * await task.dropConferenceParticipant({participantId: 'participant-id'});
1382
2111
  * ```
1383
2112
  */
1384
- consultConference(): Promise<TaskResponse>;
2113
+ dropConferenceParticipant(payload: DropConferenceParticipantPayload): Promise<TaskResponse>;
1385
2114
 
1386
2115
  /**
1387
2116
  * Exits from an ongoing conference.
@@ -1404,12 +2133,187 @@ export interface ITask extends EventEmitter {
1404
2133
  transferConference(): Promise<TaskResponse>;
1405
2134
 
1406
2135
  /**
1407
- * Toggles mute/unmute for the local audio stream during a WebRTC task.
2136
+ * Toggles between consult call and main call during consulting.
2137
+ * If on consult leg, switches to main call (holds consult).
2138
+ * If on main call, switches to consult (resumes consult).
2139
+ * Only available when in CONSULTING state.
2140
+ * @returns Promise<TaskResponse>
2141
+ * @example
2142
+ * ```typescript
2143
+ * await task.switchCall();
2144
+ * ```
2145
+ */
2146
+ switchCall(): Promise<TaskResponse>;
2147
+
2148
+ /**
2149
+ * Toggles mute/unmute for the active call.
2150
+ * WebRTC tasks toggle the local stream; wxApp engaged tasks route to telephony mute REST when
2151
+ * `enableWxBetterTogether` is active.
2152
+ * @param options - Optional target mute state (`muted`) for wxApp; ignored for WebRTC toggle.
1408
2153
  * @returns Promise<void>
1409
2154
  * @example
1410
2155
  * ```typescript
1411
2156
  * await task.toggleMute();
2157
+ * await task.toggleMute({ muted: true });
2158
+ * ```
2159
+ */
2160
+ toggleMute(options?: TaskToggleMuteOptions): Promise<void>;
2161
+
2162
+ /**
2163
+ * Sends in-call DTMF tones for wxApp engaged telephony tasks when `enableWxBetterTogether` is active.
2164
+ * @param options - DTMF digit(s) and optional shared-line owner id.
2165
+ * @returns Promise<void>
2166
+ * @example
2167
+ * ```typescript
2168
+ * await task.transmitDtmf({ dtmf: '5' });
2169
+ * ```
2170
+ */
2171
+ transmitDtmf(options: TaskTransmitDtmfOptions): Promise<void>;
2172
+ }
2173
+
2174
+ /**
2175
+ * Interface for managing digital channel task operations in the contact center
2176
+ * Digital channels (chat, email, social, SMS) have a simpler interface than voice
2177
+ * Extends ITask but overrides updateTaskData to return IDigital
2178
+ * @public
2179
+ */
2180
+ export interface IDigital extends Omit<ITask, 'updateTaskData'> {
2181
+ /**
2182
+ * Updates the task data
2183
+ * @param newData - Updated task data
2184
+ * @param shouldOverwrite - Whether to completely replace existing data
2185
+ * @returns Updated Digital task instance
2186
+ */
2187
+ updateTaskData(newData: TaskData, shouldOverwrite?: boolean): IDigital;
2188
+ }
2189
+
2190
+ /**
2191
+ * Interface for managing voice/telephony task operations in the contact center
2192
+ * Extends ITask with voice-specific functionality for hold/resume operations
2193
+ * @public
2194
+ */
2195
+ export interface IVoice extends ITask {
2196
+ /**
2197
+ * Toggles hold/resume state for a voice task.
2198
+ * If the task is currently on hold, it will be resumed.
2199
+ * If the task is active, it will be placed on hold.
2200
+ * @returns Promise<TaskResponse>
2201
+ * @example
2202
+ * ```typescript
2203
+ * await voiceTask.holdResume();
2204
+ * ```
2205
+ */
2206
+ holdResume(): Promise<TaskResponse>;
2207
+ /** @see wxAppVoiceMethods — WXCC-6026 */
2208
+ isWebexAppCallingOffer(): boolean;
2209
+ /** @see wxAppVoiceMethods — WXCC-6026 */
2210
+ getCallingDeviceDetails(): import('./WebexCallingUtils').WebexCallingDeviceDetails | undefined;
2211
+ /** @see wxAppVoiceMethods — WXCC-6026 */
2212
+ getWebexCallingCallId(): string | null;
2213
+ }
2214
+
2215
+ /**
2216
+ * Configuration options for voice task UI controls
2217
+ */
2218
+ export type VoiceUIControlOptions = {
2219
+ isEndTaskEnabled?: boolean;
2220
+ isEndConsultEnabled?: boolean;
2221
+ voiceVariant?: VoiceVariant;
2222
+ isRecordingEnabled?: boolean;
2223
+ enableWxBetterTogether?: boolean;
2224
+ consultTransferConfig?: ConsultTransferDestinationConfig;
2225
+ answerCallOnWebexService?: import('../AnswerCallOnWebexService').default;
2226
+ /** Read-only observability: whether usersub answer-calls-on-wxcc is active this session. */
2227
+ getUsersubPublished?: () => boolean;
2228
+ };
2229
+
2230
+ /**
2231
+ * Participant information for UI display
2232
+ */
2233
+ export type Participant = {
2234
+ id: string;
2235
+ name?: string;
2236
+ pType?: string;
2237
+ };
2238
+
2239
+ /**
2240
+ * @deprecated Use Participant instead
2241
+ */
2242
+ export type TaskAccessorParticipant = Participant;
2243
+
2244
+ export interface IWebRTC extends IVoice {
2245
+ /**
2246
+ * This method is used to mute/unmute the call.
2247
+ * @returns Promise<void>
2248
+ * @example
2249
+ * ```typescript
2250
+ * task.toggleMute();
1412
2251
  * ```
1413
2252
  */
1414
- toggleMute(): Promise<void>;
2253
+ toggleMute(options?: TaskToggleMuteOptions): Promise<void>;
2254
+ /**
2255
+ * Decline the incoming task for Browser Login
2256
+ *
2257
+ * @example
2258
+ * ```
2259
+ * task.decline();
2260
+ * ```
2261
+ */
2262
+ decline(): Promise<TaskResponse>;
2263
+ /**
2264
+ * This method is used to unregister the web call listeners.
2265
+ * @returns void
2266
+ * @example
2267
+ * ```typescript
2268
+ * task.unregisterWebCallListeners();
2269
+ * ```
2270
+ */
2271
+ unregisterWebCallListeners(): void;
2272
+ }
2273
+
2274
+ export type WebSocketPayload = TaskData & {
2275
+ type: string;
2276
+ mediaResourceId?: string;
2277
+ reason?: string;
2278
+ /** ContactEnded: party that ended the contact (e.g. 'Agent', 'Customer') */
2279
+ terminatingParty?: string;
2280
+ /**
2281
+ * Optional real-time transcript chunk payload.
2282
+ * Present on REAL_TIME_TRANSCRIPTION notifications.
2283
+ */
2284
+ data?: RealtimeTranscription['data'];
2285
+ };
2286
+
2287
+ export type WebSocketMessage = {
2288
+ keepalive?: 'true' | 'false' | boolean;
2289
+ type?: string;
2290
+ data: WebSocketPayload;
2291
+ };
2292
+
2293
+ /**
2294
+ * Actions to be performed after handling an event
2295
+ *
2296
+ * These actions represent TaskManager-level concerns (task collection lifecycle,
2297
+ * resource cleanup) rather than task-level state machine concerns. The separation
2298
+ * ensures proper responsibility:
2299
+ * - TaskManager: Collection management, metrics, cleanup
2300
+ * - State Machine: Task state transitions, event emissions, UI controls
2301
+ */
2302
+ export interface TaskEventActions {
2303
+ task?: ITask;
2304
+ }
2305
+
2306
+ /**
2307
+ * Context for processing an event
2308
+ *
2309
+ * Contains all information needed to process a WebSocket event:
2310
+ * - Event type and payload from the backend
2311
+ * - Task instance (if exists)
2312
+ * - Pre-mapped state machine event (if applicable)
2313
+ */
2314
+ export interface EventContext {
2315
+ eventType: string;
2316
+ payload: WebSocketPayload;
2317
+ task?: ITask;
2318
+ stateMachineEvent?: TaskEventPayload | null;
1415
2319
  }