@webex/contact-center 3.12.0-next.73 → 3.12.0-next.74

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 (188) hide show
  1. package/AGENTS.md +438 -0
  2. package/ai-docs/README.md +131 -0
  3. package/ai-docs/RULES.md +455 -0
  4. package/ai-docs/patterns/event-driven-patterns.md +485 -0
  5. package/ai-docs/patterns/testing-patterns.md +480 -0
  6. package/ai-docs/patterns/typescript-patterns.md +365 -0
  7. package/ai-docs/templates/README.md +102 -0
  8. package/ai-docs/templates/documentation/create-agents-md.md +240 -0
  9. package/ai-docs/templates/documentation/create-architecture-md.md +295 -0
  10. package/ai-docs/templates/existing-service/bug-fix.md +254 -0
  11. package/ai-docs/templates/existing-service/feature-enhancement.md +450 -0
  12. package/ai-docs/templates/new-method/00-master.md +80 -0
  13. package/ai-docs/templates/new-method/01-requirements.md +232 -0
  14. package/ai-docs/templates/new-method/02-implementation.md +295 -0
  15. package/ai-docs/templates/new-method/03-tests.md +201 -0
  16. package/ai-docs/templates/new-method/04-validation.md +141 -0
  17. package/ai-docs/templates/new-service/00-master.md +109 -0
  18. package/ai-docs/templates/new-service/01-pre-questions.md +159 -0
  19. package/ai-docs/templates/new-service/02-code-generation.md +346 -0
  20. package/ai-docs/templates/new-service/03-integration.md +178 -0
  21. package/ai-docs/templates/new-service/04-test-generation.md +205 -0
  22. package/ai-docs/templates/new-service/05-validation.md +145 -0
  23. package/dist/cc.js +53 -38
  24. package/dist/cc.js.map +1 -1
  25. package/dist/config.js +6 -0
  26. package/dist/config.js.map +1 -1
  27. package/dist/constants.js +14 -1
  28. package/dist/constants.js.map +1 -1
  29. package/dist/index.js +13 -5
  30. package/dist/index.js.map +1 -1
  31. package/dist/metrics/behavioral-events.js +26 -0
  32. package/dist/metrics/behavioral-events.js.map +1 -1
  33. package/dist/metrics/constants.js +9 -3
  34. package/dist/metrics/constants.js.map +1 -1
  35. package/dist/services/ApiAiAssistant.js +74 -3
  36. package/dist/services/ApiAiAssistant.js.map +1 -1
  37. package/dist/services/config/Util.js +2 -2
  38. package/dist/services/config/Util.js.map +1 -1
  39. package/dist/services/config/types.js +25 -9
  40. package/dist/services/config/types.js.map +1 -1
  41. package/dist/services/core/Utils.js +74 -27
  42. package/dist/services/core/Utils.js.map +1 -1
  43. package/dist/services/core/websocket/WebSocketManager.js +2 -1
  44. package/dist/services/core/websocket/WebSocketManager.js.map +1 -1
  45. package/dist/services/core/websocket/types.js.map +1 -1
  46. package/dist/services/index.js +1 -1
  47. package/dist/services/index.js.map +1 -1
  48. package/dist/services/task/Task.js +688 -0
  49. package/dist/services/task/Task.js.map +1 -0
  50. package/dist/services/task/TaskFactory.js +45 -0
  51. package/dist/services/task/TaskFactory.js.map +1 -0
  52. package/dist/services/task/TaskManager.js +725 -612
  53. package/dist/services/task/TaskManager.js.map +1 -1
  54. package/dist/services/task/TaskUtils.js +162 -26
  55. package/dist/services/task/TaskUtils.js.map +1 -1
  56. package/dist/services/task/constants.js +6 -1
  57. package/dist/services/task/constants.js.map +1 -1
  58. package/dist/services/task/digital/Digital.js +77 -0
  59. package/dist/services/task/digital/Digital.js.map +1 -0
  60. package/dist/services/task/state-machine/TaskStateMachine.js +837 -0
  61. package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -0
  62. package/dist/services/task/state-machine/actions.js +543 -0
  63. package/dist/services/task/state-machine/actions.js.map +1 -0
  64. package/dist/services/task/state-machine/constants.js +161 -0
  65. package/dist/services/task/state-machine/constants.js.map +1 -0
  66. package/dist/services/task/state-machine/guards.js +340 -0
  67. package/dist/services/task/state-machine/guards.js.map +1 -0
  68. package/dist/services/task/state-machine/index.js +53 -0
  69. package/dist/services/task/state-machine/index.js.map +1 -0
  70. package/dist/services/task/state-machine/types.js +54 -0
  71. package/dist/services/task/state-machine/types.js.map +1 -0
  72. package/dist/services/task/state-machine/uiControlsComputer.js +553 -0
  73. package/dist/services/task/state-machine/uiControlsComputer.js.map +1 -0
  74. package/dist/services/task/taskDataNormalizer.js +99 -0
  75. package/dist/services/task/taskDataNormalizer.js.map +1 -0
  76. package/dist/services/task/types.js +168 -16
  77. package/dist/services/task/types.js.map +1 -1
  78. package/dist/services/task/voice/Voice.js +1042 -0
  79. package/dist/services/task/voice/Voice.js.map +1 -0
  80. package/dist/services/task/voice/WebRTC.js +149 -0
  81. package/dist/services/task/voice/WebRTC.js.map +1 -0
  82. package/dist/types/cc.d.ts +19 -18
  83. package/dist/types/config.d.ts +6 -0
  84. package/dist/types/constants.d.ts +14 -1
  85. package/dist/types/index.d.ts +11 -5
  86. package/dist/types/metrics/constants.d.ts +7 -1
  87. package/dist/types/services/ApiAiAssistant.d.ts +11 -3
  88. package/dist/types/services/config/types.d.ts +113 -9
  89. package/dist/types/services/core/Utils.d.ts +23 -10
  90. package/dist/types/services/core/websocket/WebSocketManager.d.ts +1 -0
  91. package/dist/types/services/core/websocket/types.d.ts +1 -1
  92. package/dist/types/services/index.d.ts +1 -1
  93. package/dist/types/services/task/Task.d.ts +157 -0
  94. package/dist/types/services/task/TaskFactory.d.ts +12 -0
  95. package/dist/types/services/task/TaskUtils.d.ts +46 -2
  96. package/dist/types/services/task/constants.d.ts +5 -0
  97. package/dist/types/services/task/digital/Digital.d.ts +22 -0
  98. package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +1144 -0
  99. package/dist/types/services/task/state-machine/actions.d.ts +10 -0
  100. package/dist/types/services/task/state-machine/constants.d.ts +107 -0
  101. package/dist/types/services/task/state-machine/guards.d.ts +90 -0
  102. package/dist/types/services/task/state-machine/index.d.ts +13 -0
  103. package/dist/types/services/task/state-machine/types.d.ts +267 -0
  104. package/dist/types/services/task/state-machine/uiControlsComputer.d.ts +9 -0
  105. package/dist/types/services/task/taskDataNormalizer.d.ts +10 -0
  106. package/dist/types/services/task/types.d.ts +551 -78
  107. package/dist/types/services/task/voice/Voice.d.ts +184 -0
  108. package/dist/types/services/task/voice/WebRTC.d.ts +53 -0
  109. package/dist/types/types.d.ts +92 -0
  110. package/dist/types/webex.d.ts +1 -0
  111. package/dist/types.js +85 -0
  112. package/dist/types.js.map +1 -1
  113. package/dist/webex.js +14 -2
  114. package/dist/webex.js.map +1 -1
  115. package/package.json +15 -12
  116. package/src/cc.ts +63 -43
  117. package/src/config.ts +6 -0
  118. package/src/constants.ts +14 -1
  119. package/src/index.ts +14 -5
  120. package/src/metrics/ai-docs/AGENTS.md +348 -0
  121. package/src/metrics/ai-docs/ARCHITECTURE.md +336 -0
  122. package/src/metrics/behavioral-events.ts +28 -0
  123. package/src/metrics/constants.ts +9 -4
  124. package/src/services/ApiAiAssistant.ts +104 -3
  125. package/src/services/agent/ai-docs/AGENTS.md +238 -0
  126. package/src/services/agent/ai-docs/ARCHITECTURE.md +302 -0
  127. package/src/services/ai-docs/AGENTS.md +384 -0
  128. package/src/services/config/Util.ts +2 -2
  129. package/src/services/config/ai-docs/AGENTS.md +253 -0
  130. package/src/services/config/ai-docs/ARCHITECTURE.md +424 -0
  131. package/src/services/config/types.ts +116 -10
  132. package/src/services/core/Utils.ts +85 -34
  133. package/src/services/core/ai-docs/AGENTS.md +379 -0
  134. package/src/services/core/ai-docs/ARCHITECTURE.md +696 -0
  135. package/src/services/core/websocket/WebSocketManager.ts +2 -0
  136. package/src/services/core/websocket/types.ts +1 -1
  137. package/src/services/index.ts +1 -1
  138. package/src/services/task/Task.ts +837 -0
  139. package/src/services/task/TaskFactory.ts +55 -0
  140. package/src/services/task/TaskManager.ts +738 -697
  141. package/src/services/task/TaskUtils.ts +205 -25
  142. package/src/services/task/ai-docs/AGENTS.md +455 -0
  143. package/src/services/task/ai-docs/ARCHITECTURE.md +585 -0
  144. package/src/services/task/constants.ts +5 -0
  145. package/src/services/task/digital/Digital.ts +95 -0
  146. package/src/services/task/state-machine/TaskStateMachine.ts +1077 -0
  147. package/src/services/task/state-machine/actions.ts +685 -0
  148. package/src/services/task/state-machine/ai-docs/AGENTS.md +495 -0
  149. package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +1135 -0
  150. package/src/services/task/state-machine/constants.ts +172 -0
  151. package/src/services/task/state-machine/guards.ts +406 -0
  152. package/src/services/task/state-machine/index.ts +28 -0
  153. package/src/services/task/state-machine/types.ts +241 -0
  154. package/src/services/task/state-machine/uiControlsComputer.ts +867 -0
  155. package/src/services/task/taskDataNormalizer.ts +137 -0
  156. package/src/services/task/types.ts +654 -85
  157. package/src/services/task/voice/Voice.ts +1267 -0
  158. package/src/services/task/voice/WebRTC.ts +187 -0
  159. package/src/types.ts +112 -1
  160. package/src/utils/AGENTS.md +276 -0
  161. package/src/webex.js +2 -0
  162. package/test/unit/spec/cc.ts +133 -3
  163. package/test/unit/spec/logger-proxy.ts +70 -0
  164. package/test/unit/spec/services/ApiAiAssistant.ts +122 -17
  165. package/test/unit/spec/services/WebCallingService.ts +7 -1
  166. package/test/unit/spec/services/config/index.ts +27 -27
  167. package/test/unit/spec/services/core/Utils.ts +335 -1
  168. package/test/unit/spec/services/core/websocket/WebSocketManager.ts +66 -40
  169. package/test/unit/spec/services/task/AutoWrapup.ts +63 -0
  170. package/test/unit/spec/services/task/Task.ts +477 -0
  171. package/test/unit/spec/services/task/TaskFactory.ts +62 -0
  172. package/test/unit/spec/services/task/TaskManager.ts +821 -1936
  173. package/test/unit/spec/services/task/TaskUtils.ts +206 -0
  174. package/test/unit/spec/services/task/digital/Digital.ts +105 -0
  175. package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +1825 -0
  176. package/test/unit/spec/services/task/state-machine/guards.ts +479 -0
  177. package/test/unit/spec/services/task/state-machine/types.ts +18 -0
  178. package/test/unit/spec/services/task/state-machine/uiControlsComputer.ts +2020 -0
  179. package/test/unit/spec/services/task/taskTestUtils.ts +87 -0
  180. package/test/unit/spec/services/task/voice/Voice.ts +631 -0
  181. package/test/unit/spec/services/task/voice/WebRTC.ts +235 -0
  182. package/umd/contact-center.min.js +2 -2
  183. package/umd/contact-center.min.js.map +1 -1
  184. package/dist/services/task/index.js +0 -1530
  185. package/dist/services/task/index.js.map +0 -1
  186. package/dist/types/services/task/index.d.ts +0 -650
  187. package/src/services/task/index.ts +0 -1806
  188. package/test/unit/spec/services/task/index.ts +0 -2205
