Skip to content
ghostui

Preview

Save weekly update?docs/weekly-update.md

Design guidance

Tool composes Activity row/disclosure parts backed by canonical Collapsible. ToolApproval is a separate decision surface. Direct approval children stay visible when execution details are closed. Approval actions use nested ButtonGroup owners for distinct Deny and Allow once controls and remain disabled while a decision is pending. Approved, denied, failed, and expired records remain honest; approval does not claim that execution succeeded. Errors use an alert region, and custom content keeps the caller's semantics.

Installation

Install

Basic usage

The caller owns the decision state. Connect the callbacks to your application or runtime. An approved decision does not imply successful execution.

Structures

ToolApproval can stand alone or attach to Composer. Tool groups optional execution details; a direct approval child stays visible outside its collapsed detail.

Examples

Running

The running state names the operation and shows only caller-provided input.

Running

Input

Searching the order history.

Result details

The quiet result summary opens only when the user asks to inspect the returned details.

Result ready

Approval

Approval is a separate decision. Approve or deny updates the caller-owned record immediately.

Approval requiredShare receiptApproval required — Pending
Approval requiredAllow the assistant to share this receipt with the support team?

Approval with caller Composer

Place ToolApproval with layout="compact" in Composer.secondary. Supply the decision question through prompt and the affected file or action through children. The editor stays in the same compact LayerCard.

Save weekly update?docs/weekly-update.md

Failure and retry

The error remains visible and retry is available only when the caller supplies it.

Failed

Cancelled

Cancelled operations remain readable and do not claim completion.

Cancelled

Result

The lookup stopped before it changed anything.

Custom result

Custom result content stays caller-rendered and is not serialized by Tool.

Result ready

Result

Receipt result

Standalone approval

The decision remains visible without a disclosure.

Save weekly update?docs/weekly-update.md

Submitting a decision

Actions stay disabled until the caller acknowledges the decision.

Submitting decisiondocs/weekly-update.md

Approval failure and retry

Retry returns to the pending request. A failed submission retains the request.

Approval faileddocs/weekly-update.md

Expired approval

An expired request cannot send another decision.

Expireddocs/weekly-update.md

Long approval

The affected path wraps while the two actions remain usable.

Save weekly customer feedback and rollout review?docs/research/weekly-customer-feedback-and-rollout-review.md

Vercel AI SDK

An actual installed SDK hook and deterministic native transport drive approval and output.

Activity complete
  1. Read the weekly update
  2. Check the destination
Approval required

Input

docs/weekly-update.md
Save weekly update?docs/weekly-update.md

TanStack AI

An actual installed TanStack hook and local AG-UI connection drive the same view contract.

Activity complete
  1. Read the weekly update
  2. Check the destination
Approval required

Input

docs/weekly-update.md
Save weekly update?docs/weekly-update.md

API reference

Import decisions from @/components/ui/tool-approval. Existing @/components/ui/tool imports remain compatible. Tool names an execution; ToolApproval names the decision. Approval acknowledgement does not imply a successful result. Optional adapter bindApproval({ approvalId, addToolApprovalResponse, getCurrent }) checks the current request identity/state before dispatch; the host owns authorization and persistence.