Agent run
Single coding-agent run card with expandable step log, two-file diff approval gate and collapsible completed PR summary.
pnpm dlx shadcn@latest add @haze/agent-run---
import { Bot, Check, CheckCircle2, ChevronDown, FileCode2, GitPullRequest, ShieldAlert, X } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";
interface Props {
id?: string;
taskTitle?: string;
branch?: string;
class?: string;
}
const {
id = "haze-agent-run",
taskTitle = "Fix focus restoration when closing command palette",
branch = "agent/fix-palette-focus",
class: className,
} = Astro.props;
const steps = [
{ label: "Read src/site/client.ts and tests/keyboard.spec.ts", tool: "read_file · 2 files" },
{ label: "Reproduced focus loss on Escape in headless Chromium", tool: "run_test · 1 failed" },
{ label: "Prepared two-file patch awaiting write approval", tool: "edit_file · 2 files (+14 / -4)" },
];
---
<section aria-labelledby={`${id}-title`} data-haze-agent-run class={cn("bg-background px-4 py-10 sm:px-6 sm:py-14", className)}>
<div class="mx-auto max-w-3xl rounded-2xl border border-border bg-card p-5 sm:p-6">
<header class="flex flex-wrap items-start justify-between gap-3 border-b border-border pb-4">
<div class="flex items-start gap-2.5">
<span class="grid size-8 shrink-0 place-items-center rounded-lg border border-frame bg-muted text-muted-foreground" aria-hidden="true">
<Bot class="size-4" />
</span>
<div>
<h2 id={`${id}-title`} class="text-base/6 font-semibold tracking-tight text-foreground">{taskTitle}</h2>
<p class="mt-0.5 font-mono text-xs text-muted-foreground">{branch} · Sonnet 4.5</p>
</div>
</div>
<span data-ar-badge class="inline-flex items-center gap-1.5 rounded-full border border-frame-warning bg-warning/10 px-2.5 py-0.5 text-xs font-medium text-warning">
<ShieldAlert class="size-3.5" aria-hidden="true" />
Awaiting approval
</span>
</header>
<details open data-ar-steps class="group mt-4 rounded-xl border border-border bg-muted/40 px-4 py-3">
<summary class="flex cursor-pointer list-none items-center justify-between gap-2 text-xs font-medium text-foreground select-none focus-visible:outline-2 focus-visible:outline-ring [&::-webkit-details-marker]:hidden">
<span data-ar-summary>3 agent steps · paused before file write</span>
<ChevronDown class="size-4 text-muted-foreground transition-transform duration-150 ease-snappy group-open:rotate-180" aria-hidden="true" />
</summary>
<ol role="list" class="mt-3 space-y-2 border-t border-border pt-3">
{
steps.map((s) => (
<li class="flex flex-wrap items-center justify-between gap-2 text-xs/5">
<span class="flex items-center gap-2 text-foreground">
<CheckCircle2 class="size-3.5 shrink-0 text-success" aria-hidden="true" />
{s.label}
</span>
<span class="font-mono text-[0.6875rem] text-muted-foreground">{s.tool}</span>
</li>
))
}
</ol>
</details>
<div data-ar-gate class="mt-4 rounded-xl border border-frame-warning bg-warning/8 p-4">
<div class="flex flex-wrap items-center justify-between gap-2">
<p class="inline-flex items-center gap-1.5 text-xs font-semibold text-foreground">
<FileCode2 class="size-4 text-muted-foreground" aria-hidden="true" />
Approve 2-file patch before writing
</p>
<span class="font-mono text-[0.6875rem] text-muted-foreground">+14 / -4 lines</span>
</div>
<div class="mt-3 space-y-1.5 rounded-lg border border-border bg-muted/40 p-3 font-mono text-xs/5">
<p class="text-muted-foreground">src/site/client.ts</p>
<p class="text-destructive">- palette.close();</p>
<p class="text-success">+ palette.close(); lastFocus?.focus();</p>
<p class="pt-1 text-muted-foreground">tests/keyboard.spec.ts</p>
<p class="text-success">+ await expect(trigger).toBeFocused();</p>
</div>
<div class="mt-3 flex flex-wrap items-center justify-end gap-2">
<button type="button" data-ar-deny class="inline-flex h-8 cursor-pointer items-center gap-1 rounded-lg border border-frame bg-field px-3 text-xs font-medium text-muted-foreground hover:border-destructive-border hover:text-destructive focus-visible:outline-2 focus-visible:outline-ring transition-[background-color,border-color,color,opacity,scale] duration-150 ease-snappy active:scale-[0.97] active:duration-75">
<X class="size-3.5" aria-hidden="true" />
Deny
</button>
<button type="button" data-ar-approve class="inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg bg-primary px-3.5 text-xs font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring transition-[background-color,border-color,color,opacity,scale] duration-150 ease-snappy active:scale-[0.97] active:duration-75">
<Check class="size-3.5" aria-hidden="true" />
Approve & run checks
</button>
</div>
</div>
<div data-ar-done hidden class="mt-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-frame-success bg-success/10 p-4">
<div class="text-xs/5">
<p class="font-semibold text-success">2 files updated · 7/7 keyboard tests passed</p>
<p class="text-muted-foreground">Ready to open a pull request on {branch}.</p>
</div>
<button type="button" data-ar-pr class="inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg bg-primary px-3.5 text-xs font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-2 focus-visible:outline-ring transition-[background-color,border-color,color,opacity,scale] duration-150 ease-snappy active:scale-[0.97] active:duration-75">
<GitPullRequest class="size-3.5" aria-hidden="true" />
Create pull request
</button>
</div>
<p data-ar-status role="status" class="mt-3 min-h-4 text-xs/4 text-muted-foreground"></p>
</div>
</section>
<script>
function initAgentRuns() {
document.querySelectorAll<HTMLElement>("[data-haze-agent-run]").forEach((root) => {
if (root.hasAttribute("data-enhanced")) return;
root.setAttribute("data-enhanced", "");
const gate = root.querySelector<HTMLElement>("[data-ar-gate]");
const done = root.querySelector<HTMLElement>("[data-ar-done]");
const badge = root.querySelector<HTMLElement>("[data-ar-badge]");
const summary = root.querySelector<HTMLElement>("[data-ar-summary]");
const details = root.querySelector<HTMLDetailsElement>("[data-ar-steps]");
const status = root.querySelector<HTMLElement>("[data-ar-status]");
root.querySelector<HTMLButtonElement>("[data-ar-approve]")?.addEventListener("click", () => {
if (gate) gate.hidden = true;
if (done) done.hidden = false;
if (details) details.open = false;
if (summary) summary.textContent = "4 steps completed · 2 files changed · checks passed";
if (badge) {
badge.textContent = "Completed";
badge.className = "inline-flex items-center gap-1.5 rounded-full border border-frame-success bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success";
}
if (status) status.textContent = "Patch applied and verification checks passed.";
});
root.querySelector<HTMLButtonElement>("[data-ar-deny]")?.addEventListener("click", () => {
if (gate) gate.hidden = true;
if (badge) {
badge.textContent = "Stopped";
badge.className = "inline-flex items-center gap-1.5 rounded-full border border-frame-destructive bg-destructive/10 px-2.5 py-0.5 text-xs font-medium text-destructive";
}
if (status) status.textContent = "File write denied. Workspace left untouched.";
});
root.querySelector<HTMLButtonElement>("[data-ar-pr]")?.addEventListener("click", (ev) => {
const btn = ev.currentTarget as HTMLButtonElement;
btn.textContent = "PR 498 opened";
btn.disabled = true;
if (status) status.textContent = "Opened pull request 498.";
});
});
}
initAgentRuns();
document.addEventListener("astro:page-load", initAgentRuns);
</script>When to use
- Monitoring a coding agent run that pauses for human approval before modifying files
- Collapsing completed execution steps into a single summary bar with a Create PR action
When not to use
- Managing multiple background agent tasks across repos at once; use agent-tasks
Installation
Add the Haze registry to components.json once, then install Agent run with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.
pnpm dlx shadcn@latest add @haze/agent-runnpx shadcn@latest add @haze/agent-runyarn dlx shadcn@latest add @haze/agent-runbunx --bun shadcn@latest add @haze/agent-runFirst time? Registry and theme setup
1. Add to components.json:
{
"registries": {
"@haze": "http://localhost:4329/r/{name}.json"
}
}2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| id | string | "haze-agent-run" | Unique prefix for section heading IDs. |
| taskTitle | string | "Fix focus restoration when closing command palette" | Task description in the card header. |
| branch | string | "agent/fix-palette-focus" | Git branch created by the agent. |
| class | string | – | Extra classes on the outer section. |
Keyboard interactions
- Tab
- Move across the steps disclosure, Deny, Approve and Create PR buttons
- EnterSpace
- Toggle step log visibility, approve/deny the diff or open a pull request
Accessibility
- Step logs use a native details/summary disclosure that collapses cleanly once approved.
- Approve, Deny and Create PR actions announce outcomes via a polite role="status" message.
Notes for AI
Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.
Install and use
Install the Haze UI block "Agent run" with `npx shadcn@latest add @haze/agent-run`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AgentRun from "@/components/haze/blocks/agent-run.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/agent-run.md
Customize with real content
Adapt the Haze agent-run block for our product. Replace the demo values of these props with our real content: id, taskTitle, branch, class. Keep the layout, the heading level rules and these accessibility details: Step logs use a native details/summary disclosure that collapses cleanly once approved. Approve, Deny and Create PR actions announce outcomes via a polite role="status" message. Do not add raw color classes; use the Haze tokens.
Choose the right block
Before using agent-run, check it fits: use it when monitoring a coding agent run that pauses for human approval before modifying files; collapsing completed execution steps into a single summary bar with a create pr action. Avoid it when managing multiple background agent tasks across repos at once; use agent-tasks. Alternatives: @haze/check-runs, @haze/workflow-steps.
Dependencies
- npm: @lucide/astro
- @haze/utils
- @haze/theme (one-time setup)
Source · Original Haze UI work.