Skip to main content

Chat

PlanApproval

An agent's plan, waiting for the person before the agent starts on it: Approve, or Request changes, which opens a field to say what should change. Once answered, here or in another app, the buttons give way to one line that says who answered and from where, "Approved by Ana from their phone", which a screen reader hears, with any feedback under it; if the person was on a button or in the field, focus moves to that line. Approve and Request changes are the person's alone: its agent side, planApprovalAx, declares them person-only, so no agent door offers them.

Your agent's plan for dinner

  1. Roast the lamb at 200°C for an hour, with the carrots beside it.
  2. Start the rice on the stove twenty minutes before the end.
  3. Wilt the greens in the rice's last five minutes.

Research helper's plan for the menu

A roast, two sides and a pudding, for six.

Changes requested by Ana from their phone · 9:41

Make it vegetarian; swap the lamb for a squash.

Install

Hand it to your agent
Add PlanApproval from Ouro UI to this app. Read https://ui.ouroboros.bot/docs/plan-approval.md first and follow it.

Or by hand. Once per app, with Tailwind CSS v4 and an @/* path alias (Ouro HX is built on Base UI, so --base base; skip -t in an existing app):

npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.823

Then the component (Installing):

npx shadcn@latest add ourostack/ouro-ui/plan-approval#v1.3.823
import { PlanApproval } from "@/components/ouro/plan-approval/plan-approval";

Paths use shadcn's default @/ alias; the CLI rewrites them to yours.

Example

<PlanApproval title="Your agent's plan for dinner" onApprove={approve} onRequestChanges={revise} answer={answer}>
  <Plan steps={steps} />
</PlanApproval>

Use instead when

  • Use PermissionPrompt instead for one action the agent wants to take, and ConfirmDialog instead to confirm the person's own action in your app.

Props

Type: PlanApprovalProps.

answer
Type: PlanAnswer
The person's answer, once they have given it, in this app or another: the buttons give way to who answered.
answering
Type: "approve" | "changes"
Which answer is on its way, while your app sends it: that button shows it is busy, and the others turn off.
approveLabel
Type: string
Default: "Approve"
The approve button's label.
cancelLabel
Type: string
Default: "Cancel"
The button that closes the feedback field.
children (required)
Type: ReactNode
The plan, as your app renders it: steps, a list, Markdown.
className
Type: string
Layout only: margins, width (mt-2, max-w-xl). Appearance classes warn in development.
feedbackLabel
Type: string
Default: "What should change?"
The feedback field's label.
headingLevel
Type: 2 | 3 | 4 | 5 | 6
Default: 3
The title's heading level, one below the section's heading, as Card's.
onApprove
Type: (() => void)
Called when the person presses Approve.
onRequestChanges
Type: ((feedback: string) => void)
Called with what the person wrote when they send a request for changes.
ref
Type: Ref<HTMLDivElement>
Reaches the rendered element.
requestChangesLabel
Type: string
Default: "Request changes"
The button that opens the feedback field.
sendLabel
Type: string
Default: "Send"
The button that sends the feedback.
title (required)
Type: ReactNode
What the plan is for, as its title: "Your agent's plan for dinner".

Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

  • onAccept: Not a prop. Ouro UI uses onApprove: <PlanApproval onApprove={approve}>.
  • onReject: Not a prop. Ouro UI uses onRequestChanges, which gets the person's feedback: <PlanApproval onRequestChanges={revise}>.
  • plan: Not a prop. The plan is the children: <PlanApproval title="Plan">{plan}</PlanApproval>.
  • status: Not a prop. The person's answer is answer: <PlanApproval answer={{ decision: "approved", by: "Ana" }}>.

className is for layout only

Pass margins, width and grid placement (mt-4, w-full, col-span-2).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (hover:, sm:) and any ! are removed, it starts with bg-, text-, border-, rounded-, shadow-, font-, ring-, from-, via-, to-, fill- or stroke-, or is border, rounded, shadow or ring, or has a dark: variant. Text wrapping, overflow and table layout classes (text-wrap, text-ellipsis, border-collapse) are layout and do not warn.

Alignment classes (text-center) warn too: set alignment on a parent element.

Types

PlanAnswer

How the person answered a PlanApproval.

interface PlanAnswer {
  /** What they chose. */
  decision: "approved" | "changes-requested";
  /** Who answered: "Ana", "you". */
  by: ReactNode;
  /** Where they answered from, such as "the desktop app" or "their phone": "Approved by Ana from their phone". */
  app?: ReactNode;
  /** When, already formatted ("9:41", `<RelativeTime>`). */
  at?: ReactNode;
  /** What they asked to change, shown under the answer. */
  feedback?: ReactNode;
}