@@ -1,5 +1,6 @@
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';
5
6
 
@@ -9,6 +10,11 @@ import AutoWrapup from './AutoWrapup';
9
10
  */
10
11
  export type TaskId = string;
11
12
 
13
+ /**
14
+ * Unique identifier for a call in the Webex calling system
15
+ */
16
+ export type CallId = string;
17
+
12
18
  /**
13
19
  * Helper type for creating enum-like objects with type safety
14
20
  * @internal
@@ -90,6 +96,26 @@ export const MEDIA_CHANNEL = {
90
96
  */
91
97
  export type MEDIA_CHANNEL = Enum<typeof MEDIA_CHANNEL>;
92
98
 
99
+ /**
100
+ * Supported task channel types for UI control configuration
101
+ */
102
+ export const TASK_CHANNEL_TYPE = {
103
+ VOICE: 'voice',
104
+ DIGITAL: 'digital',
105
+ } as const;
106
+
107
+ export type TaskChannelType = Enum<typeof TASK_CHANNEL_TYPE>;
108
+
109
+ /**
110
+ * Voice channel variants that toggle PSTN/WebRTC specific behaviors
111
+ */
112
+ export const VOICE_VARIANT = {
113
+ PSTN: 'pstn',
114
+ WEBRTC: 'webrtc',
115
+ } as const;
116
+
117
+ export type VoiceVariant = Enum<typeof VOICE_VARIANT>;
118
+
93
119
  /**
94
120
  * Enumeration of all task-related events that can occur in the contact center system
95
121
  * These events represent different states and actions in the task lifecycle
@@ -203,6 +229,11 @@ export enum TASK_EVENTS {
203
229
  */
