🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(goal): make goal detail fully inspectable via portal drill-down (#18921)
Arvin Xu1f54dce007c3
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex a9b07b1a6df..5719333314c 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -483,9 +483,9 @@"goalProcess.activity.empty": "No activity yet","goalProcess.activity.finding": "Recorded finding: {{title}}","goalProcess.activity.title": "Activity",- "goalProcess.advance.label": "Advance",- "goalProcess.advance.running": "Advancing…",- "goalProcess.advance.tooltip": "The goal already advances on its own as its work settles. Press this to run the coordinator now — useful when you want to see where it stops without waiting.",+ "goalProcess.actor.agent": "Agent",+ "goalProcess.actor.system": "System",+ "goalProcess.actor.user": "You","goalProcess.attempts.failed": "Did not pass","goalProcess.attempts.nth": "Attempt {{index}}","goalProcess.attempts.passed": "Passed",@@ -498,6 +498,14 @@"goalProcess.edge.leadsTo": "leads to","goalProcess.edge.produces": "produces","goalProcess.edge.supports": "supports",+ "goalProcess.eventType.activated": "Attempt started",+ "goalProcess.eventType.created": "Created",+ "goalProcess.eventType.linked": "Linked",+ "goalProcess.eventType.rejected": "Rejected",+ "goalProcess.eventType.resolved": "Resolved",+ "goalProcess.eventType.retired": "Retired",+ "goalProcess.eventType.unlinked": "Unlinked",+ "goalProcess.eventType.updated": "Updated","goalProcess.findings.answers": "Answers “{{title}}”","goalProcess.findings.empty": "No findings yet.","goalProcess.findings.from": "From “{{title}}”",@@ -529,22 +537,57 @@"goalProcess.kind.finding": "Finding","goalProcess.kind.problem": "Question","goalProcess.kind.task": "Task",+ "goalProcess.metricDetail.budget.rounds": "Round cap",+ "goalProcess.metricDetail.budget.spendNote": "Per-run spend is recorded on each dispatched task — open a task to see what its runs actually cost.",+ "goalProcess.metricDetail.budget.title": "Budget",+ "goalProcess.metricDetail.budget.totalCost": "Total cost cap",+ "goalProcess.metricDetail.budget.uncapped": "Uncapped",+ "goalProcess.metricDetail.duration.now": "now",+ "goalProcess.metricDetail.duration.taskSpans": "Task spans",+ "goalProcess.metricDetail.duration.title": "Timeline",+ "goalProcess.metricDetail.duration.total": "Total runtime",+ "goalProcess.metricDetail.findings.title": "All findings",+ "goalProcess.metricDetail.lifecycle.empty": "No events recorded yet",+ "goalProcess.metricDetail.lifecycle.title": "Lifecycle",+ "goalProcess.metricDetail.liveness.driver": "The goal advances on its own: each finished task triggers the next move, and a recovery sweep rescues anything that stalls or loses its device. Nothing here waits for you unless a decision gate is open.",+ "goalProcess.metricDetail.liveness.latest": "Last activity",+ "goalProcess.metricDetail.liveness.running": "Running now",+ "goalProcess.metricDetail.liveness.title": "Liveness",+ "goalProcess.metricDetail.tasks.title": "All tasks",+ "goalProcess.metrics.budget": "Budget",+ "goalProcess.metrics.duration": "Runtime","goalProcess.metrics.findings": "Findings",+ "goalProcess.metrics.liveness": "Last activity",+ "goalProcess.metrics.roundsValue": "{{count}} rounds","goalProcess.metrics.status": "Status","goalProcess.metrics.tasks": "Tasks",+ "goalProcess.metrics.uncapped": "Uncapped","goalProcess.node.answered": "Answered by a finding","goalProcess.node.artifactsTooltip": "{{count}} work versions registered. Opening them needs a server read that does not exist yet.","goalProcess.node.attemptsTooltip": "{{count}} attempts so far",+ "goalProcess.node.blockers": "Blocked by","goalProcess.node.decidedByAgent": "Agent decided","goalProcess.node.decidedByYou": "You decided",+ "goalProcess.node.description": "Description",+ "goalProcess.node.detailTitle": "Node detail","goalProcess.node.done": "Done","goalProcess.node.humanTouched": "You took part in this task",+ "goalProcess.node.instruction": "Expected output",+ "goalProcess.node.openTask": "Open task detail",+ "goalProcess.node.producedByTitle": "Produced by",+ "goalProcess.node.producedFindings": "Produced findings","goalProcess.node.running": "Running","goalProcess.node.unanswered": "Unanswered","goalProcess.node.unassigned": "Not dispatched","goalProcess.node.verifier": "verifier","goalProcess.node.verifierTooltip": "This task has its own acceptance contract — a verifier judges the delivery.","goalProcess.node.waiting": "Waiting",+ "goalProcess.nodeStatus.active": "Running",+ "goalProcess.nodeStatus.proposed": "Queued",+ "goalProcess.nodeStatus.rejected": "Rejected",+ "goalProcess.nodeStatus.resolved": "Done",+ "goalProcess.nodeStatus.retired": "Retired",+ "goalProcess.nodeStatus.waiting": "Waiting","goalProcess.pause": "Pause","goalProcess.paused": "Paused — no new work will start","goalProcess.requirement": "What counts as done",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex db2bab979e0..ff0971f70de 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -483,9 +483,9 @@"goalProcess.activity.empty": "暂无活动","goalProcess.activity.finding": "沉淀结论:{{title}}","goalProcess.activity.title": "活动",- "goalProcess.advance.label": "推进",- "goalProcess.advance.running": "推进中…",- "goalProcess.advance.tooltip": "目标会随着任务完成自行推进。点这里立刻跑一轮协调器——想马上看到它停在哪一步时用。",+ "goalProcess.actor.agent": "Agent",+ "goalProcess.actor.system": "系统",+ "goalProcess.actor.user": "你","goalProcess.attempts.failed": "未通过","goalProcess.attempts.nth": "第 {{index}} 次","goalProcess.attempts.passed": "通过",@@ -498,6 +498,14 @@"goalProcess.edge.leadsTo": "导向","goalProcess.edge.produces": "产出","goalProcess.edge.supports": "支持",+ "goalProcess.eventType.activated": "开始尝试",+ "goalProcess.eventType.created": "创建",+ "goalProcess.eventType.linked": "建立关联",+ "goalProcess.eventType.rejected": "被否决",+ "goalProcess.eventType.resolved": "完成",+ "goalProcess.eventType.retired": "退役",+ "goalProcess.eventType.unlinked": "解除关联",+ "goalProcess.eventType.updated": "更新","goalProcess.findings.answers": "回答「{{title}}」","goalProcess.findings.empty": "还没有任何结论。","goalProcess.findings.from": "来自「{{title}}」",@@ -529,22 +537,57 @@"goalProcess.kind.finding": "结论","goalProcess.kind.problem": "问题","goalProcess.kind.task": "任务",+ "goalProcess.metricDetail.budget.rounds": "轮次上限",+ "goalProcess.metricDetail.budget.spendNote": "实际消耗记录在派发出去的各个任务上——打开任务详情即可查看每次运行花了多少。",+ "goalProcess.metricDetail.budget.title": "预算",+ "goalProcess.metricDetail.budget.totalCost": "总成本上限",+ "goalProcess.metricDetail.budget.uncapped": "未设限",+ "goalProcess.metricDetail.duration.now": "现在",+ "goalProcess.metricDetail.duration.taskSpans": "各任务起止",+ "goalProcess.metricDetail.duration.title": "执行时间线",+ "goalProcess.metricDetail.duration.total": "总运行时长",+ "goalProcess.metricDetail.findings.title": "全部结论",+ "goalProcess.metricDetail.lifecycle.empty": "还没有记录任何事件",+ "goalProcess.metricDetail.lifecycle.title": "生命周期",+ "goalProcess.metricDetail.liveness.driver": "目标会自主推进:每个任务完成即触发下一步,失联或停滞的任务由兜底扫描捞回。除非有决策门等你,这里没有任何事情需要你干预。",+ "goalProcess.metricDetail.liveness.latest": "最近活动",+ "goalProcess.metricDetail.liveness.running": "正在执行",+ "goalProcess.metricDetail.liveness.title": "活性",+ "goalProcess.metricDetail.tasks.title": "全部任务",+ "goalProcess.metrics.budget": "预算",+ "goalProcess.metrics.duration": "运行时长","goalProcess.metrics.findings": "结论",+ "goalProcess.metrics.liveness": "最近活动",+ "goalProcess.metrics.roundsValue": "{{count}} 轮","goalProcess.metrics.status": "状态","goalProcess.metrics.tasks": "任务",+ "goalProcess.metrics.uncapped": "未设限","goalProcess.node.answered": "已被结论回答","goalProcess.node.artifactsTooltip": "已登记 {{count}} 个产物版本;打开明细还需要服务端补读接口","goalProcess.node.attemptsTooltip": "已尝试 {{count}} 次",+ "goalProcess.node.blockers": "被谁阻塞","goalProcess.node.decidedByAgent": "Agent 决定的","goalProcess.node.decidedByYou": "你决定的",+ "goalProcess.node.description": "说明",+ "goalProcess.node.detailTitle": "节点详情","goalProcess.node.done": "完成","goalProcess.node.humanTouched": "你参与过这项任务",+ "goalProcess.node.instruction": "要求产出",+ "goalProcess.node.openTask": "打开任务详情",+ "goalProcess.node.producedByTitle": "来自任务",+ "goalProcess.node.producedFindings": "产出结论","goalProcess.node.running": "进行中","goalProcess.node.unanswered": "待回答","goalProcess.node.unassigned": "未派发","goalProcess.node.verifier": "verifier","goalProcess.node.verifierTooltip": "这项任务有自己的验收合约,由 verifier 判定交付","goalProcess.node.waiting": "等待中",+ "goalProcess.nodeStatus.active": "进行中",+ "goalProcess.nodeStatus.proposed": "排队中",+ "goalProcess.nodeStatus.rejected": "被否决",+ "goalProcess.nodeStatus.resolved": "已完成",+ "goalProcess.nodeStatus.retired": "已退役",+ "goalProcess.nodeStatus.waiting": "等待中","goalProcess.pause": "暂停","goalProcess.paused": "已暂停,不会再开始新的任务","goalProcess.requirement": "什么算完成",diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.tsindex ae5ce173bc9..1ef50f7ef7b 100644--- a/packages/locales/src/default/chat.ts+++ b/packages/locales/src/default/chat.ts@@ -1836,7 +1836,6 @@ export default {'goalProcess.attempts.title': 'Previous attempts','goalProcess.attempts.nth': 'Attempt {{index}}','goalProcess.attempts.passed': 'Passed',- 'goalProcess.advance.running': 'Advancing…','goalProcess.attempts.failed': 'Did not pass','goalProcess.attempts.retired': 'Retired','goalProcess.attempts.running': 'Running',@@ -1863,6 +1862,54 @@ export default {'goalProcess.node.waiting': 'Waiting','goalProcess.node.unanswered': 'Unanswered','goalProcess.metrics.status': 'Status',+ 'goalProcess.actor.agent': 'Agent',+ 'goalProcess.actor.system': 'System',+ 'goalProcess.actor.user': 'You',+ 'goalProcess.eventType.activated': 'Attempt started',+ 'goalProcess.eventType.created': 'Created',+ 'goalProcess.eventType.linked': 'Linked',+ 'goalProcess.eventType.rejected': 'Rejected',+ 'goalProcess.eventType.resolved': 'Resolved',+ 'goalProcess.eventType.retired': 'Retired',+ 'goalProcess.eventType.unlinked': 'Unlinked',+ 'goalProcess.eventType.updated': 'Updated',+ 'goalProcess.metricDetail.budget.rounds': 'Round cap',+ 'goalProcess.metricDetail.budget.spendNote':+ 'Per-run spend is recorded on each dispatched task \u2014 open a task to see what its runs actually cost.',+ 'goalProcess.metricDetail.budget.title': 'Budget',+ 'goalProcess.metricDetail.budget.totalCost': 'Total cost cap',+ 'goalProcess.metricDetail.budget.uncapped': 'Uncapped',+ 'goalProcess.metricDetail.duration.now': 'now',+ 'goalProcess.metricDetail.duration.taskSpans': 'Task spans',+ 'goalProcess.metricDetail.duration.title': 'Timeline',+ 'goalProcess.metricDetail.duration.total': 'Total runtime',+ 'goalProcess.metricDetail.findings.title': 'All findings',+ 'goalProcess.metricDetail.lifecycle.empty': 'No events recorded yet',+ 'goalProcess.metricDetail.lifecycle.title': 'Lifecycle',+ 'goalProcess.metricDetail.liveness.driver':+ 'The goal advances on its own: each finished task triggers the next move, and a recovery sweep rescues anything that stalls or loses its device. Nothing here waits for you unless a decision gate is open.',+ 'goalProcess.metricDetail.liveness.latest': 'Last activity',+ 'goalProcess.metricDetail.liveness.running': 'Running now',+ 'goalProcess.metricDetail.liveness.title': 'Liveness',+ 'goalProcess.metricDetail.tasks.title': 'All tasks',+ 'goalProcess.metrics.budget': 'Budget',+ 'goalProcess.metrics.duration': 'Runtime',+ 'goalProcess.metrics.liveness': 'Last activity',+ 'goalProcess.metrics.roundsValue': '{{count}} rounds',+ 'goalProcess.metrics.uncapped': 'Uncapped',+ 'goalProcess.node.blockers': 'Blocked by',+ 'goalProcess.node.description': 'Description',+ 'goalProcess.node.detailTitle': 'Node detail',+ 'goalProcess.node.instruction': 'Expected output',+ 'goalProcess.node.openTask': 'Open task detail',+ 'goalProcess.node.producedByTitle': 'Produced by',+ 'goalProcess.node.producedFindings': 'Produced findings',+ 'goalProcess.nodeStatus.active': 'Running',+ 'goalProcess.nodeStatus.proposed': 'Queued',+ 'goalProcess.nodeStatus.rejected': 'Rejected',+ 'goalProcess.nodeStatus.resolved': 'Done',+ 'goalProcess.nodeStatus.retired': 'Retired',+ 'goalProcess.nodeStatus.waiting': 'Waiting','goalProcess.metrics.tasks': 'Tasks','goalProcess.metrics.findings': 'Findings','goalProcess.requirement': 'What counts as done',@@ -1891,9 +1938,6 @@ export default {'goalProcess.summary.notStarted': 'Not started yet','goalProcess.summary.gateOpen': 'Waiting for your decision','goalProcess.summary.gateResolved': 'Decided: {{option}}',- 'goalProcess.advance.label': 'Advance',- 'goalProcess.advance.tooltip':- 'The goal already advances on its own as its work settles. Press this to run the coordinator now — useful when you want to see where it stops without waiting.','goalProcess.pause': 'Pause','goalProcess.resume': 'Resume','goalProcess.paused': 'Paused — no new work will start',diff --git a/src/features/AgentGoals/GoalDetailPage.tsx b/src/features/AgentGoals/GoalDetailPage.tsxindex b7a74a50865..1421f7d2dda 100644--- a/src/features/AgentGoals/GoalDetailPage.tsx+++ b/src/features/AgentGoals/GoalDetailPage.tsx@@ -3,19 +3,27 @@import { Flexbox } from '@lobehub/ui';import { Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';-import { memo } from 'react';+import { memo, type ReactNode, useEffect, useMemo } from 'react';import { useTranslation } from 'react-i18next';import NotFound from '@/components/404';import AsyncError from '@/components/AsyncError';+import CollapsibleContent from '@/components/CollapsibleContent';import GoalDetailSkeleton from '@/components/Skeleton/GoalDetail';import AgentBreadcrumb from '@/features/AgentBreadcrumb';+import RunningGlyph from '@/features/Home/components/RunningGlyph';import NavHeader from '@/features/NavHeader';+import { PortalContent } from '@/features/Portal/router';+import RightPanel from '@/features/RightPanel';import WideScreenContainer from '@/features/WideScreenContainer';+import { useActivityTime } from '@/hooks/useActivityTime';+import { useChatStore } from '@/store/chat';+import { chatPortalSelectors } from '@/store/chat/selectors';+import { type GoalMetricKind } from '@/store/chat/slices/portal/initialState';import { goalSelectors, useGoalStore } from '@/store/goal';import GoalDetailActions from './GoalDetailActions';-import { goalStatusKey } from './goalPresentation';+import { formatSpan, goalStatusKey } from './goalPresentation';import GoalStatusGlyph from './GoalStatusGlyph';import ProcessControl from './ProcessControl';@@ -23,6 +31,10 @@ import ProcessControl from './ProcessControl';* The goal detail page. A goal is a Goal Graph — it owns its own decomposition* and dispatches Work Tasks — so the page reads the graph snapshot directly and* the route is keyed by the `goals` row id.+ *+ * Every header metric is a drill-down entry: clicking one opens its detail in+ * the right-hand Portal, the same panel the process-control band drills into+ * (node → task → topic conversation).*/const styles = createStaticStyles(({ css }) => ({@@ -30,15 +42,58 @@ const styles = createStaticStyles(({ css }) => ({padding-block: 8px 4px;`,metric: css`+ cursor: pointer;+min-width: 112px;+ padding-block: 4px;+ padding-inline: 10px;+ border-radius: ${cssVar.borderRadius};++ transition: background 0.15s;- & + & {- padding-inline-start: 18px;- border-inline-start: 1px solid ${cssVar.colorBorderSecondary};+ &:hover {+ background: ${cssVar.colorFillQuaternary};}`,+ metrics: css`+ /* Negative inline offset keeps the metric text aligned with the title while+ the hover background still gets breathing room. */+ margin-inline-start: -10px;+ `,}));+const Metric = memo<{+ label: string;+ onClick: () => void;+ value: ReactNode;+}>(({ label, onClick, value }) => (+ <Flexbox className={styles.metric} gap={2} onClick={onClick}>+ <Flexbox horizontal align={'center'} gap={7} style={{ minHeight: 26 }}>+ {value}+ </Flexbox>+ <Text fontSize={12} type={'secondary'}>+ {label}+ </Text>+ </Flexbox>+));++Metric.displayName = 'GoalHeaderMetric';++/** Relative "last activity" readout; isolated so its refresh never re-renders the page. */+const LivenessValue = memo<{ active: boolean; latest?: Date }>(({ active, latest }) => {+ const { text } = useActivityTime(latest);+ return (+ <>+ {active && <RunningGlyph size={14} />}+ <Text fontSize={16} weight={600}>+ {text || '—'}+ </Text>+ </>+ );+});++LivenessValue.displayName = 'GoalLivenessValue';+interface GoalDetailPageProps {/** Absent for a goal with no responsible agent — e.g. one created from a project. */agentId?: string;@@ -51,6 +106,25 @@ const GoalDetailPage = memo<GoalDetailPageProps>(({ agentId, goalId }) => {const { error, isLoading, mutate } = useFetchGoalGraph(goalId);const snapshot = useGoalStore(goalSelectors.goalGraph(goalId));+ const showPortal = useChatStore(chatPortalSelectors.showPortal);+ const openGoalMetric = useChatStore((s) => s.openGoalMetric);+ const clearPortalStack = useChatStore((s) => s.clearPortalStack);++ // The portal stack belongs to this goal's inspection session — leaving the+ // page (or switching goals) must not leak it into the conversation surface.+ useEffect(() => () => clearPortalStack(), [clearPortalStack, goalId]);++ const liveness = useMemo(() => {+ if (!snapshot) return { active: false, latest: undefined };+ let latest: Date | undefined;+ let active = false;+ for (const node of snapshot.nodes) {+ if (!latest || node.updatedAt > latest) latest = node.updatedAt;+ if (node.kind === 'task' && node.status === 'active') active = true;+ }+ return { active, latest };+ }, [snapshot]);+if (error && !snapshot) return <AsyncError error={error} variant={'page'} onRetry={mutate} />;if (!snapshot)return isLoading ? (@@ -62,79 +136,137 @@ const GoalDetailPage = memo<GoalDetailPageProps>(({ agentId, goalId }) => {const { goal, nodes } = snapshot;const tasks = nodes.filter((node) => node.kind === 'task').length;const findings = nodes.filter((node) => node.kind === 'finding').length;+ const open = (metric: GoalMetricKind) => () => openGoalMetric(goalId, metric);++ const durationText = goal.startedAt+ ? formatSpan((goal.completedAt ?? new Date()).getTime() - goal.startedAt.getTime())+ : '—';+ const budgetText =+ goal.maxTotalCost === null+ ? goal.maxRounds === null+ ? t('goalProcess.metrics.uncapped')+ : t('goalProcess.metrics.roundsValue', { count: goal.maxRounds })+ : `$${goal.maxTotalCost}`;return (- <Flexbox flex={1} height={'100%'}>- <NavHeader- left={- <Flexbox horizontal align={'center'} gap={4}>- {agentId ? (- <AgentBreadcrumb- agentId={agentId}- extraItems={[goal.title]}- title={t('goalList.title')}- />- ) : (- <Text fontSize={14} weight={500}>+ <Flexbox horizontal flex={1} height={'100%'} style={{ overflow: 'hidden' }}>+ <Flexbox flex={1} height={'100%'} style={{ minWidth: 0 }}>+ <NavHeader+ left={+ <Flexbox horizontal align={'center'} gap={4}>+ {agentId ? (+ <AgentBreadcrumb+ agentId={agentId}+ extraItems={[goal.title]}+ title={t('goalList.title')}+ />+ ) : (+ <Text fontSize={14} weight={500}>+ {goal.title}+ </Text>+ )}+ {/* Not nested under the breadcrumb: an agent-less goal still has to+ be deletable, and this menu is the only place that can do it. */}+ <GoalDetailActions agentId={agentId} goalId={goal.id} projectId={goal.projectId} />+ </Flexbox>+ }+ />+ <Flexbox flex={1} style={{ overflowY: 'auto' }}>+ <WideScreenContainer gap={20} paddingBlock={16}>+ <Flexbox className={styles.header} gap={8}>+ <Text as={'h1'} fontSize={22} weight={600}>{goal.title}</Text>- )}- {/* Not nested under the breadcrumb: an agent-less goal still has to- be deletable, and this menu is the only place that can do it. */}- <GoalDetailActions agentId={agentId} goalId={goal.id} projectId={goal.projectId} />- </Flexbox>- }- />- <Flexbox flex={1} style={{ overflowY: 'auto' }}>- <WideScreenContainer gap={20} paddingBlock={16}>- <Flexbox className={styles.header} gap={8}>- <Text as={'h1'} fontSize={22} weight={600}>- {goal.title}- </Text>- <Flexbox horizontal gap={18} wrap={'wrap'}>- <Flexbox className={styles.metric} gap={2}>- <Flexbox horizontal align={'center'} gap={7}>- <GoalStatusGlyph size={16} status={goal.status} />- <Text fontSize={16} weight={600}>- {t(goalStatusKey(goal.status))}+ <Flexbox horizontal className={styles.metrics} gap={8} wrap={'wrap'}>+ <Metric+ label={t('goalProcess.metrics.status')}+ value={+ <>+ <GoalStatusGlyph size={16} status={goal.status} />+ <Text fontSize={16} weight={600}>+ {t(goalStatusKey(goal.status))}+ </Text>+ </>+ }+ onClick={open('lifecycle')}+ />+ <Metric+ label={t('goalProcess.metrics.tasks')}+ value={+ <Text fontSize={16} weight={600}>+ {tasks}+ </Text>+ }+ onClick={open('tasks')}+ />+ <Metric+ label={t('goalProcess.metrics.findings')}+ value={+ <Text fontSize={16} weight={600}>+ {findings}+ </Text>+ }+ onClick={open('findings')}+ />+ <Metric+ label={t('goalProcess.metrics.budget')}+ value={+ <Text fontSize={16} weight={600}>+ {budgetText}+ </Text>+ }+ onClick={open('budget')}+ />+ <Metric+ label={t('goalProcess.metrics.duration')}+ value={+ <Text fontSize={16} weight={600}>+ {durationText}+ </Text>+ }+ onClick={open('duration')}+ />+ <Metric+ label={t('goalProcess.metrics.liveness')}+ value={<LivenessValue active={liveness.active} latest={liveness.latest} />}+ onClick={open('liveness')}+ />+ </Flexbox>+ {goal.requirement && (+ <Flexbox gap={4} paddingBlock={'8px 0'}>+ <Text fontSize={12} type={'secondary'} weight={500}>+ {t('goalProcess.requirement')}</Text>+ {/* Generated acceptance criteria run long — clamp like the task+ instruction does, with the shared show-more affordance. */}+ <CollapsibleContent maxHeight={160}>+ <Text fontSize={14} style={{ lineHeight: 1.65, whiteSpace: 'pre-wrap' }}>+ {goal.requirement}+ </Text>+ </CollapsibleContent></Flexbox>- <Text fontSize={12} type={'secondary'}>- {t('goalProcess.metrics.status')}- </Text>- </Flexbox>- <Flexbox className={styles.metric} gap={2}>- <Text fontSize={18} weight={600}>- {tasks}- </Text>- <Text fontSize={12} type={'secondary'}>- {t('goalProcess.metrics.tasks')}- </Text>- </Flexbox>- <Flexbox className={styles.metric} gap={2}>- <Text fontSize={18} weight={600}>- {findings}- </Text>- <Text fontSize={12} type={'secondary'}>- {t('goalProcess.metrics.findings')}- </Text>- </Flexbox>+ )}</Flexbox>- {goal.requirement && (- <Flexbox gap={4} paddingBlock={'8px 0'}>- <Text fontSize={12} type={'secondary'} weight={500}>- {t('goalProcess.requirement')}- </Text>- <Text fontSize={14} style={{ lineHeight: 1.65, whiteSpace: 'pre-wrap' }}>- {goal.requirement}- </Text>- </Flexbox>- )}- </Flexbox>- <ProcessControl goalId={goal.id} />- </WideScreenContainer>+ <ProcessControl goalId={goal.id} />+ </WideScreenContainer>+ </Flexbox></Flexbox>++ {/* Same Portal the conversation surface uses — the drill-down chain+ (metric / node → task detail → topic) rides its view stack, and the+ header's back arrow and close come for free. */}+ <RightPanel+ defaultWidth={440}+ expand={showPortal}+ maxWidth={720}+ minWidth={360}+ onExpandChange={(next) => {+ if (!next) clearPortalStack();+ }}+ >+ <PortalContent />+ </RightPanel></Flexbox>);});diff --git a/src/features/AgentGoals/ProcessControl/Findings.tsx b/src/features/AgentGoals/ProcessControl/Findings.tsxindex eb338b1c278..ef787aeea33 100644--- a/src/features/AgentGoals/ProcessControl/Findings.tsx+++ b/src/features/AgentGoals/ProcessControl/Findings.tsx@@ -1,6 +1,6 @@'use client';-import { Flexbox, Icon } from '@lobehub/ui';+import { Flexbox, Icon, Markdown } from '@lobehub/ui';import { Text } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar, cx } from 'antd-style';import { ChevronRight } from 'lucide-react';@@ -101,10 +101,12 @@ const FindingRow = memo<{ onSelect: (nodeId: string) => void; view: GoalNodeView</Text></Flexbox>))}+ {/* The description is the producing run's handoff — actual Markdown+ (tables, code blocks), not plain text. Render it as such. */}{view.node.description && (- <Text fontSize={13} style={{ whiteSpace: 'pre-wrap' }}>+ <Markdown fontSize={13} variant={'chat'}>{view.node.description}- </Text>+ </Markdown>)}{view.producedBy && (<Flexboxdiff --git a/src/features/AgentGoals/ProcessControl/Frontier.tsx b/src/features/AgentGoals/ProcessControl/Frontier.tsxindex c614d1e753e..5e8ccadb6ad 100644--- a/src/features/AgentGoals/ProcessControl/Frontier.tsx+++ b/src/features/AgentGoals/ProcessControl/Frontier.tsx@@ -103,7 +103,6 @@ const styles = createStaticStyles(({ css }) => ({export interface FrontierActions {addTask: (title: string) => Promise<void>;- advance: () => void;decide: (decisionId: string, optionId: string, resolution?: string) => void;}@@ -323,18 +322,6 @@ const FrontierRow = memo<{<Flexbox horizontal align={'center'} gap={8} style={{ flex: 'none' }}>{item.kind === 'running' && <RunningClock startedAt={view.startedAt} />}{item.kind === 'done' && <DoneTime view={view} />}- {item.kind === 'stale' && canEdit && (- <Button- size={'small'}- type={'primary'}- onClick={(event) => {- stop(event);- actions.advance();- }}- >- {t('goalProcess.advance.label')}- </Button>- )}{item.kind === 'gate' &&canEdit &&view.decision?.options?.map((option) => (diff --git a/src/features/AgentGoals/ProcessControl/index.tsx b/src/features/AgentGoals/ProcessControl/index.tsxindex 9955badf93d..adc41e0d359 100644--- a/src/features/AgentGoals/ProcessControl/index.tsx+++ b/src/features/AgentGoals/ProcessControl/index.tsx@@ -1,14 +1,15 @@'use client';-import { Accordion, AccordionItem, Flexbox, Icon, Tooltip } from '@lobehub/ui';-import { Button, Tag, Text, toast } from '@lobehub/ui/base-ui';+import { Accordion, AccordionItem, Flexbox, Icon } from '@lobehub/ui';+import { Button, Tag, Text } from '@lobehub/ui/base-ui';import { createStaticStyles } from 'antd-style';-import { Pause, Play, StepForward } from 'lucide-react';+import { Pause, Play } from 'lucide-react';import { memo, useCallback, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';import { usePermission } from '@/hooks/usePermission';import { goalService } from '@/services/goal';+import { useChatStore } from '@/store/chat';import { goalSelectors, useGoalStore } from '@/store/goal';import Activity from './Activity';@@ -39,48 +40,43 @@ const ProcessControl = memo<ProcessControlProps>(({ goalId }) => {const { t } = useTranslation('chat');const { allowed: canEdit } = usePermission('create_content');const [selectedId, setSelectedId] = useState<string>();- const [advancing, setAdvancing] = useState(false);const useFetchGoalGraph = useGoalStore((s) => s.useFetchGoalGraph);const decideGoal = useGoalStore((s) => s.decideGoal);const pauseGoal = useGoalStore((s) => s.pauseGoal);const resumeGoal = useGoalStore((s) => s.resumeGoal);- const advanceGoalNow = useGoalStore((s) => s.advanceGoal);const refreshGoalGraph = useGoalStore((s) => s.refreshGoalGraph);+ const openTaskDetail = useChatStore((s) => s.openTaskDetail);+ const openGoalNode = useChatStore((s) => s.openGoalNode);useFetchGoalGraph(goalId);const snapshot = useGoalStore(goalSelectors.goalGraph(goalId));const graph = useMemo(() => (snapshot ? buildGoalGraphView(snapshot) : undefined), [snapshot]);- // One press hands the goal to the server's coordinator, which runs it as far- // as it can go in one call and then keeps going on its own as each Work Task- // settles. A single coordinator step is an implementation unit — a press that- // only ticked once usually looked like it did nothing, because the very next- // step is what dispatches the task.- const advance = useCallback(async () => {- if (advancing) return;- setAdvancing(true);- try {- const result = await advanceGoalNow(goalId);- toast.info(result.message);- } catch (error) {- toast.error((error as Error).message);- } finally {- setAdvancing(false);- }- }, [advancing, advanceGoalNow, goalId]);-const actions: FrontierActions = useMemo(() => ({addTask: async (title: string) => {await goalService.addNode({ id: goalId, kind: 'task', title });await refreshGoalGraph(goalId);},- advance: () => void advance(),decide: (decisionId, optionId, resolution) =>void decideGoal(goalId, { decisionId, optionId, resolution }),}),- [advance, decideGoal, goalId, refreshGoalGraph],+ [decideGoal, goalId, refreshGoalGraph],+ );++ // Every click funnels here: keep the map highlight (spatial continuity) and+ // open the drill-down — a dispatched Work goes straight to its Task detail,+ // everything else opens the node view. This is the chain the page was+ // missing: node → task → topic conversation.+ const select = useCallback(+ (nodeId: string) => {+ setSelectedId(nodeId);+ const taskId = graph?.byId[nodeId]?.node.taskId;+ if (taskId) openTaskDetail(taskId);+ else openGoalNode(goalId, nodeId);+ },+ [goalId, graph, openGoalNode, openTaskDetail],);// Task-carried goals share the `goals` table but never grow a graph. Nothing@@ -89,8 +85,9 @@ const ProcessControl = memo<ProcessControlProps>(({ goalId }) => {const paused = graph.goal.status === 'paused';// A closed goal cannot move: the coordinator returns immediately for these,- // so Advance would report nothing happened and a Work added here would sit- // `proposed` forever. Stop offering actions that cannot land.+ // and a Work added here would sit `proposed` forever. Stop offering actions+ // that cannot land. The goal otherwise advances entirely on its own — the+ // only legitimate human control over its pace is pause/resume.const closed = ['achieved', 'canceled', 'failed'].includes(graph.goal.status);const canAct = canEdit && !closed;@@ -99,26 +96,13 @@ const ProcessControl = memo<ProcessControlProps>(({ goalId }) => {<Flexbox gap={12}><Flexbox horizontal align={'center'} gap={8}>{canAct && (- <>- <Tooltip title={t('goalProcess.advance.tooltip')}>- <Button- icon={<Icon icon={StepForward} />}- loading={advancing}- size={'small'}- type={'primary'}- onClick={advance}- >- {advancing ? t('goalProcess.advance.running') : t('goalProcess.advance.label')}- </Button>- </Tooltip>- <Button- icon={<Icon icon={paused ? Play : Pause} />}- size={'small'}- onClick={() => void (paused ? resumeGoal(goalId) : pauseGoal(goalId))}- >- {paused ? t('goalProcess.resume') : t('goalProcess.pause')}- </Button>- </>+ <Button+ icon={<Icon icon={paused ? Play : Pause} />}+ size={'small'}+ onClick={() => void (paused ? resumeGoal(goalId) : pauseGoal(goalId))}+ >+ {paused ? t('goalProcess.resume') : t('goalProcess.pause')}+ </Button>)}{paused && (<Text fontSize={12} type={'secondary'}>@@ -127,10 +111,10 @@ const ProcessControl = memo<ProcessControlProps>(({ goalId }) => {)}</Flexbox>- <Frontier actions={actions} canEdit={canAct} graph={graph} onSelect={setSelectedId} />+ <Frontier actions={actions} canEdit={canAct} graph={graph} onSelect={select} /></Flexbox>- <Graph graph={graph} selectedId={selectedId} onSelect={setSelectedId} />+ <Graph graph={graph} selectedId={selectedId} onSelect={select} /><Accordion defaultExpandedKeys={['findings', 'activity']} gap={0}><AccordionItem@@ -147,7 +131,7 @@ const ProcessControl = memo<ProcessControlProps>(({ goalId }) => {}><Flexbox className={styles.section}>- <Findings graph={graph} onSelect={setSelectedId} />+ <Findings graph={graph} onSelect={select} /></Flexbox></AccordionItem><AccordionItem@@ -163,7 +147,7 @@ const ProcessControl = memo<ProcessControlProps>(({ goalId }) => {}><Flexbox className={styles.section}>- <Activity graph={graph} onSelect={setSelectedId} />+ <Activity graph={graph} onSelect={select} /></Flexbox></AccordionItem></Accordion>diff --git a/src/features/AgentGoals/goalPresentation.test.ts b/src/features/AgentGoals/goalPresentation.test.tsindex 51d0d75c34e..e4bae48fb1b 100644--- a/src/features/AgentGoals/goalPresentation.test.ts+++ b/src/features/AgentGoals/goalPresentation.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest';-import { goalStatusKey } from './goalPresentation';+import { formatSpan, goalStatusKey } from './goalPresentation';describe('goalStatusKey', () => {it('maps every lifecycle state to a list-vocabulary key', () => {@@ -14,3 +14,14 @@ describe('goalStatusKey', () => {expect(goalStatusKey('failed')).toBe('goalList.status.error');});});++describe('formatSpan', () => {+ it('renders sub-hour spans as minutes and clamps to at least one minute', () => {+ expect(formatSpan(4 * 60_000)).toBe('4m');+ expect(formatSpan(10_000)).toBe('1m');+ });++ it('splits hour-plus spans into hours and minutes', () => {+ expect(formatSpan(71 * 60_000)).toBe('1h 11m');+ });+});diff --git a/src/features/AgentGoals/goalPresentation.ts b/src/features/AgentGoals/goalPresentation.tsindex 720dc2141cb..133c13930de 100644--- a/src/features/AgentGoals/goalPresentation.ts+++ b/src/features/AgentGoals/goalPresentation.ts@@ -17,6 +17,14 @@ export type GoalStatusKey = (typeof goalStatusKeyMap)[GoalStatus];export const goalStatusKey = (status: GoalStatus): GoalStatusKey => goalStatusKeyMap[status];+/** `1h 23m` / `4m` — locale-neutral compact span for header metrics and drill-downs. */+export const formatSpan = (ms: number): string => {+ const minutes = Math.max(1, Math.round(ms / 60_000));+ const h = Math.floor(minutes / 60);+ const m = minutes % 60;+ return h > 0 ? `${h}h ${m}m` : `${m}m`;+};+/** Goal lifecycle state → the execution-status vocabulary the shared glyphs use. */export const goalStatusToTaskStatus = (goalStatus: GoalStatus): TaskStatus => {switch (goalStatus) {diff --git a/src/features/Portal/GoalMetric/Body.tsx b/src/features/Portal/GoalMetric/Body.tsxnew file mode 100644index 00000000000..aba936408de--- /dev/null+++ b/src/features/Portal/GoalMetric/Body.tsx@@ -0,0 +1,345 @@+import { Flexbox } from '@lobehub/ui';+import { Tag, Text } from '@lobehub/ui/base-ui';+import { createStaticStyles, cssVar } from 'antd-style';+import dayjs from 'dayjs';+import { memo, type ReactNode, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import { formatSpan } from '@/features/AgentGoals/goalPresentation';+import {+ buildGoalGraphView,+ type GoalGraphView,+} from '@/features/AgentGoals/ProcessControl/goalGraphViewModel';+import { KindDot } from '@/features/AgentGoals/ProcessControl/shared';+import { useChatStore } from '@/store/chat';+import { chatPortalSelectors } from '@/store/chat/selectors';+import { goalSelectors, useGoalStore } from '@/store/goal';++/**+ * Drill-down behind each header metric of the goal detail page. Every view is+ * an honest projection of the `goal.graph` snapshot — where the product does+ * not yet model a number (per-round spend), the view says where the data+ * lives instead of inventing a value.+ */++const styles = createStaticStyles(({ css }) => ({+ label: css`+ font-size: 12px;+ font-weight: 600;+ color: ${cssVar.colorTextSecondary};+ `,+ mono: css`+ font-family: ${cssVar.fontFamilyCode};+ font-variant-numeric: tabular-nums;+ `,+ row: css`+ cursor: pointer;+ padding-block: 6px;+ padding-inline: 6px;+ border-radius: ${cssVar.borderRadiusSM};++ &:hover {+ background: ${cssVar.colorFillQuaternary};+ }+ `,+ staticRow: css`+ padding-block: 4px;+ `,+}));++const NodeRow = memo<{+ extra?: ReactNode;+ goalId: string;+ nodeId: string;+ graph: GoalGraphView;+}>(({ extra, goalId, graph, nodeId }) => {+ const openGoalNode = useChatStore((s) => s.openGoalNode);+ const view = graph.byId[nodeId];+ if (!view) return null;++ return (+ <Flexbox+ horizontal+ align={'center'}+ className={styles.row}+ gap={8}+ onClick={() => openGoalNode(goalId, nodeId)}+ >+ {view.seq !== undefined && (+ <Text className={styles.mono} fontSize={12} style={{ flex: 'none' }} type={'secondary'}>+ #{view.seq}+ </Text>+ )}+ <KindDot kind={view.node.kind} />+ <Text ellipsis style={{ flex: 1, minWidth: 0 }} weight={500}>+ {view.node.title}+ </Text>+ {extra}+ </Flexbox>+ );+});++NodeRow.displayName = 'GoalMetricNodeRow';++const Lifecycle = memo<{ goalId: string; graph: GoalGraphView }>(({ graph }) => {+ const { t } = useTranslation('chat');+ const snapshot = useGoalStore(goalSelectors.goalGraph(graph.goal.id));+ const events = useMemo(+ () =>+ [...(snapshot?.events ?? [])].sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()),+ [snapshot],+ );++ if (events.length === 0)+ return (+ <Text fontSize={13} type={'secondary'}>+ {t('goalProcess.metricDetail.lifecycle.empty')}+ </Text>+ );++ return (+ <Flexbox gap={0}>+ {events.map((event) => {+ const subject = graph.byId[event.entityId]?.node.title;+ return (+ <Flexbox+ horizontal+ align={'baseline'}+ className={styles.staticRow}+ gap={10}+ key={event.id}+ >+ <Text className={styles.mono} fontSize={12} style={{ flex: 'none' }} type={'secondary'}>+ {dayjs(event.createdAt).format('MM-DD HH:mm')}+ </Text>+ <Flexbox flex={1} gap={1} style={{ minWidth: 0 }}>+ <Text fontSize={13}>+ {t(`goalProcess.eventType.${event.eventType}` as const)}+ {subject ? ` · ${subject}` : ''}+ </Text>+ <Text fontSize={12} type={'secondary'}>+ {t(`goalProcess.actor.${event.actorType}` as const)}+ {event.reason ? ` · ${event.reason}` : ''}+ </Text>+ </Flexbox>+ </Flexbox>+ );+ })}+ </Flexbox>+ );+});++Lifecycle.displayName = 'GoalMetricLifecycle';++const Tasks = memo<{ goalId: string; graph: GoalGraphView }>(({ goalId, graph }) => {+ const { t } = useTranslation('chat');+ const works = graph.nodes.filter((view) => view.node.kind === 'task');++ return (+ <Flexbox gap={0}>+ {works.map((view) => (+ <NodeRow+ goalId={goalId}+ graph={graph}+ key={view.node.id}+ nodeId={view.node.id}+ extra={+ <Tag size={'small'}>{t(`goalProcess.nodeStatus.${view.node.status}` as const)}</Tag>+ }+ />+ ))}+ </Flexbox>+ );+});++Tasks.displayName = 'GoalMetricTasks';++const Findings = memo<{ goalId: string; graph: GoalGraphView }>(({ goalId, graph }) => {+ const { t } = useTranslation('chat');+ const findings = [...graph.findings].sort(+ (a, b) =>+ (b.node.resolvedAt ?? b.node.createdAt).getTime() -+ (a.node.resolvedAt ?? a.node.createdAt).getTime(),+ );++ return (+ <Flexbox gap={0}>+ {findings.map((view) => (+ <NodeRow+ goalId={goalId}+ graph={graph}+ key={view.node.id}+ nodeId={view.node.id}+ extra={+ view.producedBy ? (+ <Text+ ellipsis+ fontSize={12}+ style={{ flexShrink: 1, minWidth: 0 }}+ type={'secondary'}+ >+ {t('goalProcess.findings.from', { title: view.producedBy.title })}+ </Text>+ ) : undefined+ }+ />+ ))}+ </Flexbox>+ );+});++Findings.displayName = 'GoalMetricFindings';++const Budget = memo<{ graph: GoalGraphView }>(({ graph }) => {+ const { t } = useTranslation('chat');+ const { maxRounds, maxTotalCost } = graph.goal;++ return (+ <Flexbox gap={14}>+ <Flexbox gap={2}>+ <span className={styles.label}>{t('goalProcess.metricDetail.budget.totalCost')}</span>+ <Text className={styles.mono} style={{ fontSize: 20 }} weight={600}>+ {maxTotalCost === null+ ? t('goalProcess.metricDetail.budget.uncapped')+ : `$${maxTotalCost}`}+ </Text>+ </Flexbox>+ <Flexbox gap={2}>+ <span className={styles.label}>{t('goalProcess.metricDetail.budget.rounds')}</span>+ <Text className={styles.mono} style={{ fontSize: 20 }} weight={600}>+ {maxRounds === null ? t('goalProcess.metricDetail.budget.uncapped') : maxRounds}+ </Text>+ </Flexbox>+ {/* Per-round spend is recorded on each dispatched Task, not on the goal+ row — say so instead of rendering a fabricated total. */}+ <Text fontSize={12} type={'secondary'}>+ {t('goalProcess.metricDetail.budget.spendNote')}+ </Text>+ </Flexbox>+ );+});++Budget.displayName = 'GoalMetricBudget';++const Duration = memo<{ goalId: string; graph: GoalGraphView }>(({ goalId, graph }) => {+ const { t } = useTranslation('chat');+ const { completedAt, startedAt } = graph.goal;+ const end = completedAt ?? new Date();+ const works = graph.nodes.filter((view) => view.node.kind === 'task' && view.attempts.length > 0);++ return (+ <Flexbox gap={14}>+ {startedAt && (+ <Flexbox gap={2}>+ <span className={styles.label}>{t('goalProcess.metricDetail.duration.total')}</span>+ <Text className={styles.mono} style={{ fontSize: 20 }} weight={600}>+ {formatSpan(end.getTime() - startedAt.getTime())}+ </Text>+ <Text fontSize={12} type={'secondary'}>+ {dayjs(startedAt).format('MM-DD HH:mm')} →{' '}+ {completedAt+ ? dayjs(completedAt).format('MM-DD HH:mm')+ : t('goalProcess.metricDetail.duration.now')}+ </Text>+ </Flexbox>+ )}+ <Flexbox gap={4}>+ <span className={styles.label}>{t('goalProcess.metricDetail.duration.taskSpans')}</span>+ <Flexbox gap={0}>+ {works.map((view) => {+ const first = view.attempts[0];+ const last = view.attempts.at(-1)!;+ const spanEnd = last.endedAt ?? new Date();+ return (+ <NodeRow+ goalId={goalId}+ graph={graph}+ key={view.node.id}+ nodeId={view.node.id}+ extra={+ <Text+ className={styles.mono}+ fontSize={12}+ style={{ flex: 'none' }}+ type={'secondary'}+ >+ {dayjs(first.startedAt).format('HH:mm')}–+ {last.endedAt ? dayjs(last.endedAt).format('HH:mm') : '…'} ·{' '}+ {formatSpan(spanEnd.getTime() - first.startedAt.getTime())}+ </Text>+ }+ />+ );+ })}+ </Flexbox>+ </Flexbox>+ </Flexbox>+ );+});++Duration.displayName = 'GoalMetricDuration';++const Liveness = memo<{ goalId: string; graph: GoalGraphView }>(({ goalId, graph }) => {+ const { t } = useTranslation('chat');+ const latest = useMemo(+ () =>+ graph.nodes.reduce<Date | undefined>((max, view) => {+ const at = view.node.updatedAt;+ return !max || at > max ? at : max;+ }, undefined),+ [graph],+ );+ const running = graph.nodes.filter(+ (view) => view.node.kind === 'task' && view.node.status === 'active',+ );++ return (+ <Flexbox gap={14}>+ <Flexbox gap={2}>+ <span className={styles.label}>{t('goalProcess.metricDetail.liveness.latest')}</span>+ <Text className={styles.mono} style={{ fontSize: 20 }} weight={600}>+ {latest ? dayjs(latest).format('MM-DD HH:mm') : '—'}+ </Text>+ </Flexbox>+ {running.length > 0 && (+ <Flexbox gap={4}>+ <span className={styles.label}>{t('goalProcess.metricDetail.liveness.running')}</span>+ <Flexbox gap={0}>+ {running.map((view) => (+ <NodeRow goalId={goalId} graph={graph} key={view.node.id} nodeId={view.node.id} />+ ))}+ </Flexbox>+ </Flexbox>+ )}+ {/* The contract that makes "walk away" safe: event-driven advancement+ plus the recovery sweep. State it where the user checks for a pulse. */}+ <Text fontSize={12} style={{ lineHeight: 1.7 }} type={'secondary'}>+ {t('goalProcess.metricDetail.liveness.driver')}+ </Text>+ </Flexbox>+ );+});++Liveness.displayName = 'GoalMetricLiveness';++const Body = memo(() => {+ const view = useChatStore(chatPortalSelectors.goalMetricView);+ const snapshot = useGoalStore(goalSelectors.goalGraph(view?.goalId ?? ''));+ const graph = useMemo(() => (snapshot ? buildGoalGraphView(snapshot) : undefined), [snapshot]);++ if (!view || !graph) return null;+ const { goalId, metric } = view;++ return (+ <Flexbox flex={1} padding={16} style={{ minHeight: 0, overflowY: 'auto' }}>+ {metric === 'lifecycle' && <Lifecycle goalId={goalId} graph={graph} />}+ {metric === 'tasks' && <Tasks goalId={goalId} graph={graph} />}+ {metric === 'findings' && <Findings goalId={goalId} graph={graph} />}+ {metric === 'budget' && <Budget graph={graph} />}+ {metric === 'duration' && <Duration goalId={goalId} graph={graph} />}+ {metric === 'liveness' && <Liveness goalId={goalId} graph={graph} />}+ </Flexbox>+ );+});++export default Body;diff --git a/src/features/Portal/GoalMetric/Title.tsx b/src/features/Portal/GoalMetric/Title.tsxnew file mode 100644index 00000000000..8e499f404df--- /dev/null+++ b/src/features/Portal/GoalMetric/Title.tsx@@ -0,0 +1,20 @@+import { Text } from '@lobehub/ui/base-ui';+import { memo } from 'react';+import { useTranslation } from 'react-i18next';++import { useChatStore } from '@/store/chat';+import { chatPortalSelectors } from '@/store/chat/selectors';++const Title = memo(() => {+ const { t } = useTranslation('chat');+ const view = useChatStore(chatPortalSelectors.goalMetricView);+ if (!view) return null;++ return (+ <Text style={{ fontSize: 14 }} weight={500}>+ {t(`goalProcess.metricDetail.${view.metric}.title` as const)}+ </Text>+ );+});++export default Title;diff --git a/src/features/Portal/GoalMetric/index.ts b/src/features/Portal/GoalMetric/index.tsnew file mode 100644index 00000000000..26d41936904--- /dev/null+++ b/src/features/Portal/GoalMetric/index.ts@@ -0,0 +1,5 @@+import { type PortalImpl } from '../type';+import Body from './Body';+import Title from './Title';++export const GoalMetric: PortalImpl = { Body, Title };diff --git a/src/features/Portal/GoalNode/Body.tsx b/src/features/Portal/GoalNode/Body.tsxnew file mode 100644index 00000000000..73b16c18e04--- /dev/null+++ b/src/features/Portal/GoalNode/Body.tsx@@ -0,0 +1,245 @@+import { Flexbox, Icon, Markdown } from '@lobehub/ui';+import { Button, Tag, Text } from '@lobehub/ui/base-ui';+import { createStaticStyles, cssVar } from 'antd-style';+import dayjs from 'dayjs';+import { SquareArrowOutUpRight } from 'lucide-react';+import { memo, type ReactNode, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import {+ buildGoalGraphView,+ type GoalNodeView,+} from '@/features/AgentGoals/ProcessControl/goalGraphViewModel';+import { KindDot } from '@/features/AgentGoals/ProcessControl/shared';+import { useChatStore } from '@/store/chat';+import { chatPortalSelectors } from '@/store/chat/selectors';+import { goalSelectors, useGoalStore } from '@/store/goal';++/**+ * Drill-down for one Goal Graph node. Everything rendered here is derived from+ * the same `goal.graph` snapshot the page already holds — no extra fetch. A+ * Work node links onward to its Task detail (the deep half of the chain:+ * node → task → topic conversation).+ */++const styles = createStaticStyles(({ css }) => ({+ attempt: css`+ padding-block: 6px;++ & + & {+ border-block-start: 1px dashed ${cssVar.colorBorderSecondary};+ }+ `,+ label: css`+ font-size: 12px;+ font-weight: 600;+ color: ${cssVar.colorTextSecondary};+ `,+ linkRow: css`+ cursor: pointer;+ border-radius: ${cssVar.borderRadiusSM};++ &:hover {+ background: ${cssVar.colorFillQuaternary};+ }+ `,+ mono: css`+ font-family: ${cssVar.fontFamilyCode};+ font-variant-numeric: tabular-nums;+ `,+}));++const Section = memo<{ children: ReactNode; title: string }>(({ children, title }) => (+ <Flexbox gap={6}>+ <span className={styles.label}>{title}</span>+ {children}+ </Flexbox>+));++Section.displayName = 'GoalNodePortalSection';++/** The complete ledger — unlike the frontier row, no rank gate hides it here. */+const AttemptLedger = memo<{ view: GoalNodeView }>(({ view }) => {+ const { t } = useTranslation('chat');+ if (view.attempts.length === 0) return null;++ return (+ <Section title={t('goalProcess.attempts.title')}>+ <Flexbox gap={0}>+ {view.attempts.map((attempt) => (+ <Flexbox+ horizontal+ align={'baseline'}+ className={styles.attempt}+ gap={10}+ key={attempt.index}+ >+ <Text className={styles.mono} fontSize={12} style={{ flex: 'none' }} type={'secondary'}>+ {dayjs(attempt.startedAt).format('MM-DD HH:mm')}+ </Text>+ <Text fontSize={12} style={{ flex: 'none' }} type={'secondary'}>+ {t('goalProcess.attempts.nth', { index: attempt.index })}+ </Text>+ <Text+ fontSize={12}+ style={{ flex: 'none' }}+ type={+ attempt.outcome === 'passed'+ ? 'success'+ : attempt.outcome === 'failed'+ ? 'danger'+ : 'secondary'+ }+ >+ {t(`goalProcess.attempts.${attempt.outcome}` as const)}+ </Text>+ <Text fontSize={12} style={{ flex: 1, minWidth: 0 }} type={'secondary'}>+ {attempt.reason ?? ''}+ </Text>+ </Flexbox>+ ))}+ </Flexbox>+ </Section>+ );+});++AttemptLedger.displayName = 'GoalNodePortalAttempts';++const NodeLinkRow = memo<{ onClick: () => void; text: string; view: GoalNodeView }>(+ ({ onClick, text, view }) => (+ <Flexbox+ horizontal+ align={'center'}+ className={styles.linkRow}+ gap={6}+ paddingBlock={4}+ paddingInline={4}+ onClick={onClick}+ >+ <KindDot kind={view.node.kind} />+ <Text ellipsis fontSize={12} type={'secondary'}>+ {text}+ </Text>+ </Flexbox>+ ),+);++NodeLinkRow.displayName = 'GoalNodePortalLink';++const Body = memo(() => {+ const { t } = useTranslation('chat');+ const view = useChatStore(chatPortalSelectors.goalNodeView);+ const openTaskDetail = useChatStore((s) => s.openTaskDetail);+ const openGoalNode = useChatStore((s) => s.openGoalNode);+ const snapshot = useGoalStore(goalSelectors.goalGraph(view?.goalId ?? ''));++ const graph = useMemo(() => (snapshot ? buildGoalGraphView(snapshot) : undefined), [snapshot]);+ if (!view || !graph) return null;++ const nodeView = graph.byId[view.nodeId];+ if (!nodeView) return null;+ const { node } = nodeView;+ const isFinding = node.kind === 'finding';++ return (+ <Flexbox flex={1} gap={16} padding={16} style={{ minHeight: 0, overflowY: 'auto' }}>+ <Flexbox horizontal align={'center'} gap={8}>+ <Tag size={'small'}>{t(`goalProcess.kind.${node.kind}` as const)}</Tag>+ <Tag size={'small'}>{t(`goalProcess.nodeStatus.${node.status}` as const)}</Tag>+ {nodeView.humanTouches.length > 0 && (+ <Tag size={'small'}>{t('goalProcess.node.humanTouched')}</Tag>+ )}+ </Flexbox>++ {node.description &&+ (isFinding ? (+ // A finding's description is the run's handoff — real Markdown, so+ // render it as such instead of pre-wrapped source text.+ <Markdown fontSize={13} variant={'chat'}>+ {node.description}+ </Markdown>+ ) : (+ <Section+ title={+ node.kind === 'task'+ ? t('goalProcess.node.instruction')+ : t('goalProcess.node.description')+ }+ >+ <Text fontSize={13} style={{ lineHeight: 1.7, whiteSpace: 'pre-wrap' }}>+ {node.description}+ </Text>+ </Section>+ ))}++ {node.kind === 'decision' && nodeView.decision && (+ <Section title={t('goalProcess.gate.why')}>+ <Text fontSize={13}>{nodeView.decision.question}</Text>+ </Section>+ )}++ <AttemptLedger view={nodeView} />++ {nodeView.findings.length > 0 && (+ <Section title={t('goalProcess.node.producedFindings')}>+ <Flexbox gap={2}>+ {nodeView.findings.map((finding) => {+ const findingView = graph.byId[finding.id];+ if (!findingView) return null;+ return (+ <NodeLinkRow+ key={finding.id}+ text={finding.title}+ view={findingView}+ onClick={() => openGoalNode(view.goalId, finding.id)}+ />+ );+ })}+ </Flexbox>+ </Section>+ )}++ {nodeView.producedBy && graph.byId[nodeView.producedBy.id] && (+ <Section title={t('goalProcess.node.producedByTitle')}>+ <NodeLinkRow+ text={nodeView.producedBy.title}+ view={graph.byId[nodeView.producedBy.id]}+ onClick={() => openGoalNode(view.goalId, nodeView.producedBy!.id)}+ />+ </Section>+ )}++ {nodeView.blockers.length > 0 && (+ <Section title={t('goalProcess.node.blockers')}>+ <Flexbox gap={2}>+ {nodeView.blockers.map((blocker) => {+ const blockerView = graph.byId[blocker.id];+ if (!blockerView) return null;+ return (+ <NodeLinkRow+ key={blocker.id}+ text={blocker.title}+ view={blockerView}+ onClick={() => openGoalNode(view.goalId, blocker.id)}+ />+ );+ })}+ </Flexbox>+ </Section>+ )}++ {node.taskId && (+ <Button+ icon={<Icon icon={SquareArrowOutUpRight} />}+ size={'small'}+ style={{ alignSelf: 'flex-start' }}+ onClick={() => openTaskDetail(node.taskId!)}+ >+ {t('goalProcess.node.openTask')}+ </Button>+ )}+ </Flexbox>+ );+});++export default Body;diff --git a/src/features/Portal/GoalNode/Title.tsx b/src/features/Portal/GoalNode/Title.tsxnew file mode 100644index 00000000000..32abefce7dc--- /dev/null+++ b/src/features/Portal/GoalNode/Title.tsx@@ -0,0 +1,32 @@+import { Flexbox } from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';+import { memo, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import { buildGoalGraphView } from '@/features/AgentGoals/ProcessControl/goalGraphViewModel';+import { KindIcon } from '@/features/AgentGoals/ProcessControl/shared';+import { useChatStore } from '@/store/chat';+import { chatPortalSelectors } from '@/store/chat/selectors';+import { goalSelectors, useGoalStore } from '@/store/goal';+import { oneLineEllipsis } from '@/styles';++const Title = memo(() => {+ const { t } = useTranslation('chat');+ const view = useChatStore(chatPortalSelectors.goalNodeView);+ const snapshot = useGoalStore(goalSelectors.goalGraph(view?.goalId ?? ''));+ const node = useMemo(() => {+ if (!snapshot || !view) return undefined;+ return buildGoalGraphView(snapshot).byId[view.nodeId]?.node;+ }, [snapshot, view]);++ return (+ <Flexbox horizontal align={'center'} flex={1} gap={8} style={{ minWidth: 0 }}>+ {node && <KindIcon kind={node.kind} />}+ <Text className={oneLineEllipsis} style={{ flex: 1, fontSize: 14, minWidth: 0 }}>+ {node?.title ?? t('goalProcess.node.detailTitle')}+ </Text>+ </Flexbox>+ );+});++export default Title;diff --git a/src/features/Portal/GoalNode/index.ts b/src/features/Portal/GoalNode/index.tsnew file mode 100644index 00000000000..1f53031241b--- /dev/null+++ b/src/features/Portal/GoalNode/index.ts@@ -0,0 +1,5 @@+import { type PortalImpl } from '../type';+import Body from './Body';+import Title from './Title';++export const GoalNode: PortalImpl = { Body, Title };diff --git a/src/features/Portal/router.tsx b/src/features/Portal/router.tsxindex eac49ec196b..dcd285459e7 100644--- a/src/features/Portal/router.tsx+++ b/src/features/Portal/router.tsx@@ -13,6 +13,8 @@ import { Artifacts } from './Artifacts';import Header from './components/Header';import { Document } from './Document';import { FilePreview } from './FilePreview';+import { GoalMetric } from './GoalMetric';+import { GoalNode } from './GoalNode';import { GroupThread } from './GroupThread';import { HomeBody, HomeTitle } from './Home';import { LocalFile } from './LocalFile';@@ -40,6 +42,8 @@ const VIEW_COMPONENTS: Record<PortalViewType, PortalImpl> = {[PortalViewType.Document]: Document,[PortalViewType.Notebook]: Notebook,[PortalViewType.FilePreview]: FilePreview,+ [PortalViewType.GoalMetric]: GoalMetric,+ [PortalViewType.GoalNode]: GoalNode,[PortalViewType.LocalFile]: LocalFile,[PortalViewType.MessageDetail]: MessageDetail,[PortalViewType.ToolUI]: Plugins,diff --git a/src/proxy.ts b/src/proxy.tsindex a1eb38abbf7..25d116ad87a 100644--- a/src/proxy.ts+++ b/src/proxy.ts@@ -41,6 +41,10 @@ export const config = {'/tasks(.*)','/task','/task(.*)',+ '/goals',+ '/goals(.*)',+ '/goal',+ '/goal(.*)','/me','/me(.*)','/share(.*)',diff --git a/src/store/chat/slices/portal/action.test.ts b/src/store/chat/slices/portal/action.test.tsindex c2bbd3d87e2..2d75ea198db 100644--- a/src/store/chat/slices/portal/action.test.ts+++ b/src/store/chat/slices/portal/action.test.ts@@ -382,6 +382,60 @@ describe('chatDockSlice', () => {});});+ describe('goal drill-down', () => {+ it('openGoalNode pushes a GoalNode view and exposes it via selector', () => {+ const { result } = renderHook(() => useChatStore());++ act(() => {+ result.current.openGoalNode('goal_1', 'node_1');+ });++ expect(result.current.portalStack).toEqual([+ { goalId: 'goal_1', nodeId: 'node_1', type: PortalViewType.GoalNode },+ ]);+ expect(result.current.showPortal).toBe(true);+ expect(chatPortalSelectors.goalNodeView(result.current)).toEqual({+ goalId: 'goal_1',+ nodeId: 'node_1',+ type: PortalViewType.GoalNode,+ });+ });++ it('openGoalMetric pushes a GoalMetric view; a second metric replaces it in place', () => {+ const { result } = renderHook(() => useChatStore());++ act(() => {+ result.current.openGoalMetric('goal_1', 'budget');+ result.current.openGoalMetric('goal_1', 'liveness');+ });++ // Same view type replaces instead of stacking, so Back never walks+ // through a trail of metric tabs.+ expect(result.current.portalStack).toEqual([+ { goalId: 'goal_1', metric: 'liveness', type: PortalViewType.GoalMetric },+ ]);+ expect(chatPortalSelectors.goalMetricView(result.current)?.metric).toBe('liveness');+ });++ it('a work node drill-down stacks TaskDetail on top of GoalNode for Back navigation', () => {+ const { result } = renderHook(() => useChatStore());++ act(() => {+ result.current.openGoalNode('goal_1', 'node_1');+ result.current.openTaskDetail('task_1');+ });++ expect(result.current.portalStack).toHaveLength(2);+ expect(chatPortalSelectors.currentViewType(result.current)).toBe(PortalViewType.TaskDetail);++ act(() => {+ result.current.goBack();+ });++ expect(chatPortalSelectors.goalNodeView(result.current)?.nodeId).toBe('node_1');+ });+ });+describe('openLocalFile', () => {it('should add entry to openLocalFiles, set active, and push LocalFile view', () => {const { result } = renderHook(() => useChatStore());diff --git a/src/store/chat/slices/portal/action.ts b/src/store/chat/slices/portal/action.tsindex 8f6b30738ea..f65bf90e985 100644--- a/src/store/chat/slices/portal/action.ts+++ b/src/store/chat/slices/portal/action.ts@@ -13,7 +13,12 @@ import {createSandboxLocalFileScopeKey,getLocalFileTabId,} from './helpers';-import { type OpenLocalFileParams, type PortalFile, type PortalViewData } from './initialState';+import {+ type GoalMetricKind,+ type OpenLocalFileParams,+ type PortalFile,+ type PortalViewData,+} from './initialState';import { PortalViewType } from './initialState';// Helper to get current view type from stack@@ -629,6 +634,14 @@ export class ChatPortalActionImpl {this.#get().pushPortalView({ taskId, type: PortalViewType.TaskDetail });};+ openGoalNode = (goalId: string, nodeId: string): void => {+ this.#get().pushPortalView({ goalId, nodeId, type: PortalViewType.GoalNode });+ };++ openGoalMetric = (goalId: string, metric: GoalMetricKind): void => {+ this.#get().pushPortalView({ goalId, metric, type: PortalViewType.GoalMetric });+ };+openTopicCommentThread = (topicId: string,rootCommentId: string,diff --git a/src/store/chat/slices/portal/initialState.ts b/src/store/chat/slices/portal/initialState.tsindex 3e83da0754f..0c2f0f6d6e9 100644--- a/src/store/chat/slices/portal/initialState.ts+++ b/src/store/chat/slices/portal/initialState.ts@@ -16,6 +16,8 @@ export enum PortalViewType {Artifact = 'artifact',Document = 'document',FilePreview = 'filePreview',+ GoalMetric = 'goalMetric',+ GoalNode = 'goalNode',GroupThread = 'groupThread',Home = 'home',LocalFile = 'localFile',@@ -55,8 +57,18 @@ export interface OpenLocalFileEntry extends OpenLocalFileParams {id: string;}+/**+ * Which header metric of the goal detail page a drill-down inspects. Every+ * value is derivable from the `goal.graph` snapshot the page already holds —+ * none of these views require server work.+ */+export type GoalMetricKind =+ 'budget' | 'duration' | 'findings' | 'lifecycle' | 'liveness' | 'tasks';+export type PortalViewData =| { type: PortalViewType.Home }+ | { goalId: string; metric: GoalMetricKind; type: PortalViewType.GoalMetric }+ | { goalId: string; nodeId: string; type: PortalViewType.GoalNode }| { acceptanceId: string; type: PortalViewType.Acceptance }| { acceptanceId: string; checkId: string; type: PortalViewType.AcceptanceCheck }| { agentId: string; type: PortalViewType.AgentDetail }diff --git a/src/store/chat/slices/portal/selectors.ts b/src/store/chat/slices/portal/selectors.tsindex cda27983965..2c27e85347a 100644--- a/src/store/chat/slices/portal/selectors.ts+++ b/src/store/chat/slices/portal/selectors.ts@@ -249,6 +249,10 @@ const taskDetailId = (s: ChatStoreState): string | undefined => {return view?.taskId;};+// Goal detail drill-down selectors+const goalNodeView = (s: ChatStoreState) => getViewData(s, PortalViewType.GoalNode);+const goalMetricView = (s: ChatStoreState) => getViewData(s, PortalViewType.GoalMetric);+// Topic chat selectors — the second, side-by-side topic opened in the portalconst portalTopicId = (s: ChatStoreState): string | undefined => {const view = getViewData(s, PortalViewType.Topic);@@ -329,6 +333,10 @@ export const chatPortalSelectors = {previewFileId,chunkText,+ // Goal drill-down data+ goalMetricView,+ goalNodeView,+// Local file dataactiveLocalFileId,activeLocalFilePath,