AI agent JS behaviour

Approval card

The agent asks permission: a summary, a details/diff slot, and Approve / Deny / “Always allow” with Y, N and A shortcuts; then it folds into one line with an icon swap.

Real scenarios

The component as it is used in a product — not a specimen grid.

Switch the production cache to Redis?

Edits config/cache.php and restarts the queue workers. Sessions are not affected.

edit_file · config/cache.php production
config/cache.php

No changes

Livewire sees: pending

Send the follow-up email to 14 customers?

Subject: “Your order is on its way”. Sent from support@ on your behalf.

send_email × 14

Important props

Important props
Prop Type Default What it does
title / summary / tool string — The question, a short explanation and the tool or command to run.
wire:model / state string pending pending · approved · denied · always — two-way with wire:model.
action string null A Livewire method called with the decision; an nx-approval event is dispatched too.
allow-always / shortcuts / undoable bool true · true · false The “Always allow” button, keyboard shortcuts, and an Undo.

Snippet

<x-nx::approval-card title="Run the migration?" tool="php artisan migrate --force"
    summary="Adds two columns to orders." wire:model.live="decision" undoable>
    <x-nx::diff-viewer :old-text="$before" :new-text="$after" />
</x-nx::approval-card>