204
230
  TASK_CONSULT_QUEUE_FAILED = 'task:consultQueueFailed',
205
231
 
232
+ /**
233
+ * Triggered whenever task UI controls are recalculated
234
+ */
235
+ TASK_UI_CONTROLS_UPDATED = 'task:ui-controls-updated',
236
+
206
237
  /**
207
238
  * Triggered when a consultation request is accepted
208
239
  * @example
@@ -287,6 +318,24 @@ export enum TASK_EVENTS {
287
318
  */
288
319
  TASK_WRAPPEDUP = 'task:wrappedup',
289
320
 
321
+ /**
322
+ * Triggered when the task state machine reaches a final state and resources should be cleaned up.
323
+ * Used internally by TaskManager to perform collection/call cleanup.
324
+ * @internal
325
+ */
326
+ TASK_CLEANUP = 'task:cleanup',
327
+
328
+ /**
329
+ * Triggered when recording is started
330
+ * @example
331
+ * ```typescript
332
+ * task.on(TASK_EVENTS.TASK_RECORDING_STARTED, (task: ITask) => {
333
+ * console.log('Recording started:', task.data.interactionId);
334
+ * });
335
+ * ```
336
+ */
337
+ TASK_RECORDING_STARTED = 'task:recordingStarted',
338
+
290
339
  /**
291
340
  * Triggered when recording is paused
292
341
  * @example
@@ -519,6 +568,43 @@ export enum TASK_EVENTS {
519
568
  */
520
569
  TASK_PARTICIPANT_LEFT_FAILED = 'task:participantLeftFailed',
521
570
 
571
+ /**
572
+ * Triggered when agent initiates exit from conference
573
+ * @example
574
+ * ```typescript
575
+ * task.on(TASK_EVENTS.TASK_EXIT_CONFERENCE, (task: ITask) => {
576
+ * console.log('Exiting conference:', task.data.interactionId);
577
+ * // Handle conference exit initiation
578
+ * });
579
+ * ```
580
+ */
581
+ TASK_EXIT_CONFERENCE = 'task:exitConference',
582
+
583
+ /**
584
+ * Triggered when agent initiates conference transfer
585
+ * @example
586
+ * ```typescript
587
+ * task.on(TASK_EVENTS.TASK_TRANSFER_CONFERENCE, (task: ITask) => {
588
+ * console.log('Transferring conference:', task.data.interactionId);
589
+ * // Handle conference transfer initiation
590
+ * });
591
+ * ```
592
+ */
593
+ TASK_TRANSFER_CONFERENCE = 'task:transferConference',
594
+
595
+ /**
596
+ * Triggered when agent switches between consult call and main call.
597
+ * Use task.uiControls to determine current state and button visibility.
598
+ * @example
599
+ * ```typescript
600
+ * task.on(TASK_EVENTS.TASK_SWITCH_CALL, (task: ITask) => {
601
+ * console.log('Call switched:', task.data.interactionId);
602
+ * // Update UI based on task.uiControls.main.switch / task.uiControls.consult.switch
603
+ * });
604
+ * ```
605
+ */
606
+ TASK_SWITCH_CALL = 'task:switchCall',
607
+
522
608
  /**
523
609
  * Triggered when a contact is merged
524
610
  * @example
@@ -543,6 +629,17 @@ export enum TASK_EVENTS {
543
629
  */
544
630
  TASK_POST_CALL_ACTIVITY = 'task:postCallActivity',
545
631
 
632
+ /**
633
+ * Triggered when a multi-login task update should hydrate SDK instances without Mobius registration.
634
+ * @example
635
+ * ```typescript
636
+ * task.on(TASK_EVENTS.TASK_MULTI_LOGIN_HYDRATE, (task: ITask) => {
637
+ * console.log('Multi-login hydrate:', task.data.interactionId);
638
+ * });
639
+ * ```
640
+ */
641
+ TASK_MULTI_LOGIN_HYDRATE = 'task:multiLoginHydrate',
642
+
546
643
  /**
547
644
  * Triggered when a campaign preview contact is offered to the agent
548
645
  * @example
@@ -602,20 +699,6 @@ export enum TASK_EVENTS {
602
699
  * ```
603
700
  */
604
701
  TASK_CAMPAIGN_CONTACT_UPDATED = 'task:campaignContactUpdated',
605
-
606
- /**
607
- * Triggered when a we get accept an incoming web call
608
- * This is used to send task data to the instance without mobius registration in case of multi login
609
- * @example
610
- * ```typescript
611
- * task.on(TASK_EVENTS.TASK_MULIT_LOGIN_HYDRATE, (task: ITask) => {
612
- * console.log('Mulit login detected:', task.data.interactionId);
613
- * // Handle mulit login
614
- * });
615
- * ```
616
- */
617
-
618
- TASK_MULTI_LOGIN_HYDRATE = 'task:multiLoginHydrate',
619
702
  }
