# Agent toast

One toast for a whole agent run, changing in place from queued to working to asking to done or failed.

Also called: agent notification, run toast, animated toast.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: One toast per run. Two agents: each toast changes in place from queued to working to asking to done or failed, instead of stacking a toast per event. Preview: https://chatcn.dev/preview/agent-toast-demo

Instead of a new toast per event, one toast follows the run. Queued, it is a single quiet line. Working, the step under the title edits itself and a hairline of progress runs along the bottom edge. When the agent needs you, the toast opens downward to ask, with the answer buttons right there, and its edge takes the amber of things waiting on you. Done folds it back to one line with a check and how long it took; failed does the same in red with a retry.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/agent-toast
```

## Usage

```tsx
import { AgentToast } from "@/components/ui/chatcn/pro/agent-toast"

<AgentToast
  title="Fix session expiry"
  status={run.status}
  detail={run.step}
  progress={run.progress}
  time={run.elapsed}
  question="Push 3 files and open a pull request?"
  onApprove={approve}
  onDeny={deny}
  onAction={openRun}
/>
```

## Examples

### Statuses

Example: All five statuses. Queued, working with progress, waiting on you with a question, done with an action, and failed with a retry. Preview: https://chatcn.dev/preview/agent-toast-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `status` | `"queued" | "working" | "needs-input" | "done" | "failed"` |  |
| `title` | `string` | What the agent is doing |
| `detail` | `string` | The step while working, the result when finished |
| `progress` | `number` | 0 to 1 while working |
| `time` | `string` | Elapsed or finished time, formatted |
| `question` | `string` | Shown while it needs input |
| `approveLabel` / `denyLabel` | `string` | Default Approve and Deny |
| `onApprove` / `onDeny` | `() => void` |  |
| `onAction` / `actionLabel` | `() => void` / `string` | View when done, Retry when failed |
| `onDismiss` | `() => void` | Shows the close button |

## Accessibility

- A polite `role="status"`: each change of step is read once, not each tick of progress.
- Status color always comes with the run check's shape or the question mark and the words Needs your input.

## Motion

- The question opens on `grid-template-rows`, 300 ms. Progress is a heavy spring on `scaleX`.
- Asking lifts the toast 3 px once; nothing repeats or pulses. Reduced motion keeps the fades only.

Source: https://chatcn.dev/docs/components/agent-toast