吸收数字员工PlanStep依赖图派发策略

This commit is contained in:
baiyanyun
2026-06-10 18:41:33 +08:00
parent 3ac350eb27
commit d679639175
14 changed files with 795 additions and 212 deletions

View File

@@ -334,6 +334,15 @@ describe("digital employee sync service", () => {
seq: 2,
dependsOn: ["step-0"],
preferredSkillIds: ["qimingclaw-mcp-tool-crm-crm-search"],
payload: {
dependencyGraph: {
status: "blocked",
blockedDependencies: ["step-0"],
waitingDependencies: ["step-2"],
},
lastDispatch: { status: "failed" },
skipReason: "approval_pending",
},
}),
);
mockState.fetch.mockResolvedValue(
@@ -365,7 +374,16 @@ describe("digital employee sync service", () => {
status: "pending",
seq: 2,
depends_on: ["step-0"],
dependency_count: 1,
dependency_status: "blocked",
blocked_dependencies: ["step-0"],
blocked_dependency_count: 1,
waiting_dependencies: ["step-2"],
waiting_dependency_count: 1,
preferred_skill_ids: ["qimingclaw-mcp-tool-crm-crm-search"],
dispatchable: false,
skip_reason: "approval_pending",
last_dispatch_status: "failed",
}),
}),
],
@@ -541,9 +559,24 @@ describe("digital employee sync service", () => {
});
insertEventEntity("event-dispatch", "plan_step_dispatch_failed", {
step_id: "step-1",
plan_id: "plan-1",
task_id: "task-1",
run_id: "run-1",
status: "failed",
reason: "computer chat failed",
});
insertEventEntity("event-plan-step-ready", "plan_step_ready", {
stepId: "step-2",
planId: "plan-1",
status: "ready",
dependsOn: ["step-1"],
dependencyGraph: {
status: "ready",
blockedDependencies: [],
waitingDependencies: [],
satisfiedDependencies: ["step-1"],
},
});
insertEventEntity("event-governance-input", "governance_provide_task_input", {
commandKind: "provide_task_input",
commandId: "command-provide-input",
@@ -648,6 +681,25 @@ describe("digital employee sync service", () => {
},
},
});
insertEventEntity("event-plan-step-policy", "digital_workday_update_plan_step_dispatch_policy", {
metadata: {
action: "update_plan_step_dispatch_policy",
plan_step_dispatch_policy: {
enabled: false,
max_per_sweep: 1,
auto_dispatch_ready_steps: false,
updated_at: "2026-06-07T08:07:00.000Z",
},
},
state: {
planStepDispatchPolicy: {
enabled: false,
max_per_sweep: 1,
auto_dispatch_ready_steps: false,
updated_at: "2026-06-07T08:07:00.000Z",
},
},
});
mockState.fetch.mockResolvedValue(
jsonResponse({
success: true,
@@ -658,12 +710,14 @@ describe("digital employee sync service", () => {
{ entity_type: "event", entity_id: "event-artifact" },
{ entity_type: "event", entity_id: "event-skill" },
{ entity_type: "event", entity_id: "event-dispatch" },
{ entity_type: "event", entity_id: "event-plan-step-ready" },
{ entity_type: "event", entity_id: "event-governance-input" },
{ entity_type: "event", entity_id: "event-notification-read" },
{ entity_type: "event", entity_id: "event-notification-dismiss" },
{ entity_type: "event", entity_id: "event-notification-reply" },
{ entity_type: "event", entity_id: "event-notification-preferences" },
{ entity_type: "event", entity_id: "event-approval-subscriptions" },
{ entity_type: "event", entity_id: "event-plan-step-policy" },
],
}),
);
@@ -736,9 +790,22 @@ describe("digital employee sync service", () => {
expect(businessView("event-dispatch")).toMatchObject({
category: "dispatch",
step_id: "step-1",
plan_id: "plan-1",
task_id: "task-1",
run_id: "run-1",
status: "failed",
reason: "computer chat failed",
});
expect(businessView("event-plan-step-ready")).toMatchObject({
category: "dispatch",
step_id: "step-2",
plan_id: "plan-1",
status: "ready",
dependency_count: 1,
blocked_dependencies: [],
waiting_dependencies: [],
satisfied_dependencies: ["step-1"],
});
expect(businessView("event-governance-input")).toMatchObject({
category: "governance",
command_kind: "provide_task_input",
@@ -790,6 +857,16 @@ describe("digital employee sync service", () => {
});
expect(businessView("event-approval-subscriptions")).not.toHaveProperty("state");
expect(businessView("event-approval-subscriptions")).not.toHaveProperty("approvalSubscriptionPreferences");
expect(businessView("event-plan-step-policy")).toMatchObject({
category: "dispatch",
action: "update_plan_step_dispatch_policy",
policy_enabled: false,
max_per_sweep: 1,
auto_dispatch_ready_steps: false,
updated_at: "2026-06-07T08:07:00.000Z",
});
expect(businessView("event-plan-step-policy")).not.toHaveProperty("state");
expect(businessView("event-plan-step-policy")).not.toHaveProperty("planStepDispatchPolicy");
expect(readEntity("event", "event-route")).toMatchObject({
sync_status: "synced",
sync_error: null,