affectUI › Components › Agents

Run Window

When an agent may run, as a block on a time ruler with its pixel mark and a thin line for now – drag the window or its grips to move it.

Part of affectUI Pro. Install: npx shadcn@latest add https://www.affectui.com/r/run-window.json · Import from @/components/ui/run-window

When to use

  • When an agent may run – a nightly reindex, a sync window, quiet hours for outreach – and letting people move that window
  • A dashboard tile next to other agent chart cards, with now moving along

When not to use

  • A list of upcoming runs – use Scheduled Runs
  • How far one run is – use Run Transit

Usage

import { RunWindow } from "@/components/ui/run-window";

const [win, setWin] = useState<[number, number]>([9 * 60, 10 * 60]);

<RunWindow
  title="Nightly reindex"
  range={[8 * 60 + 30, 11 * 60 + 30]}
  start={win[0]}
  end={win[1]}
  now={minutesSinceMidnight}
  onChange={(start, end) => setWin([start, end])}
  agent={{ id: "indexer", name: "Indexer" }}
  label="Reindex search"
/>

Props

NameTypeDefaultDescription
range[number, number]The ruler, in minutes from midnight – e.g. [510, 690] for 08:30 to 11:30
start / endnumberThe window, in minutes from midnight; kept inside the ruler and at least two steps long
nownumberNow, in minutes – a thin line; before the window it says when it starts, inside it the part behind now is strong
onChange(start, end) => voidMakes the window movable – drag it, drag its grips, or use the arrow keys
stepnumber5What the window snaps to, in minutes
agent{ id: string; name: string }The agent that runs in it – its pixel mark and name sit in the window
labelstring"Run"What runs – under the ruler, with the window's length
titlestring"Run Window"Heading on the frame
iconReactNodeA small mark before the title – defaults to a calendar, in red
actionLabel / onActionstring / () => void"Open"The button on the top right – it shows when onAction is given
classNamestringExtra class on the root

Keyboard

  • Tab: Moves to the window, its start grip, its end grip and Open
  • ArrowLeft / ArrowRight: On the window: moves it by a step; on a grip: moves that end. With Shift: 30 minutes

Accessibility

  • The window and both grips are sliders that read their times, e.g. "09:00 to 10:00"
  • How long it is and when it starts are plain text under the ruler

Responsive

  • Built on a container query; under 420px the agent's name and the ruler's own times step aside – the card keeps the same size as every agent chart card
  • The ruler's own times step aside when the window's are close to them
  • Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"

Requirements

  • React 19

Related

  • Run Transit – An agent carrying a job from one place to another like a flight on its way – where it comes from, where it goes, the time left and a bar its pixel mark rides on
  • Agent Time Split – Where an agent's time went – working, tool calls, waiting on you and idle – as a strip of thin ticks under the total, with every part's time and share below
  • Scheduled Runs – Agent tasks sorted into a week of sessions – each session has a usage limit, small tasks fill the gaps and big ones are split across sessions
  • Latency Range – How fast an agent answers, hour by hour, like a blood-pressure chart – every hour as a bar from p50 to p95, pink above the target, the latest large and in blue