Skip to content

The platform for continuously improving AI agents.

644 B
Raw Blame
import { type RunPhase, RunStatus } from "@/components/ai-components/run-status";
import type { ExperimentRun } from "./document";

const SETTLED: Record<string, RunPhase> = {
  blocked: "blocked",
  cancelled: "cancelled",
  completed: "done",
  exhausted: "exhausted",
  failed: "failed",
  unmet: "unmet",
};

/** The shown flow run's state on the canvas toolbar. */
export function RunNotification({ run }: { run?: ExperimentRun }) {
  return (
    <RunStatus
      completedAt={run?.completed_at}
      key={run?.id ?? "draft"}
      phase={run ? (SETTLED[run.state] ?? "running") : "idle"}
      startedAt={run?.created_at}
    />
  );
}