吸收数字员工步骤自动调度

This commit is contained in:
baiyanyun
2026-06-10 11:23:22 +08:00
parent 047651e404
commit d12db03216
12 changed files with 772 additions and 191 deletions

View File

@@ -26,6 +26,7 @@ import type {
IngressRouteResponse,
GovernanceCommandRequest,
GovernanceCommandResponse,
SchedulerCheckResponse,
DigitalEmployeeManagedService,
DigitalEmployeeWorkdayProjection,
DigitalEmployeeWorkdayActionRequest,
@@ -709,8 +710,8 @@ export function taskAction(taskId: string, action: string): Promise<any> {
* Current React pages must trigger scheduler checks through runSchedulerNow()
* so backend governance rejection and command errors are surfaced correctly.
*/
export function triggerCronCheck(): Promise<{ ok?: boolean; activated: number }> {
return apiFetch<{ ok?: boolean; activated: number }>('/api/cron/check', { method: 'POST' });
export function triggerCronCheck(): Promise<SchedulerCheckResponse> {
return apiFetch<SchedulerCheckResponse>('/api/cron/check', { method: 'POST' });
}
export function getAuditTrace(kind: string, id: string): Promise<any> {

View File

@@ -3241,6 +3241,7 @@ function buildNotifications(snapshot: QimingclawSnapshot | null, state: AdapterS
...approvalActionNotifications(snapshot),
...syncFailureNotifications(snapshot),
...managedServiceNotifications(snapshot),
...planStepDispatchNotifications(snapshot),
...taskNotifications(snapshot),
]);
const overlays = state.notificationStateById ?? {};
@@ -3353,6 +3354,28 @@ function taskNotifications(snapshot: QimingclawSnapshot | null): UserNotificatio
});
}
function planStepDispatchNotifications(snapshot: QimingclawSnapshot | null): UserNotification[] {
return runtimeEvents(snapshot)
.filter((event) => event.kind === 'plan_step_dispatch_failed')
.map((event) => {
const payload = asRecord(event.payload) ?? {};
const stepId = stringValue(payload.step_id) || event.id;
const reason = stringValue(payload.reason);
return {
notification_id: `plan-step-dispatch:${stepId}:${slugifyIdPart(event.occurredAt)}`,
plan_id: event.planId ?? stringValue(payload.plan_id),
task_id: event.taskId ?? stringValue(payload.task_id),
kind: 'task_failed',
title: 'Ready 步骤派发失败',
body: reason ? `${stepId}${reason}` : (event.message || stepId),
level: 'error',
status: 'unread',
correlation_id: stepId,
created_at: event.occurredAt,
} satisfies UserNotification;
});
}
function applyNotificationOverlay(notification: UserNotification, overlay?: NotificationState): UserNotification {
if (!overlay) return notification;
return {