feat(client): project plan and task agents
This commit is contained in:
@@ -18,6 +18,7 @@ import type {
|
||||
DigitalEmployeeDuty,
|
||||
DigitalEmployeeManagedService,
|
||||
DigitalEmployeeRunDetail,
|
||||
DigitalEmployeeTaskAgentState,
|
||||
DigitalEmployeeTaskExecutionSummary,
|
||||
DigitalEmployeeWorkEvent,
|
||||
DigitalEmployeeWorkdayProjection,
|
||||
@@ -717,6 +718,11 @@ function managedServiceSummary(service: DigitalEmployeeManagedService): string {
|
||||
return `${service.name} ${service.status_label}${service.error ? `:${service.error}` : deps}`;
|
||||
}
|
||||
|
||||
function taskAgentSummary(agent: DigitalEmployeeTaskAgentState): string {
|
||||
const next = agent.next_action === 'retry_or_skip' ? '重试或跳过' : agent.next_action === 'watch_progress' ? '观察进度' : agent.next_action;
|
||||
return `${agent.title} ${agent.status_label},下一步 ${next}`;
|
||||
}
|
||||
|
||||
function isDecisionOpen(status?: string): boolean {
|
||||
return ['pending', 'requested'].includes(String(status || '').toLowerCase());
|
||||
}
|
||||
@@ -998,6 +1004,8 @@ export default function CommandDeck({ onNavigate }: { onNavigate: (target: Digit
|
||||
const delivery = workdayProjection?.delivery;
|
||||
const managedServices = isLiveProjection ? (workdayProjection?.managed_services ?? []) : [];
|
||||
const managedServiceIssues = managedServices.filter((service) => service.requires_human_action || service.status === 'degraded');
|
||||
const taskAgents = isLiveProjection ? (workdayProjection?.task_agents ?? []) : [];
|
||||
const actionableTaskAgents = taskAgents.filter((agent) => agent.can_retry || agent.can_skip || agent.can_cancel);
|
||||
const dailyReport = isLiveProjection ? workdayProjection?.daily_report : undefined;
|
||||
const runDetails = isLiveProjection
|
||||
? (workdayProjection?.run_details?.length ? workdayProjection.run_details : allEvents.map(runDetailFromEvent))
|
||||
@@ -1055,14 +1063,18 @@ export default function CommandDeck({ onNavigate }: { onNavigate: (target: Digit
|
||||
? `已加载 ${totalDuties.length} 项任务,当前选择 ${selectedDuties.length} 项;右侧展示真实执行状态、运行明细和日报。`
|
||||
: (workday?.summary ?? '等待同步当天任务计划。');
|
||||
const currentActionTitle = currentEvent?.task_title
|
||||
?? (managedServiceIssues[0] ? managedServiceIssues[0].name : workday?.confirmed ? '等待下一条执行事件' : '等待确认任务设置');
|
||||
?? (actionableTaskAgents[0] ? actionableTaskAgents[0].title : managedServiceIssues[0] ? managedServiceIssues[0].name : workday?.confirmed ? '等待下一条执行事件' : '等待确认任务设置');
|
||||
const currentActionDetail = currentEvent
|
||||
? `${currentEvent.plan_title}:${eventBusinessResult(currentEvent)}(${eventTimingSummary(currentEvent)})`
|
||||
: actionableTaskAgents[0]
|
||||
? taskAgentSummary(actionableTaskAgents[0])
|
||||
: managedServiceIssues[0]
|
||||
? managedServiceSummary(managedServiceIssues[0])
|
||||
: '任务执行后会显示正在处理的任务、步骤或汇总动作。';
|
||||
const nextStepText = pendingDecisions[0]
|
||||
? `等待人工确认:${pendingDecisions[0].title}`
|
||||
: actionableTaskAgents[0]
|
||||
? `Task Agent:${taskAgentSummary(actionableTaskAgents[0])}`
|
||||
: managedServiceIssues[0]
|
||||
? `处理服务状态:${managedServiceSummary(managedServiceIssues[0])}`
|
||||
: workday?.confirmed
|
||||
|
||||
Reference in New Issue
Block a user