Command Preview
AI · CommandPreview, ApprovalCard
A shell command an agent wants to run on a server: the command exactly as it runs, word by word (argv) when no shell reads it, the server and access, the risk (read, change, critical), the timeout and the state read before asking (a status or log excerpt, verbatim). Ends with "Runs once after A". Pair it with ApprovalCard stepUp for critical commands, and CommandWhitelist for what may run at all.
Approval neededOps · PlatformInfrastructure1 min
Restart nginx on web-1
The health check has failed for 4 minutes; the service is stopped.
- Server
- web-1deploy@203.0.113.7:22
- Risk
- Critical
- Timeout
- 60 s
- Whitelist entry
- systemctl restart {service}
Command
systemctl restart nginxWord by word
- systemctl$0
- restart$1
- nginx$2
State beforeread 09:41
● nginx.service - A high performance web server Loaded: loaded (/lib/systemd/system/nginx.service; enabled) Active: failed (Result: exit-code) since 09:37:12; 4min ago Process: 1873 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
Runs once after A, never again on its own.
Escalates to the owner in 26 min
Props
CommandPreview
| Prop | Type | Notes |
|---|---|---|
command | string | The command exactly as it runs. |
argv? | string[] | The same command word by word, when it runs without a shell (argv). |
server | ReactNode | Required |
host? | string | Host, user and port ("deploy@203.0.113.7:22"). |
risk? | CommandRisk | |
timeout? | number | Seconds until it is stopped. |
stateBefore? | string | What was read before asking (status, a log excerpt), verbatim. |
stateAt? | ReactNode | When `stateBefore` was read ("09:41"). |
facts? | KeyValueItem[] | More facts: host key, whitelist entry, parameters. |
warnings? | ReactNode[] | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |
ApprovalCard
| Prop | Type | Notes |
|---|---|---|
title | ReactNode | Required |
text? | ReactNode | |
children? | ReactNode | |
agent? | string | |
project? | string | |
family? | RiskFamily | |
familyLabel? | string | |
age? | string | |
escalation? | ReactNode | |
trace? | ReactNode | |
note? | ReactNode | |
heading? | string | |
options? | ApprovalOption[] | |
approveLabel? | string | |
onDecide? | (key: ApprovalKey, text?: string) => void | Promise<unknown> | Called with the answer (and the text of B or D). Return a Promise to keep the card busy until it settles: the answer's button spins and every answer is disabled; a rejection shows an error (a rejected string is shown as is) and keeps the card open. Once it resolves, a card without a `decision` prop collapses to its one-line record; with a plain callback, set `decision` yourself. |
decision? | ApprovalDecision | null | The decision record: shown as one line instead of the card; `null` keeps the card open. |
compact? | boolean | Side panels: tighter, the answers in a row, the payload folded behind "Show what runs" (one click, never a summary). |
stepUp? | boolean | Money, legal and infrastructure decisions: A and B (the answers that run something) need a fresh passkey. They show "Needs your passkey"; while `onDecide` is pending the pressed answer says "Confirm with passkey". Do the WebAuthn step-up in `onDecide` and reject if it fails. |
busy? | ApprovalKey | null | The answer being sent, when you track it yourself (controlled busy state). |
error? | ReactNode | An error to show above the answers (controlled); a rejected `onDecide` shows one by itself. |
screen? | boolean | Fills its container, e.g. a deep link on a phone: the content scrolls and A–D stay at the bottom, full width, in thumb reach (with the safe area). |
href? | string | Makes the title a link to the full approval (with `linkAs` for a router's link). |
linkAs? | ElementType | |
onApprove? | () => void | |
onDeny? | () => void | |
onEdit? | (text: string) => void | |
state? | "approved" | "denied" | |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |