Agent permissions matrix (Pro)
ProIncluded in $99What each agent may do with each tool, as one grid: allow, ask or deny per cell, set by row, column or brush.
On this page
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { AgentPermissionsMatrix } from "@/components/ui/chatcn/pro/agent-permissions-matrix"
<AgentPermissionsMatrix
tools={[
{ id: "gh-merge", group: "GitHub", name: "merge_pull_request", label: "Merge pull requests", risk: "destructive" },
{ id: "sl-read", group: "Slack", name: "search_messages", label: "Search messages", risk: "read" },
]}
columns={[
{ id: "support", label: "Support", description: "Replies to customers" },
{ id: "coding", label: "Coding", description: "Works in the repo" },
]}
value={saved} // { [toolId]: { [columnId]: "allow" | "ask" | "deny" } }
onSave={(draft) => savePolicy(draft)}
/>Rows are tools, grouped by the connector they come from; columns are whatever you grant to: agents, surfaces or environments. A click cycles a cell through allow, ask and deny. Every header is a menu that sets its whole row, column or connector at once, and the brush in the toolbar paints: pick allow, ask or deny, then click or drag across cells. Edits stay a draft: changed cells carry a dot, the footer counts them, Discard puts everything back and nothing applies until Save. Tools marked destructive (they delete, send or spend) are outlined in amber and counted in the toolbar whenever they are allowed to run without asking. A missing cell reads as ask. On narrow screens the grid scrolls inside its frame with the tool names pinned.
Examples
States
Props
| Prop | Type | Notes |
|---|---|---|
tools | MatrixTool[] | { id, name, label?, group?, risk? }; rows, grouped by group |
columns | MatrixColumn[] | { id, label, description? } |
value | PermissionMatrix | The saved permissions; edits are a draft on top |
onDraftChange | (draft) => void | Every edit |
onSave | (draft) => void | Promise<void> | Throw to keep the draft |
labels | Partial<AgentPermissionsMatrixLabels> | Every string, for translation |
Keyboard
| Key | Action |
|---|---|
| Tab | Enters the grid at the last cell used; one tab stop |
| Arrow keys | Move between cells (reversed right to left) |
| Home, End | First or last cell in the row; with Ctrl or Cmd, in the grid |
| Space, Enter | Cycle allow, ask, deny |
| Y, A, N | Allow, ask, deny |
Accessibility
- A real table with row and column headers; each cell is a button named by tool, column and value.
- The header menus name what they set: Set all for Coding.
- The change count is a polite live region.
- Values carry an icon and a word, never color alone.
Motion
Cells change color over 150 ms. Nothing else moves.