import { ChevronDown, ChevronRight, FileText, Maximize2 } from "lucide-react"; import { branchFlow, branchSummaryItem, finalResultItem, multipathDecisionItem, multipathReviewItem, queryAttemptItem, retrievalAgentItem, retrievalDirectItem, retrievalStageItem, roundSummaryItem, storyItem } from "@/lib/layout"; import type { AgentDecisionProjection, BranchStory, CanvasItem, ExecutionViewV8, OpenTarget, RoundStoryV8, StoryNode } from "@/lib/types"; import { runResultFallback } from "@/lib/status-copy"; import { StatusBadge } from "@/components/ui/Badges"; import { CardFields } from "@/components/flow/CardFields"; import { authorityLabel, decisionTypeLabel } from "@/components/decision/AgentDecisionCard"; interface Props { view: ExecutionViewV8; expandedRounds: Set; expandedBranches: Set; expandedRetrievalAgents: Set; onToggleRound: (round: number) => void; onToggleBranch: (round: number, branchId: number) => void; onToggleRetrievalAgent: (agentId: string) => void; onOpen: (item: CanvasItem, target: OpenTarget) => void; onCanvas: () => void; } export function MobileTimeline({ view, expandedRounds, expandedBranches, expandedRetrievalAgents, onToggleRound, onToggleBranch, onToggleRetrievalAgent, onOpen, onCanvas }: Props) { const objective = storyItem(view.objective); const final = finalResultItem(view); const objectiveLabel = "创作目标"; return

这次构建经历了什么

按时间从上到下阅读

{view.planning ?
: null}
    {view.rounds.map((round) => onToggleRound(round.roundIndex)} onToggleBranch={onToggleBranch} onToggleRetrievalAgent={onToggleRetrievalAgent} onOpen={onOpen} />)}
; } function RoundItem({ round, expanded, expandedBranches, expandedRetrievalAgents, onToggle, onToggleBranch, onToggleRetrievalAgent, onOpen }: { round: RoundStoryV8; expanded: boolean; expandedBranches: Set; expandedRetrievalAgents: Set; onToggle: () => void; onToggleBranch: Props["onToggleBranch"]; onToggleRetrievalAgent: Props["onToggleRetrievalAgent"]; onOpen: Props["onOpen"] }) { const summary = roundSummaryItem(round); return
  • {expanded ?
      {round.branches.map((branch) => { const key = `${round.roundIndex}:${branch.branchId}`; const item = branchSummaryItem(branch, round.roundIndex); return
    1. {branch.output.type === "script-artifact" && branch.output.snapshotRef ? : null}
      {expandedBranches.has(key) ? : null}
    2. ; })} {round.convergenceBatches.map((batch) =>
      1. {batch.review ?
      2. : batch.missingReview ? : null} {batch.decision ?
      3. : batch.missingDecision ? : null}
    3. )}
    : null}
  • ; } function SummarySequence({ round }: { round: RoundStoryV8 }) { const fields = [ ["目标", round.summary.goal.headline], ["尝试", `${round.summary.approach.mode || "方式未记录"} · ${round.summary.approach.candidateCount} 个实现方案`], ["决策", round.summary.decision.batchCount ? `${round.summary.decision.batchCount} 个决策批次` : round.summary.decision.summary], ["产出", round.summary.output.summary], ] as const; return
    {fields.map(([label, value]) =>

    {label}{value || "未记录"}

    )}
    ; } function BranchProcess({ branch, roundIndex, expandedRetrievalAgents, onToggleRetrievalAgent, onOpen }: { branch: BranchStory; roundIndex: number; expandedRetrievalAgents: Set; onToggleRetrievalAgent: Props["onToggleRetrievalAgent"]; onOpen: Props["onOpen"] }) { const stage = retrievalStageItem(branch.retrievalStage, roundIndex, branch.branchId); const [task, ...tail] = branchFlow(branch); return
      1. {branch.retrievalStage.directToolGroups.map((group) => { const item = retrievalDirectItem(group, roundIndex, branch.branchId); return
      2. ; })} {branch.retrievalStage.agentRuns.map((run) => { const item = retrievalAgentItem(run, roundIndex, branch.branchId); const expanded = expandedRetrievalAgents.has(run.id); const queryListId = `mobile-query-list-${run.eventId}`; return
      3. {run.attempts.length ? : null}{expanded ?
          {run.attempts.map((attempt, index) => { const query = queryAttemptItem(attempt, roundIndex, branch.branchId); return
        1. ; })}
        : null}
      4. ; })}
    1. {tail.map((story) => )}
    ; } function StoryItem({ story, roundIndex, branchId, onOpen }: { story: StoryNode; roundIndex?: number; branchId?: number; onOpen: Props["onOpen"] }) { const item = storyItem(story, roundIndex, branchId); const card = story.card.primary || story.card.secondary.length ? story.card : { primary: { value: "查看详情" }, secondary: [] }; const label = roleLabel(story.role); if (story.decision) return
  • ; return
  • {story.artifactRef ? : null}
  • ; } function MobileDecision({ item, decision, fallbackLabel, fallbackCard, onOpen }: { item: CanvasItem; decision?: AgentDecisionProjection; fallbackLabel: string; fallbackCard: StoryNode["card"]; onOpen: Props["onOpen"] }) { const card = decision?.card || fallbackCard; const artifactRef = item.itemType === "story" ? item.artifactRef : undefined; return
    {artifactRef ? : null}
    ; } function roleLabel(role: StoryNode["role"]) { return ({ "planning-analysis": "创作规划解析", goal: "本轮目标", plan: "实现规划", "multipath-review": "多方案评审", "multipath-decision": "主 Agent 多路决策", "round-evaluation": "主脚本整体评审", "round-result": "本轮产出", "branch-task": "实现任务", "data-decision": "数据取舍", "candidate-output": "候选脚本", "domain-output": "领域事实" } as Partial>)[role] || "运行步骤"; } function modeLabel(mode: BranchStory["retrievalStage"]["observedMode"]) { return ({ single: "单项取数", sequential: "依次取数", parallel: "并行取数", mixed: "混合执行", unknown: "执行先后未确认" } as const)[mode]; }