{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bot-roster-overview",
  "title": "Bot Roster Overview",
  "description": "Every AI bot on one screen: what each is doing, how reliable it's been, what it's spent today, and one click to pause, start or unblock it.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/new-york/bot-roster-overview/bot-roster-overview.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport type BotStatus = \"working\" | \"idle\" | \"blocked\" | \"paused\";\n\nexport interface RosterBot {\n  id: string;\n  name: string;\n  role: string;\n  status: BotStatus;\n  /** What it's on now, or the last thing it did. */\n  task: string;\n  /** Share of runs that succeeded, from 0 to 100. */\n  success: number;\n  /** Spent today, in dollars. */\n  spend: number;\n  /** Runs per day, oldest first. Drawn as a small line. */\n  runs: number[];\n}\n\nexport interface BotRosterOverviewProps extends Omit<\n  React.ComponentPropsWithoutRef<\"section\">,\n  \"title\"\n> {\n  theme?: \"dark\" | \"light\";\n  title?: string;\n  bots?: RosterBot[];\n  onStatusChange?: (bot: RosterBot, status: BotStatus) => void;\n}\n\ntype Filter = \"all\" | \"working\" | \"idle\" | \"blocked\";\ntype Sort = \"default\" | \"success\" | \"spend\";\n\nconst FONT =\n  '\"Inter Variable\", Inter, \"SF Pro Display\", -apple-system, BlinkMacSystemFont, sans-serif';\nconst RING = \"outline-none focus-visible:ring-2 focus-visible:ring-[#5E6AD2]\";\nconst ROW = 60;\nconst GREEN = \"#27A644\";\nconst ORANGE = \"#FC7840\";\n\nconst PALETTES = {\n  dark: {\n    card: \"#08090A\",\n    border: \"rgba(255,255,255,0.08)\",\n    text: \"#F7F8F8\",\n    soft: \"#D0D6E0\",\n    sub: \"#8A8F98\",\n    faint: \"#62666D\",\n    chip: \"rgba(255,255,255,0.05)\",\n    tile: \"#161718\",\n    btn: \"#E5E5E6\",\n    btnText: \"#08090A\",\n  },\n  light: {\n    card: \"#FFFFFF\",\n    border: \"rgba(8,9,10,0.08)\",\n    text: \"#08090A\",\n    soft: \"#3C3F44\",\n    sub: \"#62666D\",\n    faint: \"#8A8F98\",\n    chip: \"rgba(8,9,10,0.04)\",\n    tile: \"#F7F8F8\",\n    btn: \"#08090A\",\n    btnText: \"#F7F8F8\",\n  },\n};\n\nconst DEFAULT_BOTS: RosterBot[] = [\n  {\n    id: \"aria\",\n    name: \"Aria\",\n    role: \"Writer\",\n    status: \"working\",\n    task: \"Drafting the March release notes\",\n    success: 96,\n    spend: 8.42,\n    runs: [12, 14, 13, 17, 16, 19, 21],\n  },\n  {\n    id: \"scout\",\n    name: \"Scout\",\n    role: \"Research\",\n    status: \"working\",\n    task: \"Reading 40 support tickets\",\n    success: 91,\n    spend: 11.08,\n    runs: [20, 18, 22, 21, 24, 23, 26],\n  },\n  {\n    id: \"patch\",\n    name: \"Patch\",\n    role: \"Code\",\n    status: \"blocked\",\n    task: \"Waiting for a staging password\",\n    success: 84,\n    spend: 14.6,\n    runs: [9, 11, 10, 8, 12, 7, 5],\n  },\n  {\n    id: \"relay\",\n    name: \"Relay\",\n    role: \"Operations\",\n    status: \"working\",\n    task: \"Syncing orders to the warehouse\",\n    success: 99,\n    spend: 3.17,\n    runs: [31, 30, 33, 32, 34, 33, 35],\n  },\n  {\n    id: \"sift\",\n    name: \"Sift\",\n    role: \"Support\",\n    status: \"idle\",\n    task: \"Queue is empty\",\n    success: 93,\n    spend: 2.25,\n    runs: [16, 15, 18, 14, 13, 12, 11],\n  },\n  {\n    id: \"tally\",\n    name: \"Tally\",\n    role: \"Finance\",\n    status: \"working\",\n    task: \"Matching March invoices\",\n    success: 98,\n    spend: 2.66,\n    runs: [6, 7, 7, 8, 9, 9, 10],\n  },\n];\n\nconst FILTERS: { id: Filter; label: string }[] = [\n  { id: \"all\", label: \"All\" },\n  { id: \"working\", label: \"Working\" },\n  { id: \"idle\", label: \"Idle\" },\n  { id: \"blocked\", label: \"Needs help\" },\n];\n\nconst ACTIONS: Record<BotStatus, { label: string; to: BotStatus }> = {\n  working: { label: \"Pause\", to: \"paused\" },\n  paused: { label: \"Resume\", to: \"working\" },\n  idle: { label: \"Start\", to: \"working\" },\n  blocked: { label: \"Unblock\", to: \"working\" },\n};\n\nconst STATUS_LABEL: Record<BotStatus, string> = {\n  working: \"Working\",\n  idle: \"Idle\",\n  blocked: \"Needs help\",\n  paused: \"Paused\",\n};\n\n/** Drawn as SVG, because a tiny border-radius circle turns lumpy on 1x screens. */\nfunction Dot({ size, color }: { size: number; color: string }) {\n  const r = size / 2;\n  return (\n    <svg\n      aria-hidden=\"true\"\n      width={size}\n      height={size}\n      viewBox={`0 0 ${size} ${size}`}\n      className=\"block shrink-0\"\n    >\n      <circle\n        cx={r}\n        cy={r}\n        r={r}\n        className=\"motion-safe:transition-[fill] motion-safe:duration-200\"\n        style={{ fill: color }}\n      />\n    </svg>\n  );\n}\n\nfunction Trend({ runs, color }: { runs: number[]; color: string }) {\n  const w = 64;\n  const h = 20;\n  const max = Math.max(...runs);\n  const min = Math.min(...runs);\n  const span = max - min || 1;\n  const points = runs\n    .map((v, i) => {\n      const x = Math.round((i / (runs.length - 1)) * (w - 2) * 10) / 10 + 1;\n      const y = Math.round((h - 3 - ((v - min) / span) * (h - 6)) * 10) / 10;\n      return `${x},${y}`;\n    })\n    .join(\" \");\n  return (\n    <svg\n      aria-hidden=\"true\"\n      width={w}\n      height={h}\n      viewBox={`0 0 ${w} ${h}`}\n      className=\"block shrink-0\"\n    >\n      <polyline\n        points={points}\n        fill=\"none\"\n        stroke={color}\n        strokeWidth=\"1.5\"\n        strokeLinejoin=\"round\"\n        strokeLinecap=\"round\"\n      />\n    </svg>\n  );\n}\n\nexport function BotRosterOverview({\n  theme = \"dark\",\n  title = \"Bot roster\",\n  bots = DEFAULT_BOTS,\n  onStatusChange,\n  className,\n  style,\n  ...rest\n}: BotRosterOverviewProps) {\n  const c = PALETTES[theme];\n  const [filter, setFilter] = React.useState<Filter>(\"all\");\n  const [sort, setSort] = React.useState<Sort>(\"default\");\n  const [changed, setChanged] = React.useState<Record<string, BotStatus>>({});\n\n  const statusOf = (bot: RosterBot) => changed[bot.id] ?? bot.status;\n  const colorOf = (status: BotStatus) =>\n    status === \"working\" ? GREEN : status === \"blocked\" ? ORANGE : c.faint;\n\n  const count = (id: Filter) =>\n    id === \"all\" ? bots.length : bots.filter((b) => statusOf(b) === id).length;\n  const spend = bots.reduce((sum, b) => sum + b.spend, 0);\n\n  const ordered =\n    sort === \"default\" ? bots : [...bots].sort((a, b) => b[sort] - a[sort]);\n  const shown = ordered.filter(\n    (b) => filter === \"all\" || statusOf(b) === filter,\n  );\n\n  const act = (bot: RosterBot) => {\n    const next = ACTIONS[statusOf(bot)].to;\n    setChanged((prev) => ({ ...prev, [bot.id]: next }));\n    onStatusChange?.(bot, next);\n  };\n\n  const sortButton = (key: Sort, label: string, align: string) => (\n    <button\n      type=\"button\"\n      data-sort={key}\n      aria-pressed={sort === key}\n      onClick={() => setSort(sort === key ? \"default\" : key)}\n      className={`cursor-pointer rounded border-0 bg-transparent p-0 text-[12px] leading-[16px] tracking-[-0.005em] whitespace-nowrap ${align} ${RING}`}\n      style={{ color: sort === key ? c.text : c.faint }}\n    >\n      {label}\n      {sort === key ? \" ↓\" : \"\"}\n    </button>\n  );\n\n  const columns =\n    \"grid items-center gap-x-4 grid-cols-[minmax(0,1fr)_auto] @3xl:grid-cols-[150px_minmax(0,1fr)_64px_68px_68px_68px]\";\n\n  return (\n    <section\n      aria-label={title}\n      className={`@container w-full rounded-2xl border ${className ?? \"\"}`}\n      style={{\n        background: c.card,\n        borderColor: c.border,\n        color: c.text,\n        fontFamily: FONT,\n        ...style,\n      }}\n      {...rest}\n    >\n      <div className=\"p-5 pb-3 @3xl:p-6 @3xl:pb-3\">\n        <div className=\"flex items-start justify-between gap-4\">\n          <header className=\"min-w-0\">\n            <h3 className=\"m-0 text-[20px] leading-[26px] font-[590] tracking-[-0.012em]\">\n              {title}\n            </h3>\n            <p\n              aria-live=\"polite\"\n              className=\"m-0 mt-1 text-[13px] leading-[20px] tracking-[-0.011em] tabular-nums\"\n              style={{ color: c.sub }}\n            >\n              {count(\"working\")} working, {count(\"blocked\")} need help\n            </p>\n          </header>\n          <div className=\"shrink-0 text-right\">\n            <p className=\"m-0 text-[32px] leading-[32px] font-[510] tracking-[-0.022em] tabular-nums\">\n              ${spend.toFixed(2)}\n            </p>\n            <p\n              className=\"m-0 mt-1.5 text-[13px] leading-[20px]\"\n              style={{ color: c.sub }}\n            >\n              Spent today\n            </p>\n          </div>\n        </div>\n\n        <div\n          role=\"group\"\n          aria-label=\"Filter\"\n          className=\"mt-4 flex flex-wrap gap-1.5\"\n        >\n          {FILTERS.map((f) => {\n            const on = filter === f.id;\n            return (\n              <button\n                key={f.id}\n                type=\"button\"\n                data-filter={f.id}\n                aria-pressed={on}\n                onClick={() => setFilter(f.id)}\n                className={`flex h-7 cursor-pointer items-center gap-2 rounded-full border-0 px-3 text-[13px] leading-[20px] font-[510] tracking-[-0.011em] motion-safe:transition-colors motion-safe:duration-150 ${RING}`}\n                style={{\n                  background: on ? c.chip : \"transparent\",\n                  color: on ? c.text : c.sub,\n                }}\n              >\n                {f.id !== \"all\" && (\n                  <Dot\n                    size={8}\n                    color={\n                      f.id === \"working\"\n                        ? GREEN\n                        : f.id === \"blocked\"\n                          ? ORANGE\n                          : c.faint\n                    }\n                  />\n                )}\n                {f.label}\n                <span className=\"tabular-nums\" style={{ color: c.sub }}>\n                  {count(f.id)}\n                </span>\n              </button>\n            );\n          })}\n        </div>\n      </div>\n\n      <div\n        className={`${columns} border-b px-5 pb-2 @3xl:px-6`}\n        style={{ borderColor: c.border }}\n      >\n        <span\n          className=\"text-[12px] leading-[16px] tracking-[-0.005em]\"\n          style={{ color: c.faint }}\n        >\n          Bot\n        </span>\n        <span\n          className=\"hidden text-[12px] leading-[16px] tracking-[-0.005em] @3xl:block\"\n          style={{ color: c.faint }}\n        >\n          Now\n        </span>\n        <span\n          className=\"hidden text-[12px] leading-[16px] tracking-[-0.005em] @3xl:block\"\n          style={{ color: c.faint }}\n        >\n          7 days\n        </span>\n        <span className=\"hidden text-right @3xl:block\">\n          {sortButton(\"success\", \"Success\", \"text-right\")}\n        </span>\n        <span className=\"text-right\">\n          {sortButton(\"spend\", \"Spend\", \"text-right\")}\n        </span>\n        <span className=\"hidden @3xl:block\" />\n      </div>\n\n      {/* Rows slide to their place, so sorting and filtering never change the card's height. */}\n      <ul\n        className=\"relative m-0 list-none overflow-hidden p-0\"\n        style={{ height: bots.length * ROW }}\n      >\n        {bots.map((bot) => {\n          const at = shown.indexOf(bot);\n          const on = at >= 0;\n          const status = statusOf(bot);\n          const action = ACTIONS[status];\n          return (\n            <li\n              key={bot.id}\n              data-row={bot.id}\n              aria-hidden={!on}\n              inert={!on}\n              className={`${columns} border-b px-5 motion-safe:transition-[transform,opacity] motion-safe:duration-300 @3xl:px-6`}\n              style={{\n                position: \"absolute\",\n                top: 0,\n                left: 0,\n                right: 0,\n                height: ROW,\n                borderColor: c.border,\n                opacity: on ? 1 : 0,\n                visibility: on ? \"visible\" : \"hidden\",\n                transform: `translateY(${(on ? at : ordered.indexOf(bot)) * ROW}px)`,\n              }}\n            >\n              <div className=\"flex min-w-0 items-center gap-3\">\n                <span\n                  aria-hidden=\"true\"\n                  className=\"flex shrink-0 items-center justify-center rounded-lg text-[13px] leading-[20px] font-[590]\"\n                  style={{\n                    width: 32,\n                    height: 32,\n                    background: c.tile,\n                    color: c.soft,\n                  }}\n                >\n                  {bot.name.slice(0, 1)}\n                </span>\n                <span className=\"min-w-0\">\n                  <span className=\"flex items-center gap-1.5\">\n                    <span className=\"truncate text-[13.5px] leading-[20px] font-[510] tracking-[-0.011em]\">\n                      {bot.name}\n                    </span>\n                    <Dot size={6} color={colorOf(status)} />\n                  </span>\n                  <span\n                    className=\"block truncate text-[12px] leading-[16px] tracking-[-0.005em] @3xl:hidden\"\n                    style={{ color: c.faint }}\n                  >\n                    {status === \"paused\" ? \"Paused\" : bot.task}\n                  </span>\n                  <span\n                    className=\"hidden truncate text-[12px] leading-[16px] tracking-[-0.005em] @3xl:block\"\n                    style={{ color: c.faint }}\n                  >\n                    {bot.role}\n                  </span>\n                </span>\n              </div>\n              <span className=\"hidden min-w-0 @3xl:block\">\n                <span\n                  className=\"block truncate text-[13px] leading-[20px] tracking-[-0.011em]\"\n                  style={{ color: status === \"working\" ? c.soft : c.sub }}\n                >\n                  {bot.task}\n                </span>\n                <span\n                  className=\"block text-[12px] leading-[16px] tracking-[-0.005em]\"\n                  style={{ color: colorOf(status) }}\n                >\n                  {STATUS_LABEL[status]}\n                </span>\n              </span>\n              <span className=\"hidden @3xl:block\">\n                <Trend runs={bot.runs} color={c.sub} />\n              </span>\n              <span\n                className=\"hidden text-right text-[13px] leading-[20px] font-[510] tracking-[-0.011em] tabular-nums @3xl:block\"\n                style={{ color: c.soft }}\n              >\n                {bot.success}%\n              </span>\n              <span\n                className=\"text-right text-[13px] leading-[20px] font-[510] tracking-[-0.011em] tabular-nums\"\n                style={{ color: c.soft }}\n              >\n                ${bot.spend.toFixed(2)}\n              </span>\n              <button\n                type=\"button\"\n                data-act={bot.id}\n                onClick={() => act(bot)}\n                aria-label={`${action.label} ${bot.name}`}\n                className={`hidden h-7 cursor-pointer rounded-full border-0 text-[12.5px] leading-[18px] font-[510] tracking-[-0.008em] @3xl:block ${RING}`}\n                style={{\n                  background: status === \"blocked\" ? c.btn : c.chip,\n                  color: status === \"blocked\" ? c.btnText : c.soft,\n                }}\n              >\n                {action.label}\n              </button>\n            </li>\n          );\n        })}\n      </ul>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}