feat(client): project managed services to digital employee

This commit is contained in:
baiyanyun
2026-06-08 11:40:03 +08:00
parent 8dc9ce73b9
commit 710bf72353
9 changed files with 406 additions and 146 deletions

View File

@@ -16,6 +16,7 @@ import type {
DigitalEmployeeDailyReport,
DigitalEmployeeDecision,
DigitalEmployeeDuty,
DigitalEmployeeManagedService,
DigitalEmployeeRunDetail,
DigitalEmployeeTaskExecutionSummary,
DigitalEmployeeWorkEvent,
@@ -711,6 +712,11 @@ function projectionSelectedDutyIds(projection: DigitalEmployeeWorkdayProjection)
);
}
function managedServiceSummary(service: DigitalEmployeeManagedService): string {
const deps = service.dependent_tasks.length > 0 ? `,影响 ${service.dependent_tasks.slice(0, 2).join('、')}` : '';
return `${service.name} ${service.status_label}${service.error ? `${service.error}` : deps}`;
}
function isDecisionOpen(status?: string): boolean {
return ['pending', 'requested'].includes(String(status || '').toLowerCase());
}
@@ -990,6 +996,8 @@ export default function CommandDeck({ onNavigate }: { onNavigate: (target: Digit
const employee = workdayProjection?.employee;
const workday = workdayProjection?.workday;
const delivery = workdayProjection?.delivery;
const managedServices = isLiveProjection ? (workdayProjection?.managed_services ?? []) : [];
const managedServiceIssues = managedServices.filter((service) => service.requires_human_action || service.status === 'degraded');
const dailyReport = isLiveProjection ? workdayProjection?.daily_report : undefined;
const runDetails = isLiveProjection
? (workdayProjection?.run_details?.length ? workdayProjection.run_details : allEvents.map(runDetailFromEvent))
@@ -1046,12 +1054,17 @@ export default function CommandDeck({ onNavigate }: { onNavigate: (target: Digit
const workdaySummaryText = totalDuties.length > 0
? `已加载 ${totalDuties.length} 项任务,当前选择 ${selectedDuties.length} 项;右侧展示真实执行状态、运行明细和日报。`
: (workday?.summary ?? '等待同步当天任务计划。');
const currentActionTitle = currentEvent?.task_title ?? (workday?.confirmed ? '等待下一条执行事件' : '等待确认任务设置');
const currentActionTitle = currentEvent?.task_title
?? (managedServiceIssues[0] ? managedServiceIssues[0].name : workday?.confirmed ? '等待下一条执行事件' : '等待确认任务设置');
const currentActionDetail = currentEvent
? `${currentEvent.plan_title}${eventBusinessResult(currentEvent)}${eventTimingSummary(currentEvent)}`
: managedServiceIssues[0]
? managedServiceSummary(managedServiceIssues[0])
: '任务执行后会显示正在处理的任务、步骤或汇总动作。';
const nextStepText = pendingDecisions[0]
? `等待人工确认:${pendingDecisions[0].title}`
: managedServiceIssues[0]
? `处理服务状态:${managedServiceSummary(managedServiceIssues[0])}`
: workday?.confirmed
? (delivery?.lines[0] ?? '继续按计划轮询新工单,并把结果同步到运行明细。')
: '请先确认今天要执行的任务,确认后数字员工会开始执行。';