吸收数字员工治理动作入口

This commit is contained in:
baiyanyun
2026-06-09 15:54:49 +08:00
parent 702ea05d4d
commit 9ad7881378
6 changed files with 348 additions and 142 deletions

View File

@@ -440,6 +440,41 @@ describe("digital employee state service", () => {
});
});
it("records plan action governance commands as local run facts", async () => {
const { recordDigitalEmployeeGovernanceCommand } = await import("./stateService");
recordDigitalEmployeeGovernanceCommand({
commandKind: "pause_plan",
commandId: "command-pause-plan",
planId: "plan-action",
accepted: true,
message: "暂停计划执行",
payload: { plan_id: "plan-action", requested_action: "plan_pause" },
result: { plan_id: "plan-action", status: "paused" },
});
expect(mockState.db?.plans.get("plan-action")).toMatchObject({
status: "paused",
sync_status: "pending",
});
expect(mockState.db?.tasks.get("governance-task-command-pause-plan")).toMatchObject({
plan_id: "plan-action",
status: "paused",
assigned_skill_id: "qimingclaw-governance-command",
});
expect(mockState.db?.runs.get("governance-run-command-pause-plan")).toMatchObject({
plan_id: "plan-action",
status: "paused",
finished_at: "2026-06-07T08:00:00.000Z",
});
expect(mockState.db?.events.get("governance-run-command-pause-plan:pause_plan:command-pause-plan")).toMatchObject({
kind: "governance_pause_plan",
message: "暂停计划执行",
});
expect(mockState.db?.outbox.get("plan:upsert:plan-action")).toMatchObject({ entity_type: "plan" });
expect(mockState.db?.outbox.get("event:insert:governance-run-command-pause-plan:pause_plan:command-pause-plan")).toMatchObject({ entity_type: "event" });
});
it("records schedule lifecycle commands and manual runs", async () => {
const {
readDigitalEmployeeRuntimeRecords,