添加 DEFAULT_TEAM_NODE_MAX_TOOL_ITERATIONS 配置项以控制团队节点的最大工具迭代次数, 并修改 LocalAgentRunner 中的逻辑来使用此默认值当 envelope 中未指定时。 fix(runtime): 修复团队节点运行成功判断逻辑 更新运行成功判断条件,将 finish_reason 为 "max_tool_iterations_finalized" 的情况 视为运行失败,并添加对原始工具调用输出的检测,避免将其误判为成功完成。 feat(mcp): 添加团队工作流MCP工具类别支持 增加新的本地MCP工具类别 "team_workflow" 及其对应的工具创建功能, 为团队工作流提供本地工具支持。 refactor(engine): 调整AgentLoop最大工具迭代次数设置 将 AgentProfile 中的默认 max_tool_iterations 从 30 增加到 100, 同时移除 TaskExecutionPlanner 构造函数中的重复参数传递。 perf(mcp): 优化MCP连接管理避免重复连接 添加 mcp_connected 标志来跟踪MCP连接状态,确保 connect_all 只执行一次, 提高性能并避免不必要的重复连接。 refactor(skills): 移除技能团队模板相关功能 移除与技能团队模板相关的代码,包括解析、存储和处理逻辑, 简化技能记录结构和加载流程。 feat(process): 增强会话过程投影器功能 添加技能激活快照事件处理,改进团队运行完成消息显示, 并增强技能激活事件的时间戳记录功能。 refactor(tasks): 简化任务尝试编排器团队执行逻辑 移除团队执行相关代码,将所有任务统一按单步执行处理, 简化任务编排器的复杂度并提升执行效率。 fix(evidence): 修复节点证据评估中需求验证逻辑 更新节点证据评估逻辑,跳过自然语言证据需求的确定性验证, 只执行机器可读的需求验证,避免因自然语言需求导致的节点失败。
103 lines
4.5 KiB
TypeScript
103 lines
4.5 KiB
TypeScript
'use client';
|
|
|
|
import Link from 'next/link';
|
|
import { ArrowLeft, CheckCircle2, MessageSquare } from 'lucide-react';
|
|
|
|
import { TaskRuntimeStatusBadge, formatTaskRuntimeDuration, formatTaskRuntimeTime } from '@/components/task-runtime/TaskRuntimeShared';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import { Button } from '@/components/ui/button';
|
|
import { pickAppText } from '@/lib/i18n/core';
|
|
import { useAppI18n } from '@/lib/i18n/provider';
|
|
import type { TaskRuntimeStatus } from '@/lib/task-runtime';
|
|
import type { BackendTask } from '@/types';
|
|
|
|
type Props = {
|
|
task: BackendTask;
|
|
activeLabel: string;
|
|
durationMs: number | null;
|
|
reviewTargetId?: string;
|
|
};
|
|
|
|
const RUNTIME_STATUSES = new Set<string>(['queued', 'running', 'waiting', 'blocked', 'done', 'error', 'cancelled']);
|
|
|
|
function isRuntimeStatus(status: string): status is TaskRuntimeStatus {
|
|
return RUNTIME_STATUSES.has(status);
|
|
}
|
|
|
|
function humanTaskStatus(status: string, locale: string) {
|
|
const map: Record<string, [string, string]> = {
|
|
open: ['已创建', 'Open'],
|
|
running: ['执行中', 'Running'],
|
|
awaiting_acceptance: ['等待验收', 'Awaiting acceptance'],
|
|
needs_revision: ['需要修改', 'Needs revision'],
|
|
closed: ['已完成', 'Closed'],
|
|
abandoned: ['已放弃', 'Abandoned'],
|
|
};
|
|
const item = map[status];
|
|
return item ? pickAppText(locale, item[0], item[1]) : status;
|
|
}
|
|
|
|
export function TaskLiveHeader({ task, activeLabel, durationMs, reviewTargetId }: Props) {
|
|
const { locale } = useAppI18n();
|
|
const title = task.short_title || String(task.metadata?.short_title || '') || task.description || task.goal || task.task_id;
|
|
const showReviewLink = Boolean(reviewTargetId && ['awaiting_acceptance', 'needs_revision'].includes(task.status));
|
|
|
|
return (
|
|
<header className="sticky top-14 z-20 min-w-0 border-b border-[#E6E1DE] bg-[#FBFAF9]/95 backdrop-blur supports-[backdrop-filter]:bg-[#FBFAF9]/85">
|
|
<div className="mx-auto flex max-w-[1720px] flex-col gap-1.5 px-4 py-3.5 sm:px-6 lg:px-8">
|
|
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
<Button asChild variant="outline" size="sm" className="h-11 rounded-xl border-[#E6E1DE] bg-white px-4 shadow-sm">
|
|
<Link href="/tasks">
|
|
<ArrowLeft className="mr-2 h-4 w-4" />
|
|
{pickAppText(locale, '返回任务', 'Back to tasks')}
|
|
</Link>
|
|
</Button>
|
|
<Button asChild variant="outline" size="sm" className="h-11 rounded-xl border-[#E6E1DE] bg-white px-4 shadow-sm">
|
|
<Link href="/">
|
|
<MessageSquare className="mr-2 h-4 w-4" />
|
|
{pickAppText(locale, '对话', 'Chat')}
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
<div className="flex flex-wrap items-center gap-2">
|
|
{isRuntimeStatus(task.status) ? (
|
|
<TaskRuntimeStatusBadge status={task.status} />
|
|
) : (
|
|
<Badge variant="outline" className="text-[11px]">
|
|
{humanTaskStatus(task.status, locale)}
|
|
</Badge>
|
|
)}
|
|
{activeLabel ? <Badge variant="secondary">{activeLabel}</Badge> : null}
|
|
{showReviewLink ? (
|
|
<Button asChild variant="default" size="sm" className="h-11 rounded-xl px-5 shadow-[0_12px_24px_rgba(31,24,20,0.18)]">
|
|
<a href={`#${reviewTargetId}`}>
|
|
<CheckCircle2 className="mr-2 h-4 w-4" />
|
|
{pickAppText(locale, '验收', 'Review')}
|
|
</a>
|
|
</Button>
|
|
) : null}
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex flex-col gap-2 lg:flex-row lg:items-end lg:justify-between">
|
|
<div className="min-w-0">
|
|
<h1 className="truncate text-[24px] font-semibold leading-[30px]">{title}</h1>
|
|
{task.description && task.description !== title ? (
|
|
<p className="mt-0.5 line-clamp-2 max-w-6xl text-sm leading-[22px] text-muted-foreground">{task.description}</p>
|
|
) : null}
|
|
</div>
|
|
<div className="flex shrink-0 flex-wrap gap-x-5 gap-y-1 text-sm text-muted-foreground">
|
|
<span>
|
|
{pickAppText(locale, '更新', 'Updated')}: {formatTaskRuntimeTime(task.updated_at, locale)}
|
|
</span>
|
|
<span>
|
|
{pickAppText(locale, '耗时', 'Duration')}: {formatTaskRuntimeDuration(durationMs, locale)}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
);
|
|
}
|