{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "agent-run-layout",
  "title": "AgentRunLayout",
  "description": "The run screen. It takes organisms as slots, so your app decides what goes where.",
  "dependencies": [
    "@radix-ui/react-dialog@^1.2.0"
  ],
  "registryDependencies": [
    "https://creance.pages.dev/r/avatar.json",
    "https://creance.pages.dev/r/badge.json",
    "https://creance.pages.dev/r/budget-meter.json",
    "https://creance.pages.dev/r/button.json",
    "https://creance.pages.dev/r/creance-base.json",
    "https://creance.pages.dev/r/icon-button.json",
    "https://creance.pages.dev/r/status-badge.json"
  ],
  "files": [
    {
      "path": "agent-run-layout/AgentRunLayout.css",
      "content": ".cr-run-layout {\n  display: grid;\n  grid-template-rows: auto auto 1fr;\n  gap: var(--cr-space-4);\n  min-height: 100%;\n  padding: var(--cr-space-4);\n  box-sizing: border-box;\n  background: var(--cr-gradient-horizon), var(--cr-gradient-canvas), var(--cr-color-bg-canvas);\n  background-attachment: fixed;\n  color: var(--cr-color-text-default);\n  font-family: var(--cr-font-family-sans);\n  font-size: var(--cr-font-size-md);\n}\n\n.cr-run-layout__header {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  justify-content: space-between;\n  gap: var(--cr-space-4);\n  position: sticky;\n  top: var(--cr-space-3);\n  z-index: 10;\n  padding: var(--cr-space-3) var(--cr-space-3) var(--cr-space-3) var(--cr-space-4);\n  border-radius: var(--cr-radius-xl);\n}\n\n.cr-run-layout__agent {\n  display: flex;\n  align-items: center;\n  gap: var(--cr-space-3);\n  min-width: 0;\n}\n\n.cr-run-layout__titles {\n  min-width: 0;\n}\n\n.cr-run-layout__name {\n  margin: 0;\n  font-family: var(--cr-font-family-display);\n  font-size: var(--cr-font-size-lg);\n  font-weight: var(--cr-font-weight-semibold);\n  line-height: var(--cr-font-line-height-tight);\n}\n\n.cr-run-layout__goal {\n  margin: var(--cr-space-1) 0 0;\n  color: var(--cr-color-text-muted);\n  font-size: var(--cr-font-size-sm);\n}\n\n.cr-run-layout__tools {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  gap: var(--cr-space-4);\n}\n\n.cr-run-layout__count {\n  min-width: 1.4em;\n  padding: 0 var(--cr-space-1);\n  border-radius: var(--cr-radius-full);\n  background: var(--cr-color-ink-bg);\n  color: var(--cr-color-ink-fg);\n  font-size: var(--cr-font-size-xs);\n  text-align: center;\n}\n\n.cr-run-layout__main {\n  display: grid;\n  grid-template-columns: minmax(320px, 2fr) minmax(360px, 3fr);\n  gap: var(--cr-space-4);\n  align-items: start;\n  min-height: 0;\n}\n\n.cr-run-layout__timeline {\n  position: sticky;\n  top: 96px;\n  height: min(640px, calc(100vh - 120px));\n  border-radius: var(--cr-radius-xl);\n}\n\n.cr-run-layout__detail {\n  display: grid;\n  /* minmax(0, …): a long line in a card scrolls inside it instead of widening the column. */\n  grid-template-columns: minmax(0, 1fr);\n  gap: var(--cr-space-4);\n  min-width: 0;\n}\n\n@media (max-width: 900px) {\n  .cr-run-layout__main {\n    grid-template-columns: 1fr;\n  }\n\n  .cr-run-layout__timeline {\n    position: static;\n    height: 360px;\n  }\n}\n\n.cr-run-layout__overlay {\n  position: fixed;\n  inset: 0;\n  z-index: 40;\n  background: var(--cr-color-bg-overlay);\n  -webkit-backdrop-filter: blur(2px);\n  backdrop-filter: blur(2px);\n}\n\n.cr-run-layout__drawer.cr-glass {\n  position: fixed;\n  z-index: 41;\n  display: grid;\n  grid-template-rows: auto 1fr;\n  align-content: start;\n  gap: var(--cr-space-3);\n  top: var(--cr-space-3);\n  right: var(--cr-space-3);\n  bottom: var(--cr-space-3);\n  width: min(440px, calc(100vw - 2 * var(--cr-space-3)));\n  padding: var(--cr-space-4);\n  box-sizing: border-box;\n  overflow-y: auto;\n  border-radius: var(--cr-radius-xl);\n  color: var(--cr-color-text-default);\n  font-family: var(--cr-font-family-sans);\n  animation: cr-drawer-in var(--cr-motion-duration-slow) var(--cr-motion-easing-spring);\n}\n\n.cr-run-layout__drawer:focus-visible {\n  outline: none;\n}\n\n.cr-run-layout__drawer-bar {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n}\n\n.cr-run-layout__drawer-title {\n  margin: 0;\n  color: var(--cr-color-text-muted);\n  font-size: var(--cr-font-size-sm);\n  font-weight: var(--cr-font-weight-semibold);\n}\n\n@keyframes cr-drawer-in {\n  from { opacity: 0; transform: translateX(24px) scale(0.98); }\n}\n",
      "type": "registry:file",
      "target": "@components/creance/agent-run-layout/AgentRunLayout.css"
    },
    {
      "path": "agent-run-layout/AgentRunLayout.tsx",
      "content": "'use client';\n\nimport * as Dialog from '@radix-ui/react-dialog';\nimport type { ReactNode } from 'react';\nimport { Avatar } from '@/components/creance/avatar/Avatar';\nimport type { Status } from '@/components/creance/badge/Badge';\nimport { Button } from '@/components/creance/button/Button';\nimport { IconButton } from '@/components/creance/icon-button/IconButton';\nimport { BudgetMeter, type BudgetMeterProps } from '@/components/creance/budget-meter/BudgetMeter';\nimport { StatusBadge } from '@/components/creance/status-badge/StatusBadge';\nimport { cx } from '@/lib/creance/cx';\nimport { CrossIcon } from '@/lib/creance/icons';\nimport './AgentRunLayout.css';\n\nexport type RunLayoutStatus = 'idle' | 'running' | 'waiting' | 'completed' | 'failed';\n\nconst statusBadge: Record<RunLayoutStatus, { status: Status; label: string }> = {\n  idle: { status: 'waiting', label: 'Not started' },\n  running: { status: 'running', label: 'Running' },\n  waiting: { status: 'waiting', label: 'Waiting for you' },\n  completed: { status: 'done', label: 'Completed' },\n  failed: { status: 'failed', label: 'Failed' },\n};\n\nexport interface AgentRunLayoutProps {\n  agentName: string;\n  /** What the run is trying to do. */\n  goal?: string | undefined;\n  status: RunLayoutStatus;\n  startedAt?: number | undefined;\n  endedAt?: number | undefined;\n  budget?: Pick<BudgetMeterProps, 'used' | 'limit' | 'unit'> | undefined;\n  /** Left column, usually a RunTimeline. It gets a fixed height and scrolls internally. */\n  timeline: ReactNode;\n  /** Right column: the ApprovalPrompt, DiffReview or ToolCallCard in focus. */\n  detail: ReactNode;\n  /** Full-width slot above the columns, e.g. an AgentHandoffBanner. */\n  banner?: ReactNode;\n  /** Drawer content, usually a NeedsYouInbox. The header button shows `inboxCount`. */\n  inbox?: ReactNode;\n  inboxCount?: number;\n  inboxOpen?: boolean;\n  onInboxOpenChange?: (open: boolean) => void;\n  /** Extra controls at the end of the header. */\n  actions?: ReactNode;\n  className?: string;\n}\n\n/**\n * The agent run screen: header with agent, status and budget; timeline left, detail right;\n * an inbox drawer for everything else waiting on the person. Layout only: it renders the slots it's given.\n */\nexport function AgentRunLayout({\n  agentName,\n  goal,\n  status,\n  startedAt,\n  endedAt,\n  budget,\n  timeline,\n  detail,\n  banner,\n  inbox,\n  inboxCount = 0,\n  inboxOpen,\n  onInboxOpenChange,\n  actions,\n  className,\n}: AgentRunLayoutProps) {\n  const badge = statusBadge[status];\n  return (\n    <div className={cx('cr-run-layout', className)}>\n      <header className=\"cr-run-layout__header cr-glass\">\n        <div className=\"cr-run-layout__agent\">\n          <Avatar name={agentName} decorative />\n          <div className=\"cr-run-layout__titles\">\n            <h1 className=\"cr-run-layout__name\">{agentName}</h1>\n            {goal && <p className=\"cr-run-layout__goal\">{goal}</p>}\n          </div>\n          <StatusBadge status={badge.status} label={badge.label} startedAt={startedAt} endedAt={endedAt} />\n        </div>\n        <div className=\"cr-run-layout__tools\">\n          {budget && <BudgetMeter {...budget} />}\n          {inbox && (\n            <Dialog.Root {...(inboxOpen !== undefined && { open: inboxOpen })} onOpenChange={onInboxOpenChange}>\n              <Dialog.Trigger asChild>\n                <Button>\n                  Needs you <span className=\"cr-run-layout__count\">{inboxCount}</span>\n                </Button>\n              </Dialog.Trigger>\n              <Dialog.Portal>\n                <Dialog.Overlay className=\"cr-run-layout__overlay\" />\n                <Dialog.Content className=\"cr-run-layout__drawer cr-glass\" aria-describedby={undefined}>\n                  <div className=\"cr-run-layout__drawer-bar\">\n                    <Dialog.Title className=\"cr-run-layout__drawer-title\">Inbox</Dialog.Title>\n                    <Dialog.Close asChild>\n                      <IconButton label=\"Close inbox\" icon={<CrossIcon />} tooltip={false} />\n                    </Dialog.Close>\n                  </div>\n                  {inbox}\n                </Dialog.Content>\n              </Dialog.Portal>\n            </Dialog.Root>\n          )}\n          {actions}\n        </div>\n      </header>\n\n      {banner && <div className=\"cr-run-layout__banner\">{banner}</div>}\n\n      <main className=\"cr-run-layout__main\">\n        <section className=\"cr-run-layout__timeline cr-surface\" aria-label=\"Timeline\">\n          {timeline}\n        </section>\n        <section className=\"cr-run-layout__detail\" aria-label=\"Details\">\n          {detail}\n        </section>\n      </main>\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/creance/agent-run-layout/AgentRunLayout.tsx"
    }
  ],
  "categories": [
    "template",
    "agent"
  ],
  "type": "registry:ui"
}