{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "codex-permissions",
  "title": "Codex Permissions",
  "description": "The /permissions chooser — numbered Default / Auto-review / Full Access options as a real radiogroup.",
  "files": [
    {
      "path": "registry/brainless/codex/codex-permissions.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * CodexPermissions — Codex CLI's `/permissions` chooser.\n *\n * Captured grammar (v0.132): a title, then a numbered list with a `›` on the\n * active row and wrapped descriptions. Footer: \"Press enter to confirm or esc\n * to go back\".\n */\nconst FG = \"#ededed\";\nconst DIM = \"#7a7a7a\";\nconst ACCENT = \"#f6e2b7\";\n\nexport type CodexPermissionOption = {\n  label: string;\n  description: string;\n  current?: boolean;\n};\n\nconst DEFAULT_OPTIONS: CodexPermissionOption[] = [\n  {\n    label: \"Default\",\n    current: true,\n    description:\n      \"Codex can read and edit files in the current workspace, and run commands. Approval is required to access the internet or edit other files.\",\n  },\n  {\n    label: \"Auto-review\",\n    description:\n      \"Same workspace-write permissions as Default, but eligible `on-request` approvals are routed through the auto-reviewer subagent.\",\n  },\n  {\n    label: \"Full Access\",\n    description:\n      \"Codex can edit files outside this workspace and access the internet without asking for approval. Exercise caution when using.\",\n  },\n];\n\nexport function CodexPermissions({\n  title = \"Update Model Permissions\",\n  options = DEFAULT_OPTIONS,\n  defaultSelected = 0,\n  onChoose,\n  className,\n}: {\n  title?: string;\n  options?: CodexPermissionOption[];\n  defaultSelected?: number;\n  onChoose?: (index: number) => void;\n  className?: string;\n}) {\n  const [sel, setSel] = React.useState(defaultSelected);\n\n  function onKey(e: React.KeyboardEvent, i: number) {\n    if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n      e.preventDefault();\n      const next =\n        e.key === \"ArrowDown\"\n          ? (i + 1) % options.length\n          : (i - 1 + options.length) % options.length;\n      setSel(next);\n      (e.currentTarget.parentElement?.children[next] as HTMLElement)?.focus();\n    } else if (e.key === \"Enter\" || e.key === \" \") {\n      e.preventDefault();\n      setSel(i);\n      onChoose?.(i);\n    }\n  }\n\n  return (\n    <div className={cn(\"font-mono text-[13px] leading-[1.55]\", className)}>\n      <div className=\"mb-2 font-semibold\" style={{ color: FG }}>\n        {title}\n      </div>\n\n      <div role=\"radiogroup\" aria-label={title} className=\"space-y-2\">\n        {options.map((opt, i) => {\n          const active = sel === i;\n          return (\n            <div\n              key={opt.label}\n              role=\"radio\"\n              aria-checked={active}\n              tabIndex={active ? 0 : -1}\n              onKeyDown={(e) => onKey(e, i)}\n              onClick={() => {\n                setSel(i);\n                onChoose?.(i);\n              }}\n              className=\"flex cursor-pointer gap-2 outline-none focus-visible:ring-1 focus-visible:ring-white/30\"\n            >\n              <span\n                aria-hidden\n                className=\"inline-block w-[2ch] shrink-0 font-bold\"\n                style={{ color: active ? FG : \"transparent\" }}\n              >\n                ›\n              </span>\n              <div className=\"min-w-0\">\n                <div style={{ color: active ? ACCENT : FG }}>\n                  <span className=\"tabular-nums\">{i + 1}.</span> {opt.label}\n                  {opt.current ? (\n                    <span style={{ color: DIM }}> (current)</span>\n                  ) : null}\n                </div>\n                <p\n                  className=\"mt-0.5 max-w-prose pl-0 text-[12px]\"\n                  style={{ color: DIM }}\n                >\n                  {opt.description}\n                </p>\n              </div>\n            </div>\n          );\n        })}\n      </div>\n\n      <p className=\"mt-3 text-[12px]\" style={{ color: DIM }}>\n        Press enter to confirm or esc to go back\n      </p>\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "components/brainless/codex/codex-permissions.tsx"
    }
  ],
  "type": "registry:ui"
}