@webex/contact-center 3.12.0-llmrefactor.7 → 3.12.0-llmrefactor.8
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.
- package/ai-docs/CONTRACTS.md +1 -1
- package/dist/services/task/state-machine/TaskStateMachine.js +0 -17
- package/dist/services/task/state-machine/TaskStateMachine.js.map +1 -1
- package/dist/services/task/state-machine/guards.js +7 -37
- package/dist/services/task/state-machine/guards.js.map +1 -1
- package/dist/types/services/task/state-machine/TaskStateMachine.d.ts +0 -42
- package/dist/types/services/task/state-machine/guards.d.ts +4 -4
- package/dist/webex.js +1 -1
- package/package.json +8 -8
- package/src/services/task/ai-docs/task-spec.md +15 -16
- package/src/services/task/state-machine/TaskStateMachine.ts +0 -20
- package/src/services/task/state-machine/ai-docs/AGENTS.md +2 -4
- package/src/services/task/state-machine/ai-docs/ARCHITECTURE.md +8 -9
- package/src/services/task/state-machine/ai-docs/task-state-machine-spec.md +5 -7
- package/src/services/task/state-machine/guards.ts +7 -63
- package/test/unit/spec/services/task/state-machine/TaskStateMachine.ts +72 -46
- package/test/unit/spec/services/task/state-machine/guards.ts +6 -6
- package/umd/contact-center.min.js +2 -2
- package/umd/contact-center.min.js.map +1 -1
|
@@ -199,7 +199,7 @@ describe('Task state machine', () => {
|
|
|
199
199
|
expect(emitTaskEnd).not.toHaveBeenCalled();
|
|
200
200
|
});
|
|
201
201
|
|
|
202
|
-
it('
|
|
202
|
+
it('ignores PARTICIPANT_LEAVE in CONNECTED even when it identifies the current agent', () => {
|
|
203
203
|
const {service, emitTaskEnd} = startMachineWithEndSpy();
|
|
204
204
|
const taskData = createActiveMainCallTaskData();
|
|
205
205
|
|
|
@@ -213,53 +213,71 @@ describe('Task state machine', () => {
|
|
|
213
213
|
taskData: createPartialMainCallTaskData(false, true),
|
|
214
214
|
});
|
|
215
215
|
|
|
216
|
+
expect(service.getSnapshot().value).toBe(TaskState.CONNECTED);
|
|
217
|
+
expect(emitTaskEnd).not.toHaveBeenCalled();
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it('ignores PARTICIPANT_LEAVE in HOLD_INITIATING when a remote Drop identifies the current agent', () => {
|
|
221
|
+
const {service, emitTaskEnd} = startMachineWithEndSpy();
|
|
222
|
+
const taskData = createActiveMainCallTaskData();
|
|
223
|
+
|
|
224
|
+
enterTransientHoldState(service, TaskState.HOLD_INITIATING, taskData);
|
|
225
|
+
service.send({
|
|
226
|
+
type: TaskEvent.PARTICIPANT_LEAVE,
|
|
227
|
+
participantId: 'agent-1',
|
|
228
|
+
taskData: createPartialMainCallTaskData(false, true),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
expect(service.getSnapshot().value).toBe(TaskState.HOLD_INITIATING);
|
|
232
|
+
expect(emitTaskEnd).not.toHaveBeenCalled();
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('terminates RESUME_INITIATING when a remote Drop identifies the current agent', () => {
|
|
236
|
+
const {service, emitTaskEnd} = startMachineWithEndSpy();
|
|
237
|
+
const taskData = createActiveMainCallTaskData(true);
|
|
238
|
+
|
|
239
|
+
enterTransientHoldState(service, TaskState.RESUME_INITIATING, taskData);
|
|
240
|
+
service.send({
|
|
241
|
+
type: TaskEvent.PARTICIPANT_LEAVE,
|
|
242
|
+
participantId: 'agent-1',
|
|
243
|
+
taskData: createPartialMainCallTaskData(true, true),
|
|
244
|
+
});
|
|
245
|
+
|
|
216
246
|
expect(service.getSnapshot().value).toBe(TaskState.TERMINATED);
|
|
217
247
|
expect(emitTaskEnd).toHaveBeenCalledTimes(1);
|
|
218
248
|
});
|
|
219
249
|
|
|
220
|
-
it
|
|
221
|
-
|
|
222
|
-
(
|
|
223
|
-
const {service, emitTaskEnd} = startMachineWithEndSpy();
|
|
224
|
-
const taskData = createActiveMainCallTaskData(state === TaskState.RESUME_INITIATING);
|
|
225
|
-
|
|
226
|
-
enterTransientHoldState(service, state, taskData);
|
|
227
|
-
service.send({
|
|
228
|
-
type: TaskEvent.PARTICIPANT_LEAVE,
|
|
229
|
-
participantId: 'agent-1',
|
|
230
|
-
taskData: createPartialMainCallTaskData(
|
|
231
|
-
state === TaskState.RESUME_INITIATING,
|
|
232
|
-
true
|
|
233
|
-
),
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
expect(service.getSnapshot().value).toBe(TaskState.TERMINATED);
|
|
237
|
-
expect(emitTaskEnd).toHaveBeenCalledTimes(1);
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
it.each([TaskState.HOLD_INITIATING, TaskState.RESUME_INITIATING])(
|
|
242
|
-
'keeps %s when ParticipantLeftConference identifies another participant',
|
|
243
|
-
(state) => {
|
|
244
|
-
const {service, emitTaskEnd} = startMachineWithEndSpy();
|
|
245
|
-
const taskData = createActiveMainCallTaskData(state === TaskState.RESUME_INITIATING);
|
|
246
|
-
|
|
247
|
-
enterTransientHoldState(service, state, taskData);
|
|
248
|
-
service.send({
|
|
249
|
-
type: TaskEvent.PARTICIPANT_LEAVE,
|
|
250
|
-
participantId: 'agent-2',
|
|
251
|
-
taskData: createPartialMainCallTaskData(
|
|
252
|
-
state === TaskState.RESUME_INITIATING,
|
|
253
|
-
true
|
|
254
|
-
),
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
expect(service.getSnapshot().value).toBe(state);
|
|
258
|
-
expect(emitTaskEnd).not.toHaveBeenCalled();
|
|
259
|
-
}
|
|
260
|
-
);
|
|
250
|
+
it('keeps HOLD_INITIATING when ParticipantLeftConference identifies another participant', () => {
|
|
251
|
+
const {service, emitTaskEnd} = startMachineWithEndSpy();
|
|
252
|
+
const taskData = createActiveMainCallTaskData();
|
|
261
253
|
|
|
262
|
-
|
|
254
|
+
enterTransientHoldState(service, TaskState.HOLD_INITIATING, taskData);
|
|
255
|
+
service.send({
|
|
256
|
+
type: TaskEvent.PARTICIPANT_LEAVE,
|
|
257
|
+
participantId: 'agent-2',
|
|
258
|
+
taskData: createPartialMainCallTaskData(false, true),
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
expect(service.getSnapshot().value).toBe(TaskState.HOLD_INITIATING);
|
|
262
|
+
expect(emitTaskEnd).not.toHaveBeenCalled();
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('terminates RESUME_INITIATING when another participant leave omits self from the roster', () => {
|
|
266
|
+
const {service, emitTaskEnd} = startMachineWithEndSpy();
|
|
267
|
+
const taskData = createActiveMainCallTaskData(true);
|
|
268
|
+
|
|
269
|
+
enterTransientHoldState(service, TaskState.RESUME_INITIATING, taskData);
|
|
270
|
+
service.send({
|
|
271
|
+
type: TaskEvent.PARTICIPANT_LEAVE,
|
|
272
|
+
participantId: 'agent-2',
|
|
273
|
+
taskData: createPartialMainCallTaskData(true, true),
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
expect(service.getSnapshot().value).toBe(TaskState.TERMINATED);
|
|
277
|
+
expect(emitTaskEnd).toHaveBeenCalledTimes(1);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
it('terminates HELD when another participant leave event omits self from its roster', () => {
|
|
263
281
|
const {service, emitTaskEnd} = startMachineWithEndSpy();
|
|
264
282
|
const taskData = createActiveMainCallTaskData(true);
|
|
265
283
|
|
|
@@ -275,8 +293,8 @@ describe('Task state machine', () => {
|
|
|
275
293
|
taskData: createPartialMainCallTaskData(true, true),
|
|
276
294
|
});
|
|
277
295
|
|
|
278
|
-
expect(service.getSnapshot().value).toBe(TaskState.
|
|
279
|
-
expect(emitTaskEnd).
|
|
296
|
+
expect(service.getSnapshot().value).toBe(TaskState.TERMINATED);
|
|
297
|
+
expect(emitTaskEnd).toHaveBeenCalledTimes(1);
|
|
280
298
|
});
|
|
281
299
|
|
|
282
300
|
it('keeps HELD when CONSULT_END has a partial mainCall', () => {
|
|
@@ -2064,7 +2082,15 @@ describe('Task state machine', () => {
|
|
|
2064
2082
|
|
|
2065
2083
|
it('transitions to CONNECTED on CONSULT_END without isTerminated during CONF_INITIATING', () => {
|
|
2066
2084
|
const service = startMachine();
|
|
2067
|
-
const taskData = createTaskData({
|
|
2085
|
+
const taskData = createTaskData({
|
|
2086
|
+
consultingAgentId: 'agent-1',
|
|
2087
|
+
interaction: {
|
|
2088
|
+
participants: {
|
|
2089
|
+
'agent-1': {id: 'agent-1', pType: 'Agent', hasLeft: false},
|
|
2090
|
+
'customer-1': {id: 'customer-1', pType: 'Customer', hasLeft: false},
|
|
2091
|
+
},
|
|
2092
|
+
} as any,
|
|
2093
|
+
});
|
|
2068
2094
|
|
|
2069
2095
|
service.send({type: TaskEvent.TASK_INCOMING, taskData});
|
|
2070
2096
|
service.send({type: TaskEvent.ASSIGN, taskData});
|
|
@@ -636,7 +636,7 @@ describe('State Machine Guards', () => {
|
|
|
636
636
|
expect(guards.didCurrentAgentLeaveMainInteraction(createParams(context, event))).toBe(true);
|
|
637
637
|
});
|
|
638
638
|
|
|
639
|
-
it('returns
|
|
639
|
+
it('returns false when the current participant is marked hasLeft but remains in the map', () => {
|
|
640
640
|
const context = createContext({taskData: activeTaskData});
|
|
641
641
|
const updatedTaskData = createTaskData({
|
|
642
642
|
interaction: {
|
|
@@ -652,10 +652,10 @@ describe('State Machine Guards', () => {
|
|
|
652
652
|
guards.didCurrentAgentLeaveMainInteraction(
|
|
653
653
|
createParams(context, createEventWithTaskData(updatedTaskData))
|
|
654
654
|
)
|
|
655
|
-
).toBe(
|
|
655
|
+
).toBe(false);
|
|
656
656
|
});
|
|
657
657
|
|
|
658
|
-
it('
|
|
658
|
+
it('does not infer departure from CONSULT_END mainCall membership', () => {
|
|
659
659
|
const context = createContext({taskData: activeTaskData, consultFromConference: true});
|
|
660
660
|
const updatedTaskData = createTaskData({
|
|
661
661
|
interaction: {
|
|
@@ -690,10 +690,10 @@ describe('State Machine Guards', () => {
|
|
|
690
690
|
|
|
691
691
|
expect(
|
|
692
692
|
guards.didCurrentAgentLeaveMainInteraction(createParams(context, event))
|
|
693
|
-
).toBe(
|
|
693
|
+
).toBe(false);
|
|
694
694
|
});
|
|
695
695
|
|
|
696
|
-
it('
|
|
696
|
+
it('returns true when another participant leaves and the map omits self', () => {
|
|
697
697
|
const context = createContext({taskData: activeTaskData});
|
|
698
698
|
const partialTaskData = createTaskData({
|
|
699
699
|
interaction: {
|
|
@@ -718,7 +718,7 @@ describe('State Machine Guards', () => {
|
|
|
718
718
|
taskData: partialTaskData,
|
|
719
719
|
} as TaskEventPayload;
|
|
720
720
|
|
|
721
|
-
expect(guards.didCurrentAgentLeaveMainInteraction(createParams(context, event))).toBe(
|
|
721
|
+
expect(guards.didCurrentAgentLeaveMainInteraction(createParams(context, event))).toBe(true);
|
|
722
722
|
});
|
|
723
723
|
|
|
724
724
|
it.each(['connected', 'held'])(
|