"use client"; import { useEffect, useState } from "react"; // THE RENDER QUEUE on the take panel (UI notes 2026-10-30, #18): what runs in // the machine's heavy slot and what waits at it -- e2e suites, next builds, // renders -- read from the slot's own files (GET /api/render-queue, // common/lib/heavyQueue.mjs), and how long a take of this project renders, // from its past renders (lib/report/takeEta.mjs). "Give renders the machine" // beside it (RenderModeBanner) is what sends the others to wait at the door. type Row = { pid: number; what: string; kind: string; estimateMb: number | null; build: boolean; alone: boolean; worktree: string | null; branch: string | null; since: string | null; forSeconds: number | null; stage?: string; stageWords?: string; take?: string; }; type Eta = { etaSeconds: number; rate: number; basis: { id: string; seconds: number; renderSeconds: number; how: string }[]; note: string | null }; type View = { queue: { running: Row[]; waiting: Row[]; head: Row | null; suites: (Row & { suite: string })[]; render: { held: boolean; what?: string }; memory: { availableMb: number; totalMb: number | null; floorMb: number; promisedMb: number } | null; heldBy: string | null; }; etas: { seconds: number | null; newest: string | null; fresh: Eta | null; reuse: Eta | null; past: unknown[] } | null; mine: { pid: number; take: string | null; state: "running" | "waiting"; forSeconds: number | null; stage?: string }[]; }; const dur = (s: number | null | undefined) => { if (s == null || !Number.isFinite(s)) return "—"; if (s < 90) return `${Math.round(s)} s`; const m = Math.round(s / 60); return m >= 60 ? `${Math.floor(m / 60)} h ${String(m % 60).padStart(2, "0")} min` : `${m} min`; }; const gb = (mb: number) => `${(mb / 1000).toFixed(1)} GB`; const clock = (s: number) => `${Math.floor(s / 60)}:${String(Math.round(s % 60)).padStart(2, "0")}`; function RowLine({ r, waiting }: { r: Row; waiting?: boolean }) { return (
The render queue could not be read: {error}
) : null; } const { queue, etas, mine } = view; const busy = queue.running.length > 0 || queue.waiting.length > 0; return (e2e queues held:{" "} {queue.suites .filter((s) => !queue.running.some((r) => r.pid === s.pid) && !queue.waiting.some((r) => r.pid === s.pid)) .map((s) => `${s.suite} (${s.worktree ?? "?"}, building or about to ask for the slot)`) .join(", ")}
)} {mine.length > 0 && ({mine .map((m) => `${m.take ?? "this project's render"}: ${m.state === "running" ? `rendering for ${dur(m.forSeconds)}` : `waiting ${dur(m.forSeconds)} — ${m.stage}`}`) .join(" · ")}
)}{n}
))}