import type { AgentStatus, FlowNode } from "../../../lib/types"; import type { TagTone } from "../../../components/primitives"; /** Miuix status presentation for flow nodes (design/19 §2: 节点闪烁=运行中、 * ok=成功、err=失败). The stroke/fill colors are Miuix tokens so the graph * follows the panel theme (light/dark) without hard-coded colors. */ export interface FlowTone { stroke: string; fill: string; label: string; tag: TagTone; } export const FLOW_TONE: Record = { idle: { stroke: "var(--mu-surface-5)", fill: "color-mix(in srgb, var(--mu-surface-5) 18%, transparent)", label: "空闲", tag: "neutral", }, running: { stroke: "var(--mu-accent)", fill: "color-mix(in srgb, var(--mu-accent) 18%, transparent)", label: "运行中", tag: "accent", }, blocked: { stroke: "var(--mu-warn)", fill: "color-mix(in srgb, var(--mu-warn) 18%, transparent)", label: "阻塞", tag: "warn", }, done: { stroke: "var(--mu-ok)", fill: "color-mix(in srgb, var(--mu-ok) 18%, transparent)", label: "完成", tag: "ok", }, error: { stroke: "var(--mu-err)", fill: "color-mix(in srgb, var(--mu-err) 18%, transparent)", label: "错误", tag: "err", }, }; /** Legend / aggregate order, coldest to most alarming. */ export const STATUS_ORDER: ReadonlyArray = [ "idle", "running", "blocked", "done", "error", ]; /** statusOf narrows a node's optional status to a concrete AgentStatus. */ export function statusOf(node: FlowNode): AgentStatus { return node.status ?? "idle"; }