{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "heroes-06",
  "title": "Hero with a live run",
  "description": "A hero for an AI product whose last word turns over, with an install command to copy and an agent run beside it: the plan ticks while two tool calls land their results under the ink of a run in progress.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/agent-run.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/brand-logos.json",
    "https://ui.ndekocode.dev/r/brand-tile.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/call-status.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/copy-button.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/drawn-check.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/mesh-tile.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/motion-word-rotate.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/run-session.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-kept-height.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/utils.json",
    "https://ui.ndekocode.dev/r/wash.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/heroes/heroes-06/index.tsx",
      "content": "'use client';\n\nimport { WordRotate } from '@/components/core/word-rotate';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { ArrowRightIcon, ChevronRightIcon } from '@/registry/ndeko/lib/icons';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport { HERO } from './data';\nimport { InstallChip } from './install-chip';\nimport { LiveRun } from './live-run';\n\n/** How long each last word of the title stays before the next one turns in, in seconds. */\nconst WORD_INTERVAL_S = 2.8;\n\nfunction AnnouncementLink() {\n  return (\n    <a\n      href={HERO.announcement.href}\n      className='group bg-foreground/[0.04] hover:bg-foreground/[0.07] focus-visible:ring-ring/25 inline-flex max-w-full items-center gap-2 rounded-full py-1 ps-1 pe-3 text-xs font-medium transition-[background-color,scale] duration-150 ease-(--ease-out-strong) outline-none focus-visible:ring-[3px] active:scale-[0.97]'\n    >\n      <Badge className='rounded-full'>{HERO.announcement.label}</Badge>\n      <span className='truncate'>{HERO.announcement.text}</span>\n      <ChevronRightIcon className='text-muted-foreground size-3.5 shrink-0 transition-transform duration-150 ease-(--ease-out-strong) group-hover:translate-x-0.5' />\n    </a>\n  );\n}\n\nexport default function Heroes06() {\n  const shouldReduceMotion = usePrefersReducedMotion();\n\n  return (\n    <section className='@container'>\n      <div className='mx-auto grid max-w-6xl items-center gap-12 px-4 py-16 @2xl:px-6 @2xl:py-24 @4xl:grid-cols-[minmax(0,1fr)_24rem] @4xl:gap-16'>\n        <div className='flex min-w-0 flex-col items-start gap-6'>\n          <AnnouncementLink />\n          <h1 className='text-4xl font-semibold text-balance @2xl:text-5xl'>\n            {HERO.titleStart}{' '}\n            <span className='text-primary-ink block'>\n              <WordRotate\n                words={HERO.titleWords}\n                interval={WORD_INTERVAL_S}\n                paused={shouldReduceMotion}\n                accessibleText={HERO.titleSpoken}\n              />\n            </span>\n          </h1>\n          <p className='text-muted-foreground max-w-xl text-base text-pretty'>\n            {HERO.description}\n          </p>\n          <div className='flex flex-wrap gap-2'>\n            <Button size='lg' nativeButton={false} render={<a href='#' />}>\n              {HERO.primaryAction}\n              <ArrowRightIcon />\n            </Button>\n            <Button\n              size='lg'\n              variant='outline'\n              nativeButton={false}\n              render={<a href='#' />}\n            >\n              {HERO.secondaryAction}\n            </Button>\n          </div>\n          <InstallChip command={HERO.command} />\n        </div>\n        <LiveRun />\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-06/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-06/live-run.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { useKeptHeight } from '@/registry/ndeko/hooks/use-kept-height';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport {\n  type PlanStep,\n  type RunSnapshot,\n  type RunStatus,\n  seriesColorOf,\n  type StepStatus,\n  type ToolCall,\n} from '@/registry/ndeko/lib/agent-run';\nimport { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport { LoaderIcon } from '@/registry/ndeko/lib/icons';\nimport { rowPresenceOf } from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { BrandTile } from '@/registry/ndeko/ui/brand-tile';\nimport { CallStatusMark } from '@/registry/ndeko/ui/call-status';\nimport { Fold, Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { DrawnCheck } from '@/registry/ndeko/ui/drawn-check';\nimport { ClockGate, LiveDuration } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\nimport { Wash } from '@/registry/ndeko/ui/wash';\n\nimport { AGENT, type Tool, type ToolId, TOOLS } from './data';\nimport { SESSION } from './run-script';\n\nconst AGENT_COLOR = seriesColorOf(1);\n\nconst STEP_WORD: Record<StepStatus, string> = {\n  upcoming: 'Upcoming',\n  running: 'Running',\n  done: 'Done',\n  failed: 'Failed',\n  skipped: 'Skipped',\n};\n\nconst RUN_WORD: Record<RunStatus, string> = {\n  idle: 'Queued',\n  running: 'Running',\n  waiting: 'Waiting',\n  done: 'Done',\n  failed: 'Failed',\n  cancelled: 'Stopped',\n};\n\nconst DONE_MESSAGE =\n  'Run finished: the release notes are drafted and a pull request is open.';\n\nfunction isToolId(value: string): value is ToolId {\n  return Object.hasOwn(TOOLS, value);\n}\n\nfunction toolOf(call: ToolCall): Tool | null {\n  if (!isToolId(call.tool)) {\n    return null;\n  }\n  return TOOLS[call.tool];\n}\n\nfunction resultOf(call: ToolCall) {\n  if (typeof call.output === 'string') {\n    return call.output;\n  }\n  return '';\n}\n\nfunction announcementOf(run: RunSnapshot) {\n  if (run.status === 'done') {\n    return DONE_MESSAGE;\n  }\n  return '';\n}\n\nfunction StepGlyph({ status }: { status: StepStatus }) {\n  if (status === 'done') {\n    return <DrawnCheck tone='success' entrance='draw' />;\n  }\n  if (status === 'running') {\n    return <LoaderIcon className='text-muted-foreground size-4 animate-spin' />;\n  }\n  return (\n    <span className='hairline-ring ring-foreground/25 size-3.5 rounded-full' />\n  );\n}\n\nfunction PlanRow({ step }: { step: PlanStep }) {\n  const isUpcoming = step.status === 'upcoming';\n\n  return (\n    <li className='flex h-7 items-center gap-2.5 text-[13px]'>\n      <span className='flex size-[18px] shrink-0 items-center justify-center'>\n        <Swap swapKey={step.status}>\n          <StepGlyph status={step.status} />\n        </Swap>\n      </span>\n      <span\n        className={cn(\n          'min-w-0 flex-1 truncate transition-colors duration-200',\n          isUpcoming && 'text-muted-foreground'\n        )}\n      >\n        <span className='sr-only'>{STEP_WORD[step.status]}: </span>\n        {step.title}\n      </span>\n    </li>\n  );\n}\n\n/** What a call found unfolds under it once it is done; its time sits in a box of its own width. */\nfunction CallRow({ call }: { call: ToolCall }) {\n  const tool = toolOf(call);\n  const isRunning = call.status === 'running';\n  const isDone = call.status === 'done';\n  const result = resultOf(call);\n\n  return (\n    <div className='flex items-start gap-2.5 pb-2'>\n      {tool && <BrandTile brand={tool.brand} size='lg' title={tool.name} />}\n      <div className='flex min-w-0 flex-1 flex-col'>\n        <p className='py-1 text-[13px] leading-5 text-pretty'>{call.label}</p>\n        <Fold open={isDone}>\n          <p className='text-muted-foreground text-xs text-pretty'>{result}</p>\n        </Fold>\n      </div>\n      <span className='flex h-7 shrink-0 items-center gap-2'>\n        <LiveDuration\n          item={call}\n          isRunning={isRunning}\n          className='text-muted-foreground w-11 text-end text-xs'\n        />\n        <CallStatusMark status={call.status} />\n      </span>\n    </div>\n  );\n}\n\n/**\n * A small run of the agent, playing beside the hero: the plan ticks while two tools are called\n * and their results unfold, under the ink of a run in progress. Clicking in it lets the run end;\n * Replay starts it again.\n */\nexport function LiveRun() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state: run,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const presence = rowPresenceOf(shouldReduceMotion);\n  const isRunning = run.status === 'running';\n  const runWord = RUN_WORD[run.status];\n  const canReplay = isFinished && !isAutoplaying;\n  const announcement = announcementOf(run);\n  const message = spokenUnless(isAutoplaying, announcement);\n\n  useKeptHeight(ref);\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex min-h-[21rem] w-full flex-col rounded-2xl p-1.5 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n      >\n        <div\n          role='group'\n          aria-label={`Run of ${AGENT.name}: ${run.title}`}\n          className='bg-foreground/[0.03] relative isolate flex flex-1 flex-col gap-3 rounded-[calc(var(--radius-2xl)-0.375rem)] p-4'\n        >\n          <Wash color='var(--info)' isShown={isRunning} />\n          <div className='flex items-center gap-2.5'>\n            <MeshTile seed={AGENT.name} color={AGENT_COLOR} size='lg' />\n            <div className='flex min-w-0 flex-1 flex-col'>\n              <p className='truncate text-[13px] font-medium'>{AGENT.name}</p>\n              <p className='text-muted-foreground truncate text-xs'>\n                {run.title}\n              </p>\n            </div>\n            <div className='flex shrink-0 flex-col items-end text-xs'>\n              <Swap swapKey={runWord} className='font-medium'>\n                {runWord}\n              </Swap>\n              <LiveDuration\n                item={run}\n                isRunning={isRunning}\n                className='text-muted-foreground w-12 text-end'\n              />\n            </div>\n          </div>\n          <ol aria-label='Plan' className='flex flex-col'>\n            {run.plan.map((step) => (\n              <PlanRow key={step.id} step={step} />\n            ))}\n          </ol>\n          <ul aria-label='Tool calls' className='flex flex-col'>\n            <AnimatePresence initial={false}>\n              {run.calls.map((call) => (\n                <motion.li\n                  key={call.id}\n                  {...presence}\n                  className='overflow-hidden'\n                >\n                  <CallRow call={call} />\n                </motion.li>\n              ))}\n            </AnimatePresence>\n          </ul>\n        </div>\n        <div className='flex min-h-9 items-center justify-between gap-2 ps-2.5 pe-1'>\n          <span className='text-muted-foreground text-xs'>\n            Illustrative run\n          </span>\n          <ReplayButton isShown={canReplay} onReplay={restart} />\n        </div>\n        <LiveRegion message={message} />\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-06/live-run.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-06/run-script.ts",
      "content": "import type { SessionConfig } from '@/registry/ndeko/hooks/use-session';\nimport {\n  emptyRun,\n  type PlanStep,\n  type RunAgent,\n  type RunSnapshot,\n} from '@/registry/ndeko/lib/agent-run';\nimport {\n  applyBatchAt,\n  batch,\n  reduceBatch,\n  restingOf,\n  type RunBatch,\n  type RunStep,\n} from '@/registry/ndeko/lib/run-session';\n\nimport { AGENT, RUN_TITLE } from './data';\n\n/** Added idle and set running by the first batch, so the run stamps its start. */\nconst WRITER: RunAgent = {\n  id: AGENT.id,\n  name: AGENT.name,\n  series: 1,\n  status: 'idle',\n};\n\nconst PLAN: PlanStep[] = [\n  {\n    id: 'read',\n    title: 'Read the pull requests merged since 4.1',\n    status: 'upcoming',\n  },\n  { id: 'group', title: 'Group the changes by area', status: 'upcoming' },\n  {\n    id: 'draft',\n    title: 'Draft the notes and open a pull request',\n    status: 'upcoming',\n  },\n];\n\nexport const INITIAL: RunSnapshot = emptyRun({\n  id: 'release-notes',\n  title: RUN_TITLE,\n  agents: [WRITER],\n  plan: PLAN,\n});\n\n/** A plan of three steps that tick in turn, with one call to GitHub and one to Linear on the way. */\nconst SCRIPT: RunStep[] = [\n  batch(\n    700,\n    { type: 'run.started' },\n    { type: 'agent.updated', id: AGENT.id, patch: { status: 'running' } },\n    { type: 'step.updated', id: 'read', patch: { status: 'running' } }\n  ),\n  batch(600, {\n    type: 'call.started',\n    call: {\n      id: 'merged',\n      tool: 'github',\n      label: 'List the pull requests merged since 4.1',\n      status: 'running',\n      agentId: AGENT.id,\n    },\n  }),\n  batch(\n    1700,\n    {\n      type: 'call.updated',\n      id: 'merged',\n      patch: { status: 'done', output: '38 pull requests across 6 areas' },\n    },\n    { type: 'step.updated', id: 'read', patch: { status: 'done' } },\n    { type: 'step.updated', id: 'group', patch: { status: 'running' } }\n  ),\n  batch(700, {\n    type: 'call.started',\n    call: {\n      id: 'issues',\n      tool: 'linear',\n      label: 'Match them to the issues they close',\n      status: 'running',\n      agentId: AGENT.id,\n    },\n  }),\n  batch(\n    1600,\n    {\n      type: 'call.updated',\n      id: 'issues',\n      patch: { status: 'done', output: '31 issues closed, 4 still open' },\n    },\n    { type: 'step.updated', id: 'group', patch: { status: 'done' } },\n    { type: 'step.updated', id: 'draft', patch: { status: 'running' } }\n  ),\n  batch(\n    1800,\n    { type: 'step.updated', id: 'draft', patch: { status: 'done' } },\n    { type: 'agent.updated', id: AGENT.id, patch: { status: 'done' } },\n    { type: 'run.finished', status: 'done' }\n  ),\n];\n\n/** Under reduced motion the run rests finished, with both results to read. */\nconst RESTING = restingOf(INITIAL, SCRIPT, applyBatchAt);\n\nconst LOOP_AFTER_MS = 3800;\n\nexport const SESSION: SessionConfig<RunSnapshot, RunBatch> = {\n  reducer: reduceBatch,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-06/run-script.ts"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-06/install-chip.tsx",
      "content": "import { CopyButton } from '@/registry/ndeko/ui/copy-button';\n\ntype InstallChipProps = {\n  command: string;\n};\n\n/** The command that installs the product, on one line, with a button that copies it. */\nexport function InstallChip({ command }: InstallChipProps) {\n  return (\n    <div className='bg-foreground/[0.04] inline-flex h-9 max-w-full items-center gap-2 rounded-full ps-3.5 pe-1.5 font-mono text-[13px]'>\n      <span aria-hidden='true' className='text-muted-foreground select-none'>\n        $\n      </span>\n      <code className='min-w-0 truncate'>{command}</code>\n      <CopyButton\n        text={command}\n        label='Copy the install command'\n        className='rounded-full'\n      />\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-06/install-chip.tsx"
    },
    {
      "path": "registry/ndeko/blocks/heroes/heroes-06/data.ts",
      "content": "import type { BrandSlug } from '@/registry/ndeko/lib/brand-logos';\n\nexport type ToolId = 'github' | 'linear';\n\nexport type Tool = {\n  id: ToolId;\n  name: string;\n  brand: BrandSlug;\n};\n\nexport const HERO = {\n  announcement: {\n    label: '4.2',\n    text: 'Every run now replays step by step',\n    href: '#',\n  },\n  titleStart: 'Let an agent write your',\n  /** The last word of the title turns over; the run beside it writes the first one. */\n  titleWords: ['release notes', 'changelogs', 'migration guides', 'test plans'],\n  titleSpoken: 'release notes, changelogs, migration guides and test plans',\n  description:\n    'Quillrun reads your repository and your tracker, plans the work and opens a pull request for you to review. Nothing merges without you.',\n  primaryAction: 'Start building',\n  secondaryAction: 'Read the docs',\n  command: 'npx quillrun init',\n};\n\nexport const AGENT = {\n  id: 'writer',\n  name: 'Writer',\n};\n\nexport const TOOLS: Record<ToolId, Tool> = {\n  github: { id: 'github', name: 'GitHub', brand: 'github' },\n  linear: { id: 'linear', name: 'Linear', brand: 'linear' },\n};\n\nexport const RUN_TITLE = 'Release notes for 4.2';\n",
      "type": "registry:component",
      "target": "components/blocks/heroes-06/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "heroes"
  ],
  "type": "registry:block"
}