Approval required for deploy-cloud
Changes things
File touched
- packages/
components/ src/ components/ approval-card/ approval-card.svelte
Package @lostgradient/cinderDry run No
Durable human-in-the-loop approval surface for reviewing risky tool operations before they execute.
Reference usage
Presentational human-in-the-loop approval surface for reviewing a tool operation before the host application executes it.
<script lang="ts">
import { ApprovalCard } from '@lostgradient/cinder';
</script>
<ApprovalCard
tool={{ name: 'deploy-cloud', risk: 'medium' }}
sandbox={{
provider: 'codex',
name: 'workspace-write',
workingDir: '/workspace/project',
}}
operation={{
kind: 'command',
command: 'bun run --filter=@lostgradient/cinder validate',
argsPreview: { package: '@lostgradient/cinder' },
}}
env={['DATABASE_URL', 'OPENAI_API_KEY']}
policyVersion="policy-2026-06"
idempotencyKey="approval-01JZ8T"
state="pending"
onResolve={(resolution) => console.log(resolution)}
/>ApprovalCard is fully controlled. It does not execute commands, apply patches, persist policy decisions, or read environment values. The component only renders the supplied context and invokes callback props for host-owned actions.
onResolve is the single decision contract. It fires for every action — Approve, Approve with edits and Deny — with the complete ApprovalResolution payload: the selected decision, parsed editedArgs for edited approvals, the approver's note as reason (saved with the decision; when denying, the agent reads it as the reason), and the remember checkbox state. Action buttons render only while the request is actionable and onResolve is wired; a card without the callback is purely presentational.
decision: 'deny' means the approver actively refused the operation. decision: 'cancel' is for a host that dismisses the prompt without a decision, such as on Escape; the component draws no Dismiss button, so Approve is the only primary action and Deny the only other one.
layout="row" is the one approval row used in a chat transcript and beneath a tool call in a step rail. It sits on a neutral raised surface, never a warning fill, and the risk glyph carries the alert. Its facts line keeps the human tool label, small monospace identifier, muted risk word, source, and requested time visible where the host provides them.
The optional decisionReview snippet adds a review action to the row. It receives the guarded Approve or Deny callback and whether decisions are disabled. That callback submits the same note and approval scope as the row’s buttons.
<script lang="ts">
import { ApprovalCard } from '@lostgradient/cinder';
</script>
<ApprovalCard
layout="row"
question="Refund order 4471 for $42.00?"
tool={{ name: 'issue-refund', label: 'Issue refund', risk: 'high', irreversible: true }}
source="Tool runner"
requestedAt="2026-11-02T10:38:00.000Z"
consequence="Sends $42.00 back to the original card"
operation={{
kind: 'other',
argsPreview: { orderId: 4471, amount: '$42.00', reason: 'Arrived damaged' },
}}
policyVersion="policy-2026-06"
idempotencyKey="approval-row-4471"
state="pending"
onResolve={(resolution) => console.log(resolution)}
/>label, its name as a small monospaced identifier, the risk word (Reads, Changes things or Dangerous, muted regular text, never red), "Can't be undone" when tool.irreversible, then "Approval from source" and the time it was asked ("4 min ago"; sourcePrefix replaces "Approval from" in every layout). The line wraps between its pieces and never inside one: each piece is its own element told apart by a gap and a step (the tool label medium in the body colour; the risk word, source and time regular and subtle, the time in tabular numerals), never by a comma, so "Can't be undone" and "4 min ago" are never cut off. Assistive technology reads the pieces as separate words, because the markup keeps a space between them. In a card narrower than 40rem, who asked and when move to their own line. A card narrower than 24rem (its own width, as on a phone) says the tool once: the label drops from the line, because the call above the row and the question already name it, and "Approval from Tool runner 3 min ago" stays one line down to 14rem. Omit tool.label when the call above the row already names the tool.consequence is one muted line below it, such as "Sends $42.00 back to the original card".--cinder-leading-normal), and the groups (the question; the expiry and risk; the tool and who asked; the input; the actions) stand apart by --cinder-gap-stack, which grows at the comfortable density.DescriptionList in its grid variant at the card's content edge: as many equal columns as the card is wide (about 6.5rem each), each label in the secondary text colour over its value in the body colour, so a wide card reads "Order ID 4471", "Cents 4200" and "Reason Arrived damaged" side by side, a phone card two to a row and a narrow card one. A value longer than about two lines in a column, one over several lines, or a list or an object (written whole as compact JSON in the code font, with secrets masked) takes the whole row; an empty value reads as a quiet "None" or "Empty". The rows are a group named "Input" (or inputLabel). With more than four pairs the first four show and a plain "Show all 9" button under them (with aria-expanded and aria-controls) opens the rest in place; "Show less" closes them. With four or fewer there is no button.reason with Approve and with Deny.rememberScope ("the rest of this chat") to offer "Allow label for the rest of this chat" as a checkbox on its own line before Deny and Approve; checking it sets remember. Leave it out for a tool set to Always, which never offers it.disabledReason turns Deny and Approve off while the approval is pending and writes the reason above the actions; both buttons go inert with aria-disabled, so they stay focusable, and name the reason with aria-describedby. "Add note" and "Show all" stay available.A decided approval stays in the transcript as a decision in neutral text: state="denied" with decidedBy="you" and decidedAt reads "Denied by you, 10:40 AM", with no decision buttons and no error colour. The row reads the question, the tool line, the Input disclosure, then the decision, so the decision is the last thing under what was asked. An approval decided on another page while this one was open adds decidedIn, and the row collapses to what became of it: a check (or, for a denial, the neutral prohibition glyph) in place of the risk shield, the question, and "Approved by you in Reviews, 10:46 AM" under it, with no tool line, no input and no dot.
layout="decision" is the approval a transcript asks the person to decide, and the receipt it leaves behind. It has no icon gutter. The action is the title (question), with one small facts line directly under it (at the trailing end of its row on a card 30rem wide or wider): a clock and "Expires in 30s" while expiresAt is ahead, and a warning glyph and "Can't be undone" in muted danger text when tool.irreversible is true. The warning glyph's tooltip says what approving does (consequence) when it is given. The row layout shows the same line. The host's facts (Target, Amount, anything else with an optional monospace) form the compact metadata list; tool identity is already carried by the surrounding approval step, and the always-visible command is presented as readable monospaced code with an accessible label but no redundant visible Command row. pauseSentence remains accepted for callers that share approval props, but the decision surface does not repeat a generic pause explanation. The rest of the input (a patch diff, the touched files, the arguments as rows) follows behind its initially closed Input disclosure, as in the row, and why adds a "Why the agent wants to do this" disclosure. Arguments that only repeat a fact shown in the open (the command, the target, the tool) get no rows. Once decided, the title says what was decided instead of repeating the question: the primary action's label (or the tool's label or name) and the Target fact, such as "Refund $42.00, order 4471" with the outcome spoken first to assistive technology. The three settled states are one pattern: the title, then one small muted status line ("Approved by you", "Denied by you", "Expired before a decision"), and "Ask again" at the trailing end of an expired card's line; when the card settled is not in it, so the host writes it under the card. Below 20rem each fact stacks its label above its value.
expiresAt is ahead: "Expires in 4m 10s" under an hour, "Expires in 3 h" under a day, and the deadline itself ("Expires Thu Nov 20, 9:30 AM") beyond that. Add note, rememberScope, failure, disabledReason and footnote behave as they do in the row.approveLabel names the primary ("Refund $42.00"); it reads "Approve" by default.disabledReason or unmounting all revert it without committing. Escape is handled (the event is default-prevented) only while armed, so a host that closes the surrounding surface on Escape can check defaultPrevented. Deny never arms.decidedBy and decidedIn (a link when decidedInHref is set). When it was decided is not in the card: the host writes it under the card, as it writes a message's time. The note (decisionNote, for an approval and a denial alike), the result and the command are in one Details disclosure.layout="detail" is the approval on its own page, such as a review. It reads top to bottom as an eyebrow with the risk glyph (eyebrow, "Tool approval" by default), the question, who asked and how long it has waited ("Asked by Tool runner in a chat waiting 4 min"; sourcePrefix replaces "Asked by"; sourceHref and sourceInHref write the source and the place as links, and sourceIn names the place), what the source said as a collapsed line (said: "Tool runner said Order 4471 is $42.00…", one line cut with an ellipsis that opens in place), the context snippet, the tool ("It wants to run Issue refund issue-refund Dangerous"; toolPrefix replaces the opening words), the Input block with its Fields and JSON switch, and one line with the risk glyph that carries "Can't be undone." and consequence. A failure sits under that line, then the optional rememberScope checkbox, one actions row with Add note at its start and Deny and Approve at its end, and the footnote. It has no Details disclosure.
Once decided, the green outcome line leads ("Approved by you 10:33 AM today Tool runner in a chat", with the chat a link when sourceInHref is set and the day word "today", "yesterday" or the date after the time), only an approval is green and a denial stays neutral text, and result follows the Input block. A read-only approval says nothing more than its outcome unless there is a notice, an expiry or an unavailableReason to add.
decisionNote writes the note the approver left under the outcome, in any layout: "Your note Check the carrier's claim first. Sent to the agent as the reason." for a denial. view is bindable, so a page can hold one Fields and JSON choice and give it to every card on it; it governs the card and detail layouts, since the row and decision layouts write the input as rows.
The host owns the answer, so it tells the card where the answer stands:
resolving="approve" writes "Approving…" with a spinner on Approve and turns Deny off; resolving="deny" does the same for Deny ("Denying…"). The note and the checkbox stop taking changes, the approval stays pending, and a second press is ignored until the host clears resolving.failure={{ summary, detail }} writes a bordered danger message below the input and announces it when it appears. Name the requested action in the summary, such as “Couldn’t approve,” and give the reason in the detail. Describe the durable outcome only when the host has evidence for it. In a pending review, the same Deny and Approve actions let the person retry.expiresAt is expired: read-only, with no Deny or Approve, and, in the card and detail layouts, a notice that says when it expired in the viewer's time zone ("This approval expired at 10:15 AM CST, the time its request set."); the row and decision layouts say "Expired before a decision" and leave the time to the host. Pass notice to write your own sentence for any read-only approval, such as what was refunded or what happened elsewhere.result writes what a decided approval led to ("Result: Refunded $18.50 to the original card."), and decidedIn says where it was decided when that was not here ("Approved by you in Reviews at 10:44 AM", with decidedBy and decidedAt). In the card layout a decision made elsewhere replaces the whole card with a check glyph, that sentence and one more: "Refund order 4471 for $42.00, Issue refund." followed by notice, such as "The run is continuing, so this page changed. You don't need to do anything here." Nothing of the card is left to answer, so nobody answers twice.footnote writes a muted line under the buttons while the approval waits, such as what happens once you decide. It goes with the buttons.context is a snippet written above the question, such as "Test chat, this runs for real: order 4471 is refunded".An unavailable approval is a held approval nobody can answer now, such as one that belongs to an agent whose plugin is disabled. The row shows the neutral word "Unavailable" at the right, the input in the same grid, and unavailableReason below it, with no Deny or Approve.
tool.name renders in monospace as the identifier; tool.label is the human name written before it.tool.risk is read as a muted word (Reads, Changes things, Dangerous). One shield glyph carries the alert in amber while the approval is pending and goes quiet once it is decided; its aria-label names the risk level ("High risk").card layout the heading is the first row of the card, on the card's own fill with no band or divider: who asked and when, the question, one line with the tool and its risk word, and the consequence. Without a question the title is "Approval required for name".operation.kind: 'command' renders the command as a syntax-highlighted shell CodeBlock.operation.kind: 'patch' renders the supplied unified patch as a syntax-highlighted diff.operation.filesTouched renders one flat row per unique path under "File touched" or "2 files touched": a file glyph (a diff glyph for a patch, a pen for a file write), the path in the code font with its directory muted and its name in the default colour, and a copy icon button at the inline end. A long path breaks after a slash, so the file name stays whole. Duplicate paths are collapsed.operation.argsPreview renders through PayloadInspector in the card and detail layouts; oversized previews are replaced with a bounded truncation notice before rendering. They open the Fields view, with the exact stored JSON one click away on the Fields/JSON switch. The row and decision layouts write it as label and value rows in the open instead (see the row above). In the card layout the arguments wait behind a closed disclosure, "Arguments" and a summary of the pairs (the title already names the tool), and arguments that only repeat the command get none; in a card narrower than 32rem the summary takes the line under "Arguments" at the content edge. The inspector it opens is named <tool> arguments. Pass inputLabel (for example Runs with) to name both yourself.card layout reads top to bottom: who asked, the question, the tool and its risk on one line, the command or the diff, the files, the arguments and Details disclosures, then the decision.env renders variable names only, as plain text. Values are not accepted and are stripped if a caller accidentally passes NAME=value.Pending requests render action buttons. Non-pending requests render a read-only summary in neutral text; a denied approval is never drawn in an error colour. When expiresAt passes while state is still pending, the effective state becomes expired, actions disappear, and no callback fires automatically.
The card title defaults to an h3 with section headings one level deeper. Pass headingLevel to fit the card into the host page's document outline, matching the Card convention.
Changes things
bun run --filter=@lostgradient/cinder validatePackage @lostgradient/cinder, Dry run No
A pending command approval with sandbox context, arguments, environment names, and editable arguments.
A question answered in Reviews while the page is open reads the same as an approval: "Answered by you in Reviews" with the time, then the question and what happened. Nothing is left to answer here.
When the approval is approved in Reviews while the page is open, the card is replaced by who decided, where and when, and the page says it changed. Approve and Deny are gone, so nobody approves twice.
Deny failing reads the same way: a red-toned inline message below the effect line says what failed and what is still true. Nothing was decided, so the live Deny and Approve are the retry and there is no separate Try again.
The card follows the approval-row rules on a neutral raised surface: who asked and when, the wrapping question, the tool with its identifier small and monospaced, muted "Dangerous Can't be undone", then the effect line. The arguments sit under "Runs with" and a note field is sent with both Approve and Deny.
A tool set to On changes offers the checkbox on its own line, below the note and above Deny and Approve. The note travels with Approve, with Allow, and with Deny. A tool set to Always shows only the note, Deny and Approve.
The card binds its view, so a page can hold one Fields and JSON choice and hand it to every payload: switching it on one card switches the other too.
The decision surface: the action as the title with an Irreversible badge, the pause, Tool, Target, Amount and the open Command, the countdown, Add note, then Deny and a named primary that arms on its first press.
A decided approval stays in the transcript as the action with one status line saying what was decided and by whom, and the note, result and command behind Details.
The approval's own page: the eyebrow with its risk glyph, the question, who asked (the source and the chat are links) and how long it has waited, what the source said as a collapsed line, what the tool is, the Input block with Fields and JSON, then one line with the risk glyph that says what cannot be undone and what approving does. Deny and Approve sit below.
A decided detail is read-only with no actions: the green outcome line leads with the decision, who made it and when, then where it was asked, the input and the result.
An expired approval is read-only. Beside who asked it reads Expired with a neutral dot, the input stays, and a notice says when it expired and what that means.
The failure shows in the detail as a red-toned inline message below the consequence line. Nothing was approved, so the row stays in Waiting; the decision bar stays live with Deny and a primary Approve, and Approve is the retry.
On the detail page the checkbox sits on its own line below the note and above Deny and Approve; the note travels with every decision.
A read-only approval request whose pending decision window has expired.
A high-risk patch approval that previews the proposed diff, touched files, and arguments.
The shared approval row: risk glyph and question, the tool and where it came from, the consequence, Input, Add note, Deny and Approve.
Approve reads "Approving…" with a spinner and both buttons turn off; the approval stays pending until the answer lands.
A context slot writes a line above the question, such as a test chat whose tools run for real.
A denied approval stays in the transcript as a neutral decision with who decided and when, the input it was asked about, and the note that went to the agent as the reason.
A decided approval shows who decided and when, then what it led to.
An approval decided on another page while this one was open collapses to who decided, where and when, with no Deny or Approve left, under the question it asked.
An approval that passed its `expiresAt` is read-only and says when it expired.
A red-toned inline message says what failed and what is still true. Nothing was decided, so Approve is the retry.
A tool set to On changes offers a checkbox on its own line before Deny and Approve; a tool set to Always never does.
A held approval nobody can answer now shows a neutral word and the reason, with no decision buttons.
When the approval cannot be answered right now, the reason sits above Add note, Deny and Approve, and both buttons are named by it. The question, the line, the consequence and Input stay visible.
Name | Type | Default | Description |
|---|---|---|---|
tool required | {
/** The tool's identifier, such as `issue-refund`. The `row` layout writes it small and monospaced. */
name: string;
/** The tool's human name, such as … Show full type{
/** The tool's identifier, such as `issue-refund`. The `row` layout writes it small and monospaced. */
name: string;
/** The tool's human name, such as `Issue refund`, written before the identifier. Omit it when the surrounding rows already name the call. */
label?: string;
/** Risk level assigned by the policy evaluator. Read as Reads, Changes things or Dangerous in muted text; the glyph carries the alert. */
risk: ApprovalToolRisk;
/** True when the operation cannot be reversed. Adds "Can't be undone", which never breaks across lines. */
irreversible?: boolean;
} | — | Tool requesting approval. |
sandbox | {
/** Sandbox provider, such as Codex or a remote execution backend. */
provider: string;
/** Sandbox profile or policy name. */
name: string;
/** Wor… Show full type{
/** Sandbox provider, such as Codex or a remote execution backend. */
provider: string;
/** Sandbox profile or policy name. */
name: string;
/** Working directory for the pending operation. */
workingDir: string;
} | — | Optional sandbox context in which the operation will run. |
operation required | {
/** Operation family being approved. */
kind: 'command';
/** Shell command for command approvals. */
command: string;
/** File paths that the operat… Show full type{
/** Operation family being approved. */
kind: 'command';
/** Shell command for command approvals. */
command: string;
/** File paths that the operation may read or write. Duplicate paths are collapsed for display. */
filesTouched?: string[];
/**
* JSON-like argument preview shown to the approver.
*
* @schemaPermissive
*/
argsPreview?: unknown;
} | — | Operation details shown to the approver. |
env | string[] | [] | Environment variable names only. Values are ignored if accidentally supplied as NAME=value. |
snapshotId | text | — | Snapshot identifier for the pending approval context. |
policyVersion required | text | — | Policy version that produced the approval request. |
idempotencyKey required | text | — | Idempotency key that makes repeated decisions durable. |
expiresAt | text | — | Optional ISO timestamp after which a pending approval is treated as expired. |
state required | 'pending'|'approved'|'approved_with_edits'|'denied'|'expired'|'cancelled'|'unavailable' | — | Persisted approval state. |
editableArgs | boolean | false | Whether approving with edited JSON arguments is available. Default false. |
headingLevel | 2|3|4|5|6 | 3 | Heading level for the card title; section headings render one level deeper. Default 3. |
layout | 'card' | 'row' | 'detail' | 'decision' | 'card' | Layout: the full card, the shared row (one approval inside a transcript or beneath a tool call), the approval's own detail page, or the explicit decision surface with its retained receipt. Default 'card'. |
question | text | — | The question the approval asks, such as Refund order 4471 for $42.00?. Default Run <tool>?. |
source | text | — | Who asked, written after the source prefix: Tool runner, or the agent. |
sourcePrefix | text | — | The words before source. Default Approval from, or Asked by in the detail layout. |
sourceHref | text | — | Where the source's name leads, in the detail layout: the name is written as a link ("Asked by Tool runner in a chat"). |
sourceIn | text | — | Where it was asked, written after "in" in the detail layout, such as the chat's title: "Asked by Tool runner in Please refund order 4471". |
sourceInHref | text | — | Where sourceIn leads, written as a link in the detail layout. |
said | text | — | What the source said when it asked, in the detail layout: a collapsed line under who asked, "Tool runner said Order 4471 is $42.00…", that opens in place to the whole text. |
eyebrow | text | — | The small line above the question in the detail layout, beside the risk glyph. Default Tool approval. |
toolPrefix | text | — | The words before the tool in the detail layout: "It wants to run Issue refund issue-refund Dangerous". Default It wants to run. |
requestedAt | text | — | When the approval was asked. Written as relative time ("4 min ago") while the approval is pending. |
consequence | text | — | What approving does, in one line, such as Sends $42.00 back to the original card. |
rememberScope | text | — | Offers "Allow <tool> for <scope>" as a checkbox on its own line before Deny and Approve, with
the scope written after "for", such as the rest of this chat. Leave it out for a tool set to
Always, which never offers it. Checking it sets remember on the resolution. |
reason bindable | text | '' | A host-owned decision note, retained when the host changes the open approval. |
noteInitiallyOpen | boolean | false | Opens the decision note field when the card first renders. |
decidedBy | text | — | Who decided, once the approval is decided: you. Written as "Denied by you". |
decidedAt | text | — | When the approval was decided, written as a time of day after the outcome ("Denied by you, 10:40 AM"). |
decisionNote | text | — | The note the approver left with the decision, written under the outcome as "Your note", the note, and a caption saying where it went: "Sent to the agent as the reason." for a denial. |
draftNote bindable | text | — | The pending note in the row layout. Providing a draft opens its field, even when empty. |
disabledReason | text | — | Why Deny and Approve are off while the approval is still pending, such as Approving is off until Interborough is reachable. Written above the actions and named by both buttons. |
unavailableReason | text | — | Why an unavailable approval cannot be answered now, written beneath it. |
resolving | 'approve' | 'deny' | — | The answer that is on its way: approve writes "Approving…" with a spinner on Approve,
deny writes "Denying…" with a spinner on Deny, and both buttons, the note and the
checkbox turn off until the host clears it. The approval stays pending. |
failure | {
/** What failed, in a few words, such as `Couldn't approve.`. */
summary: string;
/** The failure reason. Include a durable outcome only when the host c… Show full type{
/** What failed, in a few words, such as `Couldn't approve.`. */
summary: string;
/** The failure reason. Include a durable outcome only when the host can confirm it. */
detail?: string;
} | — | Why the last answer did not go through, written as a red-toned inline message below the consequence. Nothing was decided, so Deny and Approve stay live; Approve is the retry. |
notice | text | — | A notice written beneath a read-only approval, such as why it expired or what happened
elsewhere. Without one, an approval that passed its expiresAt says when it expired. |
result | text | — | What the approval led to, once it is decided: written as "Result: Refunded $18.50 to the original card.". |
decidedIn | text | — | Where it was decided when that was not here, such as Reviews: "Approved by you in Reviews at 10:44 AM". |
decidedInHref | text | — | Where decidedIn leads, written as a link in the decision layout's receipt: "Approved by Priya Raman in Reviews". |
facts | ApprovalFact[] | [] | Meaningful host facts the decision layout writes under the title, such as Target and Amount. Tool identity and the readable Command come from the approval itself. |
approveLabel | text | — | The decision layout's own words for the primary action, such as Refund $42.00. Default Approve. An irreversible primary reads "Press again to refund $42.00" once armed. |
pauseSentence | text | — | Shared approval context accepted by callers; the compact decision layout does not repeat a generic pause sentence. |
why | text | — | Why the agent wants to do this, written by the host and offered in the decision layout as a disclosure named "Why the agent wants to do this". |
outcomeLabel | text | — | Names the decision for a request that is not a tool approval, in place of Approved or Denied, such as Answered for a question: "Answered by you in Reviews at 10:44 AM". The request's question is then the sentence beneath, with no tool named. |
footnote | text | — | A line of text written under the buttons while the approval is pending, such as what happens once you decide. |
inputLabel | text | — | What the payload is called, such as Runs with: the name of the input rows in the row and decision layouts and of the Input block on the detail page (default Input), and of the arguments in the card (default <tool> arguments). |
context | snippet | — | A line of context written above the question, such as "Test chat, this runs for real". |
view bindable | 'fields' | 'json' | 'fields' | Which view of the arguments the card and the detail page show, Fields or JSON; the row and
decision layouts write the input as rows in the open. Bindable, so one switch can govern
every payload on a page. Default fields. |
now | number | — | The reference time for relative times. Defaults to now. |
onResolve | (resolution: ApprovalResolution) => void | — | Called for approve, approve-with-edits, and deny with the complete resolution payload. |
onAskAgain | () => void | — | Requests a fresh approval after this one has expired in the decision layout. |
decisionReview | snippet | — | An additional row-layout review control. It shares the row’s note, scope and guarded submit. |
actionRenderer | snippet | — | Wrap the existing action controls without replacing their guarded behavior. |
id | text | — | — |