620
703
 
621
704
  /**
@@ -623,6 +706,146 @@ export enum TASK_EVENTS {
623
706
  * Contains comprehensive details about an ongoing customer interaction
624
707
  * @public
625
708
  */
709
+ export interface CallAssociatedDatum {
710
+ /** Whether the field can be edited by the agent */
711
+ agentEditable: boolean;
712
+ /** Whether the field is visible to the agent */
713
+ agentViewable: boolean;
714
+ /** Display name for the field */
715
+ displayName: string;
716
+ /** Whether the field is global */
717
+ global: boolean;
718
+ /** Whether the field is secure */
719
+ isSecure: boolean;
720
+ /** Internal field name */
721
+ name: string;
722
+ /** Whether the field is reportable */
723
+ reportable: boolean;
724
+ /** Secure key identifier */
725
+ secureKeyId: string;
726
+ /** Secure key version */
727
+ secureKeyVersion: number;
728
+ /** Data type of the field */
729
+ type: string;
730
+ /** Field value */
731
+ value: string;
732
+ }
733
+
734
+ export type CallAssociatedData = Record<string, CallAssociatedDatum>;
735
+
736
+ export type CallAssociatedDetails = Record<string, string>;
737
+
738
+ export interface FlowParameter {
739
+ /** Parameter name */
740
+ name?: string;
741
+ /** Additional qualifier */
742
+ qualifier?: string;
743
+ /** Description of the parameter */
744
+ description?: string;
745
+ /** Data type of the value */
746
+ valueDataType?: string;
747
+ /** Value associated with the parameter */
748
+ value?: string;
749
+ }
750
+
751
+ export interface InteractionParticipant {
752
+ /** Unique participant identifier */
753
+ id: string;
754
+ /** Participant type label used by backend */
755
+ pType: string;
756
+ /** Friendly participant type */
757
+ type: string;
758
+ /** Whether the participant has joined */
759
+ hasJoined: boolean;
760
+ /** Whether the participant has left */
761
+ hasLeft: boolean;
762
+ /** Whether the participant is still in pre-dial */
763
+ isInPredial: boolean;
764
+ /** Optional caller identifier */
765
+ callerId?: string | null;
766
+ /** Whether auto-answer is enabled */
767
+ autoAnswerEnabled?: boolean;
768
+ /** Backchannel/bnr details */
769
+ bnrDetails?: unknown;
770
+ /** Channel identifier for the participant */
771
+ channelId?: string;
772
+ /** Current consult state */
773
+ consultState?: string | null;
774
+ /** Timestamp when consult started */
775
+ consultTimestamp?: number | null;
776
+ /** Current participant state */
777
+ currentState?: string | null;
778
+ /** Timestamp of the current state */
779
+ currentStateTimestamp?: number | null;
780
+ /** Device call identifier */
781
+ deviceCallId?: string | null;
782
+ /** Device identifier */
783
+ deviceId?: string | null;
784
+ /** Device type (AGENT_DN, BROWSER, etc.) */
785
+ deviceType?: string | null;
786
+ /** Dial number associated with participant */
787
+ dn?: string | null;
788
+ /** Whether participant is currently consulted */
789
+ isConsulted?: boolean;
790
+ /** Whether participant offer is active */
791
+ isOffered?: boolean;
792
+ /** Whether participant is in wrap-up */
793
+ isWrapUp?: boolean;
794
+ /** Whether participant completed wrap-up */
795
+ isWrappedUp?: boolean;
796
+ /** Timestamp of when participant joined */
797
+ joinTimestamp?: number | null;
798
+ /** Last updated timestamp */
799
+ lastUpdated?: number | null;
800
+ /** Friendly name of participant */
801
+ name?: string | null;
802
+ /** Queue identifier associated with participant */
803
+ queueId?: string;
804
+ /** Queue manager identifier */
805
+ queueMgrId?: string;
806
+ /** Session identifier */
807
+ sessionId?: string;
808
+ /** Site identifier */
809
+ siteId?: string;
810
+ /** Skill identifier */
811
+ skillId?: string | null;
812
+ /** Skill name */
813
+ skillName?: string | null;
814
+ /** Skill list for participant */
815
+ skills?: string[];
816
+ /** Team identifier */
817
+ teamId?: string;
818
+ /** Team name */
819
+ teamName?: string;
820
+ /** Timestamp for wrap-up */
821
+ wrapUpTimestamp?: number | null;
822
+ /** Additional metadata */
823
+ [key: string]: unknown;
824
+ }
825
+
826
+ export type InteractionParticipants = Record<string, InteractionParticipant>;
827
+
828
+ /**
829
+ * Media entry type from interaction.media
830
+ * Used for media state tracking in consult and conference scenarios
831
+ */
832
+ export type MediaEntry = {
833
+ /** Unique identifier for the media resource */
834
+ mediaResourceId: string;
835
+ /** Type of media channel */
836
+ mediaType: MEDIA_CHANNEL;
837
+ /** Media manager handling this media */
838
+ mediaMgr: string;
839
+ /** List of participant identifiers */
840
+ participants: string[];
841
+ /** Type of media (e.g., 'mainCall', 'consult') */
842
+ mType: string;
843
+ /** Indicates if media is on hold */
844
+ isHold: boolean;
845
+ /** Timestamp when media was put on hold */
846
+ holdTimestamp: number | null;
847
+ };
848
+
626
849
  export type Interaction = {
627
850
  /** Indicates if the interaction is managed by Flow Control */
628
851
  isFcManaged: boolean;
@@ -637,7 +860,11 @@ export type Interaction = {
637
860
  /** Current virtual team handling the interaction */
638
861
  currentVTeam: string;
639
862
  /** List of participants in the interaction */
640
- participants: any; // TODO: Define specific participant type
863
+ participants: InteractionParticipants;
864
+ /** Detailed call associated data */
865
+ callAssociatedData?: CallAssociatedData;
866
+ /** Simplified call associated key/value pairs */
867
+ callAssociatedDetails?: CallAssociatedDetails;
641
868
  /** Unique identifier for the interaction */
642
869
  interactionId: string;
643
870
  /** Organization identifier */
@@ -646,7 +873,18 @@ export type Interaction = {
646
873
  createdTimestamp?: number;
647
874
  /** Indicates if wrap-up assistance is enabled */
648
875
  isWrapUpAssist?: boolean;
649
- /** Detailed call processing information and metadata */
876
+ /** Identifier of parent interaction if applicable */
877
+ parentInteractionId?: string;
878
+ /** Indicates if media is forked for this interaction */
879
+ isMediaForked?: boolean;
880
+ /** Retroactive flow properties returned by backend */
881
+ flowProperties?: Record<string, unknown> | null;
882
+ /** Media specific properties returned by backend */
883
+ mediaProperties?: Record<string, unknown> | null;
884
+ /**
885
+ * Detailed call processing information and metadata.
886
+ * Mirrors the callProcessingDetails section described in Webex Contact Center Agent Contact payloads.
887
+ */
650
888
  callProcessingDetails: {
651
889
  /** Name of the Queue Manager handling this interaction */
652
890
  QMgrName: string;
@@ -664,20 +902,24 @@ export type Interaction = {
664
902
  QueueId: string;
665
903
  /** Virtual team identifier */
666
904
  vteamId: string;
667
- /** Indicates if pause/resume functionality is enabled */
668
- pauseResumeEnabled?: string;
905
+ /** Agent capability for pause/resume on this interaction */
906
+ pauseResumeEnabled?: boolean;
669
907
  /** Duration of pause in seconds */
670
908
  pauseDuration?: string;
671
- /** Indicates if the interaction is currently paused */
672
- isPaused?: string;
673
- /** Indicates if recording is in progress */
674
- recordInProgress?: string;
675
- /** Indicates if recording has started */
676
- recordingStarted?: string;
909
+ /** Legacy pause indicator (recordInProgress=false is the active pause signal) */
910
+ isPaused?: boolean;
911
+ /** Recording is actively capturing audio right now */
912
+ recordInProgress?: boolean;
913
+ /** Recording was started for this interaction (may be paused) */
914
+ recordingStarted?: boolean;
915
+ /** Customer geographic region */
916
+ customerRegion?: string;
917
+ /** Flow tag identifier */
918
+ flowTagId?: string;
677
919
  /** Indicates if Consult to Queue is in progress */
678
- ctqInProgress?: string;
920
+ ctqInProgress?: boolean;
679
921
  /** Indicates if outdial transfer to queue is enabled */
680
- outdialTransferToQueueEnabled?: string;
922
+ outdialTransferToQueueEnabled?: boolean;
681
923
  /** IVR conversation transcript */
682
924
  convIvrTranscript?: string;
683
925
  /** Customer's name */
@@ -764,6 +1006,8 @@ export type Interaction = {
764
1006
  fcDesktopView?: string;
765
1007
  /** Agent ID who initiated the outdial call */
766
1008
  outdialAgentId?: string;
1009
+ /** Indicates if the customer has left the call during an active consult */
1010
+ hasCustomerLeft?: string;
767
1011
  /** Indicates if the skip action is disabled for campaign preview contacts */
768
1012
  campaignPreviewSkipDisabled?: string;
769
1013
  /** Indicates if the remove action is disabled for campaign preview contacts */
@@ -775,61 +1019,54 @@ export type Interaction = {
775
1019
  };
776
1020
  /** Main interaction identifier for related interactions */
777
1021
  mainInteractionId?: string;
1022
+ /** Timestamp when interaction entered queue */
1023
+ queuedTimestamp?: number | null;
778
1024
  /** Media-specific information for the interaction */
779
- media: Record<
780
- string,
781
- {
782
- /** Unique identifier for the media resource */
783
- mediaResourceId: string;
784
- /** Type of media channel */
785
- mediaType: MEDIA_CHANNEL;
786
- /** Media manager handling this media */
787
- mediaMgr: string;
788
- /** List of participant identifiers */
789
- participants: string[];
790
- /** Type of media */
791
- mType: string;
792
- /** Indicates if media is on hold */
793
- isHold: boolean;
794
- /** Timestamp when media was put on hold */
795
- holdTimestamp: number | null;
796
- }
797
- >;
1025
+ media: Record<string, MediaEntry>;
798
1026
  /** Owner of the interaction */
799
1027
  owner: string;
800
1028
  /** Primary media channel for the interaction */
801
- mediaChannel: MEDIA_CHANNEL;
1029
+ mediaChannel: string;
802
1030
  /** Direction information for the contact */
803
1031
  contactDirection: {type: string};
804
1032
  /** Type of outbound interaction */
805
1033
  outboundType?: string;
1034
+ /** Optional workflow manager identifier */
1035
+ workflowManager?: string | null;
806
1036
  /** Parameters passed through the call flow */
807
- callFlowParams: Record<
808
- string,
809
- {
810
- /** Name of the parameter */
811
- name: string;
812
- /** Qualifier for the parameter */
813
- qualifier: string;
814
- /** Description of the parameter */
815
- description: string;
816
- /** Data type of the parameter value */
817
- valueDataType: string;
818
- /** Value of the parameter */
819
- value: string;
820
- }
821
- >;
1037
+ callFlowParams?: Record<string, FlowParameter>;
822
1038
  };
823
1039
 
824
1040
  /**
825
- * Task payload containing detailed information about a contact center task
826
- * This structure encapsulates all relevant data for task management
1041
+ * Task payload mirroring the Agent Contact event payload from Webex Contact Center
1042
+ * (developer.webex.com). Arrives on AGENT_* websocket events and is the source of truth
1043
+ * for UI/state machine updates.
827
1044
  * @public
828
1045
  */
1046
+ export type RealtimeTranscription = {
1047
+ agentId: string;
1048
+ orgId: string;
1049
+ notifType: string;
1050
+ notifDetails: {
1051
+ actionEvent: string;
1052
+ };
1053
+ data: {
1054
+ role: 'AGENT' | 'CALLER';
1055
+ utteranceId: string;
1056
+ conversationId: string;
1057
+ publishTimestamp: number;
1058
+ messageId: string;
1059
+ isFinal: boolean;
1060
+ languageCode: string;
1061
+ orgId: string;
1062
+ content: string;
1063
+ };
1064
+ };
1065
+
829
1066
  export type TaskData = {
830
- /** Unique identifier for the media resource handling this task */
1067
+ /** Primary media resource identifier for the active leg (matches interaction.media[].mediaResourceId) */
831
1068
  mediaResourceId: string;
832
- /** Type of event that triggered this task data */
1069
+ /** Agent event name from the websocket stream (e.g., AGENT_CONTACT_ASSIGNED) */
833
1070
  eventType: string;
834
1071
  /** Timestamp when the event occurred */
835
1072
  eventTime?: number;
@@ -839,7 +1076,7 @@ export type TaskData = {
839
1076
  destAgentId: string;
840
1077
  /** Unique tracking identifier for the task */
841
1078
  trackingId: string;
842
- /** Media resource identifier for consultation operations */
1079
+ /** Media resource identifier for consultation leg when present */
843
1080
  consultMediaResourceId: string;
844
1081
  /** Detailed interaction information */
845
1082
  interaction: Interaction;
@@ -851,7 +1088,7 @@ export type TaskData = {
851
1088
  toOwner?: boolean;
852
1089
  /** Identifier for child interaction in consult/transfer scenarios */
853
1090
  childInteractionId?: string;
854
- /** Unique identifier for the interaction */
1091
+ /** Interaction/contact identifier from backend (same as interaction.interactionId) */
855
1092
  interactionId: string;
856
1093
  /** Organization identifier */
857
1094
  orgId: string;
@@ -861,7 +1098,7 @@ export type TaskData = {
861
1098
  queueMgr: string;
862
1099
  /** Name of the queue where task is queued */
863
1100
  queueName?: string;
864
- /** Type of the task */
1101
+ /** Task/interaction type returned by the platform (routing/monitoring/etc.) */
865
1102
  type: string;
866
1103
  /** Timeout value for RONA (Redirection on No Answer) in seconds */
867
1104
  ronaTimeout?: number;
@@ -897,12 +1134,107 @@ export type TaskData = {
897
1134
  reservedAgentChannelId?: string;
898
1135
  /** Indicates if wrap-up is required for this task */
899
1136
  wrapUpRequired?: boolean;
1137
+
1138
+ /**
1139
+ * Current consultation status derived from state machine
1140
+ * Values: CONSULT_INITIATED, CONSULT_ACCEPTED, BEING_CONSULTED,
1141
+ * BEING_CONSULTED_ACCEPTED, CONNECTED, CONFERENCE, CONSULT_COMPLETED
1142
+ */
1143
+ consultStatus?: string;
1144
+
1145
+ /**
1146
+ * Indicates if consultation is in progress (state machine: CONSULTING)
1147
+ */
1148
+ isConsultInProgress?: boolean;
1149
+
1150
+ /**
1151
+ * Indicates if the task is incoming for the active agent
1152
+ */
1153
+ isIncomingTask?: boolean;
1154
+
1155
+ /**
1156
+ * Indicates if the task is on hold (state machine: HELD)
1157
+ */
1158
+ isOnHold?: boolean;
1159
+
1160
+ /**
1161
+ * Indicates if customer is currently in the call
1162
+ * Derived from participants in main media
1163
+ */
1164
+ isCustomerInCall?: boolean;
1165
+
1166
+ /**
1167
+ * Count of conference participants (agents only)
1168
+ * Used for determining if max participants reached
1169
+ */
1170
+ conferenceParticipantsCount?: number;
1171
+
1172
+ /**
1173
+ * Indicates if this is a secondary agent (consulted party)
1174
+ */
1175
+ isSecondaryAgent?: boolean;
1176
+
1177
+ /**
1178
+ * Indicates if this is a secondary EP-DN agent (telephony consult to external)
1179
+ */
1180
+ isSecondaryEpDnAgent?: boolean;
1181
+
1182
+ /**
1183
+ * Task state for MPC (Multi-Party Conference) scenarios
1184
+ * Maps participant consultState to task state
1185
+ */
1186
+ mpcState?: string;
900
1187
  /** Indicates if auto-answer is in progress for this task */
901
1188
  isAutoAnswering?: boolean;
902
1189
  /** Indicates if wrap-up is required for this task */
903
1190
  agentsPendingWrapUp?: string[];
904
1191
  };
905
1192
 
1193
+ export type TaskUIControlState = {
1194
+ isVisible: boolean;
1195
+ isEnabled: boolean;
1196
+ };
1197
+
1198
+ /**
1199
+ * UI control representation for a single interaction leg.
1200
+ */
1201
+ export type InteractionUIControls = {
1202
+ accept: TaskUIControlState;
1203
+ decline: TaskUIControlState;
1204
+ hold: TaskUIControlState;
1205
+ transfer: TaskUIControlState;
1206
+ consult: TaskUIControlState;
1207
+ end: TaskUIControlState;
1208
+ recording: TaskUIControlState;
1209
+ mute: TaskUIControlState;
1210
+ consultTransfer: TaskUIControlState;
1211
+ endConsult: TaskUIControlState;
1212
+ conference: TaskUIControlState;
1213
+ exitConference: TaskUIControlState;
1214
+ transferConference: TaskUIControlState;
1215
+ mergeToConference: TaskUIControlState;
1216
+ wrapup: TaskUIControlState;
1217
+ switch: TaskUIControlState;
1218
+ };
1219
+
1220
+ export type TaskUILeg = 'main' | 'consult';
1221
+
1222
+ /**
1223
+ * UI controls surfaced to task consumers.
1224
+ * Consumers should read controls from the per-leg surfaces and use `activeLeg`
1225
+ * to determine which one is currently interactive.
1226
+ */
1227
+ export type TaskUIControls = {
1228
+ main: InteractionUIControls;
1229
+ consult: InteractionUIControls;
1230
+ activeLeg: TaskUILeg;
1231
+ };
1232
+
1233
+ /**
1234
+ * Helper class for managing task action control state
1235
+ * Tracks visibility and enabled state for task actions that can be executed
1236
+ * @public
1237
+ */
906
1238
  /**
907
1239
  * Type representing an agent contact message within the contact center system
908
1240
  * Contains comprehensive interaction and task related details for agent operations
@@ -1124,6 +1456,15 @@ export type TransferPayload = {
1124
1456
  destinationType: DestinationType;
1125
1457
  };
1126
1458
 
1459
+ /**
1460
+ * Options for configuring transfer behavior
1461
+ * @public
1462
+ */
1463
+ export type TransferOptions = {
1464
+ /** Additional transfer configuration options */
1465
+ [key: string]: unknown;
1466
+ };
1467
+
1127
1468
  /**
1128
1469
  * API payload for ending a consultation
1129
1470
  * This is the actual payload that is sent to the developer API
@@ -1245,6 +1586,41 @@ export type ContactCleanupData = {
1245
1586
  };
1246
1587
  };
1247
1588
 
1589
+ /**
1590
+ * Boolean-like fields in callProcessingDetails that may arrive as strings.
1591
+ * Used by taskDataNormalizer to coerce payloads to actual booleans.
1592
+ */
1593
+ export type CallProcessingBooleanKey =
1594
+ | 'recordingStarted'
1595
+ | 'recordInProgress'
1596
+ | 'isPaused'
1597
+ | 'pauseResumeEnabled'
1598
+ | 'ctqInProgress'
1599
+ | 'outdialTransferToQueueEnabled'
1600
+ | 'taskToBeSelfServiced'
1601
+ | 'CONTINUE_RECORDING_ON_TRANSFER'
1602
+ | 'isParked'
1603
+ | 'participantInviteTimeout'
1604
+ | 'checkAgentAvailability';
1605
+
1606
+ /**
1607
+ * Interaction-level boolean fields that may arrive as strings from backend payloads.
1608
+ */
1609
+ export type InteractionBooleanKey = 'isFcManaged' | 'isMediaForked' | 'isTerminated';
1610
+
1611
+ /**
1612
+ * Participant boolean fields that may arrive as strings and need normalization.
1613
+ */
1614
+ export type ParticipantBooleanKey =
1615
+ | 'autoAnswerEnabled'
1616
+ | 'hasJoined'
1617
+ | 'hasLeft'
1618
+ | 'isConsulted'
1619
+ | 'isInPredial'
1620
+ | 'isOffered'
1621
+ | 'isWrapUp'
1622
+ | 'isWrappedUp';
1623
+
1248
1624
  /**
1249
1625
  * Response type for task public methods
1250
1626
  * Can be an {@link AgentContact} object containing updated task state,
@@ -1253,11 +1629,38 @@ export type ContactCleanupData = {
1253
1629
  */
1254
1630
  export type TaskResponse = AgentContact | Error | void;
1255
1631
 
1632
+ /**
1633
+ * Payload shape used by consult conference helper utilities.
1634
+ */
1635
+ export type consultConferencePayloadData = {
1636
+ agentId?: string;
1637
+ destinationType?: string;
1638
+ destAgentId?: string;
1639
+ };
1640
+
1641
+ /**
1642
+ * Minimal event-emitter contract exposed to SDK consumers.
1643
+ * Defined here so that consumers do NOT need `@types/node` in their tsconfig.
1644
+ * The runtime Task class still extends Node's EventEmitter (via ampersand-events),
1645
+ * which satisfies this interface at runtime.
1646
+ * @public
1647
+ */
1648
+ export interface IEventEmitter {
1649
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1650
+ on(event: string, listener: (...args: any[]) => void): this;
1651
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1652
+ off(event: string, listener: (...args: any[]) => void): this;
1653
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1654
+ once(event: string, listener: (...args: any[]) => void): this;
1655
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1656
+ emit(event: string, ...args: any[]): boolean;
1657
+ }
1658
+
1256
1659
  /**
1257
1660
  * Interface for managing task-related operations in the contact center
1258
- * Extends EventEmitter to support event-driven task updates
1661
+ * Extends IEventEmitter to support event-driven task updates
1259
1662
  */
1260
- export interface ITask extends EventEmitter {
1663
+ export interface ITask extends IEventEmitter {
1261
1664
  /**
1262
1665
  * Event data received in the Contact Center events.
1263
1666
  * Contains detailed task information including interaction details, media resources,
@@ -1277,6 +1680,36 @@ export interface ITask extends EventEmitter {
1277
1680
  */
1278
1681
  autoWrapup?: AutoWrapup;
1279
1682
 
1683
+ /**
1684
+ * Latest UI controls derived from the state machine.
1685
+ * Each control has `isVisible` and `isEnabled` flags computed from current task state.
1686
+ * Subscribe to {@link TASK_EVENTS.TASK_UI_CONTROLS_UPDATED} for change notifications.
1687
+ */
1688
+ readonly uiControls: TaskUIControls;
1689
+
1690
+ /**
1691
+ * State machine instance for managing task state transitions and derived properties.
1692
+ * The state machine handles:
1693
+ * - State transitions (IDLE → OFFERED → CONNECTED → HELD, etc.)
1694
+ * - Derived properties (canHold, canResume, isConsulted, etc.)
1695
+ * - Action availability based on current state
1696
+ *
1697
+ * This is part of the migration from manual state management to centralized state machine.
1698
+ * During the transition period, both the old setUIControls() and state machine coexist.
1699
+ *
1700
+ * @see createTaskStateMachine
1701
+ * @internal
1702
+ */
1703
+ stateMachineService?: AnyActorRef;
1704
+ state?: any;
1705
+
1706
+ /**
1707
+ * Helper method to send events to the state machine.
1708
+ * This is part of the migration to XState.
1709
+ * @internal
1710
+ */
1711
+ sendStateMachineEvent: (event: TaskEventPayload) => void;
1712
+
1280
1713
  /**
1281
1714
  * Cancels the auto-wrapup timer for the task.
1282
1715
  * This method stops the auto-wrapup process if it is currently active.
@@ -1298,7 +1731,7 @@ export interface ITask extends EventEmitter {
1298
1731
  * @returns Updated task instance
1299
1732
  * @ignore
1300
1733
  */
1301
- updateTaskData(newData: TaskData): ITask;
1734
+ updateTaskData(newData: TaskData): void;
1302
1735
 
1303
1736
  /**
1304
1737
  * Answers or accepts an incoming task.
@@ -1430,18 +1863,7 @@ export interface ITask extends EventEmitter {
1430
1863
  * await task.transfer({ to: "queueId", destinationType: "queue" });
1431
1864
  * ```
1432
1865
  */
1433
- transfer(transferPayload: TransferPayLoad): Promise<TaskResponse>;
1434
-
1435
- /**
1436
- * Transfers the task after consultation.
1437
- * @param consultTransferPayload - Details for consult transfer (optional)
1438
- * @returns Promise<TaskResponse>
1439
- * @example
1440
- * ```typescript
1441
- * await task.consultTransfer({ to: "agentId", destinationType: "agent" });
1442
- * ```
1443
- */
1444
- consultTransfer(consultTransferPayload?: ConsultTransferPayLoad): Promise<TaskResponse>;
1866
+ transfer(transferPayload: TransferPayLoad, options?: TransferOptions): Promise<TaskResponse>;
1445
1867
 
1446
1868
  /**
1447
1869
  * Initiates a consult conference (merge consult call with main call).
@@ -1473,6 +1895,19 @@ export interface ITask extends EventEmitter {
1473
1895
  */
1474
1896
  transferConference(): Promise<TaskResponse>;
1475
1897
 
1898
+ /**
1899
+ * Toggles between consult call and main call during consulting.
1900
+ * If on consult leg, switches to main call (holds consult).
1901
+ * If on main call, switches to consult (resumes consult).
1902
+ * Only available when in CONSULTING state.
1903
+ * @returns Promise<TaskResponse>
1904
+ * @example
1905
+ * ```typescript
1906
+ * await task.switchCall();
1907
+ * ```
1908
+ */
1909
+ switchCall(): Promise<TaskResponse>;
1910
+
1476
1911
  /**
1477
1912
  * Toggles mute/unmute for the local audio stream during a WebRTC task.
1478
1913
  * @returns Promise<void>
@@ -1483,3 +1918,137 @@ export interface ITask extends EventEmitter {
1483
1918
  */
1484
1919
  toggleMute(): Promise<void>;
1485
1920
  }
1921
+
1922
+ /**
1923
+ * Interface for managing digital channel task operations in the contact center
1924
+ * Digital channels (chat, email, social, SMS) have a simpler interface than voice
1925
+ * Extends ITask but overrides updateTaskData to return IDigital
1926
+ * @public
1927
+ */
1928
+ export interface IDigital extends Omit<ITask, 'updateTaskData'> {
1929
+ /**
1930
+ * Updates the task data
1931
+ * @param newData - Updated task data
1932
+ * @param shouldOverwrite - Whether to completely replace existing data
1933
+ * @returns Updated Digital task instance
1934
+ */
1935
+ updateTaskData(newData: TaskData, shouldOverwrite?: boolean): IDigital;
1936
+ }
1937
+
1938
+ /**
1939
+ * Interface for managing voice/telephony task operations in the contact center
1940
+ * Extends ITask with voice-specific functionality for hold/resume operations
1941
+ * @public
1942
+ */
1943
+ export interface IVoice extends ITask {
1944
+ /**
1945
+ * Toggles hold/resume state for a voice task.
1946
+ * If the task is currently on hold, it will be resumed.
1947
+ * If the task is active, it will be placed on hold.
1948
+ * @returns Promise<TaskResponse>
1949
+ * @example
1950
+ * ```typescript
1951
+ * await voiceTask.holdResume();
1952
+ * ```
1953
+ */
1954
+ holdResume(): Promise<TaskResponse>;
1955
+ }
1956
+
1957
+ /**
1958
+ * Configuration options for voice task UI controls
1959
+ */
1960
+ export type VoiceUIControlOptions = {
1961
+ isEndTaskEnabled?: boolean;
1962
+ isEndConsultEnabled?: boolean;
1963
+ voiceVariant?: VoiceVariant;
1964
+ isRecordingEnabled?: boolean;
1965
+ };
1966
+
1967
+ /**
1968
+ * Participant information for UI display
1969
+ */
1970
+ export type Participant = {
1971
+ id: string;
1972
+ name?: string;
1973
+ pType?: string;
1974
+ };
1975
+
1976
+ /**
1977
+ * @deprecated Use Participant instead
1978
+ */
1979
+ export type TaskAccessorParticipant = Participant;
1980
+
1981
+ export interface IWebRTC extends IVoice {
1982
+ /**
1983
+ * This method is used to mute/unmute the call.
1984
+ * @returns Promise<void>
1985
+ * @example
1986
+ * ```typescript
1987
+ * task.toggleMute();
1988
+ * ```
1989
+ */
1990
+ toggleMute(): Promise<void>;
1991
+ /**
1992
+ * Decline the incoming task for Browser Login
1993
+ *
1994
+ * @example
1995
+ * ```
1996
+ * task.decline();
1997
+ * ```
1998
+ */
1999
+ decline(): Promise<TaskResponse>;
2000
+ /**
2001
+ * This method is used to unregister the web call listeners.
2002
+ * @returns void
2003
+ * @example
2004
+ * ```typescript
2005
+ * task.unregisterWebCallListeners();
2006
+ * ```
2007
+ */
2008
+ unregisterWebCallListeners(): void;
2009
+ }
2010
+
2011
+ export type WebSocketPayload = TaskData & {
2012
+ type: string;
2013
+ mediaResourceId?: string;
2014
+ reason?: string;
2015
+ /**
2016
+ * Optional real-time transcript chunk payload.
2017
+ * Present on REAL_TIME_TRANSCRIPTION notifications.
2018
+ */
2019
+ data?: RealtimeTranscription['data'];
2020
+ };
2021
+
2022
+ export type WebSocketMessage = {
2023
+ keepalive?: 'true' | 'false' | boolean;
2024
+ type?: string;
2025
+ data: WebSocketPayload;
2026
+ };
2027
+
2028
+ /**
2029
+ * Actions to be performed after handling an event
2030
+ *
2031
+ * These actions represent TaskManager-level concerns (task collection lifecycle,
2032
+ * resource cleanup) rather than task-level state machine concerns. The separation
2033
+ * ensures proper responsibility:
2034
+ * - TaskManager: Collection management, metrics, cleanup
2035
+ * - State Machine: Task state transitions, event emissions, UI controls
2036
+ */
2037
+ export interface TaskEventActions {
2038
+ task?: ITask;
2039
+ }
2040
+
2041
+ /**
2042
+ * Context for processing an event
2043
+ *
2044
+ * Contains all information needed to process a WebSocket event:
2045
+ * - Event type and payload from the backend
2046
+ * - Task instance (if exists)
2047
+ * - Pre-mapped state machine event (if applicable)
2048
+ */
2049
+ export interface EventContext {
2050
+ eventType: string;
2051
+ payload: WebSocketPayload;
2052
+ task?: ITask;
2053
+ stateMachineEvent?: TaskEventPayload | null;
2054
+ }