{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "agent-requests-feature",
  "type": "registry:block",
  "title": "Agent Requests Feature",
  "description": "Feature Section built with Agent Session (AI agent terminal demo): example requests play in an agent session. A take on the terminal (cli) and product demo (interactive demo). A feature section where four example requests drive one Agent Session. The picked request plays in a terminal beside the screen it changes: an alert rule and its Slack message, a retention table filling cohort by cohort, revenue split by plan, events tagged one by one. A line under the row fills as each change lands, and the next request plays on its own until the visitor picks one.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "blocks",
    "feature-sections",
    "features",
    "terminal",
    "product-demo"
  ],
  "docs": "Live preview and the components it's built with: https://keyframeui.com/blocks/feature-sections/agent-requests-feature",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://keyframeui.com/r/agent-session.json",
    "utils"
  ],
  "files": [
    {
      "path": "components/agent-requests-feature.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\nimport {\n  AgentSession,\n  AgentSessionTarget,\n  useAgentSessionEffect,\n  type AgentSessionStep,\n} from \"@/components/ui/agent-session\";\n\n/* ── Content ─────────────────────────────────────────────────\n * Everything you'd change to make the section yours: the copy,\n * the requests a visitor can pick, and the script the agent runs\n * for each. The app the agent changes is plain markup further\n * down; its numbers are here.\n * ─────────────────────────────────────────────────────────── */\n\n/** The one accent: progress lines, the glow and rings in the session, and the app's highlights. */\nconst ACCENT = { light: \"#ea580c\", dark: \"#fb923c\" };\n\nconst BRAND = \"Tern\";\nconst HEADLINE = \"Ask for what you need.\";\nconst HEADLINE_QUIET = \"Tern does the wiring.\";\nconst SUBLINE =\n  \"Describe the change in one sentence. Your coding agent finds the events, writes the tracking code and puts the chart where you asked, as plain files in your repo.\";\nconst FOOTNOTE = \"Every change is a file you read in review and undo with git.\";\nconst TERMINAL_TITLE = \"web — agent\";\n\n/** How long a finished request rests before the next one plays, until the visitor picks one. */\nconst ADVANCE_MS = 2600;\n\ntype Screen = \"alerts\" | \"retention\" | \"revenue\" | \"events\";\ntype Icon = \"bell\" | \"hash\" | \"grid\" | \"bars\" | \"tag\" | \"clock\";\n\nconst REQUESTS: { id: Screen; label: string; icons: Icon[]; url: string; script: AgentSessionStep[] }[] = [\n  {\n    id: \"alerts\",\n    label: \"Ping #payments when checkout errors spike\",\n    icons: [\"bell\", \"hash\"],\n    url: \"localhost:3000/alerts\",\n    script: [\n      { prompt: \"Ping #payments in Slack when checkout errors spike\" },\n      {\n        run: \"npx tern events list --match checkout\",\n        ms: 800,\n        output: [\"checkout_started    checkout_failed    checkout_completed\"],\n      },\n      {\n        run: 'npx tern alert add checkout_failed --above 2% --window 10m --slack \"#payments\"',\n        ms: 1200,\n        pace: 380,\n        output: [\n          { text: \"+ tern/alerts/checkout-failed.yml   2% over 10 min\", tone: \"added\", effect: \"rule\" },\n          { text: \"✓ Slack connected · #payments\", tone: \"success\", effect: \"slack\" },\n        ],\n      },\n      {\n        run: \"npx tern alert test checkout-failed\",\n        ms: 900,\n        output: [{ text: \"✓ Test alert sent to #payments\", tone: \"success\", effect: \"toast\" }],\n      },\n      { say: \"Done. If more than 2% of checkouts fail within ten minutes, #payments hears about it.\" },\n    ],\n  },\n  {\n    id: \"retention\",\n    label: \"Add a weekly retention table\",\n    icons: [\"grid\", \"clock\"],\n    url: \"localhost:3000/retention\",\n    script: [\n      { prompt: \"Add a weekly retention table for the last four cohorts\" },\n      {\n        run: \"npx tern add retention --cohort weekly --weeks 4\",\n        ms: 1000,\n        output: [\n          { text: \"+ app/retention/cohort-table.tsx   CohortTable\", tone: \"added\", effect: \"table\" },\n          \"~ app/retention/page.tsx           +1 section\",\n        ],\n      },\n      {\n        run: \"npx tern backfill retention --since 2026-09-28\",\n        ms: 1300,\n        pace: 340,\n        output: [\n          { text: \"Week of Sep 28   1,912 people\", effect: \"w0\" },\n          { text: \"Week of Oct 5    2,104 people\", effect: \"w1\" },\n          { text: \"Week of Oct 12   2,388 people\", effect: \"w2\" },\n          { text: \"Week of Oct 19   2,241 people\", effect: \"w3\" },\n        ],\n      },\n      { say: \"Retention is climbing: 41% of the Oct 12 cohort came back in week one, up from 38% in September.\" },\n    ],\n  },\n  {\n    id: \"revenue\",\n    label: \"Break revenue down by plan\",\n    icons: [\"bars\"],\n    url: \"localhost:3000/revenue\",\n    script: [\n      { prompt: \"Break revenue down by plan, week by week\" },\n      {\n        run: 'npx tern query \"sum(amount) by plan, week\" --last 8w',\n        ms: 1100,\n        output: [\n          { text: \"plan       this week   vs 8w ago\", tone: \"muted\" },\n          \"Pro        $18,420     +31%\",\n          \"Team       $9,870      +9%\",\n          \"Starter    $2,310      −4%\",\n        ],\n      },\n      {\n        run: \"npx tern add chart revenue-by-plan --type stacked\",\n        ms: 1000,\n        output: [{ text: \"+ app/revenue/by-plan.tsx   RevenueByPlan\", tone: \"added\", effect: \"chart\" }],\n      },\n      { say: \"Pro is 60% of revenue now, up from 52% eight weeks ago. Starter is flat.\" },\n    ],\n  },\n  {\n    id: \"events\",\n    label: \"Tag every event with the customer's plan\",\n    icons: [\"tag\"],\n    url: \"localhost:3000/events\",\n    script: [\n      { prompt: \"Tag every event with the customer's plan\" },\n      {\n        run: 'npx tern properties add plan --from \"user.subscription.plan\"',\n        ms: 900,\n        output: [{ text: \"+ tern/properties/plan.ts   reads user.subscription.plan\", tone: \"added\" }],\n      },\n      {\n        run: \"npx tern backfill --property plan --last 24h\",\n        ms: 1200,\n        pace: 320,\n        output: [\n          { text: \"signup_completed    412 events\", effect: \"e0\" },\n          { text: \"checkout_started    1,036 events\", effect: \"e1\" },\n          { text: \"page_viewed         18,920 events\", effect: \"e2\" },\n          { text: \"invite_sent         96 events\", effect: \"e3\" },\n        ],\n      },\n      { say: \"Every event carries plan now, the last 24 hours included, so any chart can split by it.\" },\n    ],\n  },\n];\n\n/* The app the agent changes. */\n\nconst NAV: { label: string; screen?: Screen }[] = [\n  { label: \"Overview\" },\n  { label: \"Events\", screen: \"events\" },\n  { label: \"Retention\", screen: \"retention\" },\n  { label: \"Revenue\", screen: \"revenue\" },\n  { label: \"Alerts\", screen: \"alerts\" },\n];\n\nconst COHORTS = [\n  { effect: \"w0\", week: \"Sep 28\", people: \"1,912\", rates: [100, 38, 31, 27] },\n  { effect: \"w1\", week: \"Oct 5\", people: \"2,104\", rates: [100, 40, 33] },\n  { effect: \"w2\", week: \"Oct 12\", people: \"2,388\", rates: [100, 41] },\n  { effect: \"w3\", week: \"Oct 19\", people: \"2,241\", rates: [100] },\n];\n\n/** Revenue per week in $k: Pro, Team, Starter. */\nconst REVENUE = [\n  [10.2, 7.9, 2.4],\n  [11.0, 8.1, 2.5],\n  [11.8, 8.4, 2.3],\n  [12.9, 8.6, 2.4],\n  [14.1, 9.0, 2.4],\n  [15.6, 9.2, 2.3],\n  [16.9, 9.5, 2.3],\n  [18.4, 9.9, 2.3],\n];\n\nconst EVENTS = [\n  { effect: \"e0\", name: \"signup_completed\", who: \"maya@kiln.studio\", ago: \"2s\", plan: \"Pro\" },\n  { effect: \"e1\", name: \"checkout_started\", who: \"theo@ferngrove.co\", ago: \"6s\", plan: \"Team\" },\n  { effect: \"e2\", name: \"page_viewed\", who: \"/pricing\", ago: \"9s\", plan: \"Starter\" },\n  { effect: \"e3\", name: \"invite_sent\", who: \"ana@lumenhaus.io\", ago: \"14s\", plan: \"Pro\" },\n];\n\n/* ── Section ─────────────────────────────────────────────── */\n\nconst focusRing =\n  \"outline-none focus-visible:ring-2 focus-visible:ring-(--accent) focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-zinc-950\";\n\nconst effectsOf = (script: AgentSessionStep[]) => {\n  const names = new Set<string>();\n  for (const step of script) {\n    if (\"say\" in step && step.effect) names.add(step.effect);\n    if (\"output\" in step)\n      for (const line of step.output ?? []) if (typeof line !== \"string\" && line.effect) names.add(line.effect);\n  }\n  return names.size;\n};\n\nexport function AgentRequestsFeature() {\n  const reduced = useReducedMotion();\n  const [active, setActive] = React.useState(0);\n  const [landed, setLanded] = React.useState(0);\n  const [done, setDone] = React.useState(false);\n  // Auto-advance until the visitor picks a request themselves.\n  const [touring, setTouring] = React.useState(true);\n  const timer = React.useRef<number>(0);\n  const tabs = React.useRef<(HTMLButtonElement | null)[]>([]);\n  const id = React.useId();\n\n  React.useEffect(() => () => window.clearTimeout(timer.current), []);\n\n  const show = (index: number) => {\n    window.clearTimeout(timer.current);\n    setActive(index);\n    setLanded(0);\n    setDone(false);\n  };\n\n  const pick = (index: number) => {\n    setTouring(false);\n    show(index);\n  };\n\n  const onKeyDown = (event: React.KeyboardEvent) => {\n    const last = REQUESTS.length - 1;\n    const next =\n      event.key === \"ArrowRight\" || event.key === \"ArrowDown\"\n        ? active === last ? 0 : active + 1\n        : event.key === \"ArrowLeft\" || event.key === \"ArrowUp\"\n          ? active === 0 ? last : active - 1\n          : event.key === \"Home\"\n            ? 0\n            : event.key === \"End\"\n              ? last\n              : null;\n    if (next == null) return;\n    event.preventDefault();\n    pick(next);\n    tabs.current[next]?.focus();\n  };\n\n  const request = REQUESTS[active];\n  const changes = effectsOf(request.script);\n\n  return (\n    <section\n      style={{ \"--accent-light\": ACCENT.light, \"--accent-dark\": ACCENT.dark } as React.CSSProperties}\n      className=\"bg-white text-zinc-950 [--accent:var(--accent-light)] dark:bg-zinc-950 dark:text-white dark:[--accent:var(--accent-dark)]\"\n    >\n      <div className=\"mx-auto max-w-6xl px-6 py-24 sm:py-32\">\n        <div className=\"grid gap-x-10 gap-y-5 lg:grid-cols-12 lg:items-end\">\n          <h2 className=\"text-4xl/[1.05] font-semibold tracking-[-0.035em] text-balance sm:text-5xl/[1.02] lg:col-span-7\">\n            {HEADLINE} <span className=\"block text-zinc-400 dark:text-zinc-500\">{HEADLINE_QUIET}</span>\n          </h2>\n          <p className=\"max-w-md text-base/7 text-pretty text-zinc-600 lg:col-span-5 lg:justify-self-end dark:text-zinc-400\">\n            {SUBLINE}\n          </p>\n        </div>\n\n        <div\n          role=\"tablist\"\n          aria-label={`Requests to ${BRAND}`}\n          onKeyDown={onKeyDown}\n          className=\"mt-12 grid border-t border-zinc-950/10 sm:grid-cols-2 sm:gap-x-10 dark:border-white/10\"\n        >\n          {REQUESTS.map((item, index) => {\n            const selected = index === active;\n            return (\n              <button\n                key={item.id}\n                ref={(el) => {\n                  tabs.current[index] = el;\n                }}\n                type=\"button\"\n                role=\"tab\"\n                id={`${id}-tab-${index}`}\n                aria-selected={selected}\n                aria-controls={`${id}-panel`}\n                tabIndex={selected ? 0 : -1}\n                onClick={() => pick(index)}\n                className={cn(\n                  \"group relative flex h-14 min-w-0 items-center justify-between gap-4 border-b border-zinc-950/10 text-left text-sm transition-colors dark:border-white/10\",\n                  focusRing,\n                  selected\n                    ? \"text-zinc-950 dark:text-white\"\n                    : \"text-zinc-500 hover:text-zinc-950 dark:text-zinc-400 dark:hover:text-white\",\n                )}\n              >\n                <span className=\"min-w-0 truncate font-medium\">{item.label}</span>\n                <span className=\"flex shrink-0 items-center gap-2 text-zinc-400 dark:text-zinc-500\">\n                  {selected && (\n                    <span className=\"text-xs text-zinc-500 tabular-nums dark:text-zinc-400\">\n                      {done ? <CheckIcon className=\"size-3.5 text-(--accent)\" /> : `${landed}/${changes}`}\n                    </span>\n                  )}\n                  {item.icons.map((icon) => (\n                    <RowIcon key={icon} icon={icon} className=\"size-3.5\" />\n                  ))}\n                </span>\n                {/* Fills as each of this request's changes lands in the app. */}\n                {selected && (\n                  <motion.span\n                    aria-hidden\n                    initial={{ transform: \"scaleX(0)\" }}\n                    animate={{ transform: `scaleX(${done ? 1 : landed / Math.max(1, changes)})` }}\n                    transition={reduced ? { duration: 0 } : { type: \"spring\", visualDuration: 0.45, bounce: 0 }}\n                    className=\"absolute inset-x-0 -bottom-px h-px origin-left bg-(--accent)\"\n                  />\n                )}\n              </button>\n            );\n          })}\n        </div>\n\n        <div id={`${id}-panel`} role=\"tabpanel\" aria-labelledby={`${id}-tab-${active}`} className=\"mt-8\">\n          <AgentSession\n            script={request.script}\n            title={TERMINAL_TITLE}\n            url={request.url}\n            onEffect={() => setLanded((count) => count + 1)}\n            onComplete={() => {\n              setDone(true);\n              if (!touring) return;\n              window.clearTimeout(timer.current);\n              timer.current = window.setTimeout(() => show((active + 1) % REQUESTS.length), ADVANCE_MS);\n            }}\n            className=\"[--agent-session-accent:var(--accent)] [--agent-session-height:21rem] [--agent-session-preview-height:19rem] sm:[--agent-session-height:23rem] dark:[--agent-session-accent:var(--accent)]\"\n          >\n            <TernApp screen={request.id} />\n          </AgentSession>\n          <p className=\"mt-4 text-center text-sm text-zinc-500\">{FOOTNOTE}</p>\n        </div>\n      </div>\n    </section>\n  );\n}\n\n/* ── The app ─────────────────────────────────────────────── */\n\nfunction TernApp({ screen }: { screen: Screen }) {\n  return (\n    <div className=\"@container/app flex h-full text-zinc-900 dark:text-zinc-100\">\n      <aside className=\"hidden w-32 shrink-0 flex-col gap-0.5 border-r border-zinc-950/[0.06] bg-zinc-50/70 p-2.5 @[26rem]/app:flex dark:border-white/[0.06] dark:bg-white/[0.02]\">\n        <div className=\"mb-3 flex items-center gap-1.5 px-1.5 pt-1 text-[13px] font-semibold tracking-tight\">\n          <TernMark className=\"size-3.5 text-(--accent)\" />\n          {BRAND}\n        </div>\n        {NAV.map((item) => (\n          <div\n            key={item.label}\n            className={cn(\n              \"rounded-md px-2 py-1.5 text-xs\",\n              item.screen === screen\n                ? \"bg-white font-medium shadow-sm ring-1 ring-zinc-950/5 dark:bg-white/10 dark:ring-white/5\"\n                : \"text-zinc-500 dark:text-zinc-400\",\n            )}\n          >\n            {item.label}\n          </div>\n        ))}\n      </aside>\n      <div className=\"relative min-w-0 flex-1 p-4\">\n        {screen === \"alerts\" && <AlertsScreen />}\n        {screen === \"retention\" && <RetentionScreen />}\n        {screen === \"revenue\" && <RevenueScreen />}\n        {screen === \"events\" && <EventsScreen />}\n      </div>\n    </div>\n  );\n}\n\nfunction ScreenTitle({ title, aside }: { title: string; aside?: React.ReactNode }) {\n  return (\n    <div className=\"mb-3 flex items-baseline justify-between gap-3\">\n      <h3 className=\"text-sm font-semibold tracking-tight\">{title}</h3>\n      {aside && <span className=\"truncate text-[11px] text-zinc-400\">{aside}</span>}\n    </div>\n  );\n}\n\nconst card =\n  \"rounded-xl bg-white ring-1 ring-zinc-950/[0.08] shadow-sm dark:bg-white/[0.04] dark:ring-white/10\";\n\nfunction AlertsScreen() {\n  return (\n    <>\n      <ScreenTitle title=\"Alerts\" aside=\"2 rules\" />\n      <div className={cn(card, \"divide-y divide-zinc-950/[0.06] dark:divide-white/[0.06]\")}>\n        <AlertRow name=\"Signup drop\" rule=\"−30% in 1 hour\" to=\"Email\" />\n        <AgentSessionTarget\n          effect=\"rule\"\n          className=\"[--agent-session-ring-radius:10px]\"\n          fallback={<p className=\"px-3 py-2.5 text-[11px] text-zinc-400\">Nothing watches checkout yet</p>}\n        >\n          <AlertRow name=\"Checkout failures\" rule=\"> 2% in 10 min\" to=\"#payments\" fresh />\n        </AgentSessionTarget>\n      </div>\n\n      <div className=\"mt-3 flex items-center justify-between rounded-xl px-3 py-2.5 ring-1 ring-zinc-950/[0.08] dark:ring-white/10\">\n        <span className=\"text-xs font-medium\">Slack</span>\n        <AgentSessionTarget\n          effect=\"slack\"\n          className=\"justify-items-end [--agent-session-ring-radius:999px]\"\n          fallback={<span className=\"text-[11px] text-zinc-400\">Not connected</span>}\n        >\n          <span className=\"flex items-center gap-1.5 text-[11px] text-zinc-600 dark:text-zinc-300\">\n            <span className=\"size-1.5 rounded-full bg-emerald-500\" />\n            #payments\n          </span>\n        </AgentSessionTarget>\n      </div>\n\n      {/* The test alert, as it arrives in Slack. */}\n      <AgentSessionTarget\n        effect=\"toast\"\n        className=\"absolute right-4 bottom-4 left-4 [--agent-session-ring-radius:14px] @[26rem]/app:left-auto @[26rem]/app:w-64\"\n      >\n        <div className={cn(card, \"flex gap-2.5 p-3\")}>\n          <span className=\"grid size-7 shrink-0 place-items-center rounded-lg bg-zinc-950 text-white dark:bg-white dark:text-zinc-950\">\n            <TernMark className=\"size-3.5\" />\n          </span>\n          <div className=\"min-w-0\">\n            <p className=\"text-[11px] font-semibold\">\n              {BRAND} <span className=\"font-normal text-zinc-400\">in #payments</span>\n            </p>\n            <p className=\"mt-0.5 text-[11px]/4 text-zinc-600 dark:text-zinc-300\">\n              Test: checkout_failed at 2.4% over the last 10 minutes.\n            </p>\n          </div>\n        </div>\n      </AgentSessionTarget>\n    </>\n  );\n}\n\nfunction AlertRow({ name, rule, to, fresh = false }: { name: string; rule: string; to: string; fresh?: boolean }) {\n  return (\n    <div className=\"flex items-center gap-2.5 px-3 py-2.5\">\n      <span className={cn(\"size-1.5 shrink-0 rounded-full\", fresh ? \"bg-(--accent)\" : \"bg-zinc-300 dark:bg-zinc-600\")} />\n      <span className=\"min-w-0 flex-1 truncate text-xs font-medium\">{name}</span>\n      <span className=\"text-[11px] text-zinc-500 tabular-nums dark:text-zinc-400\">{rule}</span>\n      <span className=\"hidden rounded-md bg-zinc-100 px-1.5 py-0.5 text-[10px] text-zinc-600 @[22rem]/app:inline dark:bg-white/[0.06] dark:text-zinc-300\">\n        {to}\n      </span>\n    </div>\n  );\n}\n\nfunction RetentionScreen() {\n  return (\n    <>\n      <ScreenTitle title=\"Retention\" aside=\"Weekly cohorts\" />\n      <AgentSessionTarget\n        effect=\"table\"\n        className=\"[--agent-session-ring-radius:14px]\"\n        fallback={\n          <div className=\"flex h-full min-h-40 flex-col items-center justify-center gap-1 rounded-xl border border-dashed border-zinc-950/15 text-center dark:border-white/15\">\n            <p className=\"text-xs font-medium\">No retention view yet</p>\n            <p className=\"text-[11px] text-zinc-400\">Cohorts appear once events are tracked.</p>\n          </div>\n        }\n      >\n        <div className={cn(card, \"p-3\")}>\n          <div className=\"grid grid-cols-[minmax(0,1fr)_repeat(4,2.25rem)] gap-1 text-[10px] text-zinc-400\">\n            <span>Cohort</span>\n            {[\"W0\", \"W1\", \"W2\", \"W3\"].map((week) => (\n              <span key={week} className=\"text-center\">\n                {week}\n              </span>\n            ))}\n          </div>\n          <div className=\"mt-1.5 flex flex-col gap-1\">\n            {COHORTS.map((cohort) => (\n              <CohortRow key={cohort.effect} {...cohort} />\n            ))}\n          </div>\n        </div>\n      </AgentSessionTarget>\n    </>\n  );\n}\n\nfunction CohortRow({ effect, week, people, rates }: (typeof COHORTS)[number]) {\n  const landed = useAgentSessionEffect(effect);\n  const reduced = useReducedMotion();\n  return (\n    <AgentSessionTarget effect={effect} enter=\"none\" className=\"[--agent-session-ring-radius:8px]\">\n      <div className=\"grid grid-cols-[minmax(0,1fr)_repeat(4,2.25rem)] items-center gap-1\">\n        <span className=\"min-w-0 truncate text-[11px]\">\n          {week} <span className=\"text-zinc-400 tabular-nums\">{people}</span>\n        </span>\n        {[0, 1, 2, 3].map((i) => {\n          const rate = rates[i];\n          return (\n            <span\n              key={i}\n              className=\"relative grid h-6 place-items-center overflow-hidden rounded-md bg-zinc-100 text-[10px] tabular-nums dark:bg-white/[0.05]\"\n            >\n              {rate != null && (\n                <>\n                  <motion.span\n                    aria-hidden\n                    initial={false}\n                    animate={{ opacity: landed ? 0.15 + (rate / 100) * 0.85 : 0 }}\n                    transition={reduced ? { duration: 0 } : { duration: 0.35, delay: landed ? i * 0.06 : 0 }}\n                    className=\"absolute inset-0 bg-(--accent)\"\n                  />\n                  <motion.span\n                    initial={false}\n                    animate={{ opacity: landed ? 1 : 0 }}\n                    transition={reduced ? { duration: 0 } : { duration: 0.25, delay: landed ? i * 0.06 : 0 }}\n                    className={cn(\"relative font-medium\", rate > 60 ? \"text-white dark:text-zinc-950\" : \"\")}\n                  >\n                    {rate}%\n                  </motion.span>\n                </>\n              )}\n            </span>\n          );\n        })}\n      </div>\n    </AgentSessionTarget>\n  );\n}\n\nfunction RevenueScreen() {\n  const max = Math.max(...REVENUE.map((week) => week.reduce((a, b) => a + b, 0)));\n  return (\n    <>\n      <ScreenTitle title=\"Revenue\" aside=\"$30,600 this week\" />\n      <div className=\"mb-3 grid grid-cols-2 gap-2\">\n        <Stat label=\"This week\" value=\"$30.6k\" delta=\"+8.4%\" />\n        <Stat label=\"Paying teams\" value=\"1,148\" delta=\"+3.0%\" />\n      </div>\n      <AgentSessionTarget\n        effect=\"chart\"\n        className=\"[--agent-session-ring-radius:14px]\"\n        fallback={\n          <div className={cn(card, \"flex h-full min-h-36 items-center justify-center text-[11px] text-zinc-400\")}>\n            Revenue isn&apos;t split by plan yet\n          </div>\n        }\n      >\n        {(landed) => (\n          <div className={cn(card, \"p-3\")}>\n            <div className=\"flex h-24 items-end gap-1.5\">\n              {REVENUE.map((week, i) => (\n                <StackedBar key={i} week={week} max={max} grow={landed} index={i} />\n              ))}\n            </div>\n            <div className=\"mt-2.5 flex gap-3 text-[10px] text-zinc-500 dark:text-zinc-400\">\n              <Legend className=\"bg-(--accent)\" label=\"Pro\" />\n              <Legend className=\"bg-zinc-800 dark:bg-zinc-300\" label=\"Team\" />\n              <Legend className=\"bg-zinc-300 dark:bg-zinc-600\" label=\"Starter\" />\n            </div>\n          </div>\n        )}\n      </AgentSessionTarget>\n    </>\n  );\n}\n\nfunction StackedBar({ week, max, grow, index }: { week: number[]; max: number; grow: boolean; index: number }) {\n  const reduced = useReducedMotion();\n  const total = week.reduce((a, b) => a + b, 0);\n  const tones = [\"bg-(--accent)\", \"bg-zinc-800 dark:bg-zinc-300\", \"bg-zinc-300 dark:bg-zinc-600\"];\n  return (\n    <motion.div\n      initial={false}\n      animate={{ transform: `scaleY(${grow ? 1 : 0.04})` }}\n      transition={reduced ? { duration: 0 } : { type: \"spring\", visualDuration: 0.5, bounce: 0.08, delay: grow ? index * 0.04 : 0 }}\n      className=\"flex min-w-0 flex-1 origin-bottom flex-col-reverse overflow-hidden rounded-[3px]\"\n      style={{ height: `${(total / max) * 100}%` }}\n    >\n      {week.map((value, i) => (\n        <span key={i} className={tones[i]} style={{ height: `${(value / total) * 100}%` }} />\n      ))}\n    </motion.div>\n  );\n}\n\nfunction EventsScreen() {\n  return (\n    <>\n      <ScreenTitle\n        title=\"Live events\"\n        aside={\n          <span className=\"flex items-center gap-1.5\">\n            <span className=\"size-1.5 rounded-full bg-emerald-500\" />\n            Streaming\n          </span>\n        }\n      />\n      <div className={cn(card, \"divide-y divide-zinc-950/[0.06] dark:divide-white/[0.06]\")}>\n        {EVENTS.map((event) => (\n          <div key={event.effect} className=\"flex items-center gap-2.5 px-3 py-2.5\">\n            <span className=\"min-w-0 flex-1\">\n              <span className=\"block truncate font-mono text-[11px] font-medium\">{event.name}</span>\n              <span className=\"block truncate text-[10px] text-zinc-400\">\n                {event.who} · {event.ago} ago\n              </span>\n            </span>\n            <AgentSessionTarget\n              effect={event.effect}\n              className=\"justify-items-end [--agent-session-ring-radius:999px]\"\n              fallback={<span className=\"text-[10px] text-zinc-300 dark:text-zinc-600\">no plan</span>}\n            >\n              <span className=\"rounded-full bg-zinc-100 px-2 py-0.5 text-[10px] font-medium text-zinc-700 ring-1 ring-zinc-950/5 dark:bg-white/[0.06] dark:text-zinc-200 dark:ring-white/10\">\n                plan: <span className=\"text-(--accent)\">{event.plan}</span>\n              </span>\n            </AgentSessionTarget>\n          </div>\n        ))}\n      </div>\n    </>\n  );\n}\n\nfunction Stat({ label, value, delta }: { label: string; value: string; delta: string }) {\n  return (\n    <div className={cn(card, \"p-2.5 shadow-none\")}>\n      <p className=\"text-[11px] text-zinc-500 dark:text-zinc-400\">{label}</p>\n      <p className=\"mt-0.5 flex items-baseline gap-1.5\">\n        <span className=\"text-base font-semibold tracking-tight tabular-nums\">{value}</span>\n        <span className=\"text-[10px] font-medium text-emerald-600 dark:text-emerald-400\">{delta}</span>\n      </p>\n    </div>\n  );\n}\n\nfunction Legend({ className, label }: { className: string; label: string }) {\n  return (\n    <span className=\"flex items-center gap-1.5\">\n      <span className={cn(\"size-2 rounded-[2px]\", className)} />\n      {label}\n    </span>\n  );\n}\n\n/* ── Icons ───────────────────────────────────────────────── */\n\nfunction TernMark({ className }: { className?: string }) {\n  return (\n    <svg viewBox=\"0 0 24 24\" className={className} aria-hidden>\n      <path d=\"M1 7.5c4.2-.9 8 1.2 11 5 3-3.8 6.8-5.9 11-5-4.4 1.4-8.1 5-11 10.5C9.1 12.5 5.4 8.9 1 7.5Z\" fill=\"currentColor\" />\n    </svg>\n  );\n}\n\nfunction RowIcon({ icon, className }: { icon: Icon; className?: string }) {\n  const paths: Record<Icon, React.ReactNode> = {\n    bell: <path d=\"M4 11.5h8l-1-1.5V7a3 3 0 0 0-6 0v3l-1 1.5ZM6.8 13.5h2.4\" />,\n    hash: <path d=\"M6 2.5 5 13.5M11 2.5l-1 11M2.5 6h11M2 10h11\" />,\n    grid: <path d=\"M2.5 2.5h11v11h-11zM2.5 6.2h11M2.5 9.8h11M6.2 2.5v11M9.8 2.5v11\" />,\n    clock: <path d=\"M8 2.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11ZM8 5v3l2 1.5\" />,\n    bars: <path d=\"M3 13.5v-4M6.3 13.5V6M9.7 13.5V8M13 13.5V3\" />,\n    tag: <path d=\"M2.5 2.5h5l6 6-5 5-6-6v-5ZM5.3 5.3h.01\" />,\n  };\n  return (\n    <svg\n      viewBox=\"0 0 16 16\"\n      className={className}\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth={1.4}\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      aria-hidden\n    >\n      {paths[icon]}\n    </svg>\n  );\n}\n\nfunction CheckIcon({ className }: { className?: string }) {\n  return (\n    <svg viewBox=\"0 0 16 16\" className={className} fill=\"none\" stroke=\"currentColor\" strokeWidth={1.8} aria-hidden>\n      <path d=\"m3.5 8.5 3 3 6-7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n"
    }
  ]
}