{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "agent-session-demo",
  "type": "registry:block",
  "title": "Agent Session: Analytics Setup",
  "description": "AI Agent Terminal Demo example, Analytics Setup: An agent adds a signup funnel to a product analytics dashboard. The card arrives with its file, then each bar fills as the tracking call for that step is written. A take on the terminal (cli) and product demo (interactive demo). Fits hero and features sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "hero",
    "features",
    "terminal",
    "product-demo",
    "code-block",
    "ai",
    "code",
    "developer"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/agent-session#agent-session-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/agent-session.json"
  ],
  "files": [
    {
      "path": "components/agent-session-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { motion } from \"motion/react\";\n\nimport {\n  AgentSession,\n  AgentSessionTarget,\n  useAgentSessionEffect,\n  type AgentSessionStep,\n} from \"@/components/ui/agent-session\";\n\nconst script: AgentSessionStep[] = [\n  { prompt: \"Add a signup funnel to the dashboard and track each step\" },\n  {\n    run: \"npx tern events list --match signup\",\n    ms: 900,\n    output: [\n      \"signup_viewed      page     /signup\",\n      \"signup_submitted   form     #signup-form\",\n      \"email_verified     server   POST /api/verify\",\n    ],\n    more: 4,\n  },\n  {\n    run: \"npx tern add funnel signup --to app/dashboard\",\n    ms: 1100,\n    output: [\n      { text: \"+ app/dashboard/signup-funnel.tsx   SignupFunnel\", tone: \"added\", effect: \"funnel\" },\n      { text: \"~ app/dashboard/layout.tsx          Funnels (1)\", effect: \"nav\" },\n    ],\n  },\n  {\n    run: \"npx tern track signup_viewed signup_submitted email_verified\",\n    ms: 1200,\n    pace: 420,\n    output: [\n      { text: '+ app/signup/page.tsx       track(\"signup_viewed\")', tone: \"added\", effect: \"step-1\" },\n      { text: '+ app/signup/form.tsx       track(\"signup_submitted\")', tone: \"added\", effect: \"step-2\" },\n      { text: '+ app/api/verify/route.ts   track(\"email_verified\")', tone: \"added\", effect: \"step-3\" },\n    ],\n  },\n  {\n    say: \"Added a three-step signup funnel to the dashboard. Last week 1,204 of 12,480 visitors finished, and most of the drop happens before the form is sent.\",\n  },\n];\n\nconst steps = [\n  { effect: \"step-1\", label: \"Viewed signup\", count: \"12,480\", share: 1 },\n  { effect: \"step-2\", label: \"Sent the form\", count: \"2,911\", share: 0.233 },\n  { effect: \"step-3\", label: \"Verified email\", count: \"1,204\", share: 0.096 },\n];\n\nconst nav = [\"Overview\", \"Funnels\", \"Events\", \"Retention\", \"Settings\"];\n\nexport function AgentSessionDemo() {\n  return (\n    <AgentSession\n      script={script}\n      title=\"web — agent\"\n      url=\"localhost:3000/dashboard\"\n      className=\"max-w-5xl [--agent-session-height:26rem]\"\n    >\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 @[24rem]/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            <svg viewBox=\"0 0 16 16\" className=\"size-3.5\" aria-hidden>\n              <path d=\"M2 13 8 3l6 10H2Z\" fill=\"currentColor\" />\n            </svg>\n            Tern\n          </div>\n          {nav.map((item, i) => (\n            <div\n              key={item}\n              className={\n                i === 0\n                  ? \"flex items-center justify-between rounded-md bg-white px-2 py-1.5 text-xs font-medium shadow-sm ring-1 ring-zinc-950/5 dark:bg-white/10 dark:ring-white/5\"\n                  : \"flex items-center justify-between rounded-md px-2 py-1.5 text-xs text-zinc-500 dark:text-zinc-400\"\n              }\n            >\n              {item}\n              {item === \"Funnels\" && (\n                <AgentSessionTarget effect=\"nav\" className=\"[--agent-session-ring-radius:999px]\">\n                  <span className=\"rounded-full bg-zinc-900 px-1.5 text-[10px] leading-4 font-medium text-white tabular-nums dark:bg-white dark:text-zinc-900\">\n                    1\n                  </span>\n                </AgentSessionTarget>\n              )}\n            </div>\n          ))}\n        </aside>\n\n        <main className=\"flex min-w-0 flex-1 flex-col gap-3 p-4\">\n          <div className=\"flex items-baseline justify-between\">\n            <h3 className=\"text-sm font-semibold tracking-tight\">Overview</h3>\n            <span className=\"text-[11px] text-zinc-400\">Last 7 days</span>\n          </div>\n          <div className=\"grid grid-cols-2 gap-2\">\n            <Stat label=\"Visitors\" value=\"12,480\" delta=\"+8.2%\" />\n            <Stat label=\"Signups\" value=\"1,204\" delta=\"+3.1%\" />\n          </div>\n\n          <AgentSessionTarget\n            effect=\"funnel\"\n            className=\"[--agent-session-ring-radius:14px]\"\n            fallback={\n              <div className=\"flex h-full min-h-36 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 funnels yet</p>\n                <p className=\"text-[11px] text-zinc-400\">Ask for one, or add it from Funnels.</p>\n              </div>\n            }\n          >\n            <div className=\"rounded-xl bg-white p-3 ring-1 ring-zinc-950/[0.08] shadow-sm dark:bg-white/[0.04] dark:ring-white/10\">\n              <div className=\"mb-2.5 flex items-baseline justify-between\">\n                <p className=\"text-xs font-semibold\">Signup funnel</p>\n                <p className=\"text-[11px] text-zinc-400 tabular-nums\">9.6% convert</p>\n              </div>\n              <div className=\"flex flex-col gap-2\">\n                {steps.map((step) => (\n                  <FunnelRow key={step.effect} {...step} />\n                ))}\n              </div>\n            </div>\n          </AgentSessionTarget>\n        </main>\n      </div>\n    </AgentSession>\n  );\n}\n\nfunction Stat({ label, value, delta }: { label: string; value: string; delta: string }) {\n  return (\n    <div className=\"rounded-xl bg-white p-2.5 ring-1 ring-zinc-950/[0.08] dark:bg-white/[0.04] dark:ring-white/10\">\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\n// Each row fills once its tracking call lands, so the bars arrive in the order the agent wrote them.\nfunction FunnelRow({ effect, label, count, share }: (typeof steps)[number]) {\n  const landed = useAgentSessionEffect(effect);\n  return (\n    <AgentSessionTarget effect={effect} enter=\"none\" className=\"[--agent-session-ring-radius:8px]\">\n      <div className=\"flex flex-col gap-1\">\n        <div className=\"flex items-baseline justify-between text-[11px]\">\n          <span className=\"text-zinc-600 dark:text-zinc-300\">{label}</span>\n          <motion.span\n            initial={false}\n            animate={{ opacity: landed ? 1 : 0.35 }}\n            className=\"font-medium tabular-nums\"\n          >\n            {landed ? count : \"—\"}\n          </motion.span>\n        </div>\n        <div className=\"h-1.5 overflow-hidden rounded-full bg-zinc-100 dark:bg-white/[0.07]\">\n          <motion.div\n            initial={false}\n            animate={{ transform: `scaleX(${landed ? share : 0})` }}\n            transition={{ type: \"spring\", visualDuration: 0.6, bounce: 0 }}\n            className=\"h-full origin-left rounded-full bg-zinc-900 dark:bg-zinc-100\"\n          />\n        </div>\n      </div>\n    </AgentSessionTarget>\n  );\n}\n"
    }
  ]
}