吸收数字员工PlanStep本地软租约

This commit is contained in:
baiyanyun
2026-06-10 22:29:52 +08:00
parent 909f11dae5
commit 6f2ccdf783
13 changed files with 604 additions and 49 deletions

View File

@@ -342,6 +342,16 @@ describe("digital employee sync service", () => {
},
lastDispatch: { status: "failed" },
skipReason: "approval_pending",
dispatchLease: {
lease_id: "lease-step-1",
state: "active",
owner_device_id: "device-001",
acquired_at: "2026-06-07T07:59:00.000Z",
expires_at: "2026-06-07T08:04:00.000Z",
trigger_source: "manual",
orchestration_id: "manual-ready-steps-plan-1",
candidate_count: 1,
},
},
}),
);
@@ -382,8 +392,14 @@ describe("digital employee sync service", () => {
waiting_dependency_count: 1,
preferred_skill_ids: ["qimingclaw-mcp-tool-crm-crm-search"],
dispatchable: false,
skip_reason: "approval_pending",
skip_reason: "lease_active",
last_dispatch_status: "failed",
lease_id: "lease-step-1",
lease_state: "active",
lease_owner_device_id: "device-001",
lease_acquired_at: "2026-06-07T07:59:00.000Z",
lease_expires_at: "2026-06-07T08:04:00.000Z",
lease_active: true,
}),
}),
],
@@ -567,6 +583,26 @@ describe("digital employee sync service", () => {
trigger_source: "manual",
orchestration_id: "manual-ready-steps-plan-1",
});
insertEventEntity("event-lease", "plan_step_lease_released", {
step_id: "step-1",
plan_id: "plan-1",
task_id: "task-1",
run_id: "run-1",
lease_id: "lease-step-1",
lease_state: "released",
lease_owner_device_id: "device-001",
lease_expires_at: "2026-06-07T08:04:00.000Z",
reason: "completed",
lease: {
lease_id: "lease-step-1",
state: "released",
owner_device_id: "device-001",
acquired_at: "2026-06-07T07:59:00.000Z",
expires_at: "2026-06-07T08:04:00.000Z",
released_at: "2026-06-07T08:01:00.000Z",
release_reason: "completed",
},
});
insertEventEntity("event-plan-step-ready", "plan_step_ready", {
stepId: "step-2",
planId: "plan-1",
@@ -712,6 +748,7 @@ 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-lease" },
{ 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" },
@@ -800,6 +837,21 @@ describe("digital employee sync service", () => {
trigger_source: "manual",
orchestration_id: "manual-ready-steps-plan-1",
});
expect(businessView("event-lease")).toMatchObject({
category: "dispatch",
step_id: "step-1",
plan_id: "plan-1",
task_id: "task-1",
run_id: "run-1",
lease_id: "lease-step-1",
lease_state: "released",
lease_owner_device_id: "device-001",
lease_acquired_at: "2026-06-07T07:59:00.000Z",
lease_expires_at: "2026-06-07T08:04:00.000Z",
lease_released_at: "2026-06-07T08:01:00.000Z",
lease_release_reason: "completed",
reason: "completed",
});
expect(businessView("event-plan-step-ready")).toMatchObject({
category: "dispatch",
step_id: "step-2",