吸收数字员工PlanStep远端策略拉取
This commit is contained in:
@@ -94,6 +94,7 @@ vi.mock("../services/digitalEmployee/schedulerService", () => ({
|
||||
vi.mock("../services/digitalEmployee/syncService", () => ({
|
||||
flushDigitalEmployeeSyncOutbox: vi.fn(),
|
||||
getDigitalEmployeeSyncStatus: vi.fn(),
|
||||
pullDigitalEmployeePlanStepDispatchPolicy: vi.fn(async () => ({ ok: true, policy: { enabled: true, max_per_sweep: 3, auto_dispatch_ready_steps: true, updated_at: null } })),
|
||||
}));
|
||||
|
||||
vi.mock("../services/digitalEmployee/planTemplateService", () => ({
|
||||
@@ -232,6 +233,23 @@ describe("digital employee managed service actions", () => {
|
||||
expect(mockStateService.recordArtifactLifecycle).toHaveBeenCalledWith({ artifactId: "artifact-1", action: "mark_keep" });
|
||||
});
|
||||
|
||||
it("registers plan step dispatch policy pull through the digital employee IPC boundary", async () => {
|
||||
const electron = await import("electron");
|
||||
const syncService = await import("../services/digitalEmployee/syncService");
|
||||
const { registerDigitalEmployeeHandlers } = await import("./digitalEmployeeHandlers");
|
||||
|
||||
registerDigitalEmployeeHandlers(createCtx());
|
||||
const calls = vi.mocked(electron.ipcMain.handle).mock.calls;
|
||||
const policyPullCall = calls.find(([channel]) => channel === "digitalEmployee:pullPlanStepDispatchPolicy");
|
||||
expect(policyPullCall).toBeTruthy();
|
||||
|
||||
const handler = policyPullCall?.[1] as () => Promise<unknown>;
|
||||
const result = await handler();
|
||||
|
||||
expect(result).toMatchObject({ ok: true });
|
||||
expect(syncService.pullDigitalEmployeePlanStepDispatchPolicy).toHaveBeenCalledWith({ force: true });
|
||||
});
|
||||
|
||||
it("registers approval action history through the digital employee IPC boundary", async () => {
|
||||
const electron = await import("electron");
|
||||
const { registerDigitalEmployeeHandlers } = await import("./digitalEmployeeHandlers");
|
||||
|
||||
@@ -57,6 +57,7 @@ import {
|
||||
import {
|
||||
flushDigitalEmployeeSyncOutbox,
|
||||
getDigitalEmployeeSyncStatus,
|
||||
pullDigitalEmployeePlanStepDispatchPolicy,
|
||||
} from "../services/digitalEmployee/syncService";
|
||||
import { listDigitalEmployeePlanTemplates } from "../services/digitalEmployee/planTemplateService";
|
||||
import {
|
||||
@@ -188,6 +189,10 @@ export function registerDigitalEmployeeHandlers(ctx: HandlerContext): void {
|
||||
return flushDigitalEmployeeSyncOutbox({ force: true });
|
||||
});
|
||||
|
||||
ipcMain.handle("digitalEmployee:pullPlanStepDispatchPolicy", async () => {
|
||||
return pullDigitalEmployeePlanStepDispatchPolicy({ force: true });
|
||||
});
|
||||
|
||||
ipcMain.handle("digitalEmployee:getCronSettings", async () => {
|
||||
return readDigitalEmployeeCronSettings();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user