{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "application-13",
  "title": "Agent start screen",
  "description": "A Wrenfield start screen for an agent app: recent sessions down the side, one prompt box with attachments, a model key and a mode key, suggested tasks that fill the prompt when picked and the latest runs with their state, where a run that waits is allowed or denied in place. Behind it a field of mono glyphs shows in a soft lens that follows the pointer, and a press on empty space sends a ripple through it. Plug your agent into onSend, onApprove and onDeny.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/agent-run.json",
    "https://ui.ndekocode.dev/r/animated-size.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/chat-motion.json",
    "https://ui.ndekocode.dev/r/company-mark.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/inline-sheet.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-roll.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-agent-run.json",
    "https://ui.ndekocode.dev/r/use-is-narrow.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/use-timeouts.json",
    "https://ui.ndekocode.dev/r/utils.json",
    "https://ui.ndekocode.dev/r/words.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/index.tsx",
      "content": "'use client';\n\nimport { useRef } from 'react';\n\nimport { useIsNarrow } from '@/registry/ndeko/hooks/use-is-narrow';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { useTimeouts } from '@/registry/ndeko/hooks/use-timeouts';\nimport { spokenUnless } from '@/registry/ndeko/lib/demonstration';\nimport { MenuIcon } from '@/registry/ndeko/lib/icons';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { InlineSheet } from '@/registry/ndeko/ui/inline-sheet';\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\n\nimport { BRAND, type Attachment } from './data';\nimport { GlyphField } from './glyph-field';\nimport { PromptBox } from './prompt-box';\nimport { RecentRuns } from './recent-runs';\nimport {\n  INITIAL,\n  LOOP_AFTER_MS,\n  reducer,\n  RESTING,\n  RUN_MS,\n  SCRIPT,\n  sentRunIdOf,\n  START_MS,\n  type Decision,\n} from './session';\nimport { SessionSidebar } from './session-sidebar';\nimport { Suggestions } from './suggestions';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\n/** The width of the `@3xl` container variant: under it the recent sessions live in a sheet. */\nconst SHEET_BELOW_REM = 48;\n\n/**\n * Nothing calls a network. A real agent plugs in here: the prompt a person starts a session with,\n * and their answer to a run that waits on them.\n */\nexport type Application13Props = {\n  onSend?: (text: string) => void;\n  onApprove?: () => void;\n  onDeny?: () => void;\n};\n\nexport default function Application13({\n  onSend,\n  onApprove,\n  onDeny,\n}: Application13Props) {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  const { schedule } = useTimeouts();\n  const fieldHostRef = useRef<HTMLElement>(null);\n  const isNarrow = useIsNarrow(ref, SHEET_BELOW_REM);\n  const isSidebarShown = isNarrow && state.isSidebarOpen;\n  const canReplay = isFinished && !isAutoplaying;\n  const message = spokenUnless(isAutoplaying, state.spoken);\n\n  function focusLater(selector: string) {\n    requestAnimationFrame(() => {\n      const target = ref.current?.querySelector<HTMLElement>(selector);\n      target?.focus();\n    });\n  }\n\n  function focusPromptAtEnd() {\n    requestAnimationFrame(() => {\n      const field = ref.current?.querySelector<HTMLTextAreaElement>(\n        '[data-prompt-field]'\n      );\n      if (!field) {\n        return;\n      }\n      const end = field.value.length;\n      field.focus();\n      field.setSelectionRange(end, end);\n    });\n  }\n\n  /** The run of a sent prompt starts, then ends: a backend would send these two events itself. */\n  function send() {\n    const text = state.draft.trim();\n    act({ type: 'sent' });\n    if (text === '') {\n      return;\n    }\n    const sentCount = state.sentCount + 1;\n    const id = sentRunIdOf(sentCount);\n    const endsAfter = START_MS + RUN_MS;\n    schedule(() => act({ type: 'runStarted', id }), START_MS);\n    schedule(() => act({ type: 'runFinished', id }), endsAfter);\n    onSend?.(text);\n  }\n\n  function closeSidebar() {\n    act({ type: 'sidebar', isOpen: false });\n    focusLater('[data-sidebar-open]');\n  }\n\n  function openSidebar() {\n    act({ type: 'sidebar', isOpen: true });\n    focusLater('[data-sheet-close=\"sessions\"]');\n  }\n\n  function fillPrompt(prompt: string) {\n    act({ type: 'picked', prompt });\n    if (isSidebarShown) {\n      act({ type: 'sidebar', isOpen: false });\n    }\n    focusPromptAtEnd();\n  }\n\n  function startNewSession() {\n    fillPrompt('');\n  }\n\n  /** The two buttons leave the row, so the focus goes to the row, which now says what was decided. */\n  function decide(id: string, decision: Decision) {\n    act({ type: 'decided', id, decision });\n    focusLater(`[data-run=\"${id}\"]`);\n    if (decision === 'denied') {\n      onDeny?.();\n      return;\n    }\n    schedule(() => act({ type: 'runStarted', id }), START_MS);\n    onApprove?.();\n  }\n\n  const sidebar = {\n    sessions: state.sessions,\n    onNewSession: startNewSession,\n    onAskAgain: fillPrompt,\n  };\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-sidebar text-foreground @container min-h-dvh w-full'\n      >\n        <div className='relative flex h-dvh min-h-[40rem] overflow-hidden'>\n          <div inert={isSidebarShown} className='flex min-w-0 flex-1 @3xl:p-2'>\n            <aside\n              aria-label='Sessions'\n              className='hidden w-60 shrink-0 pe-2 @3xl:flex'\n            >\n              {!isNarrow && <SessionSidebar {...sidebar} />}\n            </aside>\n            <main\n              ref={fieldHostRef}\n              className='bg-background @3xl:hairline-ring @3xl:ring-border relative flex min-w-0 flex-1 flex-col overflow-hidden @3xl:rounded-xl @3xl:shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n            >\n              <GlyphField\n                hostRef={fieldHostRef}\n                isActive={isInView}\n                demoLens={state.demoLens}\n                demoRipples={state.demoRipples}\n              />\n              <div className='relative flex min-h-0 flex-1 flex-col overflow-y-auto'>\n                <div className='flex h-12 shrink-0 items-center gap-2 px-3'>\n                  <Button\n                    type='button'\n                    variant='ghost'\n                    size='icon-sm'\n                    data-sidebar-open\n                    aria-label='Open the recent sessions'\n                    aria-haspopup='dialog'\n                    onClick={openSidebar}\n                    className='text-muted-foreground @3xl:hidden'\n                  >\n                    <MenuIcon />\n                  </Button>\n                  <span className='text-[13px] font-semibold @3xl:hidden'>\n                    {BRAND.name}\n                  </span>\n                  <span className='ms-auto'>\n                    <ReplayButton\n                      isShown={canReplay}\n                      onReplay={restart}\n                      label='Replay'\n                    />\n                  </span>\n                </div>\n                <div className='mx-auto flex w-full max-w-2xl flex-col gap-8 px-4 pt-4 pb-10 @3xl:pt-8'>\n                  <header className='flex flex-col gap-1.5'>\n                    <h1 className='text-xl font-semibold text-balance @md:text-2xl'>\n                      Start a session\n                    </h1>\n                    <p className='text-muted-foreground text-sm text-balance'>\n                      Say what you need, attach what it takes and choose how far\n                      the agent may go on its own\n                    </p>\n                  </header>\n                  <div className='flex flex-col gap-3'>\n                    <PromptBox\n                      draft={state.draft}\n                      attachments={state.attachments}\n                      model={state.model}\n                      mode={state.mode}\n                      hint={state.hint}\n                      refusals={state.refusals}\n                      pressed={pressed}\n                      onType={(text) => act({ type: 'typed', text })}\n                      onSend={send}\n                      onAttach={(attachments: Attachment[]) =>\n                        act({ type: 'attached', attachments })\n                      }\n                      onDetach={(id) => act({ type: 'detached', id })}\n                      onModelChange={(model) =>\n                        act({ type: 'modelSet', model })\n                      }\n                      onModeChange={(mode) => act({ type: 'modeSet', mode })}\n                    />\n                    <Suggestions\n                      draft={state.draft}\n                      pressed={pressed}\n                      onPick={fillPrompt}\n                    />\n                  </div>\n                  <RecentRuns\n                    runs={state.runs}\n                    pressed={pressed}\n                    onDecide={decide}\n                  />\n                </div>\n              </div>\n            </main>\n          </div>\n\n          <InlineSheet\n            name='sessions'\n            label='Recent sessions'\n            closeLabel='Close the recent sessions'\n            side='start'\n            isOpen={isSidebarShown}\n            className='@3xl:hidden'\n            panelClassName='bg-sidebar gap-1 p-3'\n            onClose={closeSidebar}\n          >\n            {isNarrow && <SessionSidebar {...sidebar} />}\n          </InlineSheet>\n          <LiveRegion message={message} />\n        </div>\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-13/index.tsx"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/session-sidebar.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { HistoryIcon, PlusIcon } from '@/registry/ndeko/lib/icons';\nimport { rowPresenceOf } from '@/registry/ndeko/lib/motion-presets';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\n\nimport { BRAND, DAYS, type PastSession } from './data';\n\n/** The ring is drawn inside the row: the row sits in a box that clips while it arrives. */\nconst ROW =\n  'hover:bg-foreground/5 focus-visible:ring-ring/25 flex h-7 w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-2 text-start text-[13px] font-medium outline-none transition-colors duration-150 focus-visible:ring-[3px] focus-visible:ring-inset';\n\ntype SessionRowProps = {\n  session: PastSession;\n  onAskAgain: (prompt: string) => void;\n};\n\nfunction SessionRow({ session, onAskAgain }: SessionRowProps) {\n  function askAgain() {\n    onAskAgain(session.prompt);\n  }\n\n  return (\n    <button\n      type='button'\n      aria-label={`Ask again: ${session.title}`}\n      onClick={askAgain}\n      className={ROW}\n    >\n      <HistoryIcon className='text-muted-foreground size-4 shrink-0' />\n      <span className='min-w-0 flex-1 truncate'>{session.title}</span>\n    </button>\n  );\n}\n\ntype SessionSidebarProps = {\n  sessions: PastSession[];\n  onNewSession: () => void;\n  onAskAgain: (prompt: string) => void;\n};\n\n/** A past session puts its prompt back in the field, ready to be sent again or changed first. */\nexport function SessionSidebar({\n  sessions,\n  onNewSession,\n  onAskAgain,\n}: SessionSidebarProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowPresence = rowPresenceOf(shouldReduceMotion);\n\n  return (\n    <div className='flex min-h-0 w-full flex-col gap-3'>\n      <div className='flex flex-col gap-2'>\n        <div className='flex h-9 items-center gap-2 px-1.5'>\n          <CompanyMark seed={BRAND.name} className='size-6 rounded-md' />\n          <span className='text-[13px] font-semibold'>{BRAND.name}</span>\n        </div>\n        <Button\n          type='button'\n          variant='outline'\n          onClick={onNewSession}\n          className='w-full justify-start'\n        >\n          <PlusIcon />\n          New session\n        </Button>\n      </div>\n      <nav\n        aria-label='Recent sessions'\n        className='-mx-1 flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-1'\n      >\n        {DAYS.map((day) => {\n          const ofDay = sessions.filter((session) => session.day === day);\n          return (\n            <section key={day} className='flex flex-col gap-0.5'>\n              <h2 className='text-muted-foreground flex h-6 items-center px-2 text-xs font-medium'>\n                {day}\n              </h2>\n              <ul className='flex flex-col'>\n                <AnimatePresence initial={false}>\n                  {ofDay.map((session) => (\n                    <motion.li\n                      key={session.id}\n                      className='-mx-1 overflow-hidden px-1'\n                      {...rowPresence}\n                    >\n                      <SessionRow session={session} onAskAgain={onAskAgain} />\n                    </motion.li>\n                  ))}\n                </AnimatePresence>\n              </ul>\n            </section>\n          );\n        })}\n      </nav>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-13/session-sidebar.tsx"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/prompt-box.tsx",
      "content": "'use client';\n\nimport { motion } from 'motion/react';\nimport { useId, useRef } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  pressedQuietOf,\n  pressedSolidOf,\n} from '@/registry/ndeko/lib/demonstration';\nimport {\n  ArrowUpIcon,\n  FileTextIcon,\n  PaperclipIcon,\n  XIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport {\n  EMPTY_PROMPT_HINT,\n  FULL_HINT,\n  type Attachment,\n  type ModeId,\n  type ModelId,\n} from './data';\nimport { ModeKey, ModelKey } from './prompt-keys';\nimport type { Hint } from './session';\n\nconst KILOBYTE = 1024;\n\nconst MEGABYTE = KILOBYTE * KILOBYTE;\n\nconst HINT_TEXT: Record<Hint, string> = {\n  none: '',\n  empty: EMPTY_PROMPT_HINT,\n  full: FULL_HINT,\n};\n\nconst NUDGE = { x: [0, -4, 4, 0] };\n\nconst STILL = { x: 0 };\n\n/** A refused entry nudges its reason once. Reduced motion keeps it still. */\nfunction nudgeOf(shouldReduceMotion: boolean) {\n  if (shouldReduceMotion) {\n    return STILL;\n  }\n  return NUDGE;\n}\n\n/** 48 KB, 1.2 MB. */\nfunction formatBytes(bytes: number) {\n  if (bytes < MEGABYTE) {\n    const rounded = Math.round(bytes / KILOBYTE);\n    const kilobytes = Math.max(1, rounded);\n    return `${kilobytes} KB`;\n  }\n  const megabytes = bytes / MEGABYTE;\n  return `${megabytes.toFixed(1)} MB`;\n}\n\nfunction describedByOf(hasHint: boolean, hintId: string) {\n  if (hasHint) {\n    return hintId;\n  }\n  return undefined;\n}\n\nfunction isSendKey(event: React.KeyboardEvent<HTMLTextAreaElement>) {\n  const isPlainEnter = event.key === 'Enter' && !event.shiftKey;\n  return isPlainEnter && !event.nativeEvent.isComposing;\n}\n\ntype AttachmentChipProps = {\n  attachment: Attachment;\n  onRemove: (id: string) => void;\n};\n\nfunction AttachmentChip({ attachment, onRemove }: AttachmentChipProps) {\n  function remove() {\n    onRemove(attachment.id);\n  }\n\n  return (\n    <li className='bg-foreground/[0.05] flex h-7 max-w-full items-center gap-1.5 rounded-lg ps-2 pe-1 text-xs transition-[opacity,scale] duration-200 ease-(--ease-out-strong) starting:scale-95 starting:opacity-0'>\n      <FileTextIcon className='text-muted-foreground size-3.5 shrink-0' />\n      <span className='min-w-0 truncate'>{attachment.name}</span>\n      <span className='text-muted-foreground shrink-0 tabular-nums'>\n        {formatBytes(attachment.bytes)}\n      </span>\n      <button\n        type='button'\n        aria-label={`Remove ${attachment.name}`}\n        onClick={remove}\n        className='text-muted-foreground hover:bg-foreground/[0.07] hover:text-foreground focus-visible:ring-ring/25 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-md outline-none focus-visible:ring-[3px] active:scale-[0.97]'\n      >\n        <XIcon className='size-3' />\n      </button>\n    </li>\n  );\n}\n\ntype PromptBoxProps = {\n  draft: string;\n  attachments: Attachment[];\n  model: ModelId;\n  mode: ModeId;\n  hint: Hint;\n  refusals: number;\n  pressed: string | null;\n  onType: (text: string) => void;\n  onSend: () => void;\n  onAttach: (attachments: Attachment[]) => void;\n  onDetach: (id: string) => void;\n  onModelChange: (model: ModelId) => void;\n  onModeChange: (mode: ModeId) => void;\n};\n\n/** Nothing is uploaded here: a picked file is only listed, by its name and its size. */\nexport function PromptBox({\n  draft,\n  attachments,\n  model,\n  mode,\n  hint,\n  refusals,\n  pressed,\n  onType,\n  onSend,\n  onAttach,\n  onDetach,\n  onModelChange,\n  onModeChange,\n}: PromptBoxProps) {\n  const hintId = useId();\n  const pickerRef = useRef<HTMLInputElement>(null);\n  const pickedCount = useRef(0);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const hasHint = hint !== 'none';\n  const hasAttachments = attachments.length > 0;\n\n  function sendFromKeys(event: React.KeyboardEvent<HTMLTextAreaElement>) {\n    if (!isSendKey(event)) {\n      return;\n    }\n    event.preventDefault();\n    onSend();\n  }\n\n  function openPicker() {\n    pickerRef.current?.click();\n  }\n\n  function attachmentOf(file: File): Attachment {\n    pickedCount.current += 1;\n    const id = `picked-${pickedCount.current}`;\n    return { id, name: file.name, bytes: file.size };\n  }\n\n  function attachPicked(event: React.ChangeEvent<HTMLInputElement>) {\n    const picked = event.target.files ?? [];\n    const files = Array.from(picked);\n    event.target.value = '';\n    if (files.length === 0) {\n      return;\n    }\n    const added = files.map(attachmentOf);\n    onAttach(added);\n  }\n\n  return (\n    <div\n      data-solid\n      className='bg-card hairline-ring ring-foreground/12 has-[textarea:focus-visible]:ring-ring/25 dark:bg-foreground/[0.04] dark:ring-foreground/15 relative flex flex-col rounded-2xl p-2 shadow-[0_1px_2px_rgb(0_0_0/0.05)] transition-[box-shadow] duration-150 has-[textarea:focus-visible]:ring-[3px]'\n    >\n      <AnimatedSize>\n        {hasAttachments && (\n          <ul\n            aria-label='Attached files'\n            className='flex flex-wrap gap-1.5 pb-2'\n          >\n            {attachments.map((attachment) => (\n              <AttachmentChip\n                key={attachment.id}\n                attachment={attachment}\n                onRemove={onDetach}\n              />\n            ))}\n          </ul>\n        )}\n      </AnimatedSize>\n      <textarea\n        data-prompt-field\n        value={draft}\n        rows={2}\n        aria-label='What the agent should do'\n        aria-invalid={hasHint}\n        aria-describedby={describedByOf(hasHint, hintId)}\n        placeholder='Describe a task, or pick one under this field'\n        onChange={(event) => onType(event.target.value)}\n        onKeyDown={sendFromKeys}\n        className='placeholder:text-muted-foreground/75 field-sizing-content max-h-[8lh] min-h-[2lh] resize-none bg-transparent px-1.5 py-1 text-base leading-normal outline-none md:text-sm'\n      />\n      <div className='flex flex-wrap items-center gap-1.5 pt-2'>\n        <Button\n          type='button'\n          variant='ghost'\n          size='icon-sm'\n          aria-label='Attach files'\n          onClick={openPicker}\n          className={cn(\n            'text-muted-foreground',\n            pressedQuietOf(pressed === 'attach')\n          )}\n        >\n          <PaperclipIcon />\n        </Button>\n        <input\n          ref={pickerRef}\n          type='file'\n          multiple\n          tabIndex={-1}\n          aria-hidden='true'\n          onChange={attachPicked}\n          className='sr-only'\n        />\n        <ModelKey value={model} onValueChange={onModelChange} />\n        <ModeKey value={mode} onValueChange={onModeChange} />\n        <Button\n          type='button'\n          size='sm'\n          onClick={onSend}\n          className={cn('ms-auto', pressedSolidOf(pressed === 'send'))}\n        >\n          Start\n          <ArrowUpIcon />\n        </Button>\n      </div>\n      {hasHint && (\n        <motion.p\n          key={refusals}\n          id={hintId}\n          animate={nudgeOf(shouldReduceMotion)}\n          transition={{ duration: 0.28 }}\n          className='text-destructive-ink px-1.5 pt-2 text-xs'\n        >\n          {HINT_TEXT[hint]}\n        </motion.p>\n      )}\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-13/prompt-box.tsx"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/prompt-keys.tsx",
      "content": "'use client';\n\nimport { WordRoll } from '@/components/core/word-roll';\nimport {\n  ChevronDownIcon,\n  HandIcon,\n  ListChecksIcon,\n  ZapIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { BrandTile } from '@/registry/ndeko/ui/brand-tile';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuGroup,\n  DropdownMenuGroupLabel,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\n\nimport {\n  modelOf,\n  MODELS,\n  modeOf,\n  MODES,\n  type ModeId,\n  type ModelId,\n} from './data';\n\n/** Both controls are drawn as key caps, the material of a key. */\nconst KEY = 'keycap-3d text-foreground h-7 gap-1.5 rounded-md px-2 text-xs';\n\nconst MODEL_NAMES = MODELS.map((model) => model.name);\n\nconst MODE_LABELS = MODES.map((mode) => mode.label);\n\nconst MODE_ICON: Record<ModeId, Icon> = {\n  ask: HandIcon,\n  plan: ListChecksIcon,\n  act: ZapIcon,\n};\n\ntype ModelKeyProps = {\n  value: ModelId;\n  onValueChange: (model: ModelId) => void;\n};\n\n/** The menu belongs to a person. The demonstration changes the value, and the key rolls to its new name. */\nexport function ModelKey({ value, onValueChange }: ModelKeyProps) {\n  const model = modelOf(value);\n\n  function change(next: unknown) {\n    const found = MODELS.find((candidate) => candidate.id === next);\n    if (found) {\n      onValueChange(found.id);\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <Button\n            type='button'\n            variant='ghost'\n            size='sm'\n            aria-label={`Model: ${model.name}`}\n            className={KEY}\n          />\n        }\n      >\n        <Swap swapKey={model.brand}>\n          <BrandTile brand={model.brand} size='sm' />\n        </Swap>\n        <WordRoll text={model.name} labels={MODEL_NAMES} />\n        <ChevronDownIcon className='size-3.5 opacity-60' />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent side='top' align='start' className='w-56'>\n        <DropdownMenuGroup>\n          <DropdownMenuGroupLabel>Model</DropdownMenuGroupLabel>\n          <DropdownMenuRadioGroup value={value} onValueChange={change}>\n            {MODELS.map((option) => (\n              <DropdownMenuRadioItem\n                key={option.id}\n                value={option.id}\n                closeOnClick\n              >\n                <BrandTile brand={option.brand} size='sm' />\n                {option.name}\n              </DropdownMenuRadioItem>\n            ))}\n          </DropdownMenuRadioGroup>\n        </DropdownMenuGroup>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\ntype ModeKeyProps = {\n  value: ModeId;\n  onValueChange: (mode: ModeId) => void;\n};\n\nexport function ModeKey({ value, onValueChange }: ModeKeyProps) {\n  const mode = modeOf(value);\n  const ModeIcon = MODE_ICON[value];\n\n  function change(next: unknown) {\n    const found = MODES.find((candidate) => candidate.id === next);\n    if (found) {\n      onValueChange(found.id);\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <Button\n            type='button'\n            variant='ghost'\n            size='sm'\n            aria-label={`Mode: ${mode.label}`}\n            className={KEY}\n          />\n        }\n      >\n        <Swap swapKey={value}>\n          <ModeIcon className='size-3.5' />\n        </Swap>\n        <WordRoll text={mode.label} labels={MODE_LABELS} />\n        <ChevronDownIcon className='size-3.5 opacity-60' />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent side='top' align='start' className='w-72'>\n        <DropdownMenuGroup>\n          <DropdownMenuGroupLabel>How the agent works</DropdownMenuGroupLabel>\n          <DropdownMenuRadioGroup value={value} onValueChange={change}>\n            {MODES.map((option) => {\n              const OptionIcon = MODE_ICON[option.id];\n              return (\n                <DropdownMenuRadioItem\n                  key={option.id}\n                  value={option.id}\n                  closeOnClick\n                  className='h-auto items-start py-1.5'\n                >\n                  <OptionIcon className='mt-0.5' />\n                  <span className='flex min-w-0 flex-col'>\n                    <span>{option.label}</span>\n                    <span className='text-muted-foreground text-xs'>\n                      {option.hint}\n                    </span>\n                  </span>\n                </DropdownMenuRadioItem>\n              );\n            })}\n          </DropdownMenuRadioGroup>\n        </DropdownMenuGroup>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-13/prompt-keys.tsx"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/suggestions.tsx",
      "content": "'use client';\n\nimport { pressedQuietOf } from '@/registry/ndeko/lib/demonstration';\nimport {\n  CodeIcon,\n  PencilIcon,\n  SearchIcon,\n  TableIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nimport { SUGGESTIONS, type Suggestion, type SuggestionKind } from './data';\n\nconst KIND_ICON: Record<SuggestionKind, Icon> = {\n  data: TableIcon,\n  writing: PencilIcon,\n  search: SearchIcon,\n  code: CodeIcon,\n};\n\n/** The card whose task sits in the prompt keeps a ring, so the pick stays visible after the press. */\nfunction pickedOf(isPicked: boolean) {\n  if (isPicked) {\n    return 'ring-primary/45';\n  }\n  return 'ring-border hover:bg-foreground/[0.03]';\n}\n\ntype SuggestionCardProps = {\n  suggestion: Suggestion;\n  isPicked: boolean;\n  isPressed: boolean;\n  onPick: (prompt: string) => void;\n};\n\nfunction SuggestionCard({\n  suggestion,\n  isPicked,\n  isPressed,\n  onPick,\n}: SuggestionCardProps) {\n  const KindIcon = KIND_ICON[suggestion.kind];\n\n  function pick() {\n    onPick(suggestion.prompt);\n  }\n\n  return (\n    <li className='flex'>\n      <button\n        type='button'\n        data-solid\n        aria-pressed={isPicked}\n        onClick={pick}\n        className={cn(\n          'bg-card hairline-ring focus-visible:ring-ring dark:bg-foreground/[0.04] flex min-h-14 w-full cursor-pointer items-center gap-3 rounded-xl p-2.5 text-start shadow-[0_1px_2px_rgb(0_0_0/0.04)] transition-[background-color,box-shadow,scale] duration-150 ease-(--ease-out-strong) outline-none focus-visible:ring-2 active:scale-[0.97]',\n          pickedOf(isPicked),\n          pressedQuietOf(isPressed)\n        )}\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          <KindIcon className='size-4' />\n        </span>\n        <span className='flex min-w-0 flex-col leading-tight'>\n          <span className='truncate text-[13px] font-medium'>\n            {suggestion.title}\n          </span>\n          <span className='text-muted-foreground truncate text-xs'>\n            {suggestion.hint}\n          </span>\n        </span>\n      </button>\n    </li>\n  );\n}\n\ntype SuggestionsProps = {\n  draft: string;\n  pressed: string | null;\n  onPick: (prompt: string) => void;\n};\n\nexport function Suggestions({ draft, pressed, onPick }: SuggestionsProps) {\n  return (\n    <ul\n      aria-label='Suggested tasks'\n      className='grid grid-cols-1 gap-2 @md:grid-cols-2'\n    >\n      {SUGGESTIONS.map((suggestion) => {\n        const pressKey = `suggestion-${suggestion.id}`;\n        return (\n          <SuggestionCard\n            key={suggestion.id}\n            suggestion={suggestion}\n            isPicked={draft === suggestion.prompt}\n            isPressed={pressed === pressKey}\n            onPick={onPick}\n          />\n        );\n      })}\n    </ul>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-13/suggestions.tsx"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/recent-runs.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useId } from 'react';\n\nimport { WordRoll } from '@/components/core/word-roll';\nimport { useNow } from '@/registry/ndeko/hooks/use-agent-run';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  elapsedOf,\n  formatCost,\n  formatDuration,\n  seriesColorOf,\n} from '@/registry/ndeko/lib/agent-run';\nimport { pressedSolidOf } 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 { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\n\nimport { AGENTS, type RunStatus } from './data';\nimport type { Decision, Run } from './session';\n\nconst STATUS_WORD: Record<RunStatus, string> = {\n  queued: 'Queued',\n  running: 'Running',\n  waiting: 'Waiting on you',\n  done: 'Done',\n  failed: 'Failed',\n};\n\nconst STATUS_WORDS = Object.values(STATUS_WORD);\n\nconst DOT_TONE: Record<RunStatus, string> = {\n  queued: 'bg-muted-foreground/45',\n  running: 'bg-info',\n  waiting: 'bg-warning',\n  done: 'bg-success',\n  failed: 'bg-destructive',\n};\n\nconst WORD_TONE: Record<RunStatus, string> = {\n  queued: 'text-muted-foreground',\n  running: 'text-foreground',\n  waiting: 'text-warning-foreground',\n  done: 'text-muted-foreground',\n  failed: 'text-destructive-ink',\n};\n\n/** Only a run that is really running breathes. */\nfunction pulseOf(status: RunStatus) {\n  if (status === 'running') {\n    return 'animate-pulse';\n  }\n  return undefined;\n}\n\nconst SECOND_MS = 1000;\n\n/** A run on the start screen has been going for minutes: its clock ticks once a second, and only this text re-renders. */\nfunction RunningClock({ run }: { run: Run }) {\n  const now = useNow(SECOND_MS, true);\n  const elapsed = elapsedOf(run, now);\n\n  return <span className='w-14 tabular-nums'>{formatDuration(elapsed)}</span>;\n}\n\nfunction RunClock({ run }: { run: Run }) {\n  if (run.status === 'queued') {\n    return null;\n  }\n  if (run.status === 'running') {\n    return <RunningClock run={run} />;\n  }\n  const end = run.endedAt ?? run.startedAt;\n  const elapsed = elapsedOf(run, end);\n  return <span className='tabular-nums'>{formatDuration(elapsed)}</span>;\n}\n\n/** A run that waits shows its request and its two answers. Any other run shows the trace it kept, if it has one. */\nfunction traceOf(run: Run) {\n  if (run.status === 'waiting') {\n    return undefined;\n  }\n  return run.note;\n}\n\ntype RunRowProps = {\n  run: Run;\n  isAllowPressed: boolean;\n  onDecide: (id: string, decision: Decision) => void;\n};\n\nfunction RunRow({ run, isAllowPressed, onDecide }: RunRowProps) {\n  const agent = AGENTS[run.agentId];\n  const isWaiting = run.status === 'waiting';\n  const hasCost = run.costUsd > 0;\n  const trace = traceOf(run);\n\n  function allow() {\n    onDecide(run.id, 'approved');\n  }\n\n  function deny() {\n    onDecide(run.id, 'denied');\n  }\n\n  return (\n    <div\n      data-run={run.id}\n      tabIndex={-1}\n      className='flex items-start gap-3 px-3 py-2.5 outline-none'\n    >\n      <MeshTile\n        seed={agent.name}\n        color={seriesColorOf(agent.series)}\n        size='lg'\n      />\n      <div className='flex min-w-0 flex-1 flex-col gap-0.5'>\n        <p className='flex items-baseline gap-3'>\n          <span className='min-w-0 flex-1 truncate text-[13px] font-medium'>\n            {run.title}\n          </span>\n          {hasCost && (\n            <span className='text-muted-foreground shrink-0 text-xs tabular-nums'>\n              {formatCost(run.costUsd)}\n            </span>\n          )}\n        </p>\n        <p className='text-muted-foreground flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs'>\n          <span>{agent.name}</span>\n          <span\n            className={cn(\n              'flex items-center gap-1.5 transition-colors duration-200',\n              WORD_TONE[run.status]\n            )}\n          >\n            <span\n              aria-hidden='true'\n              className={cn(\n                'size-1.5 shrink-0 rounded-full transition-colors duration-200',\n                DOT_TONE[run.status],\n                pulseOf(run.status)\n              )}\n            />\n            <WordRoll text={STATUS_WORD[run.status]} labels={STATUS_WORDS} />\n          </span>\n          <RunClock run={run} />\n        </p>\n        {isWaiting && (\n          <div className='flex flex-wrap items-center gap-2 pt-1.5'>\n            <span className='text-foreground/85 min-w-0 flex-1 text-xs'>\n              {run.request}\n            </span>\n            <Button\n              type='button'\n              size='sm'\n              aria-label={`Allow: ${run.request}`}\n              onClick={allow}\n              className={pressedSolidOf(isAllowPressed)}\n            >\n              Allow\n            </Button>\n            <Button\n              type='button'\n              size='sm'\n              variant='outline'\n              aria-label={`Deny: ${run.request}`}\n              onClick={deny}\n            >\n              Deny\n            </Button>\n          </div>\n        )}\n        {trace && (\n          <p\n            key={trace}\n            className='text-muted-foreground text-xs transition-opacity duration-300 starting:opacity-0'\n          >\n            {trace}\n          </p>\n        )}\n      </div>\n    </div>\n  );\n}\n\ntype RecentRunsProps = {\n  runs: Run[];\n  pressed: string | null;\n  onDecide: (id: string, decision: Decision) => void;\n};\n\n/** A new run arrives at the top with its height and the oldest one leaves, so the list keeps its length. */\nexport function RecentRuns({ runs, pressed, onDecide }: RecentRunsProps) {\n  const titleId = useId();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowPresence = rowPresenceOf(shouldReduceMotion);\n\n  return (\n    <section aria-labelledby={titleId} className='flex flex-col gap-2'>\n      <div className='flex items-center gap-2 px-1'>\n        <h2 id={titleId} className='text-[13px] font-medium'>\n          Recent runs\n        </h2>\n        <Badge variant='secondary'>Illustrative</Badge>\n      </div>\n      <ul\n        data-solid\n        className='bg-card hairline-ring ring-border dark:bg-foreground/[0.04] flex flex-col rounded-xl shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n      >\n        <AnimatePresence initial={false}>\n          {runs.map((run) => (\n            <motion.li\n              key={run.id}\n              className='overflow-hidden'\n              {...rowPresence}\n            >\n              <RunRow\n                run={run}\n                isAllowPressed={pressed === 'allow'}\n                onDecide={onDecide}\n              />\n            </motion.li>\n          ))}\n        </AnimatePresence>\n      </ul>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-13/recent-runs.tsx"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/glyph-field.tsx",
      "content": "'use client';\n\nimport { useEffect, useRef, type RefObject } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\n\nimport { createGlyphField, type GlyphFieldEngine } from './glyph-engine';\nimport type { Point } from './session';\n\ntype GlyphFieldProps = {\n  hostRef: RefObject<HTMLElement | null>;\n  isActive: boolean;\n  demoLens: Point | null;\n  demoRipples: number;\n};\n\n/**\n * The field of glyphs behind the content of `hostRef`. It takes its colour and its mono face from\n * the classes of the canvas, draws only while it is in view, and holds one still frame under\n * reduced motion. It is decoration: nothing in it is read aloud.\n */\nexport function GlyphField({\n  hostRef,\n  isActive,\n  demoLens,\n  demoRipples,\n}: GlyphFieldProps) {\n  const canvasRef = useRef<HTMLCanvasElement>(null);\n  const engineRef = useRef<GlyphFieldEngine | null>(null);\n  const seenRipples = useRef(demoRipples);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const isLive = isActive && !shouldReduceMotion;\n\n  useEffect(() => {\n    const canvas = canvasRef.current;\n    const host = hostRef.current;\n    if (!canvas || !host) {\n      return;\n    }\n    const engine = createGlyphField(canvas, host);\n    engineRef.current = engine;\n    return () => {\n      engine?.dispose();\n      engineRef.current = null;\n    };\n  }, [hostRef]);\n\n  useEffect(() => {\n    engineRef.current?.setLive(isLive);\n  }, [isLive]);\n\n  useEffect(() => {\n    engineRef.current?.aimDemo(demoLens);\n  }, [demoLens]);\n\n  useEffect(() => {\n    const hasNewRipple = demoRipples > seenRipples.current;\n    seenRipples.current = demoRipples;\n    if (hasNewRipple) {\n      engineRef.current?.rippleDemo();\n    }\n  }, [demoRipples]);\n\n  return (\n    <canvas\n      ref={canvasRef}\n      aria-hidden='true'\n      className='text-muted-foreground pointer-events-none absolute inset-0 size-full font-mono'\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-13/glyph-field.tsx"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/glyph-engine.ts",
      "content": "import {\n  inkGlyphs,\n  measure,\n  paint,\n  REST_ALPHA,\n  RIPPLE_MS,\n  type Lens,\n  type Ripple,\n  type Surface,\n} from './glyph-paint';\nimport type { Point } from './session';\n\nconst POINTER_EASE_S = 0.12;\n\nconst DEMO_EASE_S = 0.38;\n\nconst FADE_EASE_S = 0.25;\n\n/** A frame that comes late, after a hidden tab, moves the lens no further than this long would. */\nconst MAX_STEP_S = 0.05;\n\nconst REST_PX = 0.4;\n\n/** A press on one of these is a press on the interface, not on the empty field behind it. */\nconst SOLID = '[data-solid], button, a, input, textarea, select, label';\n\ntype FieldState = Surface & {\n  lens: Lens;\n  target: Lens;\n  easeSeconds: number;\n  demo: Point | null;\n  hasPointer: boolean;\n  isLive: boolean;\n  ripples: Ripple[];\n  frame: number;\n  lastTick: number;\n};\n\nexport type GlyphFieldEngine = {\n  aimDemo: (point: Point | null) => void;\n  rippleDemo: () => void;\n  setLive: (isLive: boolean) => void;\n  dispose: () => void;\n};\n\nfunction draw(state: FieldState) {\n  const now = performance.now();\n  paint(state, state.lens, state.ripples, now);\n}\n\n/** The still frame: the lens where it is aimed, no ripple. It is what shows at rest and under reduced motion. */\nfunction settle(state: FieldState) {\n  state.lens.x = state.target.x;\n  state.lens.y = state.target.y;\n  state.lens.alpha = state.target.alpha;\n  state.ripples = [];\n  draw(state);\n}\n\nfunction isAtRest(state: FieldState) {\n  const { lens, target } = state;\n  const offsetX = target.x - lens.x;\n  const offsetY = target.y - lens.y;\n  const distance = Math.hypot(offsetX, offsetY);\n  const alphaGap = Math.abs(target.alpha - lens.alpha);\n  const isStill = distance < REST_PX;\n  const isFaded = alphaGap < REST_ALPHA;\n  const isSettled = isStill && isFaded;\n  return isSettled && state.ripples.length === 0;\n}\n\n/** How much of the way left is covered in `seconds`: the same glide whatever the frame rate. */\nfunction shareOf(seconds: number, easeSeconds: number) {\n  const ratio = seconds / easeSeconds;\n  const decay = Math.exp(-ratio);\n  return 1 - decay;\n}\n\nfunction towards(from: number, to: number, share: number) {\n  const gap = to - from;\n  const step = gap * share;\n  return from + step;\n}\n\nfunction glide(state: FieldState, seconds: number) {\n  const { lens, target } = state;\n  const move = shareOf(seconds, state.easeSeconds);\n  const fade = shareOf(seconds, FADE_EASE_S);\n  lens.x = towards(lens.x, target.x, move);\n  lens.y = towards(lens.y, target.y, move);\n  lens.alpha = towards(lens.alpha, target.alpha, fade);\n}\n\nfunction isAlive(ripple: Ripple, now: number) {\n  const age = now - ripple.startedAt;\n  return age < RIPPLE_MS;\n}\n\n/** Frames are asked for only while something moves. Once the lens has arrived and no ripple is left, the loop ends. */\nfunction tick(state: FieldState, now: number) {\n  const sinceLast = now - state.lastTick;\n  const elapsed = sinceLast / 1000;\n  const seconds = Math.min(MAX_STEP_S, elapsed);\n  state.lastTick = now;\n  glide(state, seconds);\n  state.ripples = state.ripples.filter((ripple) => isAlive(ripple, now));\n  if (isAtRest(state)) {\n    state.frame = 0;\n    settle(state);\n    return;\n  }\n  paint(state, state.lens, state.ripples, now);\n  state.frame = requestAnimationFrame((next) => tick(state, next));\n}\n\nfunction wake(state: FieldState) {\n  const isAsleep = state.frame === 0;\n  if (!state.isLive || !isAsleep) {\n    return;\n  }\n  state.lastTick = performance.now();\n  state.frame = requestAnimationFrame((now) => tick(state, now));\n}\n\n/** A lens that was away fades in where it is aimed: it does not glide in from where it left. */\nfunction aimAt(state: FieldState, x: number, y: number, easeSeconds: number) {\n  const wasAway = state.lens.alpha <= REST_ALPHA;\n  state.target.x = x;\n  state.target.y = y;\n  state.target.alpha = 1;\n  state.easeSeconds = easeSeconds;\n  if (wasAway) {\n    state.lens.x = x;\n    state.lens.y = y;\n  }\n}\n\n/** Without a pointer on the field the lens goes where the demonstration holds it, or away. */\nfunction aimAtDemo(state: FieldState) {\n  const { demo } = state;\n  if (!demo) {\n    state.target.alpha = 0;\n    return;\n  }\n  const x = demo.x * state.width;\n  const y = demo.y * state.height;\n  aimAt(state, x, y, DEMO_EASE_S);\n}\n\nfunction placeOf(state: FieldState, event: PointerEvent) {\n  const box = state.canvas.getBoundingClientRect();\n  const x = event.clientX - box.left;\n  const y = event.clientY - box.top;\n  return { x, y };\n}\n\nfunction isOnEmptySpace(event: PointerEvent) {\n  const target = event.target;\n  if (!(target instanceof Element)) {\n    return false;\n  }\n  return target.closest(SOLID) === null;\n}\n\nfunction followPointer(state: FieldState, event: PointerEvent) {\n  if (!state.isLive) {\n    return;\n  }\n  const place = placeOf(state, event);\n  state.hasPointer = true;\n  aimAt(state, place.x, place.y, POINTER_EASE_S);\n  wake(state);\n}\n\nfunction releasePointer(state: FieldState) {\n  state.hasPointer = false;\n  if (!state.isLive) {\n    return;\n  }\n  aimAtDemo(state);\n  wake(state);\n}\n\nfunction startRipple(state: FieldState, x: number, y: number) {\n  const startedAt = performance.now();\n  state.ripples.push({ x, y, startedAt });\n  wake(state);\n}\n\nfunction pressField(state: FieldState, event: PointerEvent) {\n  if (!state.isLive) {\n    return;\n  }\n  followPointer(state, event);\n  if (!isOnEmptySpace(event)) {\n    return;\n  }\n  const place = placeOf(state, event);\n  startRipple(state, place.x, place.y);\n}\n\n/** A new theme: the glyphs take the new colour and the frame is drawn again as it stands. */\nfunction reink(state: FieldState) {\n  inkGlyphs(state);\n  draw(state);\n}\n\n/** A new size: the field is measured again and drawn where it stands, without a glide. */\nfunction refit(state: FieldState) {\n  measure(state);\n  if (!state.hasPointer) {\n    aimAtDemo(state);\n  }\n  settle(state);\n}\n\nfunction setLive(state: FieldState, isLive: boolean) {\n  state.isLive = isLive;\n  if (isLive) {\n    wake(state);\n    return;\n  }\n  cancelAnimationFrame(state.frame);\n  state.frame = 0;\n  settle(state);\n}\n\nfunction aimDemo(state: FieldState, point: Point | null) {\n  state.demo = point;\n  if (state.hasPointer) {\n    return;\n  }\n  aimAtDemo(state);\n  if (!state.isLive) {\n    settle(state);\n    return;\n  }\n  wake(state);\n}\n\nfunction rippleDemo(state: FieldState) {\n  if (!state.isLive) {\n    return;\n  }\n  startRipple(state, state.target.x, state.target.y);\n}\n\n/**\n * One canvas behind the content of `host`. The lens follows the pointer over `host`, a press on empty\n * space sends a ripple, and nothing is drawn while nothing moves.\n */\nexport function createGlyphField(\n  canvas: HTMLCanvasElement,\n  host: HTMLElement\n): GlyphFieldEngine | null {\n  const pen = canvas.getContext('2d');\n  if (!pen) {\n    return null;\n  }\n  const state: FieldState = {\n    canvas,\n    pen,\n    width: 0,\n    height: 0,\n    pixelRatio: 1,\n    sprites: [],\n    inked: [],\n    lens: { x: 0, y: 0, alpha: 0 },\n    target: { x: 0, y: 0, alpha: 0 },\n    easeSeconds: DEMO_EASE_S,\n    demo: null,\n    hasPointer: false,\n    isLive: false,\n    ripples: [],\n    frame: 0,\n    lastTick: 0,\n  };\n\n  function onMove(event: PointerEvent) {\n    followPointer(state, event);\n  }\n\n  function onLeave() {\n    releasePointer(state);\n  }\n\n  function onPress(event: PointerEvent) {\n    pressField(state, event);\n  }\n\n  function onResize() {\n    refit(state);\n  }\n\n  function onTheme() {\n    reink(state);\n  }\n\n  // The glyphs are inked before anything can ask for a frame.\n  measure(state);\n  const sizeObserver = new ResizeObserver(onResize);\n  const themeObserver = new MutationObserver(onTheme);\n  sizeObserver.observe(canvas);\n  themeObserver.observe(document.documentElement, {\n    attributes: true,\n    attributeFilter: ['class', 'data-theme'],\n  });\n  host.addEventListener('pointermove', onMove, { passive: true });\n  host.addEventListener('pointerleave', onLeave, { passive: true });\n  host.addEventListener('pointerdown', onPress, { passive: true });\n\n  return {\n    aimDemo: (point) => aimDemo(state, point),\n    rippleDemo: () => rippleDemo(state),\n    setLive: (isLive) => setLive(state, isLive),\n    dispose() {\n      cancelAnimationFrame(state.frame);\n      state.frame = 0;\n      sizeObserver.disconnect();\n      themeObserver.disconnect();\n      host.removeEventListener('pointermove', onMove);\n      host.removeEventListener('pointerleave', onLeave);\n      host.removeEventListener('pointerdown', onPress);\n    },\n  };\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-13/glyph-engine.ts"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/glyph-paint.ts",
      "content": "const CELL_PX = 22;\n\nconst HALF_CELL_PX = CELL_PX / 2;\n\nconst GLYPH_PX = 12;\n\nconst SPRITE_PX = 16;\n\nconst HALF_SPRITE_PX = SPRITE_PX / 2;\n\nconst GLYPHS = ['·', '+', '/'];\n\n/** Out of a hundred cells, how many are dots and how many are dots or plus signs. The rest are slashes. */\nconst DOT_SHARE = 62;\n\nconst DOT_OR_PLUS_SHARE = 86;\n\nconst LENS_RADIUS_PX = 150;\n\n/** The glyphs stay faint at the heart of the lens: text sits above the field and must stay easy to read. */\nconst LENS_INK = 0.6;\n\nexport const RIPPLE_MS = 1500;\n\nconst RIPPLE_SPEED_PX = 560;\n\nconst RIPPLE_HALF_BAND_PX = 27;\n\nconst RIPPLE_PUSH_PX = 5;\n\nconst RIPPLE_INK = 0.55;\n\n/** A backing store above two device pixels a point costs four times the fill for glyphs nobody sees sharper. */\nconst MAX_PIXEL_RATIO = 2;\n\n/** Under this much ink a lens counts as away: it is neither drawn nor waited for. */\nexport const REST_ALPHA = 0.01;\n\nexport type Lens = {\n  x: number;\n  y: number;\n  alpha: number;\n};\n\nexport type Ripple = {\n  x: number;\n  y: number;\n  startedAt: number;\n};\n\ntype Cells = {\n  first: number;\n  last: number;\n};\n\ntype Patch = {\n  x: number;\n  y: number;\n  side: number;\n};\n\nexport type Surface = {\n  canvas: HTMLCanvasElement;\n  pen: CanvasRenderingContext2D;\n  width: number;\n  height: number;\n  pixelRatio: number;\n  sprites: HTMLCanvasElement[];\n  inked: Patch[];\n};\n\n/** The same cell always shows the same glyph, so the field does not shuffle between two frames. */\nfunction glyphIndexOf(column: number, row: number) {\n  const columnHash = Math.imul(column, 73856093);\n  const rowHash = Math.imul(row, 19349663);\n  const mixed = Math.imul(columnHash ^ rowHash, 2654435761);\n  const positive = mixed >>> 0;\n  const share = positive % 100;\n  if (share < DOT_SHARE) {\n    return 0;\n  }\n  if (share < DOT_OR_PLUS_SHARE) {\n    return 1;\n  }\n  return 2;\n}\n\n/** Each glyph is drawn as text once, in the colour and the mono face of the canvas, then stamped. */\nfunction spriteOf(\n  glyph: string,\n  ink: string,\n  face: string,\n  pixelRatio: number\n) {\n  const sprite = document.createElement('canvas');\n  const side = Math.round(SPRITE_PX * pixelRatio);\n  sprite.width = side;\n  sprite.height = side;\n  const pen = sprite.getContext('2d');\n  if (!pen) {\n    return sprite;\n  }\n  const fontSize = GLYPH_PX * pixelRatio;\n  const middle = side / 2;\n  pen.font = `${fontSize}px ${face}`;\n  pen.textAlign = 'center';\n  pen.textBaseline = 'middle';\n  pen.fillStyle = ink;\n  pen.fillText(glyph, middle, middle);\n  return sprite;\n}\n\nexport function inkGlyphs(surface: Surface) {\n  const style = getComputedStyle(surface.canvas);\n  surface.sprites = GLYPHS.map((glyph) =>\n    spriteOf(glyph, style.color, style.fontFamily, surface.pixelRatio)\n  );\n}\n\nexport function measure(surface: Surface) {\n  const box = surface.canvas.getBoundingClientRect();\n  const devicePixelRatio = window.devicePixelRatio || 1;\n  const pixelRatio = Math.min(devicePixelRatio, MAX_PIXEL_RATIO);\n  const deviceWidth = box.width * pixelRatio;\n  const deviceHeight = box.height * pixelRatio;\n  surface.width = box.width;\n  surface.height = box.height;\n  surface.pixelRatio = pixelRatio;\n  surface.canvas.width = Math.round(deviceWidth);\n  surface.canvas.height = Math.round(deviceHeight);\n  surface.pen.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\n  surface.inked = [];\n  inkGlyphs(surface);\n}\n\nfunction cellAt(position: number) {\n  return Math.floor(position / CELL_PX);\n}\n\nfunction cellsAround(centre: number, reach: number, extent: number): Cells {\n  const lowest = cellAt(centre - reach);\n  const highest = cellAt(centre + reach);\n  const lastCell = cellAt(extent);\n  const first = Math.max(0, lowest);\n  const last = Math.min(lastCell, highest);\n  return { first, last };\n}\n\nfunction centreOf(cell: number) {\n  const start = cell * CELL_PX;\n  return start + HALF_CELL_PX;\n}\n\nfunction stamp(\n  surface: Surface,\n  column: number,\n  row: number,\n  x: number,\n  y: number,\n  ink: number\n) {\n  const glyphIndex = glyphIndexOf(column, row);\n  const sprite = surface.sprites[glyphIndex];\n  if (!sprite) {\n    return;\n  }\n  surface.pen.globalAlpha = ink;\n  surface.pen.drawImage(\n    sprite,\n    x - HALF_SPRITE_PX,\n    y - HALF_SPRITE_PX,\n    SPRITE_PX,\n    SPRITE_PX\n  );\n}\n\n/** The square a lens or a ring was drawn into, with room for the glyphs that straddle its edge. */\nfunction patchAround(x: number, y: number, reach: number): Patch {\n  const margin = reach + SPRITE_PX;\n  const left = x - margin;\n  const top = y - margin;\n  const side = margin * 2;\n  return { x: left, y: top, side };\n}\n\n/** Only what the last frame inked is wiped, never the whole canvas: a still lens leaves most of it untouched. */\nfunction wipe(surface: Surface) {\n  surface.pen.globalAlpha = 1;\n  for (const patch of surface.inked) {\n    surface.pen.clearRect(patch.x, patch.y, patch.side, patch.side);\n  }\n  surface.inked = [];\n}\n\n/** Only the cells under the lens are drawn: the rest of the field costs nothing. */\nfunction paintLens(surface: Surface, lens: Lens) {\n  if (lens.alpha <= REST_ALPHA) {\n    return;\n  }\n  const patch = patchAround(lens.x, lens.y, LENS_RADIUS_PX);\n  surface.inked.push(patch);\n  const columns = cellsAround(lens.x, LENS_RADIUS_PX, surface.width);\n  const rows = cellsAround(lens.y, LENS_RADIUS_PX, surface.height);\n  for (let row = rows.first; row <= rows.last; row += 1) {\n    for (let column = columns.first; column <= columns.last; column += 1) {\n      const x = centreOf(column);\n      const y = centreOf(row);\n      const offsetX = x - lens.x;\n      const offsetY = y - lens.y;\n      const distance = Math.hypot(offsetX, offsetY);\n      if (distance >= LENS_RADIUS_PX) {\n        continue;\n      }\n      const farness = distance / LENS_RADIUS_PX;\n      const closeness = 1 - farness;\n      const softness = closeness * closeness;\n      const shown = softness * lens.alpha;\n      const ink = shown * LENS_INK;\n      stamp(surface, column, row, x, y, ink);\n    }\n  }\n}\n\n/** A ring that widens and fades: the glyphs on its crest show and are pushed outwards a little. */\nfunction paintRipple(surface: Surface, ripple: Ripple, now: number) {\n  const age = now - ripple.startedAt;\n  const spent = age / RIPPLE_MS;\n  const life = 1 - spent;\n  const seconds = age / 1000;\n  const radius = seconds * RIPPLE_SPEED_PX;\n  const reach = radius + RIPPLE_HALF_BAND_PX;\n  const inkedReach = reach + RIPPLE_PUSH_PX;\n  const patch = patchAround(ripple.x, ripple.y, inkedReach);\n  surface.inked.push(patch);\n  const columns = cellsAround(ripple.x, reach, surface.width);\n  const rows = cellsAround(ripple.y, reach, surface.height);\n  for (let row = rows.first; row <= rows.last; row += 1) {\n    for (let column = columns.first; column <= columns.last; column += 1) {\n      const x = centreOf(column);\n      const y = centreOf(row);\n      const offsetX = x - ripple.x;\n      const offsetY = y - ripple.y;\n      const distance = Math.hypot(offsetX, offsetY);\n      const gap = Math.abs(distance - radius);\n      if (gap >= RIPPLE_HALF_BAND_PX) {\n        continue;\n      }\n      const offCrest = gap / RIPPLE_HALF_BAND_PX;\n      const crest = 1 - offCrest;\n      const strength = crest * life;\n      const pushPx = strength * RIPPLE_PUSH_PX;\n      const pushShare = pushPx / Math.max(distance, 1);\n      const pushX = offsetX * pushShare;\n      const pushY = offsetY * pushShare;\n      const pushedX = x + pushX;\n      const pushedY = y + pushY;\n      const ink = strength * RIPPLE_INK;\n      stamp(surface, column, row, pushedX, pushedY, ink);\n    }\n  }\n}\n\nexport function paint(\n  surface: Surface,\n  lens: Lens,\n  ripples: Ripple[],\n  now: number\n) {\n  wipe(surface);\n  paintLens(surface, lens);\n  for (const ripple of ripples) {\n    paintRipple(surface, ripple, now);\n  }\n}\n",
      "type": "registry:component",
      "target": "components/templates/application-13/glyph-paint.ts"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\nimport { restingOf } from '@/registry/ndeko/lib/run-session';\nimport { wordsOf } from '@/registry/ndeko/lib/words';\n\nimport {\n  DEMO_ATTACHMENT,\n  DEMO_SUGGESTION,\n  EMPTY_PROMPT_HINT,\n  FULL_HINT,\n  MAX_ATTACHMENTS,\n  RUNS,\n  RUNS_SHOWN,\n  SESSIONS,\n  STARTING_AGENT,\n  TITLE_WORDS,\n  WAITING_RUN,\n  type AgentId,\n  type Attachment,\n  type ModeId,\n  type ModelId,\n  type PastSession,\n  type RunSeed,\n  type RunStatus,\n} from './data';\n\n/** A place in the field of glyphs, as a share of its width and of its height. */\nexport type Point = {\n  x: number;\n  y: number;\n};\n\nexport type Decision = 'approved' | 'denied';\n\nexport type Hint = 'none' | 'empty' | 'full';\n\nexport type Run = {\n  id: string;\n  agentId: AgentId;\n  title: string;\n  status: RunStatus;\n  startedAt: number;\n  endedAt?: number;\n  costUsd: number;\n  request?: string;\n  note?: string;\n};\n\nexport type StartState = {\n  draft: string;\n  attachments: Attachment[];\n  model: ModelId;\n  mode: ModeId;\n  runs: Run[];\n  sessions: PastSession[];\n  sentCount: number;\n  hint: Hint;\n  refusals: number;\n  spoken: string;\n  demoLens: Point | null;\n  demoRipples: number;\n  isSidebarOpen: boolean;\n};\n\nexport type StartAction =\n  | { type: 'typed'; text: string }\n  | { type: 'picked'; prompt: string }\n  | { type: 'attached'; attachments: Attachment[] }\n  | { type: 'detached'; id: string }\n  | { type: 'modelSet'; model: ModelId }\n  | { type: 'modeSet'; mode: ModeId }\n  | { type: 'sent' }\n  | { type: 'runStarted'; id: string }\n  | { type: 'runFinished'; id: string }\n  | { type: 'decided'; id: string; decision: Decision }\n  | { type: 'lens'; point: Point | null }\n  | { type: 'rippled' }\n  | { type: 'sidebar'; isOpen: boolean };\n\ntype Step = SessionStep<StartState, StartAction>;\n\nconst MINUTE_MS = 60_000;\n\nconst LOADED_AT = Date.now();\n\nfunction since(minutes: number) {\n  const elapsed = minutes * MINUTE_MS;\n  return LOADED_AT - elapsed;\n}\n\nfunction endedAtOf(seed: RunSeed) {\n  if (seed.endedMinutesAgo === undefined) {\n    return undefined;\n  }\n  return since(seed.endedMinutesAgo);\n}\n\nfunction runOf(seed: RunSeed): Run {\n  return {\n    id: seed.id,\n    agentId: seed.agentId,\n    title: seed.title,\n    status: seed.status,\n    startedAt: since(seed.startedMinutesAgo),\n    endedAt: endedAtOf(seed),\n    costUsd: seed.costUsd,\n    request: seed.request,\n    note: seed.failure,\n  };\n}\n\nexport const INITIAL: StartState = {\n  draft: '',\n  attachments: [],\n  model: 'claude-sonnet',\n  mode: 'ask',\n  runs: RUNS.map(runOf),\n  sessions: SESSIONS,\n  sentCount: 0,\n  hint: 'none',\n  refusals: 0,\n  spoken: '',\n  demoLens: null,\n  demoRipples: 0,\n  isSidebarOpen: false,\n};\n\nexport function sentRunIdOf(count: number) {\n  return `sent-${count}`;\n}\n\nconst FIRST_SENT_RUN = sentRunIdOf(1);\n\nfunction refused(state: StartState, hint: Hint, spoken: string): StartState {\n  const refusals = state.refusals + 1;\n  return { ...state, hint, refusals, spoken };\n}\n\nfunction attached(state: StartState, added: Attachment[]): StartState {\n  const room = MAX_ATTACHMENTS - state.attachments.length;\n  const accepted = added.slice(0, room);\n  const attachments = [...state.attachments, ...accepted];\n  const hasOverflow = added.length > room;\n  if (hasOverflow) {\n    return refused({ ...state, attachments }, 'full', FULL_HINT);\n  }\n  return { ...state, attachments, hint: 'none' };\n}\n\nfunction detached(state: StartState, id: string): StartState {\n  const attachments = state.attachments.filter((file) => file.id !== id);\n  return { ...state, attachments, hint: 'none' };\n}\n\nfunction shortTitleOf(text: string) {\n  const words = wordsOf(text);\n  const kept = words.slice(0, TITLE_WORDS);\n  return kept.join(' ');\n}\n\n/** A sent prompt becomes the newest run and the newest session. The list of runs keeps to the latest ones. */\nfunction sent(state: StartState, now: number): StartState {\n  const text = state.draft.trim();\n  if (text === '') {\n    return refused(state, 'empty', EMPTY_PROMPT_HINT);\n  }\n  const sentCount = state.sentCount + 1;\n  const id = sentRunIdOf(sentCount);\n  const title = shortTitleOf(text);\n  const run: Run = {\n    id,\n    agentId: STARTING_AGENT,\n    title: text,\n    status: 'queued',\n    startedAt: now,\n    costUsd: 0,\n  };\n  const session: PastSession = { id, day: 'Today', title, prompt: text };\n  const runs = [run, ...state.runs];\n  const latestRuns = runs.slice(0, RUNS_SHOWN);\n  const spoken = `Session started: ${title}`;\n  return {\n    ...state,\n    draft: '',\n    attachments: [],\n    runs: latestRuns,\n    sessions: [session, ...state.sessions],\n    sentCount,\n    hint: 'none',\n    spoken,\n  };\n}\n\nfunction patchedRun(\n  state: StartState,\n  id: string,\n  from: RunStatus,\n  change: (run: Run) => Run\n): StartState {\n  const runs = state.runs.map((run) => {\n    const isTarget = run.id === id && run.status === from;\n    if (!isTarget) {\n      return run;\n    }\n    return change(run);\n  });\n  return { ...state, runs };\n}\n\n/** A run that starts again forgets when it stopped, so its clock counts on from its first start. */\nfunction runStarted(state: StartState, id: string): StartState {\n  return patchedRun(state, id, 'queued', (run) => ({\n    ...run,\n    status: 'running',\n    endedAt: undefined,\n  }));\n}\n\nconst DEMO_RUN_USD = 0.094;\n\nfunction finishedRun(run: Run, now: number): Run {\n  const costUsd = run.costUsd + DEMO_RUN_USD;\n  return { ...run, status: 'done', endedAt: now, costUsd };\n}\n\nfunction runFinished(state: StartState, id: string, now: number): StartState {\n  return patchedRun(state, id, 'running', (run) => finishedRun(run, now));\n}\n\nfunction decided(\n  state: StartState,\n  id: string,\n  decision: Decision,\n  now: number\n): StartState {\n  if (decision === 'approved') {\n    const allowed = patchedRun(state, id, 'waiting', (run) => ({\n      ...run,\n      status: 'queued',\n      note: 'Allowed by you',\n    }));\n    return { ...allowed, spoken: 'Allowed. The run starts again' };\n  }\n  const stopped = patchedRun(state, id, 'waiting', (run) => ({\n    ...run,\n    status: 'done',\n    endedAt: now,\n    note: 'Denied by you, nothing was run',\n  }));\n  return { ...stopped, spoken: 'Denied. Nothing was run' };\n}\n\nfunction rippled(state: StartState): StartState {\n  const demoRipples = state.demoRipples + 1;\n  return { ...state, demoRipples };\n}\n\nexport function applyAt(\n  state: StartState,\n  action: StartAction,\n  now: number\n): StartState {\n  switch (action.type) {\n    case 'typed':\n      return { ...state, draft: action.text, hint: 'none' };\n    case 'picked':\n      return { ...state, draft: action.prompt, hint: 'none' };\n    case 'attached':\n      return attached(state, action.attachments);\n    case 'detached':\n      return detached(state, action.id);\n    case 'modelSet':\n      return { ...state, model: action.model };\n    case 'modeSet':\n      return { ...state, mode: action.mode };\n    case 'sent':\n      return sent(state, now);\n    case 'runStarted':\n      return runStarted(state, action.id);\n    case 'runFinished':\n      return runFinished(state, action.id, now);\n    case 'decided':\n      return decided(state, action.id, action.decision, now);\n    case 'lens':\n      return { ...state, demoLens: action.point };\n    case 'rippled':\n      return rippled(state);\n    case 'sidebar':\n      return { ...state, isSidebarOpen: action.isOpen };\n  }\n}\n\nexport function reducer(state: StartState, action: StartAction) {\n  return applyAt(state, action, Date.now());\n}\n\nfunction hasSent(state: StartState) {\n  return state.sentCount > 0;\n}\n\nfunction hasDecided(state: StartState) {\n  const run = state.runs.find((candidate) => candidate.id === WAITING_RUN);\n  return run?.status !== 'waiting';\n}\n\nexport const START_MS = 800;\n\nexport const RUN_MS = 3000;\n\nconst DEMO_DECIDES_AFTER_MS = 2500;\n\nfunction lens(after: number, point: Point | null): Step {\n  return { after, by: 'demo', action: { type: 'lens', point } };\n}\n\nfunction ripple(after: number): Step {\n  return { after, by: 'demo', action: { type: 'rippled' } };\n}\n\n/** The lens glides the way a pointer would before a person touches anything, then the prompt is filled in. */\nconst OPENING: Step[] = [\n  lens(900, { x: 0.18, y: 0.1 }),\n  lens(1200, { x: 0.84, y: 0.13 }),\n  lens(1300, { x: 0.9, y: 0.56 }),\n  ripple(800),\n  lens(1100, { x: 0.5, y: 0.5 }),\n  {\n    after: 900,\n    by: 'demo',\n    press: `suggestion-${DEMO_SUGGESTION.id}`,\n    action: { type: 'picked', prompt: DEMO_SUGGESTION.prompt },\n  },\n  {\n    after: 1000,\n    by: 'demo',\n    press: 'attach',\n    action: { type: 'attached', attachments: [DEMO_ATTACHMENT] },\n  },\n  { after: 1000, by: 'demo', action: { type: 'modeSet', mode: 'plan' } },\n  {\n    after: 900,\n    by: 'demo',\n    action: { type: 'modelSet', model: 'claude-opus' },\n  },\n  lens(800, { x: 0.1, y: 0.74 }),\n];\n\nconst CLOSING: Step[] = [\n  {\n    after: 1500,\n    by: 'person',\n    press: 'send',\n    action: { type: 'sent' },\n    isAnswered: hasSent,\n  },\n  { after: START_MS, action: { type: 'runStarted', id: FIRST_SENT_RUN } },\n  {\n    after: DEMO_DECIDES_AFTER_MS,\n    by: 'person',\n    press: 'allow',\n    action: { type: 'decided', id: WAITING_RUN, decision: 'approved' },\n    isAnswered: hasDecided,\n  },\n  { after: START_MS, action: { type: 'runStarted', id: WAITING_RUN } },\n  ripple(700),\n  { after: 2200, action: { type: 'runFinished', id: FIRST_SENT_RUN } },\n  lens(900, null),\n];\n\nexport const SCRIPT: Step[] = [...OPENING, ...CLOSING];\n\nconst FILLED = restingOf(INITIAL, OPENING, applyAt);\n\n/** Where the lens rests when nothing plays: high on the right, in the margin beside the title on a wide page. */\nconst RESTING_LENS: Point = { x: 0.82, y: 0.12 };\n\n/** Under reduced motion the prompt is filled in and ready to send, and one run waits for an answer. */\nexport const RESTING: StartState = { ...FILLED, demoLens: RESTING_LENS };\n\nexport const LOOP_AFTER_MS = 3200;\n",
      "type": "registry:component",
      "target": "components/templates/application-13/session.ts"
    },
    {
      "path": "registry/ndeko/templates/agent-workspaces/application-13/data.ts",
      "content": "import type { SeriesSlot } from '@/registry/ndeko/lib/agent-run';\nimport type { BrandSlug } from '@/registry/ndeko/lib/brand-logos';\n\nexport const BRAND = { name: 'Wrenfield' };\n\nexport type AgentId = 'planner' | 'researcher' | 'writer' | 'coder';\n\nexport type Agent = {\n  name: string;\n  series: SeriesSlot;\n};\n\nexport const AGENTS: Record<AgentId, Agent> = {\n  planner: { name: 'Planner', series: 1 },\n  researcher: { name: 'Researcher', series: 2 },\n  writer: { name: 'Writer', series: 3 },\n  coder: { name: 'Coder', series: 5 },\n};\n\n/** A new session goes to the planner, which hands the work to the others. */\nexport const STARTING_AGENT: AgentId = 'planner';\n\nexport type ModelId =\n  'claude-sonnet' | 'claude-opus' | 'gpt-mini' | 'gemini-pro';\n\nexport type ModelOption = {\n  id: ModelId;\n  name: string;\n  brand: BrandSlug;\n};\n\nexport const MODELS: ModelOption[] = [\n  { id: 'claude-sonnet', name: 'Claude Sonnet', brand: 'claude' },\n  { id: 'claude-opus', name: 'Claude Opus', brand: 'claude' },\n  { id: 'gpt-mini', name: 'GPT mini', brand: 'openai' },\n  { id: 'gemini-pro', name: 'Gemini Pro', brand: 'gemini' },\n];\n\nexport function modelOf(id: ModelId) {\n  const model = MODELS.find((candidate) => candidate.id === id);\n  return model ?? MODELS[0];\n}\n\nexport type ModeId = 'ask' | 'plan' | 'act';\n\nexport type ModeOption = {\n  id: ModeId;\n  label: string;\n  hint: string;\n};\n\nexport const MODES: ModeOption[] = [\n  { id: 'ask', label: 'Ask first', hint: 'Asks before every action' },\n  {\n    id: 'plan',\n    label: 'Plan first',\n    hint: 'Writes a plan and waits for your yes',\n  },\n  {\n    id: 'act',\n    label: 'Act',\n    hint: 'Works until done, asks before anything risky',\n  },\n];\n\nexport function modeOf(id: ModeId) {\n  const mode = MODES.find((candidate) => candidate.id === id);\n  return mode ?? MODES[0];\n}\n\nexport type SuggestionKind = 'data' | 'writing' | 'search' | 'code';\n\nexport type Suggestion = {\n  id: string;\n  kind: SuggestionKind;\n  title: string;\n  hint: string;\n  prompt: string;\n};\n\nexport const SUGGESTIONS: Suggestion[] = [\n  {\n    id: 'invoices',\n    kind: 'data',\n    title: 'Reconcile last month',\n    hint: 'Invoices against the bank export',\n    prompt:\n      'Reconcile the March invoices with the bank export and list what does not match.',\n  },\n  {\n    id: 'newsletter',\n    kind: 'writing',\n    title: 'Draft the newsletter',\n    hint: 'From what shipped this month',\n    prompt:\n      'Draft the spring newsletter from the changelog of this month, in our usual tone.',\n  },\n  {\n    id: 'spam',\n    kind: 'search',\n    title: 'Find a cause',\n    hint: 'Why our emails land in spam',\n    prompt:\n      'Find out why our checkout emails land in spam and say what to change.',\n  },\n  {\n    id: 'rename',\n    kind: 'code',\n    title: 'Rename across the code',\n    hint: 'One field, every file',\n    prompt:\n      'Rename the price fields to amount across the API and update the tests.',\n  },\n];\n\nexport const DEMO_SUGGESTION = SUGGESTIONS[0];\n\nexport type Attachment = {\n  id: string;\n  name: string;\n  bytes: number;\n};\n\nexport const DEMO_ATTACHMENT: Attachment = {\n  id: 'demo',\n  name: 'bank-export-march.csv',\n  bytes: 48_200,\n};\n\nexport const MAX_ATTACHMENTS = 4;\n\nexport type RunStatus = 'queued' | 'running' | 'waiting' | 'done' | 'failed';\n\nexport type RunSeed = {\n  id: string;\n  agentId: AgentId;\n  title: string;\n  status: RunStatus;\n  startedMinutesAgo: number;\n  endedMinutesAgo?: number;\n  costUsd: number;\n  request?: string;\n  failure?: string;\n};\n\nexport const WAITING_RUN = 'rename';\n\n/** Invented tasks, times and costs. The figures are illustrative. */\nexport const RUNS: RunSeed[] = [\n  {\n    id: 'couriers',\n    agentId: 'researcher',\n    title: 'Compare three couriers for parcels under 2 kg',\n    status: 'running',\n    startedMinutesAgo: 3,\n    costUsd: 0.214,\n  },\n  {\n    id: WAITING_RUN,\n    agentId: 'coder',\n    title: 'Rename the price fields across the API',\n    status: 'waiting',\n    startedMinutesAgo: 9,\n    endedMinutesAgo: 2,\n    costUsd: 0.482,\n    request: 'Asks to run the migration on staging',\n  },\n  {\n    id: 'returns',\n    agentId: 'writer',\n    title: 'Draft the returns page',\n    status: 'done',\n    startedMinutesAgo: 26,\n    endedMinutesAgo: 22,\n    costUsd: 0.188,\n  },\n  {\n    id: 'prices',\n    agentId: 'researcher',\n    title: 'Check our prices against the supplier sheet',\n    status: 'failed',\n    startedMinutesAgo: 41,\n    endedMinutesAgo: 40,\n    costUsd: 0.061,\n    failure: 'The supplier sheet has no price column',\n  },\n];\n\n/** The start screen lists the latest runs only: a new one pushes the oldest out. */\nexport const RUNS_SHOWN = 4;\n\nexport type Day = 'Today' | 'Yesterday';\n\nexport type PastSession = {\n  id: string;\n  day: Day;\n  title: string;\n  prompt: string;\n};\n\nexport const DAYS: Day[] = ['Today', 'Yesterday'];\n\nexport const SESSIONS: PastSession[] = [\n  {\n    id: 'couriers',\n    day: 'Today',\n    title: 'Couriers under 2 kg',\n    prompt:\n      'Compare three couriers for parcels under 2 kg, by price and delay.',\n  },\n  {\n    id: 'rename',\n    day: 'Today',\n    title: 'Price fields in the API',\n    prompt:\n      'Rename the price fields to amount across the API and update the tests.',\n  },\n  {\n    id: 'returns',\n    day: 'Today',\n    title: 'Returns page',\n    prompt: 'Draft the returns page from the policy we agreed last week.',\n  },\n  {\n    id: 'supplier',\n    day: 'Yesterday',\n    title: 'Prices against the supplier',\n    prompt: 'Check our prices against the supplier sheet and flag the gaps.',\n  },\n  {\n    id: 'onboarding',\n    day: 'Yesterday',\n    title: 'Onboarding emails',\n    prompt: 'Rewrite the three onboarding emails so each asks for one thing.',\n  },\n  {\n    id: 'releases',\n    day: 'Yesterday',\n    title: 'Weekly releases',\n    prompt: 'Plan the move from monthly to weekly releases in six steps.',\n  },\n];\n\nexport const TITLE_WORDS = 5;\n\nexport const EMPTY_PROMPT_HINT =\n  'Say what you need, or pick one of the tasks under the field';\n\nexport const FULL_HINT = `${MAX_ATTACHMENTS} files fit in one prompt. Remove one to add another`;\n",
      "type": "registry:component",
      "target": "components/templates/application-13/data.ts"
    }
  ],
  "categories": [
    "templates",
    "agent-workspaces"
  ],
  "type": "registry:block"
}