Skip to content
GitHub (opens in a new tab)

PermissionRequest

An agent asks for standing access to a capability (files, email, repo, billing), scope by scope, with why and expiry. Grant / Deny, then one line.

stableOrganismcontracts/permissionrequest.json

Preview

PermissionRequest

Standing access, scope by scope. Not ApprovalCard. Not Switch.

Master

Grant or deny. Grant goes through granting to one line.

Permission request

2 scopes

Research agent wants standing access, not a single action. It applies to every run until you revoke it or it expires.

  • ~/acme/ledger/docsRead
    Why: Summarise weekly doc changes for the Monday digest.Expires in 7 days
  • Send email as ops@acme.devWrite
    Why: Post the digest to the #ops mailing list.No expiry
    Limit: 50 emails a day

Standing access. Every future run can send email without asking again. Revoke any time in Settings → Agents.

requested 14:02

Usage

PermissionRequest grants access that lasts. Name every scope, its access level, why and its expiry. One action is an ApprovalCard.

Do's

  • an agent needs access that lasts beyond one action
  • several scopes with read / write / admin levels
  • the grant can fail and needs Retry
  • badge: the request waits on this person, like "Needs you" on a page that also lists what is already allowed
  • summary: the change fits in two to four short cells, like Changes, For, Still asks, so it reads before the scopes

Don'ts

  • one command or edit — ApprovalCard
  • a settings toggle the person flips themselves — Switch
  • a must-choose interruption for the whole page — AlertDialog
<PermissionRequest
  description="…"
  scopes={[
    { id: "docs", resource: "~/acme/ledger/docs", access: "read", icon: "Folder", reason: "Summarise weekly doc changes for the Monday digest.", expiry: "Expires in 7 days" },
    { id: "mail", resource: "Send email as ops@acme.dev", access: "write", icon: "Mail", reason: "Post the digest to the #ops mailing list.", limit: "50 emails a day", expiry: "No expiry" },
  ]}
  warning="…"
  status={status}
  onGrant={grant}
  onDeny={deny}
/>

When to use

  • an agent needs access that lasts beyond one action
  • several scopes with read / write / admin levels
  • the grant can fail and needs Retry
  • badge: the request waits on this person, like "Needs you" on a page that also lists what is already allowed
  • summary: the change fits in two to four short cells, like Changes, For, Still asks, so it reads before the scopes

When not to use

  • one command or edit — ApprovalCard
  • a settings toggle the person flips themselves — Switch
  • a must-choose interruption for the whole page — AlertDialog

What an agent reads

import { PermissionRequest } from "agentic-ds-kit";
must
  • section aria-labelledby the h3 title
  • scopes are a list; access is text in a Badge
  • Escape denies (not on another control) and ⌘/Ctrl+Enter grants while focus is in the card; buttons carry aria-keyshortcuts and show their keys as aria-hidden chips (Esc on Deny, ⌘⏎ on Grant)
  • granting sets aria-busy and announces in a status region
  • the error is a kit LoadError (role=alert) with Retry
  • summary is a dl: each label is a dt and its value a dd
  • under 40rem of card width Grant and Deny stack full width at size lg, Grant first, and the key chips are left out
  • resolved row is named "Granted: <title>"
  • motion is opacity and transform only, off under prefers-reduced-motion
defaults
  • title Permission request
  • status pending
  • errorMessage Couldn't save the grant.
stops if
  • Do not invent a local PermissionCard, AccessRequest, or ScopePicker
  • Do not hide expiry or the standing-access warning for write or admin
  • Grant is the one solid primary; Deny is outline
  • Do not put the reason or the warning in badge; badge is one or two words on who it waits for
  • Do not repeat every scope in summary or drop the scopes for it; summary says the change, the scopes say the access
  • Do not use raw hex

From contracts/permissionrequest.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
titlestringNoPermission request—
descriptionstringNo——
scopesarrayYes—{ id, resource, access: "read" | "write" | "admin", reason?, limit?, expiry?, icon? }[]. limit says how far the access goes, e.g. "$500 per refund". The access Badge reads Read, Write or Admin.
statusenumNopendinggranted / denied / expired render one line. pending | granting | error | granted | denied | expired
warningstringNo—Standing-access warning, a kit Alert (warning).
errorMessagestringNoCouldn't save the grant.A small kit LoadError with Retry.
requestedAtstringNo—e.g. "requested 14:02", in mono at the start of the footer. With badge it sits beside the badge instead.
badgestringNo—A warning kit Badge with a Hand icon on a row above the title, e.g. "Needs you". requestedAt moves onto that row and the scope count is left out.
summaryarrayNo—{ label, value }[], two to four cells, e.g. [{ label: "For", value: "30 days, until 22 Dec" }]. A dl strip under the description: columns, or label and value rows when the card is under 40rem.
resolvedNotestringNo—Resolved row detail, e.g. "until 17 Nov".
resolvedActionslotNo—One small control at the end of the resolved row, e.g. a kit Button (ghost, sm) "Change level" that opens the same edit flow as the page. Granted, denied and expired only.
onGrantfunctionNo—Grant (Check icon), the one solid primary. ⌘/Ctrl+Enter inside the card.
onDenyfunctionNo—Deny, outline. Escape while focus is in the card but not on another control.
onRetryfunctionNo—Error row Retry. Falls back to onGrant.
  • Component
    →

    ApprovalCard

    The agent asks before it acts: risk, what will happen in words, an exact preview of the command or diff, and Approve (⌘/Ctrl+Enter) / Deny (Escape) with an optional auto-deny countdown.

  • Component
    →

    Switch

    Immediate on/off setting.

  • Component
    →

    AlertDialog

    Must-choose overlay that interrupts until the user cancels or confirms.

  • Component
    →

    Alert

    Inline status banner that stays on the page.