{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ai-product-02",
  "title": "Home for an AI app",
  "description": "The start page of a signed-in AI product: counts roll in once, a question box answers its suggestions, quick actions sit in tiles, and the agents that need you arrive row by row, each with one action that checks itself off, beside cards for spend and finished tasks.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/agent-run.json",
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/company-mark.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/input.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/mesh-tile.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/streamed-text.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"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/ai-product/ai-product-02/index.tsx",
      "content": "'use client';\n\nimport { useState } from '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 { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\nimport { AskBar } from './ask-bar';\nimport { PERSON, WORKSPACE } from './data';\nimport { Figures } from './figures';\nimport { NeedsYou } from './needs-you';\nimport { QuickActions } from './quick-actions';\nimport {\n  INITIAL,\n  LOOP_AFTER_MS,\n  reducer,\n  RESTING,\n  SCRIPT,\n  waitingCountOf,\n} from './session';\nimport { SpendCard, TasksCard } from './trend-cards';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\nexport default function AiProduct02() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  useKeptHeight(ref);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const [hasRolled, setHasRolled] = useState(false);\n  if (isInView && !hasRolled) {\n    setHasRolled(true);\n  }\n  const isRolled = hasRolled || shouldReduceMotion;\n  const waiting = waitingCountOf(state);\n  const message = spokenUnless(isAutoplaying, state.spoken);\n  const canReplay = isFinished && !isAutoplaying;\n  const isStreaming = !shouldReduceMotion;\n\n  return (\n    <div\n      ref={ref}\n      className='bg-background text-foreground @container min-h-[88rem] w-full @3xl:min-h-[50rem]'\n    >\n      <div className='mx-auto flex max-w-5xl flex-col gap-5 px-4 py-6 @2xl:px-6 @2xl:py-8'>\n        <header className='flex flex-wrap items-center justify-between gap-x-4 gap-y-2'>\n          <div className='flex min-w-0 items-center gap-2.5'>\n            <CompanyMark seed={WORKSPACE.name} size='lg' />\n            <div className='flex min-w-0 flex-col'>\n              <h1 className='truncate text-lg font-semibold'>Home</h1>\n              <p className='text-muted-foreground flex items-center gap-1.5 text-xs'>\n                {WORKSPACE.name}\n                <Badge variant='secondary'>Illustrative</Badge>\n              </p>\n            </div>\n          </div>\n          <div className='flex items-center gap-3'>\n            <ReplayButton\n              isShown={canReplay}\n              onReplay={restart}\n              label='Replay'\n            />\n            <span className='flex items-center gap-2 text-[13px]'>\n              <Avatar seed={PERSON.name} className='size-7' />\n              {PERSON.name}\n            </span>\n          </div>\n        </header>\n\n        <Figures isRolled={isRolled} waiting={waiting} />\n\n        <AskBar\n          question={state.question}\n          answerId={state.answerId}\n          isStreaming={isStreaming}\n          pressed={pressed}\n          onType={(text) => act({ type: 'questionTyped', text })}\n          onAsk={() => act({ type: 'asked' })}\n          onPick={(id) => act({ type: 'suggestionPicked', id })}\n        />\n\n        <QuickActions />\n\n        <div className='grid gap-5 @3xl:grid-cols-[minmax(0,1.35fr)_minmax(0,1fr)] @3xl:items-start'>\n          <NeedsYou\n            arrived={state.arrived}\n            resolved={state.resolved}\n            waiting={waiting}\n            pressed={pressed}\n            onAct={(id) => act({ type: 'resolved', id })}\n          />\n          <div className='flex flex-col gap-5'>\n            <SpendCard isRolled={isRolled} />\n            <TasksCard isRolled={isRolled} />\n          </div>\n        </div>\n      </div>\n      <LiveRegion message={message} />\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-product-02/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/ai-product/ai-product-02/figures.tsx",
      "content": "'use client';\n\nimport { MotionNumber } from '@/components/core/motion-number';\n\nimport { TODAY } from './data';\n\nconst MONEY: Intl.NumberFormatOptions = {\n  minimumFractionDigits: 2,\n  maximumFractionDigits: 2,\n};\n\nfunction shownOf(isRolled: boolean, value: number) {\n  if (isRolled) {\n    return value;\n  }\n  return 0;\n}\n\ntype FigureProps = {\n  label: string;\n  children: React.ReactNode;\n};\n\nfunction Figure({ label, children }: FigureProps) {\n  return (\n    <li className='bg-foreground/[0.03] flex min-w-0 flex-col gap-1 rounded-xl p-4'>\n      <p className='text-muted-foreground truncate text-[13px]'>{label}</p>\n      <p className='flex text-2xl font-semibold'>{children}</p>\n    </li>\n  );\n}\n\ntype FiguresProps = {\n  /** The counts roll up from zero the first time the page is seen. */\n  isRolled: boolean;\n  waiting: number;\n};\n\nexport function Figures({ isRolled, waiting }: FiguresProps) {\n  return (\n    <ul aria-label='Today' className='grid grid-cols-2 gap-3 @3xl:grid-cols-4'>\n      <Figure label='Runs today'>\n        <MotionNumber value={shownOf(isRolled, TODAY.runs)} />\n      </Figure>\n      <Figure label='Tasks finished'>\n        <MotionNumber value={shownOf(isRolled, TODAY.finished)} />\n      </Figure>\n      <Figure label='Waiting on you'>\n        <MotionNumber value={waiting} />\n      </Figure>\n      <Figure label='Spent today'>\n        <MotionNumber\n          value={shownOf(isRolled, TODAY.spentUsd)}\n          prefix='$'\n          format={MONEY}\n        />\n      </Figure>\n    </ul>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-product-02/figures.tsx"
    },
    {
      "path": "registry/ndeko/blocks/ai-product/ai-product-02/ask-bar.tsx",
      "content": "'use client';\n\nimport { useId } from 'react';\n\nimport { pressedSolidOf } from '@/registry/ndeko/lib/demonstration';\nimport { SearchIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Fold } from '@/registry/ndeko/ui/chat-motion';\nimport { Input } from '@/registry/ndeko/ui/input';\nimport { StreamedInk } from '@/registry/ndeko/ui/streamed-text';\n\nimport { answerTextOf, SUGGESTIONS, type SuggestionId } from './data';\nimport type { AnswerId } from './session';\n\nconst WORD_MS = 38;\n\ntype AskBarProps = {\n  question: string;\n  answerId: AnswerId | null;\n  isStreaming: boolean;\n  pressed: string | null;\n  onType: (text: string) => void;\n  onAsk: () => void;\n  onPick: (id: SuggestionId) => void;\n};\n\nexport function AskBar({\n  question,\n  answerId,\n  isStreaming,\n  pressed,\n  onType,\n  onAsk,\n  onPick,\n}: AskBarProps) {\n  const fieldId = useId();\n  const answerRegionId = useId();\n  const hasAnswer = answerId !== null;\n\n  function ask(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    onAsk();\n  }\n\n  return (\n    <section aria-label='Ask' className='flex flex-col gap-3'>\n      <form onSubmit={ask} className='flex items-center gap-2'>\n        <div className='relative min-w-0 flex-1'>\n          <label htmlFor={fieldId} className='sr-only'>\n            Ask about your runs, tasks and spend\n          </label>\n          <SearchIcon className='text-muted-foreground pointer-events-none absolute start-3 top-1/2 size-4 -translate-y-1/2' />\n          <Input\n            id={fieldId}\n            autoComplete='off'\n            placeholder='Ask about your runs, tasks and spend'\n            value={question}\n            aria-controls={answerRegionId}\n            onChange={(event) => onType(event.target.value)}\n            className='h-10 rounded-lg ps-9'\n          />\n        </div>\n        <Button\n          type='submit'\n          size='lg'\n          className={cn('h-10 shrink-0', pressedSolidOf(pressed === 'ask'))}\n        >\n          Ask\n        </Button>\n      </form>\n      <ul aria-label='Suggested questions' className='flex flex-wrap gap-1.5'>\n        {SUGGESTIONS.map((suggestion) => (\n          <li key={suggestion.id}>\n            <Button\n              type='button'\n              variant='outline'\n              size='sm'\n              onClick={() => onPick(suggestion.id)}\n            >\n              {suggestion.label}\n            </Button>\n          </li>\n        ))}\n      </ul>\n      <Fold open={hasAnswer} id={answerRegionId}>\n        {hasAnswer && (\n          <div className='bg-foreground/[0.04] flex flex-col gap-1 rounded-lg p-3'>\n            <p className='text-muted-foreground text-xs'>Answer</p>\n            <p\n              key={answerId}\n              className='max-w-prose text-[13px] leading-relaxed text-pretty'\n            >\n              <StreamedInk\n                text={answerTextOf(answerId)}\n                isStreaming={isStreaming}\n                wordMs={WORD_MS}\n              />\n            </p>\n          </div>\n        )}\n      </Fold>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-product-02/ask-bar.tsx"
    },
    {
      "path": "registry/ndeko/blocks/ai-product/ai-product-02/quick-actions.tsx",
      "content": "import {\n  BotIcon,\n  PlugIcon,\n  PlusIcon,\n  UserRoundPlusIcon,\n} from '@/registry/ndeko/lib/icons';\n\nimport { ACTIONS, type ActionId, type QuickAction } from './data';\n\nconst GLYPHS: Record<ActionId, typeof PlusIcon> = {\n  task: PlusIcon,\n  agent: BotIcon,\n  app: PlugIcon,\n  invite: UserRoundPlusIcon,\n};\n\nfunction ActionTile({ action }: { action: QuickAction }) {\n  const Glyph = GLYPHS[action.id];\n\n  return (\n    <a\n      href='#'\n      className='bg-foreground/[0.03] hover:bg-foreground/[0.05] focus-visible:ring-ring/25 flex items-center gap-3 rounded-xl p-3 transition-[background-color,scale] duration-150 ease-(--ease-out-strong) outline-none focus-visible:ring-[3px] active:scale-[0.97]'\n    >\n      <span\n        aria-hidden='true'\n        className='keycap-3d text-muted-foreground inline-flex size-8 shrink-0 items-center justify-center rounded-lg'\n      >\n        <Glyph className='size-4' />\n      </span>\n      <span className='flex min-w-0 flex-col'>\n        <span className='truncate text-[13px] font-medium'>{action.label}</span>\n        <span className='text-muted-foreground truncate text-xs'>\n          {action.hint}\n        </span>\n      </span>\n    </a>\n  );\n}\n\nexport function QuickActions() {\n  return (\n    <ul\n      aria-label='Quick actions'\n      className='grid gap-3 @lg:grid-cols-2 @4xl:grid-cols-4'\n    >\n      {ACTIONS.map((action) => (\n        <li key={action.id}>\n          <ActionTile action={action} />\n        </li>\n      ))}\n    </ul>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-product-02/quick-actions.tsx"
    },
    {
      "path": "registry/ndeko/blocks/ai-product/ai-product-02/needs-you.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { seriesColorOf } from '@/registry/ndeko/lib/agent-run';\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport { rowPresenceOf } from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { DrawnCheck } from '@/registry/ndeko/ui/drawn-check';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\n\nimport { WAITING, type Waiting, type WaitingId } from './data';\n\nfunction toneOf(isDone: boolean) {\n  if (isDone) {\n    return 'opacity-60';\n  }\n  return undefined;\n}\n\nfunction waitingVariantOf(waiting: number) {\n  if (waiting === 0) {\n    return 'secondary';\n  }\n  return 'warning';\n}\n\nfunction stateKeyOf(isDone: boolean) {\n  if (isDone) {\n    return 'done';\n  }\n  return 'open';\n}\n\ntype RowProps = {\n  waiting: Waiting;\n  isDone: boolean;\n  pressed: string | null;\n  onAct: (id: WaitingId) => void;\n};\n\nfunction WaitingRow({ waiting, isDone, pressed, onAct }: RowProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const presence = rowPresenceOf(shouldReduceMotion);\n  const isPressed = pressed === `act-${waiting.id}`;\n\n  return (\n    <motion.li className='overflow-hidden' {...presence}>\n      <div className='grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-2 px-1 py-2.5 @md:grid-cols-[auto_minmax(0,1fr)_auto]'>\n        <MeshTile\n          seed={waiting.agent}\n          color={seriesColorOf(waiting.series)}\n          size='lg'\n        />\n        <div\n          className={cn(\n            'flex min-w-0 flex-1 flex-col gap-0.5 transition-opacity duration-200',\n            toneOf(isDone)\n          )}\n        >\n          <p className='flex items-baseline gap-2 text-[13px] font-medium'>\n            {waiting.agent}\n            <span className='text-muted-foreground text-xs font-normal tabular-nums'>\n              {waiting.waited}\n            </span>\n          </p>\n          <p className='text-muted-foreground text-xs text-pretty'>\n            {waiting.ask}\n          </p>\n        </div>\n        <Swap\n          swapKey={stateKeyOf(isDone)}\n          className='col-start-2 justify-self-start @md:col-start-auto @md:justify-self-end'\n        >\n          {!isDone && (\n            <Button\n              type='button'\n              size='sm'\n              variant='outline'\n              onClick={() => onAct(waiting.id)}\n              className={pressedQuietOf(isPressed)}\n            >\n              {waiting.action}\n            </Button>\n          )}\n          {isDone && (\n            <span className='text-success-foreground flex items-center gap-1.5 text-xs font-medium'>\n              <DrawnCheck tone='success' entrance='draw' />\n              {waiting.done}\n            </span>\n          )}\n        </Swap>\n      </div>\n    </motion.li>\n  );\n}\n\ntype NeedsYouProps = {\n  arrived: number;\n  resolved: WaitingId[];\n  waiting: number;\n  pressed: string | null;\n  onAct: (id: WaitingId) => void;\n};\n\nexport function NeedsYou({\n  arrived,\n  resolved,\n  waiting,\n  pressed,\n  onAct,\n}: NeedsYouProps) {\n  const rows = WAITING.slice(0, arrived);\n  const isNobodyWaiting = waiting === 0;\n\n  return (\n    <section\n      aria-label='Agents that need you'\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex flex-col gap-2 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)] @2xl:p-5'\n    >\n      <header className='flex items-center justify-between gap-3'>\n        <h2 className='text-sm font-medium'>Needs you</h2>\n        <Badge variant={waitingVariantOf(waiting)}>\n          <MotionNumber value={waiting} />\n          waiting\n        </Badge>\n      </header>\n      <ul className='flex flex-col'>\n        <AnimatePresence initial={false}>\n          {rows.map((row) => (\n            <WaitingRow\n              key={row.id}\n              waiting={row}\n              isDone={resolved.includes(row.id)}\n              pressed={pressed}\n              onAct={onAct}\n            />\n          ))}\n        </AnimatePresence>\n      </ul>\n      {isNobodyWaiting && (\n        <p className='text-muted-foreground py-6 text-center text-[13px]'>\n          Nothing is waiting on you\n        </p>\n      )}\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-product-02/needs-you.tsx"
    },
    {
      "path": "registry/ndeko/blocks/ai-product/ai-product-02/trend-cards.tsx",
      "content": "'use client';\n\nimport type { CSSProperties } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nimport { SPEND, TASKS_DONE, WEEK_DAYS } from './data';\n\nconst STAGGER_MS = 60;\n\nfunction easedOf(shouldReduceMotion: boolean) {\n  if (shouldReduceMotion) {\n    return 'transition-none';\n  }\n  return 'transition-transform duration-700 ease-(--ease-out-strong)';\n}\n\nfunction tallestOf(values: readonly number[]) {\n  return Math.max(1, ...values);\n}\n\nfunction barStyleOf(\n  value: number,\n  tallest: number,\n  isRolled: boolean,\n  index: number\n): CSSProperties {\n  let share = 0;\n  if (isRolled) {\n    share = value / tallest;\n  }\n  const delay = index * STAGGER_MS;\n  return { transform: `scaleY(${share})`, transitionDelay: `${delay}ms` };\n}\n\nfunction barToneOf(isToday: boolean) {\n  if (isToday) {\n    return 'bg-primary';\n  }\n  return 'bg-primary/35';\n}\n\ntype MiniBarsProps = {\n  values: readonly number[];\n  isRolled: boolean;\n  caption: string;\n  unit: string;\n};\n\nfunction MiniBars({ values, isRolled, caption, unit }: MiniBarsProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const eased = easedOf(shouldReduceMotion);\n  const tallest = tallestOf(values);\n  const lastIndex = values.length - 1;\n\n  return (\n    <div className='relative flex flex-col gap-1.5'>\n      <div aria-hidden='true' className='flex h-16 items-stretch gap-1.5'>\n        {values.map((value, index) => (\n          <span\n            key={WEEK_DAYS[index]}\n            className='bg-foreground/[0.04] relative flex-1 overflow-hidden rounded-[3px]'\n          >\n            <span\n              style={barStyleOf(value, tallest, isRolled, index)}\n              className={cn(\n                'absolute inset-0 origin-bottom',\n                eased,\n                barToneOf(index === lastIndex)\n              )}\n            />\n          </span>\n        ))}\n      </div>\n      <div aria-hidden='true' className='flex gap-1.5'>\n        {WEEK_DAYS.map((day) => (\n          <span\n            key={day}\n            className='text-muted-foreground flex-1 text-center text-[11px]'\n          >\n            {day}\n          </span>\n        ))}\n      </div>\n      <div className='sr-only'>\n        <table>\n          <caption>{caption}</caption>\n          <tbody>\n            {values.map((value, index) => (\n              <tr key={WEEK_DAYS[index]}>\n                <th scope='row'>{WEEK_DAYS[index]}</th>\n                <td>\n                  {value} {unit}\n                </td>\n              </tr>\n            ))}\n          </tbody>\n        </table>\n      </div>\n    </div>\n  );\n}\n\nfunction shownOf(isRolled: boolean, value: number) {\n  if (isRolled) {\n    return value;\n  }\n  return 0;\n}\n\nfunction meterStyleOf(share: number, isRolled: boolean): CSSProperties {\n  let shown = 0;\n  if (isRolled) {\n    shown = share;\n  }\n  const open = 1 - shown;\n  const remaining = open * 100;\n  return { transform: `translateX(-${remaining}%)` };\n}\n\nconst CARD =\n  'bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex flex-col gap-4 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)] @2xl:p-5';\n\ntype TrendCardProps = {\n  isRolled: boolean;\n};\n\nexport function SpendCard({ isRolled }: TrendCardProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const eased = easedOf(shouldReduceMotion);\n  const share = SPEND.usedUsd / SPEND.budgetUsd;\n  const meterStyle = meterStyleOf(share, isRolled);\n\n  return (\n    <section aria-label='Spend against budget' className={CARD}>\n      <header className='flex flex-col gap-1'>\n        <h3 className='text-muted-foreground text-[13px] font-medium'>\n          Spend this month\n        </h3>\n        <p className='flex items-baseline gap-2'>\n          <MotionNumber\n            value={shownOf(isRolled, SPEND.usedUsd)}\n            prefix='$'\n            className='text-2xl font-semibold'\n          />\n          <span className='text-muted-foreground text-[13px] tabular-nums'>\n            of ${SPEND.budgetUsd} budget\n          </span>\n        </p>\n      </header>\n      <div\n        role='meter'\n        aria-label='Budget used'\n        aria-valuemin={0}\n        aria-valuemax={SPEND.budgetUsd}\n        aria-valuenow={SPEND.usedUsd}\n        className='bg-foreground/[0.06] h-1.5 overflow-hidden rounded-full'\n      >\n        <span\n          style={meterStyle}\n          className={cn('bg-primary block h-full rounded-full', eased)}\n        />\n      </div>\n      <MiniBars\n        values={SPEND.byDay}\n        isRolled={isRolled}\n        caption='Dollars spent by day this week, illustrative'\n        unit='dollars'\n      />\n    </section>\n  );\n}\n\nexport function TasksCard({ isRolled }: TrendCardProps) {\n  return (\n    <section aria-label='Tasks done this week' className={CARD}>\n      <header className='flex flex-col gap-1'>\n        <h3 className='text-muted-foreground text-[13px] font-medium'>\n          Tasks done this week\n        </h3>\n        <p className='flex'>\n          <MotionNumber\n            value={shownOf(isRolled, TASKS_DONE.total)}\n            className='text-2xl font-semibold'\n          />\n        </p>\n      </header>\n      <MiniBars\n        values={TASKS_DONE.byDay}\n        isRolled={isRolled}\n        caption='Tasks done by day this week, illustrative'\n        unit='tasks'\n      />\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-product-02/trend-cards.tsx"
    },
    {
      "path": "registry/ndeko/blocks/ai-product/ai-product-02/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\nimport { keyDelayOf, prefixesOf } from '@/registry/ndeko/lib/demonstration';\n\nimport {\n  answerTextOf,\n  SUGGESTIONS,\n  suggestionOf,\n  WAITING,\n  type SuggestionId,\n  type WaitingId,\n} from './data';\n\nexport type AnswerId = SuggestionId | 'none';\n\nexport type HomeState = {\n  question: string;\n  answerId: AnswerId | null;\n  /** How many of the agents have stopped to ask for the person. They arrive in the order of the list. */\n  arrived: number;\n  resolved: WaitingId[];\n  spoken: string;\n};\n\nexport type HomeAction =\n  | { type: 'arrived' }\n  | { type: 'questionTyped'; text: string }\n  | { type: 'asked' }\n  | { type: 'suggestionPicked'; id: SuggestionId }\n  | { type: 'resolved'; id: WaitingId };\n\ntype Step = SessionStep<HomeState, HomeAction>;\n\nexport const INITIAL: HomeState = {\n  question: '',\n  answerId: null,\n  arrived: 0,\n  resolved: [],\n  spoken: '',\n};\n\nexport function waitingCountOf(state: HomeState) {\n  return state.arrived - state.resolved.length;\n}\n\nfunction arrived(state: HomeState): HomeState {\n  if (state.arrived >= WAITING.length) {\n    return state;\n  }\n  const next = WAITING[state.arrived];\n  const spoken = `${next.agent} needs you: ${next.ask}`;\n  return { ...state, arrived: state.arrived + 1, spoken };\n}\n\nfunction questionTyped(state: HomeState, text: string): HomeState {\n  return { ...state, question: text, answerId: null };\n}\n\nfunction asked(state: HomeState): HomeState {\n  const isEmpty = state.question.trim() === '';\n  if (isEmpty) {\n    return state;\n  }\n  const match = suggestionOf(state.question);\n  const answerId: AnswerId = match?.id ?? 'none';\n  const spoken = answerTextOf(answerId);\n  return { ...state, answerId, spoken };\n}\n\nfunction suggestionPicked(state: HomeState, id: SuggestionId): HomeState {\n  const suggestion = SUGGESTIONS.find((candidate) => candidate.id === id);\n  if (!suggestion) {\n    return state;\n  }\n  return {\n    ...state,\n    question: suggestion.question,\n    answerId: id,\n    spoken: suggestion.answer,\n  };\n}\n\nfunction resolved(state: HomeState, id: WaitingId): HomeState {\n  const index = WAITING.findIndex((waiting) => waiting.id === id);\n  const hasArrived = index >= 0 && index < state.arrived;\n  const isDone = state.resolved.includes(id);\n  if (!hasArrived || isDone) {\n    return state;\n  }\n  const spoken = WAITING[index].done;\n  return { ...state, resolved: [...state.resolved, id], spoken };\n}\n\nexport function reducer(state: HomeState, action: HomeAction): HomeState {\n  switch (action.type) {\n    case 'arrived':\n      return arrived(state);\n    case 'questionTyped':\n      return questionTyped(state, action.text);\n    case 'asked':\n      return asked(state);\n    case 'suggestionPicked':\n      return suggestionPicked(state, action.id);\n    case 'resolved':\n      return resolved(state, action.id);\n  }\n}\n\nconst KEY_MS = 42;\n\nfunction typingSteps(text: string, startAfter: number): Step[] {\n  const prefixes = prefixesOf(text);\n  return prefixes.map((typed, index) => ({\n    after: keyDelayOf(index, startAfter, KEY_MS),\n    by: 'demo',\n    action: { type: 'questionTyped', text: typed },\n  }));\n}\n\nfunction arrivalAfterOf(index: number) {\n  if (index === 0) {\n    return 900;\n  }\n  return 750;\n}\n\n/** The agents arrive on their own, so they keep arriving after a person takes over. */\nconst ARRIVALS: Step[] = WAITING.map((_, index) => ({\n  after: arrivalAfterOf(index),\n  action: { type: 'arrived' },\n}));\n\nconst QUESTION = SUGGESTIONS[0].question;\n\nexport const SCRIPT: Step[] = [\n  ...ARRIVALS,\n  ...typingSteps(QUESTION, 1500),\n  { after: 450, by: 'demo', press: 'ask', action: { type: 'asked' } },\n  {\n    after: 2800,\n    by: 'demo',\n    press: 'act-writer',\n    action: { type: 'resolved', id: 'writer' },\n  },\n];\n\nfunction endOf(script: Step[]) {\n  let state = INITIAL;\n  for (const step of script) {\n    state = reducer(state, step.action);\n  }\n  return state;\n}\n\nexport const RESTING: HomeState = { ...endOf(SCRIPT), spoken: '' };\n\nexport const LOOP_AFTER_MS = 4200;\n",
      "type": "registry:component",
      "target": "components/blocks/ai-product-02/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/ai-product/ai-product-02/data.ts",
      "content": "import type { SeriesSlot } from '@/registry/ndeko/lib/agent-run';\n\nexport const WORKSPACE = { name: 'Nyota Studio' };\n\nexport const PERSON = { name: 'Grace Mbuyi' };\n\nexport const TODAY = {\n  runs: 38,\n  finished: 27,\n  spentUsd: 14.2,\n};\n\nexport type WaitingId = 'writer' | 'researcher' | 'coder' | 'planner';\n\nexport type Waiting = {\n  id: WaitingId;\n  agent: string;\n  series: SeriesSlot;\n  ask: string;\n  waited: string;\n  action: string;\n  done: string;\n};\n\nexport const WAITING: Waiting[] = [\n  {\n    id: 'writer',\n    agent: 'Writer',\n    series: 2,\n    ask: 'Wants to send the Lubumbashi price update to 14 customers',\n    waited: '6 min',\n    action: 'Review draft',\n    done: 'Draft approved',\n  },\n  {\n    id: 'researcher',\n    agent: 'Researcher',\n    series: 3,\n    ask: 'Two sources disagree on the Goma freight rate',\n    waited: '12 min',\n    action: 'Choose a source',\n    done: 'Source chosen',\n  },\n  {\n    id: 'coder',\n    agent: 'Coder',\n    series: 1,\n    ask: 'Asks to merge the invoice export fix',\n    waited: '21 min',\n    action: 'Approve merge',\n    done: 'Merge approved',\n  },\n  {\n    id: 'planner',\n    agent: 'Planner',\n    series: 4,\n    ask: 'Needs a start date for the Kinshasa launch plan',\n    waited: '34 min',\n    action: 'Pick a date',\n    done: 'Date picked',\n  },\n];\n\nexport type SuggestionId = 'finished' | 'waiting' | 'spend';\n\nexport type Suggestion = {\n  id: SuggestionId;\n  label: string;\n  question: string;\n  answer: string;\n};\n\nexport const SUGGESTIONS: Suggestion[] = [\n  {\n    id: 'finished',\n    label: 'Finished yesterday',\n    question: 'What did the agents finish yesterday?',\n    answer:\n      '31 tasks finished yesterday: 12 customer updates drafted, 9 invoices matched, 7 fixes merged and 3 reports filed. Nothing failed.',\n  },\n  {\n    id: 'waiting',\n    label: 'Customers waiting',\n    question: 'Which customers are waiting for a reply?',\n    answer:\n      'Four customers wrote in the last hour: two in Kinshasa, one in Goma and one in Lubumbashi. The Writer has a draft ready for each.',\n  },\n  {\n    id: 'spend',\n    label: 'Research spend',\n    question: 'How much did research cost this week?',\n    answer:\n      'Research runs cost $64 this week, which is 30% of the $212 spent this month.',\n  },\n];\n\nexport const NO_ANSWER =\n  'This sample answers the three suggested questions. Pick one to see how an answer lands.';\n\nexport type ActionId = 'task' | 'agent' | 'app' | 'invite';\n\nexport type QuickAction = {\n  id: ActionId;\n  label: string;\n  hint: string;\n};\n\nexport const ACTIONS: QuickAction[] = [\n  { id: 'task', label: 'New task', hint: 'Give an agent a job' },\n  { id: 'agent', label: 'Create an agent', hint: 'Name it, set its job' },\n  { id: 'app', label: 'Connect an app', hint: 'Notion, Linear, Gmail' },\n  { id: 'invite', label: 'Invite a teammate', hint: 'Share the reviews' },\n];\n\nexport const WEEK_DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'];\n\nexport const SPEND = {\n  usedUsd: 212,\n  budgetUsd: 400,\n  byDay: [28, 36, 31, 40, 14.2],\n};\n\nexport const TASKS_DONE = {\n  total: 124,\n  byDay: [22, 29, 26, 20, 27],\n};\n\nexport function suggestionOf(question: string) {\n  const wanted = question.trim().toLowerCase();\n  return SUGGESTIONS.find(\n    (suggestion) => suggestion.question.toLowerCase() === wanted\n  );\n}\n\nexport function answerTextOf(id: SuggestionId | 'none') {\n  const suggestion = SUGGESTIONS.find((candidate) => candidate.id === id);\n  return suggestion?.answer ?? NO_ANSWER;\n}\n",
      "type": "registry:component",
      "target": "components/blocks/ai-product-02/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "ai-product"
  ],
  "type": "registry:block"
}