import type { StepResult } from "../lib/api"; /** * The pair of contextual chips a step can carry beyond its status: * * "cached" — served from the per-node prefix cache (pipeline * prefix unchanged since the last run). * * "live" — intentionally nondeterministic (e.g. sampled * fidelity with N shots). The cache is bypassed for this step * and everything downstream so the user gets a fresh shot draw * each run. * * Two visual variants: * * `tile` — compact 9px text + tight padding for the canvas tile * (QNode's result strip). 9px is a DELIBERATE exception to the * app's 10px type floor (audit S3: documented, not drift): the * chips are single-word statuses whose meaning the border color * already carries, and at 10px they collide with the tile's * metric text at the default canvas zoom. * * `card` — the global `.chip` pill used in the right pane card * (ResultsPane's step header). * * cached and live are mutually exclusive in practice (a cache hit * can't also be flagged nondeterministic, since we never write * nondeterministic results into the cache), so we render at most one. */ export function RunStatusChips({ step, variant, }: { step: StepResult; variant: "tile" | "card"; }) { const isTile = variant === "tile"; const cachedClass = isTile ? "text-[9px] px-1 py-0.5 rounded border border-accent/30 text-accent" : "chip !border-accent/30 !text-accent text-[9px]"; const liveClass = isTile ? "text-[9px] px-1 py-0.5 rounded border border-warn/30 text-warn" : "chip !border-warn/30 !text-warn text-[9px]"; if (step.from_step_cache) { return ( cached ); } if (step.nondeterministic) { return ( live ); } return null; }