{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "block-agent-code",
  "type": "registry:block",
  "title": "Agent code",
  "description": "An agent workspace in Code mode: sessions by repository, a transcript of the plan, steps, test runs and an approval waiting for a command, beside a pane with the changes, a terminal, a preview, the files, the tasks or the pull request’s checks.",
  "dependencies": [
    "@remixicon/react@^4.9.0"
  ],
  "registryDependencies": [
    "https://wideset.co/r/app-shell.json",
    "https://wideset.co/r/avatar.json",
    "https://wideset.co/r/block-styles.json",
    "https://wideset.co/r/breadcrumbs.json",
    "https://wideset.co/r/button.json",
    "https://wideset.co/r/card.json",
    "https://wideset.co/r/checkbox.json",
    "https://wideset.co/r/chip.json",
    "https://wideset.co/r/divider.json",
    "https://wideset.co/r/dropdown-menu.json",
    "https://wideset.co/r/icon-button.json",
    "https://wideset.co/r/list-item.json",
    "https://wideset.co/r/popup.json",
    "https://wideset.co/r/progress-bar.json",
    "https://wideset.co/r/radio-button.json",
    "https://wideset.co/r/segmented-control.json",
    "https://wideset.co/r/select.json",
    "https://wideset.co/r/sidebar.json",
    "https://wideset.co/r/status-badge.json",
    "https://wideset.co/r/table.json",
    "https://wideset.co/r/tabs.json",
    "https://wideset.co/r/text-input.json",
    "https://wideset.co/r/textarea.json",
    "https://wideset.co/r/toast.json",
    "https://wideset.co/r/tooltip.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/agent-code/agent-turn.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/agent-turn.tsx",
      "content": "'use client';\n\n// TODO(custom): the agent's side of a turn (its thoughts, steps, answer and what it made, then the answer's actions); Wideset has no message or transcript component.\nimport { cn } from '@/lib/wideset/utils';\n\nimport { AnswerActions } from './answer-actions';\nimport type { AgentTurn as Turn, ApprovalAnswer, TranscriptView } from './model';\nimport { ARRIVE } from './motion';\nimport { Prose } from './prose';\nimport { QuestionCard } from './question-card';\nimport { Reasoning } from './reasoning';\nimport { proseText } from './run';\nimport { StepGroup } from './step-group';\nimport { type CardRender, StepRow } from './step-row';\n\ntype AgentTurnProps = {\n  /** The turn as it shows now: whole, playing, held where it waits, or cut where it was stopped. */\n  turn: Turn;\n  view: TranscriptView;\n  /** It is running: its parts arrive with motion and its actions wait. */\n  live: boolean;\n  /** The newest answer keeps its actions in view; older ones show them on hover or focus. */\n  latest: boolean;\n  /** Draws a `card` block, and what a step carries under its detail. */\n  card?: CardRender;\n  onAnswer: (stepId: string, answer: ApprovalAnswer) => void;\n  /** Answers a question with one of its own answers. */\n  onChoose: (questionId: string, text: string) => void;\n  onRate: (rating?: 'up' | 'down') => void;\n  onRetry?: () => void;\n};\n\n/**\n * Everything the agent did in one turn, in the order it happened, on the left with no bubble and\n * no avatar: the page is the agent's, and only your messages are set apart. The view decides what\n * starts open: reasoning in Thinking, reasoning and every step in Verbose. The answer's actions\n * come once it is an answer: not while it runs, and not while it is held at something it waits\n * for from you.\n */\nexport function AgentTurn({\n  turn,\n  view,\n  live,\n  latest,\n  card,\n  onAnswer,\n  onChoose,\n  onRate,\n  onRetry,\n}: AgentTurnProps) {\n  // What was written: the answer's text, and the text of a card that was written like one.\n  const prose = turn.blocks.flatMap((block) =>\n    block.kind === 'text' || block.kind === 'card' ? (block.prose ?? []) : [],\n  );\n\n  return (\n    <article aria-label=\"Answer\" aria-busy={live} className=\"group/turn gap-ws-2 flex flex-col\">\n      {turn.blocks.map((block) => {\n        switch (block.kind) {\n          case 'reasoning':\n            return (\n              <Reasoning key={block.id} block={block} defaultOpen={view !== 'normal'} live={live} />\n            );\n          case 'step':\n            return (\n              <StepRow\n                key={block.id}\n                step={block}\n                defaultOpen={view === 'verbose'}\n                live={live}\n                card={card}\n                onAnswer={onAnswer}\n              />\n            );\n          case 'steps':\n            return (\n              <StepGroup\n                key={block.id}\n                block={block}\n                defaultOpen={view === 'verbose'}\n                live={live}\n                card={card}\n                onAnswer={onAnswer}\n              />\n            );\n          case 'text':\n            return (\n              <div key={block.id} className=\"px-ws-3 py-ws-3\">\n                <Prose blocks={block.prose} />\n              </div>\n            );\n          case 'card': {\n            const drawn = card?.(block.card, block);\n            return (\n              drawn && (\n                <div key={block.id} className={cn('px-ws-3 py-ws-3', live && ARRIVE)}>\n                  {drawn}\n                </div>\n              )\n            );\n          }\n          case 'question':\n            // Answered, the question is the text above it and your message under it.\n            return (\n              block.answer === undefined &&\n              !turn.stopped && (\n                <div key={block.id} className={cn('px-ws-3 py-ws-3', live && ARRIVE)}>\n                  <QuestionCard\n                    title={block.title}\n                    options={block.options}\n                    onAnswer={(text) => onChoose(block.id, text)}\n                  />\n                </div>\n              )\n            );\n        }\n      })}\n      {turn.stopped && (\n        <p className=\"typography-caption-md text-ws-static-subtle px-ws-3 py-ws-2\">Stopped</p>\n      )}\n      {!live && !turn.held && prose.length > 0 && (\n        <div\n          className={cn(\n            'px-ws-2 pt-ws-3 transition-opacity duration-(--ws-motion-duration-quick) ease-(--ws-motion-ease-out)',\n            !latest && 'opacity-0 group-focus-within/turn:opacity-100 group-hover/turn:opacity-100',\n          )}\n        >\n          <AnswerActions\n            text={() => proseText(prose)}\n            rating={turn.rating}\n            onRate={onRate}\n            onRetry={onRetry}\n          />\n        </div>\n      )}\n    </article>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/answer-actions.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/answer-actions.tsx",
      "content": "'use client';\n\nimport {\n  RiRestartLine,\n  RiThumbDownFill,\n  RiThumbDownLine,\n  RiThumbUpFill,\n  RiThumbUpLine,\n} from '@remixicon/react';\n\nimport { CopyButton } from './copy-button';\nimport { IconAction } from './icon-action';\n\n/** The icons are grey until used: a thumb that was given takes the strong colour and its fill. */\nconst QUIET = 'text-ws-static-subtle';\n\ntype AnswerActionsProps = {\n  /** The answer as plain text, for Copy. */\n  text: () => string;\n  rating?: 'up' | 'down';\n  onRate: (rating?: 'up' | 'down') => void;\n  /** Runs the turn again; only the newest answer offers it. */\n  onRetry?: () => void;\n};\n\n/**\n * What can be done with an answer, under it: Copy, Retry, and a thumb up or down. Ghost, grey,\n * the smallest size, each named by a tooltip, so they are there to use and never compete with\n * the answer. A second press on a thumb takes the rating back.\n */\nexport function AnswerActions({ text, rating, onRate, onRetry }: AnswerActionsProps) {\n  return (\n    <div role=\"group\" aria-label=\"Answer actions\" className=\"gap-ws-2 flex\">\n      <CopyButton text={text} quiet />\n      {onRetry && (\n        <IconAction\n          label=\"Retry\"\n          icon={RiRestartLine}\n          iconClassName={QUIET}\n          size=\"xs\"\n          onClick={onRetry}\n        />\n      )}\n      <IconAction\n        label=\"Helpful\"\n        icon={rating === 'up' ? RiThumbUpFill : RiThumbUpLine}\n        iconClassName={rating === 'up' ? undefined : QUIET}\n        size=\"xs\"\n        aria-pressed={rating === 'up'}\n        onClick={() => onRate(rating === 'up' ? undefined : 'up')}\n      />\n      <IconAction\n        label=\"Not helpful\"\n        icon={rating === 'down' ? RiThumbDownFill : RiThumbDownLine}\n        iconClassName={rating === 'down' ? undefined : QUIET}\n        size=\"xs\"\n        aria-pressed={rating === 'down'}\n        onClick={() => onRate(rating === 'down' ? undefined : 'down')}\n      />\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/approval-card.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/approval-card.tsx",
      "content": "'use client';\n\n// TODO(custom): the permission a step waits for (what it wants to run, why, allow or deny); Wideset's InlineAlert is a message with one action and Popup is anchored to a control.\nimport { Button } from '@/components/ui/wideset/button/Button';\n\nimport type { Approval, ApprovalAnswer } from './model';\n\ntype ApprovalCardProps = {\n  approval: Approval;\n  onAnswer: (answer: ApprovalAnswer) => void;\n};\n\n/**\n * What the agent asks before a step that needs permission: a bordered card in the transcript with\n * the command or path in monospace, the reason in a sentence, and the three answers. Allow once\n * is the screen's filled button while the card waits; Stop in the composer steps back for it.\n */\nexport function ApprovalCard({ approval, onAnswer }: ApprovalCardProps) {\n  return (\n    <div\n      role=\"group\"\n      aria-label={approval.title}\n      className=\"border-ws-static-base rounded-ws-container-md p-ws-9 gap-ws-7 ml-ws-12 mt-ws-2 mb-ws-3 flex flex-col border\"\n    >\n      <div className=\"gap-ws-3 flex flex-col\">\n        <p className=\"typography-label-strong-sm text-ws-static-strong\">{approval.title}</p>\n        <code className=\"font-ws-mono typography-body-sm tracking-ws-normal text-ws-static-strong bg-ws-static-alpha-subtle rounded-ws-control-md px-ws-5 py-ws-3 break-all\">\n          {approval.command}\n        </code>\n        <p className=\"typography-body-md text-ws-static-subtle\">{approval.reason}</p>\n      </div>\n      <div className=\"gap-ws-3 flex flex-wrap\">\n        <Button size=\"sm\" onClick={() => onAnswer('once')}>\n          Allow once\n        </Button>\n        <Button size=\"sm\" variant=\"secondary\" preset=\"border\" onClick={() => onAnswer('always')}>\n          {`Always allow in ${approval.scope}`}\n        </Button>\n        <Button size=\"sm\" variant=\"secondary\" preset=\"ghost\" onClick={() => onAnswer('denied')}>\n          Deny\n        </Button>\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/bar-action.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/bar-action.tsx",
      "content": "'use client';\n\nimport type { ComponentProps } from 'react';\n\nimport { IconAction } from './icon-action';\n\n/**\n * A quiet icon action in a pane's bar (the terminal's, the preview's, the console's): the kit's\n * icon action at the bar's 24px, named by a tooltip under it.\n */\nexport function BarAction(props: ComponentProps<typeof IconAction>) {\n  return <IconAction size=\"xs\" side=\"bottom\" {...props} />;\n}\n"
    },
    {
      "path": "src/blocks/agent-code/brand-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/brand-mark.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nconst TILE =\n  'M0 16C0 8.45753 0 4.68629 2.34315 2.34315C4.68629 0 8.45753 0 16 0C23.5425 0 27.3137 0 29.6569 2.34315C32 4.68629 32 8.45753 32 16C32 23.5425 32 27.3137 29.6569 29.6569C27.3137 32 23.5425 32 16 32C8.45753 32 4.68629 32 2.34315 29.6569C0 27.3137 0 23.5425 0 16Z';\n\n/**\n * Tandem's mark: two strokes leaning the same way, one a step behind the other, on the inverse\n * tile, so it inverts in dark mode. It takes the size of its place (36px in the sidebar).\n * Decorative beside the product's name; give it a `label` when it stands alone.\n */\nexport function BrandMark({ className, label }: { className?: string; label?: string }) {\n  return (\n    <svg\n      viewBox=\"0 0 32 32\"\n      role={label ? 'img' : undefined}\n      aria-label={label}\n      aria-hidden={label ? undefined : true}\n      className={cn('size-ws-14 shrink-0', className)}\n    >\n      <path d={TILE} className=\"fill-(--ws-static-fill-inverse-background)\" />\n      <g transform=\"rotate(24 16 16)\" className=\"fill-(--ws-static-text-inverse-strong)\">\n        <rect x=\"10.25\" y=\"7\" width=\"4.5\" height=\"14\" rx=\"2.25\" />\n        <rect x=\"17.25\" y=\"11\" width=\"4.5\" height=\"14\" rx=\"2.25\" />\n      </g>\n    </svg>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/canon.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/canon.ts",
      "content": "import {\n  type RemixiconComponentType,\n  RiBarChartBoxLine,\n  RiBugLine,\n  RiGitPullRequestLine,\n  RiListCheck3,\n  RiQuillPenLine,\n  RiSearchEyeLine,\n} from '@remixicon/react';\n\nimport type { AgentTurn, Context, Mode, Model, Thread, ThreadGroup, Turn } from './model';\n\n/*\n  The canon: the one world every agent block shows. Tandem, an agent workspace with two modes, at\n  Lumen Studio, which makes meeting-room hardware (Lumen Display, Lumen Hub) and the booking app\n  `lumen-app`. Ines Navarro, a product engineer, is signed in. The sidebar lists the same chats\n  and sessions in every block, with the same names and states; each carries a short transcript,\n  enough to open it. A block puts its own thread in with `withThread` (its full turns, and the\n  mark its screen implies) and keeps everything else as it is here.\n*/\n\nexport const product = 'Tandem';\nexport const workspace = 'Lumen Studio';\nexport const account = { name: 'Ines Navarro', email: 'ines@lumenstudio.co', initials: 'IN' };\n\nexport const models: Model[] = [\n  { id: 'pro', name: 'Tandem Pro', note: 'Everyday work' },\n  { id: 'fast', name: 'Tandem Fast', note: 'Quick answers, lighter reasoning' },\n  { id: 'max', name: 'Tandem Max', note: 'Long, hard problems' },\n];\n\nexport const efforts = ['Low', 'Medium', 'High'];\n\n/** How much Tandem may do in a repository without asking (Code). */\nexport const permissions = ['Ask before edits', 'Accept edits', 'Plan'];\n\nexport const repositories = ['lumen-app', 'lumen-web', 'billing-service'];\nexport const branches = ['main', 'feature/bookings-csv-export', 'release/4.2'];\n\n/** A way to start a new thread: the chip, and the words it puts in the composer. */\nexport type Starter = { label: string; icon: RemixiconComponentType; prompt: string };\n\nexport const starters: Record<Mode, Starter[]> = {\n  chat: [\n    { label: 'Draft a document', icon: RiQuillPenLine, prompt: 'Draft a one-page brief on ' },\n    { label: 'Research a question', icon: RiSearchEyeLine, prompt: 'Research how ' },\n    {\n      label: 'Analyze a file',\n      icon: RiBarChartBoxLine,\n      prompt: 'Look at the attached file and tell me ',\n    },\n    { label: 'Plan a project', icon: RiListCheck3, prompt: 'Plan the work for ' },\n  ],\n  code: [\n    {\n      label: 'Fix a failing test',\n      icon: RiBugLine,\n      prompt: 'Find out why this test fails and fix it: ',\n    },\n    { label: 'Review a pull request', icon: RiGitPullRequestLine, prompt: 'Review pull request #' },\n    { label: 'Plan a change', icon: RiListCheck3, prompt: 'Plan how to ' },\n  ],\n};\n/** Files in the workspace, by name: what Add files puts on the composer's tray, one after another. */\nexport const files = ['hub-2-positioning.md', 'price-list-2026.csv', 'bookings-export.spec.ts'];\n\n/** A session's context before much has happened: 58K of 200K tokens, 29%, and what it is made of. */\nexport const context: Context = {\n  used: 58_000,\n  limit: 200_000,\n  parts: [\n    { label: 'Files read', tokens: 24_000 },\n    { label: 'Conversation', tokens: 21_000 },\n    { label: 'Command output', tokens: 13_000 },\n  ],\n};\n\n/* The other threads: a question and a short answer each, enough to open them. */\n\nconst brief = (id: string, prompt: string, ...paragraphs: string[]): Turn[] => [\n  { id: `${id}-1`, role: 'user', text: prompt },\n  {\n    id: `${id}-2`,\n    role: 'agent',\n    blocks: [\n      {\n        kind: 'text',\n        id: `${id}-answer`,\n        prose: paragraphs.map((text) => ({ kind: 'paragraph', text })),\n      },\n    ],\n  },\n];\n\n/** A chat that waits for Ines: the agent wants a file from outside the project. */\nconst launchTimeline: Turn[] = [\n  { id: 'timeline-1', role: 'user', text: 'Plan launch day, November 17, hour by hour.' },\n  {\n    id: 'timeline-2',\n    role: 'agent',\n    blocks: [\n      {\n        kind: 'reasoning',\n        id: 'timeline-2-thought',\n        seconds: 7,\n        text: 'Launch day has fixed points: the store opens at 09:00 Pacific and the announcement goes out with it. Marketing schedules the newsletter and the social posts; their calendar is outside this project, so I have to ask before I read it.',\n      },\n      {\n        kind: 'step',\n        id: 'read-calendar',\n        label: 'Read `Marketing/campaign-calendar.xlsx`',\n        active: 'Reading `Marketing/campaign-calendar.xlsx`',\n        result: '14 entries',\n        status: 'waiting',\n        approval: {\n          title: 'Read a file outside this project',\n          command: 'Marketing/campaign-calendar.xlsx',\n          reason:\n            'The campaign calendar has the newsletter and social slots for November 17. Tandem reads it and changes nothing.',\n          scope: 'this project',\n        },\n      },\n      {\n        kind: 'text',\n        id: 'timeline-2-answer',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'Here is the day, in Pacific time. The newsletter and the social posts keep the slots Marketing gave them.',\n          },\n          {\n            kind: 'list',\n            items: [\n              '**07:00** Last check of the store page and the trade-in form.',\n              '**09:00** The store opens; the announcement and the newsletter go out.',\n              '**10:30** Social posts, then replies through the day.',\n              '**16:00** First numbers to the team: orders, trade-ins, support tickets.',\n            ],\n          },\n        ],\n      },\n    ],\n  },\n];\n\n/** The research chat, still running when it is opened. */\nconst hardwarePricing: Turn[] = [\n  {\n    id: 'pricing-1',\n    role: 'user',\n    text: 'How do Roomline, Meetwise and Deskhaven price their meeting-room hardware?',\n  },\n  {\n    id: 'pricing-2',\n    role: 'agent',\n    blocks: [\n      {\n        kind: 'reasoning',\n        id: 'pricing-2-thought',\n        seconds: 6,\n        text: 'Three vendors, and what matters is the model: hardware sold once, a subscription, or both. Their pricing pages will say. I will search first, then read each vendor’s own page rather than a comparison site.',\n      },\n      {\n        kind: 'step',\n        id: 'search-web',\n        label: 'Searched the web',\n        active: 'Searching the web',\n        result: '4 results',\n        status: 'done',\n        detail: {\n          kind: 'results',\n          items: [\n            { title: 'Roomline pricing: hubs, panels and plans', source: 'roomline.example' },\n            { title: 'Meetwise Room Kit: plans and pricing', source: 'meetwise.example' },\n            { title: 'Deskhaven hardware store', source: 'deskhaven.example' },\n            { title: 'Meeting room hardware compared, 2026', source: 'workplaceweekly.example' },\n          ],\n        },\n      },\n      {\n        kind: 'steps',\n        id: 'pricing-2-pages',\n        label: 'Read 3 pages',\n        steps: [\n          {\n            id: 'read-roomline',\n            label: 'Read `roomline.example/pricing`',\n            active: 'Reading `roomline.example/pricing`',\n            status: 'done',\n          },\n          {\n            id: 'read-meetwise',\n            label: 'Read `meetwise.example/room-kit`',\n            active: 'Reading `meetwise.example/room-kit`',\n            status: 'done',\n          },\n          {\n            id: 'read-deskhaven',\n            label: 'Read `deskhaven.example/store`',\n            active: 'Reading `deskhaven.example/store`',\n            status: 'done',\n          },\n        ],\n      },\n      {\n        kind: 'text',\n        id: 'pricing-2-answer',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'All three sell the hub outright and charge for software on top, so the fair comparison is the hardware plus the first year.',\n          },\n          {\n            kind: 'list',\n            items: [\n              '**Roomline:** $429 a hub, then $12 a room a month.',\n              '**Meetwise:** $299 a hub, sold only with the $19 a room a month plan.',\n              '**Deskhaven:** $379 a hub, software included for the first year.',\n            ],\n          },\n          {\n            kind: 'paragraph',\n            text: 'At $349 with no subscription, Hub 2 costs the least over a year in every case.',\n          },\n        ],\n      },\n    ],\n  },\n];\n\n/** A chat whose last turn failed on a file it could not open. */\nconst educationDiscount: Turn[] = [\n  {\n    id: 'education-1',\n    role: 'user',\n    text: 'Turn last year’s education discount into a one-page memo for Hub 2.',\n  },\n  {\n    id: 'education-2',\n    role: 'agent',\n    blocks: [\n      {\n        kind: 'step',\n        id: 'read-memo',\n        label: 'Read `education-discount-2025.docx`',\n        result: 'File is locked',\n        status: 'failed',\n        detail: {\n          kind: 'output',\n          lines: [\n            'Pricing/education-discount-2025.docx',\n            'Locked for editing by Elena Silva since 9:12 AM',\n          ],\n          errors: [1],\n        },\n      },\n      {\n        kind: 'text',\n        id: 'education-2-answer',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'I could not open last year’s memo: Elena Silva has it open for editing. Ask her to close it and press Retry, or attach a copy here.',\n          },\n        ],\n      },\n    ],\n  },\n];\n\n/** The subagent working on the failing E2E test of pull request #482 (Code). */\nconst e2eFix: Turn[] = [\n  {\n    id: 'e2e-1',\n    role: 'user',\n    text: 'Find out why “bookings export › downloads the file” times out in CI, and fix it.',\n  },\n  {\n    id: 'e2e-2',\n    role: 'agent',\n    blocks: [\n      {\n        kind: 'reasoning',\n        id: 'e2e-2-thought',\n        seconds: 5,\n        text: 'The test passes on my machine and times out in CI, so it is waiting for something the CI browser never does. The export opens a blob URL; a headless browser may not raise a download for that.',\n      },\n      {\n        kind: 'step',\n        id: 'read-spec',\n        label: 'Read `e2e/bookings-export.spec.ts`',\n        active: 'Reading `e2e/bookings-export.spec.ts`',\n        result: '42 lines',\n        status: 'done',\n      },\n      {\n        kind: 'step',\n        id: 'run-e2e',\n        label: 'Ran `pnpm test:e2e bookings`',\n        active: 'Running `pnpm test:e2e bookings`',\n        result: '2 passed, 1 failed',\n        status: 'failed',\n        ms: 3200,\n        detail: {\n          kind: 'output',\n          lines: [\n            '$ pnpm test:e2e bookings',\n            '  ✓ bookings › lists the day',\n            '  ✓ bookings › filters by room',\n            '  ✗ bookings export › downloads the file (30.0s)',\n            '    Timeout 30000ms exceeded while waiting for event \"download\"',\n            '      at e2e/bookings-export.spec.ts:15:27',\n            '  3 tests, 1 failed',\n          ],\n          errors: [3, 4, 5],\n        },\n      },\n      {\n        kind: 'text',\n        id: 'e2e-2-answer',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'The test waits for a `download` event that never comes: the export opens a blob URL in a new tab instead of using a download link. Next I will change `export-csv.ts` to a link with the `download` attribute and run the test again.',\n          },\n        ],\n      },\n    ],\n  },\n];\n\n/** A session that waits for Ines before it runs a command (Code). */\nconst vatRounding: Turn[] = [\n  {\n    id: 'vat-1',\n    role: 'user',\n    text: 'Invoice totals are off by a cent when VAT is 23%. Find it and fix it.',\n  },\n  {\n    id: 'vat-2',\n    role: 'agent',\n    blocks: [\n      {\n        kind: 'reasoning',\n        id: 'vat-2-thought',\n        seconds: 4,\n        text: 'A cent off at 23% points at rounding each line and then adding them up, instead of rounding the total. Before I change the query I want to see how many stored invoices would move.',\n      },\n      {\n        kind: 'step',\n        id: 'dry-run',\n        label: 'Ran `pnpm db:migrate --dry-run`',\n        pending: 'Run `pnpm db:migrate --dry-run`',\n        active: 'Running `pnpm db:migrate --dry-run`',\n        result: '212 rows would change',\n        status: 'waiting',\n        approval: {\n          title: 'Run a command',\n          command: 'pnpm db:migrate --dry-run',\n          reason:\n            'A dry run lists the invoices whose total would change. It reads the database and writes nothing.',\n          scope: 'this repository',\n        },\n      },\n      {\n        kind: 'text',\n        id: 'vat-2-answer',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'The dry run shows 212 invoices off by one cent, all with three or more lines at 23%. I will round the total once in `invoice-totals.ts` and add a test with the smallest case.',\n          },\n        ],\n      },\n    ],\n  },\n];\n\n/** A session that waits for Ines with a question: the fix can go two ways (Code). */\nconst flakySync: Turn[] = [\n  {\n    id: 'sync-1',\n    role: 'user',\n    text: 'The calendar sync test fails about one run in ten. Find out why and fix it.',\n  },\n  {\n    id: 'sync-2',\n    role: 'agent',\n    blocks: [\n      {\n        kind: 'step',\n        id: 'run-sync',\n        label: 'Ran `pnpm test calendar-sync` 20 times',\n        active: 'Running `pnpm test calendar-sync` 20 times',\n        result: '2 of 20 failed',\n        status: 'done',\n      },\n      {\n        kind: 'text',\n        id: 'sync-2-finding',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'Found it: the test books a room “in one hour” and fails when the run crosses midnight UTC. Freezing the clock fixes it, and there are two places to do that.',\n          },\n        ],\n      },\n      {\n        kind: 'question',\n        id: 'sync-2-question',\n        title: 'Freeze the clock in this test only, or in the setup for every test?',\n        options: [\n          {\n            value: 'one',\n            label: 'This test only',\n            description: 'One line in the test file. Other tests keep the real clock.',\n          },\n          {\n            value: 'all',\n            label: 'Every test',\n            description: 'In the test setup. No test depends on the hour it runs at again.',\n          },\n        ],\n      },\n    ],\n  },\n];\n\n/** What Tandem does once a question is answered, whichever way. */\nconst decided = (id: string): AgentTurn => ({\n  id,\n  role: 'agent',\n  blocks: [\n    {\n      kind: 'step',\n      id: `${id}-edit`,\n      label: 'Edited 1 file',\n      active: 'Editing 1 file',\n      result: '+3 −1',\n      status: 'done',\n    },\n    {\n      kind: 'text',\n      id: `${id}-answer`,\n      prose: [\n        {\n          kind: 'paragraph',\n          text: 'Done, the way you chose. The clock is frozen, and the test passed 20 runs out of 20.',\n        },\n      ],\n    },\n  ],\n});\n\nexport const chatGroups: ThreadGroup[] = [\n  {\n    id: 'hub-2-launch',\n    label: 'Hub 2 launch',\n    threads: [\n      {\n        id: 'launch-announcement',\n        title: 'Launch announcement',\n        turns: brief(\n          'launch',\n          'Draft the launch announcement for Lumen Hub 2.',\n          'The announcement is written, in two versions. The second is a third shorter and opens with the price: $349, out on November 17.',\n        ),\n      },\n      {\n        id: 'partner-version',\n        title: 'Partner version',\n        child: true,\n        state: 'unread',\n        turns: brief(\n          'partner',\n          'Fork this for resellers: the same facts, but the trade-in terms first.',\n          'Done, as its own document. It opens with the $100 trade-in credit and the January 31 deadline, then the three changes.',\n        ),\n      },\n      {\n        id: 'press-kit',\n        title: 'Press kit checklist',\n        turns: brief(\n          'press',\n          'What does the press kit still need before November 17?',\n          'Four things are open: product photos on white, the spec sheet as a PDF, two customer quotes and the founder bio. The photos take longest; the studio delivers on November 12.',\n        ),\n      },\n      {\n        id: 'launch-timeline',\n        title: 'Launch day timeline',\n        state: 'needs-you',\n        turns: launchTimeline,\n      },\n    ],\n  },\n  {\n    id: 'customer-research',\n    label: 'Customer research',\n    threads: [\n      {\n        id: 'hardware-pricing',\n        title: 'Room booking hardware pricing',\n        state: 'working',\n        turns: hardwarePricing,\n      },\n      {\n        id: 'interview-themes',\n        title: 'Interview themes, October',\n        turns: brief(\n          'interviews',\n          'What came up most in the October customer interviews?',\n          'Three themes, in this order: setup time (9 of 12 calls), rooms left booked but empty (7), and updates that interrupt meetings (5).',\n        ),\n      },\n    ],\n  },\n  {\n    id: 'pricing',\n    label: 'Pricing',\n    threads: [\n      {\n        id: 'price-tiers',\n        title: 'Hub 2 price tiers',\n        turns: brief(\n          'tiers',\n          'Sketch three price tiers for Hub 2 by number of rooms.',\n          'A simple ladder holds up: $349 a hub up to 20 rooms, $329 from 21 to 100, and $309 above that, each with the same trade-in credit.',\n        ),\n      },\n      {\n        id: 'education-discount',\n        title: 'Education discount memo',\n        state: 'failed',\n        turns: educationDiscount,\n      },\n    ],\n  },\n  {\n    id: 'recents',\n    label: 'Recents',\n    fixed: true,\n    threads: [\n      {\n        id: 'onboarding-email',\n        title: 'Rewrite the onboarding email',\n        turns: brief(\n          'onboarding',\n          'Make the onboarding email half as long.',\n          'It is down from 240 words to 110. The three setup steps stay; the company story and the second call to action are gone.',\n        ),\n      },\n      {\n        id: 'support-tickets',\n        title: 'Support tickets in Q3',\n        turns: brief(\n          'tickets',\n          'What were the top reasons for support tickets in Q3?',\n          'Pairing the camera led with 31% of tickets, then calendar sync at 22% and firmware updates at 14%.',\n        ),\n      },\n      {\n        id: 'release-notes',\n        title: 'Release notes for app 4.2',\n        turns: brief(\n          'notes',\n          'Write the release notes for Lumen app 4.2 from the changelog.',\n          'Done: five lines for customers, led by the new room filter, with the fixes grouped under one heading.',\n        ),\n      },\n    ],\n  },\n];\n\nexport const codeGroups: ThreadGroup[] = [\n  {\n    id: 'lumen-app',\n    label: 'lumen-app',\n    threads: [\n      {\n        id: 'csv-export',\n        title: 'CSV export for bookings',\n        pullRequest: { number: 482, comments: 2 },\n        turns: brief(\n          'csv',\n          'Add a CSV export to the bookings table.',\n          'The export is on `feature/bookings-csv-export` as draft pull request #482: five files, +148 −7. The unit tests pass, 14 of 14.',\n          'Two things are open: the E2E test “bookings export › downloads the file” times out, and Tom Becker left two comments.',\n        ),\n      },\n      {\n        id: 'e2e-fix',\n        title: 'Debug the E2E timeout',\n        child: true,\n        state: 'working',\n        turns: e2eFix,\n      },\n      {\n        id: 'room-filter',\n        title: 'Room filter on bookings',\n        turns: brief(\n          'filter',\n          'Add a filter by room to the bookings page.',\n          'Merged as #476. The filter sits in `bookings-toolbar.tsx` and keeps its value in the URL.',\n        ),\n      },\n    ],\n  },\n  {\n    id: 'lumen-web',\n    label: 'lumen-web',\n    threads: [\n      {\n        id: 'pricing-page',\n        title: 'Pricing page for Hub 2',\n        state: 'unread',\n        turns: brief(\n          'page',\n          'Add Hub 2 to the pricing page, with the trade-in note.',\n          'The page shows Hub 2 at $349 with the trade-in line under it. It is on `feature/hub-2-pricing`, ready for a look.',\n        ),\n      },\n      {\n        id: 'next-upgrade',\n        title: 'Upgrade to Next.js 16',\n        state: 'failed',\n        turns: brief(\n          'upgrade',\n          'Upgrade lumen-web to Next.js 16.',\n          'The upgrade stopped at the build: `next-image-export` does not support Next.js 16 yet. Nothing was committed. Pin it and try again, or wait for its next release.',\n        ),\n      },\n    ],\n  },\n  {\n    id: 'billing-service',\n    label: 'billing-service',\n    threads: [\n      {\n        id: 'vat-rounding',\n        title: 'Invoice rounding for VAT',\n        state: 'needs-you',\n        turns: vatRounding,\n      },\n    ],\n  },\n  {\n    id: 'recents',\n    label: 'Recents',\n    fixed: true,\n    threads: [\n      { id: 'flaky-sync', title: 'Flaky calendar sync test', state: 'needs-you', turns: flakySync },\n      {\n        id: 'rename-room',\n        title: 'Rename Room to Space',\n        state: 'paused',\n        turns: brief(\n          'rename',\n          'Rename Room to Space across lumen-app.',\n          'Paused at the usage limit, 31 of 86 files in. The components and their tests are renamed; the database column and the public API are next, and they need your word before I touch them. I go on at 4:00 PM.',\n        ),\n      },\n    ],\n  },\n];\n\n/** The mode's groups with one thread changed: a block's own thread, in its place in the canon. */\nexport const withThread = (\n  groups: ThreadGroup[],\n  id: string,\n  change: (thread: Thread) => Thread,\n): ThreadGroup[] =>\n  groups.map((group) => ({\n    ...group,\n    threads: group.threads.map((thread) => (thread.id === id ? change(thread) : thread)),\n  }));\n\nconst QUESTIONS = [flakySync].flatMap((turns) =>\n  turns.flatMap((turn) =>\n    turn.role === 'agent'\n      ? turn.blocks.flatMap((block) => (block.kind === 'question' ? block.options : []))\n      : [],\n  ),\n);\n\n/**\n * What Tandem does about a message this sample has no turn for: it goes on when the message\n * answers one of its questions, and otherwise asks for more to go on.\n */\nexport const fallback = (id: string, text = ''): AgentTurn =>\n  QUESTIONS.some((option) => option.label === text)\n    ? decided(id)\n    : {\n        id,\n        role: 'agent',\n        blocks: [\n          {\n            kind: 'reasoning',\n            id: `${id}-thought`,\n            seconds: 2,\n            text: 'The message is short, and nothing here says which files or sources to use. Asking is quicker than guessing.',\n          },\n          {\n            kind: 'text',\n            id: `${id}-answer`,\n            prose: [\n              {\n                kind: 'paragraph',\n                text: 'I do not have enough to act on that yet. Tell me which files or sources to use and what the result should be, and I will start.',\n              },\n            ],\n          },\n        ],\n      };\n"
    },
    {
      "path": "src/blocks/agent-code/changes-comment-composer.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-comment-composer.tsx",
      "content": "'use client';\n\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { Textarea } from '@/components/ui/wideset/textarea/Textarea';\nimport { type FormEvent, type KeyboardEvent, useEffect, useRef, useState } from 'react';\n\ntype CommentComposerProps = {\n  /** Names the field: \"Comment on line 36\", \"Reply to Tom Becker\". */\n  label: string;\n  /** The send button's word: Comment for a new thread, Reply inside one. */\n  action: string;\n  onSubmit: (text: string) => void;\n  onCancel: () => void;\n};\n\n/**\n * Where a comment is written: the field takes the focus as it opens, Ctrl or Cmd with Enter\n * sends (Enter alone breaks the line, a review comment is often several), Escape cancels. The\n * send button is bordered, never filled: the session's composer owns the screen's filled button.\n * It stays disabled while the field is empty.\n */\nexport function CommentComposer({ label, action, onSubmit, onCancel }: CommentComposerProps) {\n  const [text, setText] = useState('');\n  const field = useRef<HTMLTextAreaElement>(null);\n\n  useEffect(() => field.current?.focus(), []);\n\n  const submit = (event?: FormEvent) => {\n    event?.preventDefault();\n    if (text.trim()) onSubmit(text.trim());\n  };\n\n  const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n    // Escape and Enter that finish an input method's composition are the composition's own.\n    if (event.nativeEvent.isComposing) return;\n    if (event.key === 'Escape') {\n      // Only this composer closes, not whatever holds the pane.\n      event.stopPropagation();\n      onCancel();\n    }\n    if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) submit();\n  };\n\n  return (\n    <form\n      onSubmit={submit}\n      className=\"gap-ws-5 animate-in fade-in-0 flex flex-col duration-(--ws-motion-duration-fast) ease-(--ws-motion-ease-smooth-out)\"\n    >\n      <Textarea\n        ref={field}\n        size=\"sm\"\n        rows={2}\n        resize=\"none\"\n        aria-label={label}\n        placeholder=\"Leave a comment\"\n        value={text}\n        onChange={(event) => setText(event.target.value)}\n        onKeyDown={onKeyDown}\n      />\n      <div className=\"gap-ws-3 flex justify-end\">\n        <Button variant=\"secondary\" preset=\"ghost\" size=\"xs\" onClick={onCancel}>\n          Cancel\n        </Button>\n        <Button type=\"submit\" variant=\"secondary\" preset=\"border\" size=\"xs\" disabled={!text.trim()}>\n          {action}\n        </Button>\n      </div>\n    </form>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/changes-comment-thread.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-comment-thread.tsx",
      "content": "'use client';\n\n// TODO(custom): a review thread on a line of a diff (the comment, its replies, what to do with it); Wideset has no Comment component.\nimport { RiCheckLine } from '@remixicon/react';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { cn } from '@/lib/wideset/utils';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { CommentComposer } from './changes-comment-composer';\nimport type { Thread } from './changes-data';\nimport { formatWhen } from './changes-format';\nimport { PersonAvatar } from './person-avatar';\n\ntype CommentThreadProps = {\n  thread: Thread;\n  onReply: (text: string) => void;\n  onResolve: (resolved: boolean) => void;\n  /** Puts the comment in the session's composer, for Tandem to fix what it asks. */\n  onSend: () => void;\n};\n\n/**\n * A review thread under the line it is about, in a box drawn rather than filled, so it reads as\n * apart from the tinted lines around it: who wrote, how long ago, the text, then the replies.\n * Three ways on: Reply (the composer opens in place of the actions), Resolve (the thread folds to\n * one quiet line that can be reopened) and Ask Tandem to fix, which puts the comment in the\n * session's composer and then says so instead of offering it twice. The agent's action is the bordered one;\n * none is filled.\n */\nexport function CommentThread({ thread, onReply, onResolve, onSend }: CommentThreadProps) {\n  const [replying, setReplying] = useState(false);\n  const root = useRef<HTMLElement>(null);\n  const [first] = thread.comments;\n\n  // An action that takes away the control in use (the composer closing, Resolve, Reopen, the\n  // hand-over) leaves the focus in the thread, on its first action, not at the top of the page.\n  const state = `${replying} ${thread.resolved} ${thread.sent}`;\n  const lastState = useRef(state);\n  useEffect(() => {\n    if (lastState.current !== state && !replying) root.current?.querySelector('button')?.focus();\n    lastState.current = state;\n  }, [state, replying]);\n\n  return (\n    <article\n      ref={root}\n      aria-label={`Comment by ${first.author.name}`}\n      className={cn(\n        'border-ws-static-base rounded-ws-container-sm bg-ws-static-foreground p-ws-7 flex border',\n        thread.resolved ? 'gap-ws-5 items-center' : 'gap-ws-7 flex-col',\n      )}\n    >\n      {thread.resolved ? (\n        <>\n          <RiCheckLine\n            aria-hidden=\"true\"\n            className=\"size-ws-9 text-ws-semantic-positive shrink-0\"\n          />\n          <p className=\"typography-label-sm text-ws-static-subtle min-w-0 flex-1 truncate\">\n            <span className=\"text-ws-static-base\">Resolved</span> · {first.author.name}:{' '}\n            {first.text}\n          </p>\n          <Button variant=\"secondary\" preset=\"ghost\" size=\"xs\" onClick={() => onResolve(false)}>\n            Reopen\n          </Button>\n        </>\n      ) : (\n        <>\n          <ol className=\"gap-ws-7 flex flex-col\">\n            {thread.comments.map((comment) => (\n              <li key={comment.id} className=\"gap-ws-5 flex\">\n                <PersonAvatar size=\"xs\" {...comment.author} aria-hidden />\n                <div className=\"gap-ws-2 flex min-w-0 flex-1 flex-col\">\n                  <p className=\"typography-label-sm gap-x-ws-5 flex flex-wrap items-baseline\">\n                    <span className=\"typography-label-strong-sm text-ws-static-strong\">\n                      {comment.author.name}\n                    </span>\n                    <time dateTime={comment.postedAt} className=\"text-ws-static-subtle\">\n                      {formatWhen(comment.postedAt)}\n                    </time>\n                  </p>\n                  <p className=\"typography-body-md text-ws-static-base text-pretty\">\n                    {comment.text}\n                  </p>\n                </div>\n              </li>\n            ))}\n          </ol>\n\n          {replying ? (\n            <CommentComposer\n              label={`Reply to ${first.author.name}`}\n              action=\"Reply\"\n              onSubmit={(text) => {\n                onReply(text);\n                setReplying(false);\n              }}\n              onCancel={() => setReplying(false)}\n            />\n          ) : (\n            <div className=\"gap-ws-3 flex flex-wrap items-center justify-end\">\n              <Button\n                variant=\"secondary\"\n                preset=\"ghost\"\n                size=\"xs\"\n                onClick={() => setReplying(true)}\n              >\n                Reply\n              </Button>\n              <Button variant=\"secondary\" preset=\"ghost\" size=\"xs\" onClick={() => onResolve(true)}>\n                Resolve\n              </Button>\n              {thread.sent ? (\n                <p\n                  role=\"status\"\n                  className=\"typography-caption-strong-md text-ws-static-subtle gap-ws-2 h-ws-forms-xs px-ws-4 flex items-center\"\n                >\n                  <RiCheckLine aria-hidden=\"true\" className=\"size-ws-8\" />\n                  Added to your message\n                </p>\n              ) : (\n                <Button variant=\"secondary\" preset=\"border\" size=\"xs\" onClick={onSend}>\n                  Ask Tandem to fix\n                </Button>\n              )}\n            </div>\n          )}\n        </>\n      )}\n    </article>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/changes-counts.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-counts.tsx",
      "content": "'use client';\n\n// TODO(custom): lines added and removed as a pair of figures (+18 −4); Wideset has no diff stat.\n\ntype ChangeCountsProps = { added: number; removed: number };\n\n/**\n * How much a change adds and removes, in the colours of their meanings: added is positive,\n * removed negative. Nothing removed shows no figure, as a new file has no old side. Read aloud as\n * a sentence rather than as \"plus\" and \"minus\".\n */\nexport function ChangeCounts({ added, removed }: ChangeCountsProps) {\n  return (\n    <span className=\"typography-label-sm gap-ws-3 flex shrink-0 tabular-nums\">\n      <span className=\"sr-only\">\n        {removed > 0 ? `${added} lines added, ${removed} removed` : `${added} lines added`}\n      </span>\n      <span aria-hidden=\"true\" className=\"text-ws-semantic-positive\">\n        +{added}\n      </span>\n      {removed > 0 && (\n        <span aria-hidden=\"true\" className=\"text-ws-semantic-negative\">\n          −{removed}\n        </span>\n      )}\n    </span>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/changes-data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-data.ts",
      "content": "'use client';\n\nimport type { AvatarColor } from '@/components/ui/wideset/avatar/Avatar.colors';\n\nimport { type Anchor, countChanges, type Hunk, parsePatch } from './changes-diff';\n\n/** The moment the screen shows: the afternoon of 10 November 2026. */\nexport const NOW = new Date('2026-11-10T16:30:00');\n\nexport type Person = { name: string; initials: string; color: AvatarColor };\n\nexport const ME: Person = { name: 'Ines Navarro', initials: 'IN', color: 'teal' };\nconst TOM: Person = { name: 'Tom Becker', initials: 'TB', color: 'orange' };\n\n/** A file the session changed: its path from the repository root and its diff. */\nexport type ChangedFile = {\n  path: string;\n  /** The file did not exist on `main`. */\n  isNew: boolean;\n  hunks: Hunk[];\n  added: number;\n  removed: number;\n};\n\n/*\n  The session's changes on feature/bookings-csv-export, as `git diff main` prints them (without\n  the file headers), in git's order. The counts on screen are counted from these lines.\n*/\n\nconst BOOKINGS_TABLE = String.raw`\n@@ -1,12 +1,16 @@\n import { DataTable } from '@lumen/ui';\n-import { useMemo, useState } from 'react';\n+import { useCallback, useMemo, useState } from 'react';\n+\n+import { downloadFile } from '@/lib/download';\n+import { formatTimestamp } from '@/lib/format-date';\n\n import { BookingsToolbar } from './bookings-toolbar';\n import { COLUMNS } from './columns';\n+import { exportBookingsCsv } from './export-csv';\n import { applyFilters, NO_FILTERS } from './filters';\n import { useBookings } from './use-bookings';\n\n-/** Every room's bookings, with search and filters. */\n+/** Every room's bookings, with search, filters and CSV export. */\n export function BookingsTable() {\n   const { bookings, loading } = useBookings();\n   const [filters, setFilters] = useState(NO_FILTERS);\n@@ -16,11 +20,21 @@ export function BookingsTable() {\n     [bookings, filters],\n   );\n\n+  const handleExport = useCallback(() => {\n+    const csv = exportBookingsCsv(rows);\n+    const day = formatTimestamp(new Date()).slice(0, 10);\n+    downloadFile('bookings-' + day + '.csv', csv, 'text/csv');\n+  }, [rows]);\n+\n   return (\n     <section aria-labelledby=\"bookings-title\">\n       <h1 id=\"bookings-title\">Bookings</h1>\n-      {/* TODO: CSV export for the finance team */}\n-      <BookingsToolbar filters={filters} onChange={setFilters} />\n+      <BookingsToolbar\n+        filters={filters}\n+        onChange={setFilters}\n+        onExport={handleExport}\n+        exportDisabled={rows.length === 0}\n+      />\n       <DataTable columns={COLUMNS} rows={rows} loading={loading} />\n     </section>\n   );\n`;\n\nconst BOOKINGS_TOOLBAR = String.raw`\n@@ -6,10 +6,18 @@ import { RoomFilter } from './room-filter';\n type Props = {\n   filters: BookingFilters;\n   onChange: (filters: BookingFilters) => void;\n+  onExport: () => void;\n+  /** True when there is nothing to export. */\n+  exportDisabled?: boolean;\n };\n\n /** Search and filters over the bookings table. */\n-export function BookingsToolbar({ filters, onChange }: Props) {\n+export function BookingsToolbar({\n+  filters,\n+  onChange,\n+  onExport,\n+  exportDisabled,\n+}: Props) {\n   return (\n     <div className=\"flex items-center gap-ws-3\">\n       <SearchField\n@@ -24,6 +32,9 @@ export function BookingsToolbar({ filters, onChange }: Props) {\n       <Button variant=\"ghost\" onClick={() => onChange(NO_FILTERS)}>\n         Clear filters\n       </Button>\n+      <Button disabled={exportDisabled} onClick={onExport}>\n+        Export CSV\n+      </Button>\n     </div>\n   );\n }\n`;\n\nconst EXPORT_CSV_TEST = String.raw`\n@@ -0,0 +1,48 @@\n+import { describe, expect, it } from 'vitest';\n+\n+import { escapeField, exportBookingsCsv } from './export-csv';\n+import type { Booking } from './types';\n+\n+const booking: Booking = {\n+  id: 'BK-2041',\n+  room: { name: 'Atlas', floor: 3 },\n+  host: { name: 'Priya Raman', email: 'priya@lumenstudio.co' },\n+  startsAt: new Date('2026-11-10T09:00:00Z'),\n+  endsAt: new Date('2026-11-10T09:45:00Z'),\n+  attendees: ['jonas@lumenstudio.co', 'elena@lumenstudio.co'],\n+  repeats: false,\n+  status: 'confirmed',\n+  note: 'Hub 2 demo, bring the adapter',\n+};\n+\n+describe('exportBookingsCsv', () => {\n+  it('writes a header line and a line for each booking', () => {\n+    const lines = exportBookingsCsv([booking]).split('\\r\\n');\n+    expect(lines).toHaveLength(3);\n+    expect(lines[0]).toContain('Booking,Room,Floor,Host,Email');\n+    expect(lines[1]).toContain('BK-2041,Atlas,3,Priya Raman');\n+  });\n+\n+  it('writes start times as UTC ISO strings', () => {\n+    const [head, row] = exportBookingsCsv([booking]).split('\\r\\n');\n+    const col = head.split(',').indexOf('Starts');\n+    const cells = row.split(',');\n+    // 10:00 at the office, an hour ahead of UTC.\n+    expect(cells[col]).toBe('2026-11-10T09:00:00Z');\n+  });\n+});\n+\n+describe('escapeField', () => {\n+  it('quotes a field with a comma', () => {\n+    expect(escapeField('Demo, Hub 2')).toBe('\"Demo, Hub 2\"');\n+  });\n+\n+  it('doubles the quotes inside a quoted field', () => {\n+    expect(escapeField('a \"big\" room')).toBe('\"a \"\"big\"\" room\"');\n+  });\n+\n+  it('keeps a formula from running', () => {\n+    expect(escapeField('=SUM(A1:A9)')).toBe(\"'=SUM(A1:A9)\");\n+    expect(escapeField('-2 seats')).toBe(\"'-2 seats\");\n+  });\n+});\n`;\n\nconst EXPORT_CSV = String.raw`\n@@ -0,0 +1,64 @@\n+import { formatTimestamp } from '@/lib/format-date';\n+\n+import type { Booking } from './types';\n+\n+/** A column: its header and what a booking puts under it. */\n+type Column = {\n+  header: string;\n+  value: (booking: Booking) => string | number;\n+};\n+\n+/** The columns, in the order the finance team reads them. */\n+const COLUMNS: Column[] = [\n+  { header: 'Booking', value: (b) => b.id },\n+  { header: 'Room', value: (b) => b.room.name },\n+  { header: 'Floor', value: (b) => b.room.floor },\n+  { header: 'Host', value: (b) => b.host.name },\n+  { header: 'Email', value: (b) => b.host.email },\n+  { header: 'Starts', value: (b) => formatTimestamp(b.startsAt) },\n+  { header: 'Ends', value: (b) => formatTimestamp(b.endsAt) },\n+  { header: 'Attendees', value: (b) => b.attendees.length },\n+  { header: 'Repeats', value: (b) => (b.repeats ? 'Yes' : 'No') },\n+  { header: 'Status', value: (b) => b.status },\n+  { header: 'Note', value: (b) => b.note ?? '' },\n+];\n+\n+/** Without this mark Excel misreads UTF-8 names. */\n+const BOM = '\\uFEFF';\n+\n+/** RFC 4180 ends every line with CRLF. */\n+const LINE_BREAK = '\\r\\n';\n+\n+/** Text that starts like this runs as a formula in Excel. */\n+const FORMULA = /^[=+\\-@]/;\n+\n+/**\n+ * One value as a CSV field. Text that could run as a formula\n+ * gets a leading apostrophe. A field with a comma or a quote\n+ * is quoted, and the quotes inside it are doubled.\n+ */\n+export function escapeField(value: string | number): string {\n+  if (typeof value === 'number') return String(value);\n+  const text = FORMULA.test(value) ? \"'\" + value : value;\n+  const needsQuotes = text.includes(',') || text.includes('\"');\n+  if (!needsQuotes) return text;\n+  return '\"' + text.replaceAll('\"', '\"\"') + '\"';\n+}\n+\n+/** One line of the file: its fields, escaped and joined. */\n+function toLine(fields: (string | number)[]): string {\n+  return fields.map(escapeField).join(',');\n+}\n+\n+/**\n+ * The bookings as CSV text: a header line, then a line for each\n+ * booking, in the order given. Dates are UTC ISO strings, so the\n+ * file reads the same in every time zone.\n+ */\n+export function exportBookingsCsv(bookings: Booking[]): string {\n+  const header = toLine(COLUMNS.map((column) => column.header));\n+  const lines = bookings.map((booking) =>\n+    toLine(COLUMNS.map((column) => column.value(booking))),\n+  );\n+  return BOM + [header, ...lines].join(LINE_BREAK) + LINE_BREAK;\n+}\n`;\n\nconst FORMAT_DATE = String.raw`\n@@ -18,9 +18,13 @@ export function formatDay(date: Date): string {\n   return format(date, 'MMM d, yyyy');\n }\n\n-/** A moment for a file name or an export. */\n+/**\n+ * A moment for a file name or an export: UTC to the second, as\n+ * 2026-11-10T09:00:00Z, wherever the file is written.\n+ */\n export function formatTimestamp(date: Date): string {\n-  return format(date, \"yyyy-MM-dd'T'HH:mm:ssxxx\");\n+  if (Number.isNaN(date.getTime())) return '';\n+  return date.toISOString().slice(0, 19) + 'Z';\n }\n\n /** Whether two moments fall on the same calendar day. */\n`;\n\nconst file = (path: string, patch: string): ChangedFile => {\n  const hunks = parsePatch(patch);\n  return { path, isNew: hunks[0].header.startsWith('@@ -0,0'), hunks, ...countChanges(hunks) };\n};\n\nexport const FILES: ChangedFile[] = [\n  file('src/features/bookings/bookings-table.tsx', BOOKINGS_TABLE),\n  file('src/features/bookings/bookings-toolbar.tsx', BOOKINGS_TOOLBAR),\n  file('src/features/bookings/export-csv.test.ts', EXPORT_CSV_TEST),\n  file('src/features/bookings/export-csv.ts', EXPORT_CSV),\n  file('src/lib/format-date.ts', FORMAT_DATE),\n];\n\n/** Ines has read the test already, so it opens folded. */\nexport const VIEWED = ['src/features/bookings/export-csv.test.ts'];\n\nexport type Comment = { id: string; author: Person; postedAt: string; text: string };\n\n/** A conversation on one line of a file: the first comment and the replies to it. */\nexport type Thread = {\n  id: string;\n  path: string;\n  anchor: Anchor;\n  comments: Comment[];\n  resolved: boolean;\n  /** Handed to the session for Tandem to fix. */\n  sent: boolean;\n};\n\n/** Tom Becker's review of the draft: two comments, neither resolved yet. */\nexport const THREADS: Thread[] = [\n  {\n    id: 't1',\n    path: 'src/features/bookings/bookings-table.tsx',\n    anchor: { side: 'new', line: 25 },\n    comments: [\n      {\n        id: 't1-c1',\n        author: TOM,\n        postedAt: '2026-11-10T14:12:00',\n        text: 'This is the UTC day, so in the first hour after midnight in Berlin the file is named for yesterday. Use the local date for the name.',\n      },\n    ],\n    resolved: false,\n    sent: false,\n  },\n  {\n    id: 't2',\n    path: 'src/features/bookings/export-csv.ts',\n    anchor: { side: 'new', line: 43 },\n    comments: [\n      {\n        id: 't2-c1',\n        author: TOM,\n        postedAt: '2026-11-10T14:20:00',\n        text: 'This misses a value with a line break in it. A two-line note will split the row once the file is opened in a spreadsheet.',\n      },\n    ],\n    resolved: false,\n    sent: false,\n  },\n];\n\n/** A path as the folder it sits in and its own name: the name is what the eye looks for. */\nexport function splitPath(path: string) {\n  const at = path.lastIndexOf('/') + 1;\n  return { folder: path.slice(0, at), name: path.slice(at) };\n}\n"
    },
    {
      "path": "src/blocks/agent-code/changes-diff.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-diff.ts",
      "content": "// TODO(custom): reads a unified diff (the text `git diff` prints) into hunks and numbered lines; Wideset has no diff component.\n\nexport type LineKind = 'added' | 'removed' | 'context';\n\n/** One line of a diff: its number on the side it exists on (old, new or both) and its text. */\nexport type DiffLine = { kind: LineKind; old?: number; new?: number; text: string };\n\n/** A run of changed lines with the unchanged lines around them, under its `@@` header. */\nexport type Hunk = { header: string; lines: DiffLine[] };\n\n/** Where a comment sits: a line of the new file, or a removed line of the old one. */\nexport type Anchor = { side: 'old' | 'new'; line: number };\n\nconst HUNK_HEADER = /^@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/;\n\nconst KIND: Record<string, LineKind> = { '+': 'added', '-': 'removed', ' ': 'context' };\n\n/**\n * A file's patch as hunks. Line numbers are counted from each hunk header: an added line moves\n * the new side on, a removed line the old side, an unchanged line both.\n */\nexport function parsePatch(patch: string): Hunk[] {\n  const hunks: Hunk[] = [];\n  let old = 0;\n  let next = 0;\n  const lines = patch.split('\\n');\n  // The sample's patches open and close on a line break: those empty ends are not diff lines.\n  // Trimming instead would also cut a last blank context line and trailing spaces.\n  if (lines[0] === '') lines.shift();\n  if (lines.at(-1) === '') lines.pop();\n  for (const raw of lines) {\n    const header = HUNK_HEADER.exec(raw);\n    if (header) {\n      old = Number(header[1]);\n      next = Number(header[2]);\n      hunks.push({ header: raw, lines: [] });\n      continue;\n    }\n    const kind = KIND[raw[0] ?? ' '];\n    const hunk = hunks.at(-1);\n    if (!kind || !hunk) continue;\n    hunk.lines.push({\n      kind,\n      old: kind === 'added' ? undefined : old++,\n      new: kind === 'removed' ? undefined : next++,\n      text: raw.slice(1),\n    });\n  }\n  return hunks;\n}\n\n/** How many lines a patch adds and removes. */\nexport function countChanges(hunks: Hunk[]) {\n  const lines = hunks.flatMap((hunk) => hunk.lines);\n  return {\n    added: lines.filter((line) => line.kind === 'added').length,\n    removed: lines.filter((line) => line.kind === 'removed').length,\n  };\n}\n\n/** The place a comment on this line is kept under: the new file's line, or the old one's if removed. */\nexport function anchorOf(line: DiffLine): Anchor {\n  return line.kind === 'removed'\n    ? { side: 'old', line: line.old ?? 0 }\n    : { side: 'new', line: line.new ?? 0 };\n}\n\nexport const sameAnchor = (a: Anchor, b: Anchor) => a.side === b.side && a.line === b.line;\n"
    },
    {
      "path": "src/blocks/agent-code/changes-file-diff.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-file-diff.tsx",
      "content": "'use client';\n\n// TODO(custom): one file's unified diff (hunk headers, old and new line numbers, added and removed lines, comments on lines); Wideset has no diff or code component.\nimport { RiAddLine } from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport { Fragment, type KeyboardEvent, useRef, useState } from 'react';\n\nimport { CommentComposer } from './changes-comment-composer';\nimport { CommentThread } from './changes-comment-thread';\nimport { type ChangedFile, splitPath, type Thread } from './changes-data';\nimport { type Anchor, anchorOf, type DiffLine, type LineKind, sameAnchor } from './changes-diff';\nimport { TOKEN_COLOUR, tokenize } from './highlight';\n\n/**\n * The whole line is tinted, edge to edge, and its sign says the same for anyone who cannot tell\n * the tints apart.\n */\nconst LINE: Record<LineKind, { row: string; sign: string; signColour: string; spoken: string }> = {\n  added: {\n    row: 'bg-ws-semantic-positive',\n    sign: '+',\n    signColour: 'text-ws-semantic-positive',\n    spoken: 'Added',\n  },\n  removed: {\n    row: 'bg-ws-semantic-negative',\n    sign: '−',\n    signColour: 'text-ws-semantic-negative',\n    spoken: 'Removed',\n  },\n  context: { row: '', sign: '', signColour: '', spoken: 'Unchanged' },\n};\n\nconst NUMBER = 'w-ws-13 text-ws-static-subtle shrink-0 text-right tabular-nums select-none';\n\ntype DiffRowProps = {\n  line: DiffLine;\n  /** The one line button the Tab key stops on; the arrows reach the rest. */\n  tabStop: boolean;\n  onFocus: () => void;\n  /** Up and Down move to the next line's button. */\n  onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;\n  onComment: (opener: HTMLElement) => void;\n};\n\n/**\n * A line of the diff: its number in the old file and in the new one, its sign, the code in the\n * tokenizer's colours. A long line wraps instead of scrolling sideways, so the pane holds at any\n * width. The \"+\" in the left margin opens a comment on the line: it shows when the line is\n * hovered or the button has the focus, and never takes room from the code.\n */\nfunction DiffRow({ line, tabStop, onFocus, onKeyDown, onComment }: DiffRowProps) {\n  const { row, sign, signColour, spoken } = LINE[line.kind];\n  const { line: number } = anchorOf(line);\n  const where = line.kind === 'removed' ? `removed line ${number}` : `line ${number}`;\n\n  return (\n    <div data-new-line={line.new} className={cn('group/line px-ws-11 py-ws-2 relative flex', row)}>\n      <button\n        type=\"button\"\n        data-line=\"\"\n        tabIndex={tabStop ? 0 : -1}\n        aria-label={`Comment on ${where}`}\n        onFocus={onFocus}\n        onKeyDown={onKeyDown}\n        onClick={(event) => onComment(event.currentTarget)}\n        className=\"left-ws-2 top-ws-2 size-ws-9 rounded-ws-control-sm border-ws-dynamic-secondary-default bg-ws-static-foreground text-ws-dynamic-secondary-default hover:border-ws-dynamic-secondary-hover hover:text-ws-dynamic-secondary-hover focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default absolute grid cursor-pointer place-items-center border opacity-0 transition-opacity duration-(--ws-motion-duration-micro) ease-(--ws-motion-ease-out) group-hover/line:opacity-100 focus-visible:opacity-100\"\n      >\n        <RiAddLine aria-hidden=\"true\" className=\"size-ws-7\" />\n      </button>\n      <span aria-hidden=\"true\" className={NUMBER}>\n        {line.old}\n      </span>\n      <span aria-hidden=\"true\" className={NUMBER}>\n        {line.new}\n      </span>\n      <span\n        aria-hidden=\"true\"\n        className={cn('w-ws-11 shrink-0 text-center select-none', signColour)}\n      >\n        {sign}\n      </span>\n      <span className=\"sr-only\">\n        {spoken}, {where}:\n      </span>\n      <code className=\"font-ws-mono min-h-[1lh] min-w-0 flex-1 wrap-anywhere whitespace-pre-wrap\">\n        {tokenize(line.text).map((token) => (\n          <span key={token.start} className={TOKEN_COLOUR[token.kind]}>\n            {token.text}\n          </span>\n        ))}\n      </code>\n    </div>\n  );\n}\n\ntype FileDiffProps = {\n  file: ChangedFile;\n  /** The threads on this file's lines. */\n  threads: Thread[];\n  onComment: (anchor: Anchor, text: string) => void;\n  onReply: (threadId: string, text: string) => void;\n  onResolve: (threadId: string, resolved: boolean) => void;\n  onSend: (threadId: string) => void;\n};\n\n/**\n * A file's changes as a unified diff, in monospace on the pane's own surface so it follows the\n * theme: each hunk under its `@@` header, removed lines tinted negative and added ones positive.\n * Review threads sit under the lines they are about, and a new comment is written in the same\n * place. One line button is a tab stop; Up and Down move between the lines, so a long diff is\n * not a hundred stops.\n */\nexport function FileDiff({ file, threads, onComment, onReply, onResolve, onSend }: FileDiffProps) {\n  const [draft, setDraft] = useState<Anchor | null>(null);\n  const [tabStop, setTabStop] = useState(0);\n  const opener = useRef<HTMLElement | null>(null);\n\n  const close = () => {\n    setDraft(null);\n    opener.current?.focus();\n  };\n\n  const move = (event: KeyboardEvent<HTMLButtonElement>) => {\n    const { key, currentTarget } = event;\n    if (key !== 'ArrowDown' && key !== 'ArrowUp') return;\n    const buttons = [\n      ...(currentTarget.closest('[data-diff]')?.querySelectorAll<HTMLElement>('[data-line]') ?? []),\n    ];\n    const next = buttons[buttons.indexOf(currentTarget) + (key === 'ArrowDown' ? 1 : -1)];\n    if (!next) return;\n    event.preventDefault();\n    next.focus();\n  };\n\n  // Where each hunk's lines start in the file's run of lines, for the roving tab stop.\n  const starts = file.hunks.map((_, at) =>\n    file.hunks.slice(0, at).reduce((sum, hunk) => sum + hunk.lines.length, 0),\n  );\n\n  return (\n    <div\n      role=\"group\"\n      aria-label={`Changes in ${splitPath(file.path).name}`}\n      data-diff=\"\"\n      className=\"font-ws-mono typography-body-sm tracking-ws-normal\"\n    >\n      {file.hunks.map((hunk, at) => (\n        <Fragment key={hunk.header}>\n          <p className=\"bg-ws-static-alpha-subtle text-ws-static-subtle px-ws-11 py-ws-3 truncate\">\n            {hunk.header}\n          </p>\n          {hunk.lines.map((line, index) => {\n            const anchor = anchorOf(line);\n            return (\n              <Fragment key={`${anchor.side}${anchor.line}`}>\n                <DiffRow\n                  line={line}\n                  tabStop={tabStop === starts[at] + index}\n                  onFocus={() => setTabStop(starts[at] + index)}\n                  onKeyDown={move}\n                  onComment={(button) => {\n                    opener.current = button;\n                    setDraft(anchor);\n                  }}\n                />\n                {threads\n                  .filter((thread) => sameAnchor(thread.anchor, anchor))\n                  .map((thread) => (\n                    <div key={thread.id} className=\"font-ws-body px-ws-11 py-ws-5\">\n                      <CommentThread\n                        thread={thread}\n                        onReply={(text) => onReply(thread.id, text)}\n                        onResolve={(resolved) => onResolve(thread.id, resolved)}\n                        onSend={() => onSend(thread.id)}\n                      />\n                    </div>\n                  ))}\n                {draft && sameAnchor(draft, anchor) && (\n                  <div className=\"font-ws-body px-ws-11 py-ws-5\">\n                    <CommentComposer\n                      label={`Comment on line ${anchor.line}`}\n                      action=\"Comment\"\n                      onSubmit={(text) => {\n                        onComment(anchor, text);\n                        close();\n                      }}\n                      onCancel={close}\n                    />\n                  </div>\n                )}\n              </Fragment>\n            );\n          })}\n        </Fragment>\n      ))}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/changes-file-section.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-file-section.tsx",
      "content": "'use client';\n\n// TODO(custom): a changed file as a section that folds (its path, counts and a Viewed tick in a header that stays in view, the diff under it); Accordion's trigger cannot hold a second control, and Wideset has no file header.\nimport { RiArrowRightSLine } from '@remixicon/react';\nimport { Checkbox } from '@/components/ui/wideset/checkbox/Checkbox';\nimport { cn } from '@/lib/wideset/utils';\nimport { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';\nimport { type ReactNode, useId } from 'react';\n\nimport { ChangeCounts } from './changes-counts';\nimport { type ChangedFile, splitPath } from './changes-data';\n\ntype FileSectionProps = {\n  file: ChangedFile;\n  open: boolean;\n  /** Left out by the filter: hidden, not unmounted, so its comment drafts stay. */\n  hidden?: boolean;\n  viewed: boolean;\n  onOpenChange: (open: boolean) => void;\n  onViewedChange: (viewed: boolean) => void;\n  /** The file's diff. */\n  children: ReactNode;\n};\n\n/**\n * One changed file: a header row, then its diff. The row does one thing, fold the file, so the\n * path is a button stretched over the whole row and the chevron turns; the Viewed tick sits above\n * it as the row's second control. The header stays at the top of the pane while its diff scrolls\n * under it, so the file's name and its tick are always at hand. The folder is quiet and gives\n * way first; the file's name is what the eye looks for. A file new on this branch says so in the\n * info colour, which is what the status badge keeps for news.\n */\nexport function FileSection({\n  file,\n  open,\n  hidden = false,\n  viewed,\n  onOpenChange,\n  onViewedChange,\n  children,\n}: FileSectionProps) {\n  const diffId = useId();\n  const { folder, name } = splitPath(file.path);\n\n  return (\n    <section aria-label={file.path} hidden={hidden} className=\"border-ws-static-subtle border-b\">\n      <div\n        className={cn(\n          'bg-ws-static-foreground top-ws-0 z-ws-base h-ws-16 gap-ws-7 px-ws-11 border-ws-static-subtle sticky flex items-center',\n          open && 'border-b',\n        )}\n      >\n        <button\n          type=\"button\"\n          aria-expanded={open}\n          aria-controls={diffId}\n          onClick={() => onOpenChange(!open)}\n          className=\"gap-ws-3 typography-label-sm focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default after:inset-ws-0 hover:after:bg-ws-dynamic-secondary-alpha-hover flex min-w-0 flex-1 cursor-pointer items-center text-left after:absolute\"\n        >\n          <RiArrowRightSLine\n            aria-hidden=\"true\"\n            className={cn(\n              'size-ws-9 text-ws-dynamic-secondary-default shrink-0 transition-transform duration-(--ws-motion-duration-quick) ease-(--ws-motion-ease-smooth-out)',\n              open && 'rotate-90',\n            )}\n          />\n          <span className=\"flex min-w-0 items-baseline\">\n            <span className=\"text-ws-static-subtle truncate\">{folder}</span>\n            <span className=\"typography-label-strong-sm text-ws-static-strong shrink-0\">\n              {name}\n            </span>\n          </span>\n        </button>\n        {file.isNew && (\n          <StatusBadge size=\"sm\" color=\"info\">\n            New\n          </StatusBadge>\n        )}\n        <ChangeCounts added={file.added} removed={file.removed} />\n        {/* Over the row's button, so the tick is its own target. */}\n        <div className=\"relative shrink-0\">\n          <Checkbox\n            size=\"sm\"\n            label=\"Viewed\"\n            checked={viewed}\n            onCheckedChange={(checked) => onViewedChange(checked === true)}\n          />\n        </div>\n      </div>\n      {/* Folded, the diff is hidden rather than dropped: a comment half written stays. */}\n      <div id={diffId} hidden={!open}>\n        {children}\n      </div>\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/changes-format.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-format.ts",
      "content": "import { NOW } from './changes-data';\n\n// One locale for the whole screen; swap it for the user's.\nconst LOCALE = 'en-US';\nconst MINUTE = 60_000;\n\nconst relative = new Intl.RelativeTimeFormat(LOCALE, { numeric: 'auto' });\n\n/** How long ago a comment was left, the same day: \"Just now\", \"35 minutes ago\", \"2 hours ago\". */\nexport function formatWhen(iso: string) {\n  const minutes = Math.round((NOW.getTime() - new Date(iso).getTime()) / MINUTE);\n  if (minutes < 1) return 'Just now';\n  if (minutes < 60) return relative.format(-minutes, 'minute');\n  return relative.format(-Math.floor(minutes / 60), 'hour');\n}\n"
    },
    {
      "path": "src/blocks/agent-code/changes-pane.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-pane.tsx",
      "content": "'use client';\n\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { FILES, ME, NOW, splitPath, type Thread, VIEWED } from './changes-data';\nimport type { Anchor } from './changes-diff';\nimport { FileDiff } from './changes-file-diff';\nimport { FileSection } from './changes-file-section';\nimport { ChangesToolbar } from './changes-toolbar';\n\n/** A line of a changed file to bring into view; a new `key` asks again for the same line. */\n/** A changed file to bring into view, at one of its lines or, with no `line`, from its top. */\nexport type Reveal = { path: string; line?: number; key: number };\n\ntype ChangesPaneProps = {\n  reveal?: Reveal;\n  /** The review threads, kept by the pane's owner so the Checks pane counts the same ones. */\n  threads: Thread[];\n  onThreadsChange: (change: (threads: Thread[]) => Thread[]) => void;\n  /** Puts a request in the session's composer. */\n  onAsk?: (text: string) => void;\n};\n\nconst ADDED = FILES.reduce((sum, file) => sum + file.added, 0);\nconst REMOVED = FILES.reduce((sum, file) => sum + file.removed, 0);\n\n/**\n * The Changes pane: what the session changed, to review. A bar with the totals, a filter and the\n * way to the pull request; under it the changed files in git's order, each a section that folds,\n * with its diff and the review threads on their lines. Ticking Viewed folds a file, as reading it\n * is what the tick records, and unticking opens it again. The diff is the pane's one heavy\n * thing; nothing here is filled, since the session's composer owns the screen's filled button.\n *\n * `reveal` is a line to bring into view (a comment followed from the Checks pane): its file\n * opens, whatever the filter and its tick, and the line comes to the middle of the pane. `onAsk`\n * takes the words of Ask Tandem to fix to the session's composer.\n */\nexport function ChangesPane({ reveal, threads, onThreadsChange, onAsk }: ChangesPaneProps) {\n  const [query, setQuery] = useState('');\n  const [viewed, setViewed] = useState(VIEWED);\n  const [open, setOpen] = useState(() =>\n    FILES.map((file) => file.path).filter((path) => !VIEWED.includes(path)),\n  );\n  const scroller = useRef<HTMLDivElement>(null);\n  /** The `reveal` already scrolled to, so folding a file later does not scroll again. */\n  const revealed = useRef<number>(undefined);\n\n  useEffect(() => {\n    if (!reveal) return;\n    setQuery('');\n    setOpen((current) => [...new Set([...current, reveal.path])]);\n  }, [reveal]);\n\n  useEffect(() => {\n    if (!reveal || revealed.current === reveal.key || query || !open.includes(reveal.path)) return;\n    revealed.current = reveal.key;\n    const pane = scroller.current;\n    const file = `[aria-label=\"${reveal.path}\"]`;\n    const target = pane?.querySelector(\n      reveal.line === undefined ? file : `${file} [data-new-line=\"${reveal.line}\"]`,\n    );\n    // The pane's own scroll only: `scrollIntoView` would move every box around it as well. A line\n    // comes to the middle, a file's top to the pane's top.\n    if (pane && target) {\n      pane.scrollTop +=\n        target.getBoundingClientRect().top -\n        pane.getBoundingClientRect().top -\n        (reveal.line === undefined ? 0 : pane.clientHeight / 2);\n    }\n  }, [reveal, open, query]);\n\n  const needle = query.trim().toLowerCase();\n  const shown = FILES.filter((file) => file.path.toLowerCase().includes(needle));\n  const anyOpen = shown.some((file) => open.includes(file.path));\n\n  const setOpenFor = (paths: string[], value: boolean) =>\n    setOpen((current) => [\n      ...current.filter((path) => !paths.includes(path)),\n      ...(value ? paths : []),\n    ]);\n\n  const setViewedFor = (path: string, value: boolean) => {\n    setViewed((current) => [...current.filter((item) => item !== path), ...(value ? [path] : [])]);\n    setOpenFor([path], !value);\n  };\n\n  const update = (id: string, change: (thread: Thread) => Thread) =>\n    onThreadsChange((current) =>\n      current.map((thread) => (thread.id === id ? change(thread) : thread)),\n    );\n\n  const comment = (path: string, anchor: Anchor, text: string) =>\n    onThreadsChange((current) => [\n      ...current,\n      {\n        id: `t${current.length + 1}`,\n        path,\n        anchor,\n        comments: [{ id: 'c1', author: ME, postedAt: NOW.toISOString(), text }],\n        resolved: false,\n        sent: false,\n      },\n    ]);\n\n  const reply = (id: string, text: string) =>\n    update(id, (thread) => ({\n      ...thread,\n      comments: [\n        ...thread.comments,\n        {\n          id: `c${thread.comments.length + 1}`,\n          author: ME,\n          postedAt: NOW.toISOString(),\n          text,\n        },\n      ],\n    }));\n\n  return (\n    <div className=\"flex min-h-0 flex-1 flex-col\">\n      <ChangesToolbar\n        total={FILES.length}\n        shown={shown.length}\n        added={ADDED}\n        removed={REMOVED}\n        query={query}\n        onQueryChange={setQuery}\n        anyOpen={anyOpen}\n        onToggleAll={() =>\n          setOpenFor(\n            shown.map((file) => file.path),\n            !anyOpen,\n          )\n        }\n      />\n\n      <div ref={scroller} className=\"ws-scrollbar min-h-0 flex-1 overflow-y-auto\">\n        {FILES.map((file) => (\n          <FileSection\n            key={file.path}\n            file={file}\n            open={open.includes(file.path)}\n            hidden={!shown.includes(file)}\n            viewed={viewed.includes(file.path)}\n            onOpenChange={(value) => setOpenFor([file.path], value)}\n            onViewedChange={(value) => setViewedFor(file.path, value)}\n          >\n            <FileDiff\n              file={file}\n              threads={threads.filter((thread) => thread.path === file.path)}\n              onComment={(anchor, text) => comment(file.path, anchor, text)}\n              onReply={reply}\n              onResolve={(id, resolved) => update(id, (thread) => ({ ...thread, resolved }))}\n              onSend={(id) => {\n                const thread = threads.find((item) => item.id === id);\n                if (!thread) return;\n                const [{ author, text }] = thread.comments;\n                onAsk?.(\n                  `Fix ${author.name}’s comment on ${splitPath(thread.path).name}:${thread.anchor.line}: “${text}”`,\n                );\n                update(id, (item) => ({ ...item, sent: true }));\n              }}\n            />\n          </FileSection>\n        ))}\n\n        {shown.length === 0 && (\n          <div className=\"gap-ws-7 px-ws-11 py-ws-16 flex flex-col items-center text-center\">\n            <p className=\"typography-body-md text-ws-static-subtle\">\n              No changed file has “{query.trim()}” in its path.\n            </p>\n            <Button variant=\"secondary\" preset=\"border\" size=\"sm\" onClick={() => setQuery('')}>\n              Clear filter\n            </Button>\n          </div>\n        )}\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/changes-toolbar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/changes-toolbar.tsx",
      "content": "'use client';\n\nimport {\n  RiCollapseVerticalLine,\n  RiExpandVerticalLine,\n  RiGitPullRequestLine,\n  RiSearchLine,\n} from '@remixicon/react';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\n\nimport { BarAction } from './bar-action';\nimport { ChangeCounts } from './changes-counts';\nimport { PULL_REQUEST } from './checks-data';\n\ntype ChangesToolbarProps = {\n  /** How many files the session changed, and how many of them the filter shows. */\n  total: number;\n  shown: number;\n  added: number;\n  removed: number;\n  query: string;\n  onQueryChange: (query: string) => void;\n  /** Whether any file shown is open: then the one button folds them all, else it opens them. */\n  anyOpen: boolean;\n  onToggleAll: () => void;\n};\n\n/**\n * The pane's bar: what the session changed in all (files, lines added and removed), then a\n * filter by path, one button that folds every file or opens them again, and the way to the pull\n * request. The filter is a field, not a menu: five paths or five hundred, typing a part of one\n * is the quickest way to it. The pull request is a link, drawn as a quiet button to sit level\n * with the icon beside it.\n */\nexport function ChangesToolbar({\n  total,\n  shown,\n  added,\n  removed,\n  query,\n  onQueryChange,\n  anyOpen,\n  onToggleAll,\n}: ChangesToolbarProps) {\n  const toggleLabel = anyOpen ? 'Fold all files' : 'Expand all files';\n\n  return (\n    <div className=\"h-ws-16 border-ws-static-subtle px-ws-11 gap-ws-7 flex shrink-0 items-center border-b\">\n      <p className=\"typography-label-sm text-ws-static-base gap-ws-5 flex shrink-0 items-center\">\n        <span aria-live=\"polite\" className=\"tabular-nums\">\n          {shown === total ? `${total} files` : `${shown} of ${total} files`}\n        </span>\n        <ChangeCounts added={added} removed={removed} />\n      </p>\n\n      <div className=\"gap-ws-3 ml-auto flex min-w-0 flex-1 items-center justify-end\">\n        <TextInput\n          size=\"sm\"\n          className=\"mr-ws-3 max-w-[14rem] min-w-0 flex-1\"\n          value={query}\n          onChange={(event) => onQueryChange(event.target.value)}\n        >\n          <TextInput.Prefix inner>\n            <TextInput.Icon icon={RiSearchLine} />\n          </TextInput.Prefix>\n          <TextInput.Input type=\"search\" placeholder=\"Filter files\" aria-label=\"Filter files\" />\n          <TextInput.Suffix inner>\n            <TextInput.ClearButton aria-label=\"Clear filter\" />\n          </TextInput.Suffix>\n        </TextInput>\n\n        <BarAction\n          icon={anyOpen ? RiCollapseVerticalLine : RiExpandVerticalLine}\n          label={toggleLabel}\n          onClick={onToggleAll}\n        />\n\n        <Button asChild variant=\"secondary\" preset=\"ghost\" size=\"xs\">\n          <a\n            href={PULL_REQUEST.href}\n            target=\"_blank\"\n            rel=\"noreferrer\"\n            aria-label={`Open pull request #${PULL_REQUEST.number}`}\n          >\n            <Button.Icon icon={RiGitPullRequestLine} />\n            {/* Under asChild the label's inset is ours to give, as Button gives its own. */}\n            <span className=\"px-ws-2 tabular-nums\">#{PULL_REQUEST.number}</span>\n          </a>\n        </Button>\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/chat-tools.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/chat-tools.tsx",
      "content": "'use client';\n\nimport { type RemixiconComponentType, RiGlobalLine, RiSearchEyeLine } from '@remixicon/react';\nimport { SegmentedControl } from '@/components/ui/wideset/segmented-control/SegmentedControl';\nimport { Tooltip } from '@/components/ui/wideset/tooltip/Tooltip';\nimport { useState } from 'react';\n\nimport { ToolsMenu } from './tools-menu';\n\nconst MODES: { value: string; label: string; icon: RemixiconComponentType }[] = [\n  { value: 'web', label: 'Web search', icon: RiGlobalLine },\n  { value: 'research', label: 'Research', icon: RiSearchEyeLine },\n];\n\ntype ChatToolsProps = {\n  /** The chat is a research run: a follow-up stays one unless it is switched back. */\n  research?: boolean;\n  /** Add files, from the \"…\" menu. */\n  onAttach?: () => void;\n};\n\n/**\n * Chat's tools in the composer, as in the AI chat starting point: how the agent looks things up,\n * as two modes in an icon-only segmented control (a quick web search, or a longer research run),\n * each named by a tooltip, then the \"…\" menu with the rest. The tooltip hangs on a wrapper, not\n * on the segment: a tooltip trigger writes its own `data-state`, which is the attribute the\n * segment is styled by.\n */\nexport function ChatTools({ research = false, onAttach }: ChatToolsProps) {\n  const [mode, setMode] = useState(research ? 'research' : 'web');\n\n  return (\n    <>\n      <SegmentedControl size=\"sm\" aria-label=\"Search mode\" value={mode} onValueChange={setMode}>\n        {MODES.map(({ value, label, icon }) => (\n          <Tooltip key={value} size=\"sm\">\n            <Tooltip.Trigger asChild>\n              <span className=\"flex\">\n                <SegmentedControl.Item value={value} icon={icon} aria-label={label} />\n              </span>\n            </Tooltip.Trigger>\n            <Tooltip.Content className=\"ws-block-utility\">\n              <Tooltip.Label>{label}</Tooltip.Label>\n            </Tooltip.Content>\n          </Tooltip>\n        ))}\n      </SegmentedControl>\n      <ToolsMenu onAttach={onAttach} />\n    </>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/checks-check-list.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/checks-check-list.tsx",
      "content": "'use client';\n\n// TODO(custom): the checks a pull request ran, as rows (state, name, time) where a failed one opens on its log; Wideset has no check list, and Accordion's rows all open.\nimport {\n  type RemixiconComponentType,\n  RiArrowRightSLine,\n  RiCheckboxCircleFill,\n  RiCheckLine,\n  RiCloseCircleFill,\n} from '@remixicon/react';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { Card } from '@/components/ui/wideset/card/Card';\nimport { cn } from '@/lib/wideset/utils';\nimport { useId, useRef, useState } from 'react';\n\nimport { type Check, CHECKS, type CheckState } from './checks-data';\nimport { LogExcerpt } from './checks-log-excerpt';\nimport { formatDuration } from './format';\n\n/** A state is a judgement, so its mark takes the colour of its meaning; the shape says it too. */\nconst STATE: Record<CheckState, { icon: RemixiconComponentType; colour: string; spoken: string }> =\n  {\n    passed: {\n      icon: RiCheckboxCircleFill,\n      colour: 'text-ws-semantic-positive',\n      spoken: 'Passed in',\n    },\n    failed: {\n      icon: RiCloseCircleFill,\n      colour: 'text-ws-semantic-negative',\n      spoken: 'Failed after',\n    },\n  };\n\n/**\n * One check: its state's mark, its name, how long it ran. A failed check opens on the lines of\n * its log that say why, with the way on under them: ask Tandem to fix it (the pane's one accented\n * action, bordered, never filled: it writes the request into the session's composer) or read the\n * whole log. Folded, it says what failed in a line\n * under its name. A check with nothing to show is a plain row, not a control.\n */\nfunction CheckRow({ check, onFix }: { check: Check; onFix?: (text: string) => void }) {\n  const [open, setOpen] = useState(check.state === 'failed');\n  const [sent, setSent] = useState(false);\n  const toggle = useRef<HTMLButtonElement>(null);\n  const detailId = useId();\n  const { icon: Icon, colour, spoken } = STATE[check.state];\n\n  // The button gives way to a line saying where the request went. Without a composer to take the\n  // focus, it goes back to the row.\n  const send = () => {\n    setSent(true);\n    toggle.current?.focus();\n    onFix?.(`Fix the failing ${check.name} check: ${check.reason}`);\n  };\n\n  return (\n    <li className=\"border-ws-static-base border-b last:border-b-0\">\n      <div\n        className={cn(\n          'gap-ws-5 px-ws-11 py-ws-6 relative flex items-center',\n          check.log && 'hover:bg-ws-dynamic-secondary-alpha-hover',\n        )}\n      >\n        <Icon aria-hidden=\"true\" className={cn('size-ws-11 shrink-0', colour)} />\n        <div className=\"flex min-w-0 flex-1 flex-col\">\n          {check.log ? (\n            <button\n              ref={toggle}\n              type=\"button\"\n              aria-expanded={open}\n              aria-controls={detailId}\n              onClick={() => setOpen((value) => !value)}\n              className=\"typography-label-strong-sm text-ws-static-strong focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default after:inset-ws-0 w-fit cursor-pointer text-left after:absolute\"\n            >\n              {check.name}\n            </button>\n          ) : (\n            <span className=\"typography-label-strong-sm text-ws-static-strong\">{check.name}</span>\n          )}\n          {/* Folded, the row says what failed; open, the log under it does. */}\n          {check.reason && !open && (\n            <span className=\"typography-caption-md text-ws-static-subtle text-pretty\">\n              {check.reason}\n            </span>\n          )}\n        </div>\n        <span className=\"typography-label-sm text-ws-static-subtle shrink-0 tabular-nums\">\n          <span className=\"sr-only\">{spoken} </span>\n          {formatDuration(check.seconds)}\n        </span>\n        {/* Rows that do not open keep the chevron's room, so the times stand in one column. */}\n        <span className=\"size-ws-9 shrink-0\">\n          {check.log && (\n            <RiArrowRightSLine\n              aria-hidden=\"true\"\n              className={cn(\n                'size-ws-9 text-ws-dynamic-secondary-default transition-transform duration-(--ws-motion-duration-quick) ease-(--ws-motion-ease-smooth-out)',\n                open && 'rotate-90',\n              )}\n            />\n          )}\n        </span>\n      </div>\n\n      {check.log && open && (\n        <div id={detailId}>\n          <LogExcerpt lines={check.log} />\n          <div className=\"gap-ws-5 px-ws-11 py-ws-5 flex flex-wrap items-center\">\n            {sent ? (\n              <p\n                role=\"status\"\n                className=\"typography-label-strong-sm text-ws-static-subtle gap-ws-3 h-ws-forms-sm flex items-center\"\n              >\n                <RiCheckLine aria-hidden=\"true\" className=\"size-ws-9\" />\n                Added to your message\n              </p>\n            ) : (\n              <Button preset=\"border\" size=\"sm\" onClick={send}>\n                Fix with Tandem\n              </Button>\n            )}\n            {check.logHref && (\n              <Button asChild variant=\"secondary\" preset=\"ghost\" size=\"sm\">\n                <a href={check.logHref} target=\"_blank\" rel=\"noreferrer\">\n                  View full log\n                </a>\n              </Button>\n            )}\n          </div>\n        </div>\n      )}\n    </li>\n  );\n}\n\n/**\n * The pull request's checks in a card: the failing one first and open, since it is the one that\n * asks for something, then the rest in the order they ran. Rows run edge to edge, split by\n * lines, their text in line with the card's title.\n */\nexport function CheckList({ onFix }: { onFix?: (text: string) => void }) {\n  const titleId = useId();\n\n  return (\n    <Card role=\"region\" aria-labelledby={titleId}>\n      <Card.Header>\n        <h3 id={titleId} className=\"typography-label-strong-md text-ws-static-strong\">\n          Checks\n        </h3>\n      </Card.Header>\n      {/* Straight in the card, not in Card.Content: its scroll area reserves a scrollbar gutter\n          and wraps what it holds in display: table (a library bug). */}\n      <ul>\n        {CHECKS.map((check) => (\n          <CheckRow key={check.id} check={check} onFix={onFix} />\n        ))}\n      </ul>\n    </Card>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/checks-comment-list.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/checks-comment-list.tsx",
      "content": "'use client';\n\n// TODO(custom): review comments as rows that lead to their line (who, how long ago, the text, the file and line); Wideset has no Comment component.\nimport { RiArrowRightSLine } from '@remixicon/react';\nimport { Card } from '@/components/ui/wideset/card/Card';\nimport { useId } from 'react';\n\nimport { splitPath, type Thread } from './changes-data';\nimport { formatWhen } from './changes-format';\nimport { PersonAvatar } from './person-avatar';\n\n/**\n * The review comments still open, in a card: who wrote on which file and line, how long ago, and\n * the comment in full. Each row is one target, the link on its file and line stretched over the\n * whole row, and leads to that line in the Changes pane, where the comment is answered, resolved\n * or handed to Tandem. Nothing is decided here, so the rows carry no actions of their own.\n */\nexport function CommentList({ threads }: { threads: Thread[] }) {\n  const titleId = useId();\n  const unresolved = threads.filter((thread) => !thread.resolved);\n\n  return (\n    <Card role=\"region\" aria-labelledby={titleId}>\n      <Card.Header>\n        <h3 id={titleId} className=\"typography-label-strong-md text-ws-static-strong\">\n          Unresolved comments\n        </h3>\n      </Card.Header>\n      {/* Straight in the card, not in Card.Content: its scroll area reserves a scrollbar gutter\n          and wraps what it holds in display: table (a library bug). */}\n      <ul>\n        {unresolved.map(({ id, path, anchor, comments: [comment] }) => (\n          <li\n            key={id}\n            className=\"border-ws-static-base gap-ws-5 px-ws-11 py-ws-7 hover:bg-ws-dynamic-secondary-alpha-hover relative flex items-start border-b last:border-b-0\"\n          >\n            <PersonAvatar size=\"xs\" {...comment.author} aria-hidden />\n            <div className=\"gap-ws-2 flex min-w-0 flex-1 flex-col\">\n              <p className=\"typography-label-sm text-ws-static-subtle gap-x-ws-5 flex flex-wrap items-baseline\">\n                <span>\n                  <span className=\"typography-label-strong-sm text-ws-static-strong\">\n                    {comment.author.name}\n                  </span>{' '}\n                  on{' '}\n                  <a\n                    href={`#changes/${path}:${anchor.line}`}\n                    className=\"text-ws-static-base rounded-ws-control-sm focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default after:inset-ws-0 wrap-anywhere after:absolute\"\n                  >\n                    {splitPath(path).name}:{anchor.line}\n                    <span className=\"sr-only\">, open in Changes</span>\n                  </a>\n                </span>\n                <time dateTime={comment.postedAt}>{formatWhen(comment.postedAt)}</time>\n              </p>\n              <p className=\"typography-body-md text-ws-static-base text-pretty\">{comment.text}</p>\n            </div>\n            <RiArrowRightSLine\n              aria-hidden=\"true\"\n              className=\"size-ws-9 text-ws-dynamic-secondary-default shrink-0 self-center\"\n            />\n          </li>\n        ))}\n      </ul>\n    </Card>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/checks-data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/checks-data.ts",
      "content": "/** The session's pull request: a draft from its branch into `main`. */\nexport const PULL_REQUEST = {\n  number: 482,\n  title: 'Add CSV export to the bookings table',\n  state: 'Draft',\n  head: 'feature/bookings-csv-export',\n  base: 'main',\n  href: 'https://git.lumenstudio.example/lumen-app/pull/482',\n};\n\nexport type CheckState = 'passed' | 'failed';\n\n/** A line of a check's log: its number in the full log, and whether it is the error itself. */\nexport type LogLine = { number: number; text: string; error?: boolean };\n\n/** One check the pull request ran: how it ended, how long it took, and for a failure, why. */\nexport type Check = {\n  id: string;\n  name: string;\n  state: CheckState;\n  /** How long the check ran, in seconds. */\n  seconds: number;\n  /** What failed, in one line. */\n  reason?: string;\n  /** The lines of the log that say why, out of the whole of it. */\n  log?: LogLine[];\n  /** The whole log, on the git host. */\n  logHref?: string;\n};\n\n/** The failing check first, since it is the one that needs something; the rest in the order they ran. */\nexport const CHECKS: Check[] = [\n  {\n    id: 'e2e',\n    name: 'E2E',\n    state: 'failed',\n    seconds: 186,\n    reason: 'bookings export › downloads the file timed out',\n    log: [\n      { number: 187, text: '$ pnpm test:e2e bookings' },\n      { number: 193, text: 'Running 3 tests using 1 worker' },\n      { number: 197, text: ' × bookings export › downloads the file (30.0s)', error: true },\n      {\n        number: 199,\n        text: '   Test timeout of 30000ms exceeded while waiting for the download',\n        error: true,\n      },\n      { number: 201, text: '   page.waitForEvent: waiting for event \"download\"' },\n      { number: 204, text: '   at e2e/bookings-export.spec.ts:15:27' },\n      { number: 208, text: ' 1 failed | 2 passed (41.8s)' },\n    ],\n    logHref: 'https://git.lumenstudio.example/lumen-app/pull/482/checks/e2e',\n  },\n  { id: 'lint', name: 'Lint', state: 'passed', seconds: 38 },\n  { id: 'typecheck', name: 'Typecheck', state: 'passed', seconds: 72 },\n  { id: 'unit', name: 'Unit tests', state: 'passed', seconds: 54 },\n  { id: 'preview', name: 'Preview deploy', state: 'passed', seconds: 107 },\n];\n"
    },
    {
      "path": "src/blocks/agent-code/checks-format.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/checks-format.ts",
      "content": "/** A count with its noun: \"1 failing check\", \"2 unresolved comments\". */\nexport const formatCount = (count: number, noun: string) =>\n  `${count} ${noun}${count === 1 ? '' : 's'}`;\n"
    },
    {
      "path": "src/blocks/agent-code/checks-log-excerpt.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/checks-log-excerpt.tsx",
      "content": "'use client';\n\n// TODO(custom): an excerpt of a log (the lines that matter, with their numbers in the whole log, the error in the negative colour); Wideset has no log or code part.\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { LogLine } from './checks-data';\n\n/**\n * The few lines of a check's log that say why it failed, not the log: each keeps its number in\n * the whole log, so the gaps show that lines were left out. The error itself takes the negative\n * colour and the rest stays plain. A band across the card on the quiet fill the diff gives its\n * hunk headers, in monospace, following the theme; long lines wrap.\n */\nexport function LogExcerpt({ lines }: { lines: LogLine[] }) {\n  return (\n    <ol\n      aria-label=\"Log excerpt\"\n      className=\"font-ws-mono typography-body-sm tracking-ws-normal bg-ws-static-alpha-subtle py-ws-5\"\n    >\n      {lines.map(({ number, text, error }) => (\n        <li key={number} className=\"gap-ws-7 px-ws-11 py-ws-1 flex\">\n          <span\n            aria-hidden=\"true\"\n            className=\"w-ws-13 text-ws-static-subtle shrink-0 text-right tabular-nums select-none\"\n          >\n            {number}\n          </span>\n          <span\n            className={cn(\n              'min-w-0 flex-1 wrap-anywhere whitespace-pre-wrap',\n              error ? 'text-ws-semantic-negative' : 'text-ws-static-base',\n            )}\n          >\n            {text}\n          </span>\n        </li>\n      ))}\n    </ol>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/checks-pane.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/checks-pane.tsx",
      "content": "'use client';\n\nimport type { Thread } from './changes-data';\nimport { CheckList } from './checks-check-list';\nimport { CommentList } from './checks-comment-list';\nimport { PullRequestHeader } from './checks-pr-header';\nimport { ReadySummary } from './checks-ready-summary';\n\n/**\n * The Checks pane: the session's pull request and what it still needs. Its heading, then two\n * cards that are each something to act on (the checks, with the failing one open on its log, and\n * the unresolved review comments), scrolling inside the pane; and under them, always in view, the\n * line that sums up what stands between the draft and its review, with Mark ready held back.\n * `onFix` takes the words of Fix with Tandem to the session's composer.\n */\nexport function ChecksPane({\n  threads,\n  onFix,\n}: {\n  /** The review threads as the Changes pane left them. */\n  threads: Thread[];\n  onFix?: (text: string) => void;\n}) {\n  return (\n    <div className=\"flex min-h-0 flex-1 flex-col\">\n      <div className=\"ws-scrollbar min-h-0 flex-1 overflow-y-auto\">\n        <div className=\"gap-ws-9 p-ws-11 flex flex-col\">\n          <PullRequestHeader />\n          <CheckList onFix={onFix} />\n          <CommentList threads={threads} />\n        </div>\n      </div>\n      <ReadySummary threads={threads} />\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/checks-pr-header.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/checks-pr-header.tsx",
      "content": "'use client';\n\n// TODO(custom): a pull request's heading (title and number, state, the branches it joins); Wideset has no heading for a record with its state and facts.\nimport { RiArrowRightLine, RiExternalLinkLine, RiGitBranchLine } from '@remixicon/react';\nimport { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';\n\nimport { BarAction } from './bar-action';\nimport { PULL_REQUEST } from './checks-data';\n\n/**\n * What the pane is about: the pull request's title with its number after it, then its state and\n * the branch it brings into which. Draft is a state with nothing to signal, so its badge stays\n * neutral. Branch names are code, so they are set in monospace and break anywhere rather than\n * push the pane wider. The way out to the git host is a quiet icon at the title's end.\n */\nexport function PullRequestHeader() {\n  const { number, title, state, head, base, href } = PULL_REQUEST;\n\n  return (\n    <header className=\"gap-ws-5 flex flex-col\">\n      <div className=\"gap-ws-7 flex items-start\">\n        <h2 className=\"typography-subtitle-xs text-ws-static-strong min-w-0 flex-1 text-pretty\">\n          {title} <span className=\"text-ws-static-subtle tabular-nums\">#{number}</span>\n        </h2>\n        <BarAction asChild icon={RiExternalLinkLine} label=\"Open on the git host\">\n          {/* eslint-disable-next-line jsx-a11y/anchor-has-content -- IconButton slots its icon into the anchor, which BarAction names by its label */}\n          <a href={href} target=\"_blank\" rel=\"noreferrer\" />\n        </BarAction>\n      </div>\n\n      <div className=\"gap-x-ws-7 gap-y-ws-3 flex flex-wrap items-center\">\n        <StatusBadge>{state}</StatusBadge>\n        <p className=\"font-ws-mono typography-body-sm tracking-ws-normal text-ws-static-base gap-ws-3 flex min-w-0 flex-wrap items-center\">\n          <RiGitBranchLine\n            aria-hidden=\"true\"\n            className=\"size-ws-9 text-ws-static-subtle shrink-0\"\n          />\n          <span className=\"wrap-anywhere\">{head}</span>\n          <RiArrowRightLine\n            role=\"img\"\n            aria-label=\"into\"\n            className=\"size-ws-8 text-ws-static-subtle shrink-0\"\n          />\n          <span>{base}</span>\n        </p>\n      </div>\n    </header>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/checks-ready-summary.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/checks-ready-summary.tsx",
      "content": "'use client';\n\n// TODO(custom): what stands between a draft and its review, with the action it gates (a footer of blockers beside a disabled button); Wideset has no gate or checklist-summary part.\nimport { RiChat3Fill, RiCheckboxCircleFill, RiCloseCircleFill } from '@remixicon/react';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { useId } from 'react';\n\nimport type { Thread } from './changes-data';\nimport { CHECKS } from './checks-data';\nimport { formatCount } from './checks-format';\n\nconst ITEM = 'gap-ws-3 flex items-center';\nconst MARK = 'size-ws-9 shrink-0';\n\n/**\n * The pane's closing line, kept in view under the scrolling content: what still stands between\n * the draft and Ready for review, counted from the checks and the comments above, beside the\n * action it holds back. A disabled button gives no reason by itself, so the reason is the text\n * next to it and is tied to it for a screen reader. A failing check is a failure (negative); an\n * open comment waits for an answer (notice). The button is bordered: the session's composer owns\n * the screen's filled one.\n */\nexport function ReadySummary({ threads }: { threads: Thread[] }) {\n  const reasonId = useId();\n  const failing = CHECKS.filter((check) => check.state === 'failed').length;\n  const unresolved = threads.filter((thread) => !thread.resolved).length;\n  const ready = failing + unresolved === 0;\n\n  return (\n    <footer className=\"border-ws-static-base gap-x-ws-9 gap-y-ws-7 px-ws-11 py-ws-9 flex shrink-0 flex-wrap items-center border-t\">\n      <div id={reasonId} className=\"gap-ws-3 flex min-w-[12rem] flex-1 flex-col\">\n        <h3 className=\"typography-label-strong-sm text-ws-static-strong\">\n          {ready ? 'Ready for review' : 'Not ready for review yet'}\n        </h3>\n        <ul className=\"typography-label-sm text-ws-static-base gap-x-ws-9 gap-y-ws-2 flex flex-wrap\">\n          {ready && (\n            <li className={ITEM}>\n              <RiCheckboxCircleFill\n                aria-hidden=\"true\"\n                className={`${MARK} text-ws-semantic-positive`}\n              />\n              Every check passed and every comment is resolved\n            </li>\n          )}\n          {failing > 0 && (\n            <li className={ITEM}>\n              <RiCloseCircleFill\n                aria-hidden=\"true\"\n                className={`${MARK} text-ws-semantic-negative`}\n              />\n              {formatCount(failing, 'failing check')}\n            </li>\n          )}\n          {unresolved > 0 && (\n            <li className={ITEM}>\n              <RiChat3Fill aria-hidden=\"true\" className={`${MARK} text-ws-semantic-notice`} />\n              {formatCount(unresolved, 'unresolved comment')}\n            </li>\n          )}\n        </ul>\n      </div>\n      <Button\n        variant=\"secondary\"\n        preset=\"border\"\n        size=\"sm\"\n        disabled={!ready}\n        aria-describedby={reasonId}\n      >\n        Mark ready for review\n      </Button>\n    </footer>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/code-block.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/code-block.tsx",
      "content": "'use client';\n\n// TODO(custom): a block of code in an answer (the lines in monospace, Copy in its corner); Wideset has no Code component.\nimport { CopyButton } from './copy-button';\n\n/**\n * Lines to copy exactly, set apart in an outlined box that follows the theme, with Copy in its\n * top right corner. Long lines scroll inside the box rather than break.\n */\nexport function CodeBlock({ language, lines }: { language: string; lines: string[] }) {\n  return (\n    <div\n      role=\"group\"\n      aria-label={`${language} code`}\n      className=\"border-ws-static-base rounded-ws-container-md relative border\"\n    >\n      <pre className=\"font-ws-mono typography-body-md tracking-ws-normal text-ws-static-strong py-ws-7 pl-ws-9 pr-ws-16 ws-scrollbar overflow-x-auto whitespace-pre\">\n        <code>{lines.join('\\n')}</code>\n      </pre>\n      <div className=\"top-ws-3 right-ws-3 absolute\">\n        <CopyButton label=\"Copy code\" quiet text={() => lines.join('\\n')} />\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/code-pane.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/code-pane.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\nimport { Tabs } from '@/components/ui/wideset/tabs/Tabs';\nimport { useState } from 'react';\n\nimport { THREADS } from './changes-data';\nimport { ChangesPane, type Reveal } from './changes-pane';\nimport { ChecksPane } from './checks-pane';\nimport { FilesPane } from './files-pane';\nimport { PreviewPane } from './preview-pane';\nimport { TasksPane } from './tasks-pane';\nimport { TerminalPane } from './terminal-pane';\n\nexport type Pane = 'changes' | 'terminal' | 'preview' | 'files' | 'tasks' | 'checks';\n\nconst PANES: { id: Pane; label: string }[] = [\n  { id: 'changes', label: 'Changes' },\n  { id: 'terminal', label: 'Terminal' },\n  { id: 'preview', label: 'Preview' },\n  { id: 'files', label: 'Files' },\n  { id: 'tasks', label: 'Tasks' },\n  { id: 'checks', label: 'Checks' },\n];\n\ntype CodePaneProps = {\n  id: string;\n  pane: Pane;\n  onPaneChange: (pane: Pane) => void;\n  /** A line to bring into view in Changes. */\n  reveal?: Reveal;\n  /** Puts a request (Fix with Tandem, Ask Tandem to fix) in the session's composer. */\n  onAsk: (text: string) => void;\n  /** The files on the composer's tray, by path: Files adds and removes its open file there. */\n  attachments: string[];\n  onAttach: (path: string) => void;\n  onDetach: (path: string) => void;\n  /** Closed from the bar: kept, hidden, so a comment or a shell's history is there on reopening. */\n  hidden?: boolean;\n};\n\n/**\n * The session's pane: the right part of the session's own card, behind one vertical line, as\n * wide as the chat's document pane so the line stays put between the modes. Its bar is as high\n * as the session's and holds the six panes as tabs: words alone, since six one-word names fit\n * with room to spare and an icon each would only crowd them, and underlined, so the quiet ghost\n * tabs are left to the Terminal's shells one level down. The bar draws the one line; the tabs\n * sit on it with the open tab's mark over it.\n */\nexport function CodePane({\n  id,\n  pane,\n  onPaneChange,\n  reveal,\n  onAsk,\n  attachments,\n  onAttach,\n  onDetach,\n  hidden = false,\n}: CodePaneProps) {\n  const [visited, setVisited] = useState<Pane[]>([pane]);\n  if (!visited.includes(pane)) setVisited((current) => [...current, pane]);\n  // The review threads live here: answered in Changes, counted in Checks.\n  const [threads, setThreads] = useState(THREADS);\n\n  return (\n    <aside\n      id={id}\n      aria-label=\"Pane\"\n      hidden={hidden}\n      className={cn(\n        'border-ws-static-base flex w-[32rem] shrink-0 flex-col border-l',\n        hidden && 'hidden',\n      )}\n    >\n      <Tabs\n        value={pane}\n        onValueChange={(value) => onPaneChange(value as Pane)}\n        divider={false}\n        className=\"min-h-0 flex-1\"\n      >\n        <div className=\"h-ws-18 border-ws-static-base px-ws-11 flex shrink-0 items-end border-b\">\n          <Tabs.List aria-label=\"Panes\" className=\"-mb-px\">\n            {PANES.map(({ id: value, label }) => (\n              <Tabs.Item key={value} value={value}>\n                <Tabs.Label>{label}</Tabs.Label>\n              </Tabs.Item>\n            ))}\n          </Tabs.List>\n        </div>\n        {/* Every tab has its panel. A pane opened once stays mounted, hidden when another is\n            shown, so what was done in it (a reply, a Viewed tick, a stopped server, a shell's\n            history) is there on return. */}\n        {PANES.map(({ id: value }) => (\n          <Tabs.Content\n            key={value}\n            value={value}\n            forceMount\n            hidden={value !== pane}\n            className=\"flex min-h-0 flex-1 flex-col\"\n          >\n            {visited.includes(value) && (\n              <>\n                {value === 'changes' && (\n                  <ChangesPane\n                    reveal={reveal}\n                    threads={threads}\n                    onThreadsChange={setThreads}\n                    onAsk={onAsk}\n                  />\n                )}\n                {value === 'terminal' && <TerminalPane />}\n                {value === 'preview' && <PreviewPane />}\n                {value === 'files' && (\n                  <FilesPane attachments={attachments} onAttach={onAttach} onDetach={onDetach} />\n                )}\n                {value === 'tasks' && <TasksPane />}\n                {value === 'checks' && <ChecksPane threads={threads} onFix={onAsk} />}\n              </>\n            )}\n          </Tabs.Content>\n        ))}\n      </Tabs>\n    </aside>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/code-tools.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/code-tools.tsx",
      "content": "'use client';\n\nimport { Select } from '@/components/ui/wideset/select/Select';\nimport { type ReactNode, useState } from 'react';\n\nimport { ContextSummary } from './context-summary';\nimport type { Context } from './model';\nimport { ToolsMenu } from './tools-menu';\n\ntype CodeToolsProps = {\n  /** How much the agent may do in a repository without asking, least first. */\n  permissions: string[];\n  defaultPermission?: string;\n  /** The session's context: the meter and its short summary. A new session has none yet. */\n  context?: Context;\n  /** The block's own meter in place of the summary: a `ContextMeter` that opens something else. */\n  meter?: ReactNode;\n  /** Add files, from the \"…\" menu. */\n  onAttach?: () => void;\n};\n\n/**\n * Code's tools in the composer: how much the agent may do in the repository without asking, how\n * full the context is, then the \"…\" menu with the rest. The permission is a few fixed choices\n * whose words matter (Ask before edits is not an icon), so it stays a `Select`, the current one\n * always in view with its chevron.\n */\nexport function CodeTools({\n  permissions,\n  defaultPermission = permissions[0],\n  context,\n  meter,\n  onAttach,\n}: CodeToolsProps) {\n  const [permission, setPermission] = useState(defaultPermission);\n\n  return (\n    <>\n      <Select\n        size=\"sm\"\n        aria-label=\"Permission mode\"\n        className=\"w-[11.5rem]\"\n        options={permissions.map((value) => ({ value, label: value }))}\n        value={permission}\n        onValueChange={setPermission}\n      />\n      {meter ?? (context && <ContextSummary {...context} />)}\n      <ToolsMenu onAttach={onAttach} />\n    </>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/composer.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/composer.tsx",
      "content": "'use client';\n\n// TODO(custom): the composer (the message card on a grey tray: a growing text area, the mode's tools, the model and Send, the attachments under it); Textarea does not grow and has no slot for actions inside its frame.\nimport { RiArrowRightLine, RiFileLine, RiStopFill } from '@remixicon/react';\nimport { Chip } from '@/components/ui/wideset/chip/Chip';\nimport { cn } from '@/lib/wideset/utils';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { Tooltip } from '@/components/ui/wideset/tooltip/Tooltip';\nimport {\n  type FormEvent,\n  type KeyboardEvent,\n  type ReactNode,\n  useEffect,\n  useId,\n  useRef,\n  useState,\n} from 'react';\n\nimport { IconAction } from './icon-action';\nimport { SWAP } from './motion';\n\ntype ComposerProps = {\n  /** The form's name: \"Message Tandem\". */\n  label: string;\n  placeholder: string;\n  /**\n   * Words put in the field from outside (a way to start that was picked, a queued message taken\n   * back, a request from a pane). A new `id` puts them there again, with the cursor in the field.\n   */\n  draft?: { text: string; id: number };\n  /** Left of the bar under the text: the mode's tools. */\n  tools?: ReactNode;\n  /** Right of the bar, before Send: the model. */\n  model?: ReactNode;\n  /** The files that go with the message, by name: removable chips on the tray. */\n  attachments?: string[];\n  onDetach?: (index: number) => void;\n  /** The agent is working: Send becomes Stop, Esc stops too, and what is sent meanwhile queues. */\n  running?: boolean;\n  /** Whether Send or Stop is the screen's one filled button (not while something waits for you). */\n  primary?: boolean;\n  /**\n   * Why nothing can be sent right now (\"You are offline\"). Send is disabled and says it; the text\n   * stays editable, so a draft is not lost. A run in progress keeps Stop: stopping is not a send.\n   */\n  blocked?: string;\n  /** On a new-chat screen, where the composer is the page: room for a few lines from the start. */\n  roomy?: boolean;\n  onSend: (text: string) => void;\n  onStop?: () => void;\n};\n\n/**\n * Where you write, in the anatomy of the AI chat starting point (Figma's prompt composer): the\n * message card, white and raised, on a grey tray that also holds the attachments as removable\n * chips. In the card the text grows with what is typed, up to a few lines, over one bar: the\n * mode's tools on the left; on the right the keyboard hint, the model and Send. The hint is the\n * first to give way: when the bar has no room for it, it is not shown, and nothing wraps.\n *\n * Enter sends, Shift + Enter starts a new line. While the agent works Send is Stop, in the same\n * place, and Enter still sends: the message waits its turn. When sending is blocked the reason\n * is the placeholder, Send's tooltip and a hidden description of the field. What Figma's card\n * does not draw is added: the card takes a field's focus ring while the text has the focus.\n */\nexport function Composer({\n  label,\n  placeholder,\n  draft,\n  tools,\n  model,\n  attachments = [],\n  onDetach,\n  running = false,\n  primary = true,\n  blocked,\n  roomy = false,\n  onSend,\n  onStop,\n}: ComposerProps) {\n  const reasonId = useId();\n  const attachmentsId = useId();\n  const [text, setText] = useState(draft?.text ?? '');\n  const field = useRef<HTMLTextAreaElement>(null);\n\n  // Send and Stop trade places with a short grow-in, but only once a run has begun: on opening,\n  // Send is simply there.\n  const [swapped, setSwapped] = useState(false);\n  useEffect(() => {\n    if (running) setSwapped(true);\n  }, [running]);\n\n  // Words put in from outside are there to be finished: the cursor waits in the field, once\n  // whatever was pressed to put them there has given the focus up.\n  const applied = useRef(draft?.id);\n  useEffect(() => {\n    if (!draft || draft.id === applied.current) return;\n    applied.current = draft.id;\n    setText(draft.text);\n    const id = window.setTimeout(() => field.current?.focus());\n    return () => window.clearTimeout(id);\n  }, [draft]);\n\n  // Esc stops the run from anywhere on the screen, unless it is closing a menu or a dialog.\n  useEffect(() => {\n    if (!running || !onStop) return;\n    const onKey = (event: globalThis.KeyboardEvent) => {\n      // Esc that cancels an IME candidate is not a stop (Safari sends it after compositionend).\n      if (event.isComposing || event.keyCode === 229) return;\n      const inOverlay =\n        event.target instanceof Element &&\n        event.target.closest('[role=\"menu\"], [role=\"dialog\"], [role=\"listbox\"]');\n      if (event.key === 'Escape' && !event.defaultPrevented && !inOverlay) onStop();\n    };\n    window.addEventListener('keydown', onKey);\n    return () => window.removeEventListener('keydown', onKey);\n  }, [running, onStop]);\n\n  const send = (event: FormEvent | KeyboardEvent) => {\n    event.preventDefault();\n    const message = text.trim();\n    // Nothing to send, or nowhere to send it: keep the cursor where the message goes.\n    if (!message || blocked) return field.current?.focus();\n    onSend(message);\n    setText('');\n  };\n\n  const look = {\n    variant: primary ? ('primary' as const) : ('secondary' as const),\n    preset: primary ? ('filled' as const) : ('border' as const),\n  };\n\n  return (\n    <form\n      onSubmit={send}\n      aria-label={label}\n      className=\"bg-ws-static-alpha-subtle p-ws-3 gap-ws-5 relative flex flex-col rounded-(--ws-radius-600)\"\n    >\n      <div className=\"bg-ws-static-overlay shadow-ws-low rounded-ws-container-xl p-ws-5 gap-ws-3 has-[textarea:focus]:border-ws-dynamic-primary-strong-default has-[textarea:focus]:shadow-ws-forms-active flex flex-col border border-transparent transition-[border-color,box-shadow] duration-(--ws-motion-duration-quick) ease-(--ws-motion-ease-out)\">\n        <div className=\"p-ws-3\">\n          <textarea\n            ref={field}\n            aria-label=\"Message\"\n            aria-describedby={blocked ? reasonId : undefined}\n            placeholder={blocked ?? placeholder}\n            value={text}\n            onChange={(event) => setText(event.target.value)}\n            onKeyDown={(event) => {\n              // Shift + Enter keeps the browser's new line; Enter that confirms an IME word is not a\n              // send. Safari ends the composition before that keydown, so keyCode 229 says it too.\n              const composing = event.nativeEvent.isComposing || event.keyCode === 229;\n              if (event.key === 'Enter' && !event.shiftKey && !composing) {\n                send(event);\n              }\n            }}\n            className={cn(\n              'typography-body-lg text-ws-static-strong placeholder:text-ws-static-subtle max-h-ws-28 block field-sizing-content w-full resize-none bg-transparent outline-hidden',\n              roomy ? 'min-h-ws-23' : 'min-h-ws-12',\n            )}\n          />\n        </div>\n        <div className=\"gap-ws-5 flex items-center\">\n          <div className=\"gap-ws-5 flex shrink-0 items-center\">{tools}</div>\n          <div className=\"gap-ws-5 flex min-w-0 flex-1 items-center justify-end\">\n            {/* The hint sits on the first line of a wrapping row one line high: when it does not\n                fit beside the empty item before it, it wraps out of sight instead of truncating. */}\n            <div className=\"h-ws-11 flex min-w-0 flex-1 flex-wrap justify-end overflow-hidden\">\n              <span className=\"h-ws-11\" />\n              <p className=\"typography-body-md text-ws-static-subtle whitespace-nowrap\">\n                Shift + Enter for a new line\n              </p>\n            </div>\n            {model}\n            {running ? (\n              <IconAction\n                label=\"Stop\"\n                icon={RiStopFill}\n                iconClassName={swapped ? SWAP : undefined}\n                onClick={onStop}\n                {...look}\n              />\n            ) : blocked ? (\n              // A disabled button takes no hover, so the tooltip hangs on a wrapper that does. The\n              // keyboard and a screen reader have the reason from the field: its placeholder and\n              // its description.\n              <Tooltip size=\"sm\">\n                <Tooltip.Trigger asChild>\n                  <span className=\"flex\">\n                    <IconButton\n                      icon={RiArrowRightLine}\n                      size=\"sm\"\n                      disabled\n                      aria-label=\"Send\"\n                      aria-describedby={reasonId}\n                      {...look}\n                    />\n                  </span>\n                </Tooltip.Trigger>\n                <Tooltip.Content className=\"ws-block-utility\">\n                  <Tooltip.Label>{blocked}</Tooltip.Label>\n                </Tooltip.Content>\n              </Tooltip>\n            ) : (\n              <IconAction\n                type=\"submit\"\n                label=\"Send\"\n                icon={RiArrowRightLine}\n                iconClassName={swapped ? SWAP : undefined}\n                {...look}\n              />\n            )}\n          </div>\n        </div>\n      </div>\n\n      {attachments.length > 0 && (\n        <div role=\"group\" aria-labelledby={attachmentsId} className=\"py-ws-5\">\n          <p\n            id={attachmentsId}\n            className=\"typography-label-strong-sm text-ws-static-subtle px-ws-7 py-ws-3\"\n          >\n            Attachments\n          </p>\n          <div className=\"gap-ws-3 px-ws-7 flex flex-wrap\">\n            {attachments.map((name, index) => (\n              <Chip key={name} variant=\"secondary\" style=\"border\">\n                <Chip.Icon icon={RiFileLine} />\n                <Chip.Label>{name}</Chip.Label>\n                <Chip.IconButton aria-label={`Remove ${name}`} onClick={() => onDetach?.(index)} />\n              </Chip>\n            ))}\n          </div>\n        </div>\n      )}\n\n      {blocked && (\n        <p id={reasonId} className=\"sr-only\">\n          {blocked}\n        </p>\n      )}\n    </form>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/context-meter.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/context-meter.tsx",
      "content": "'use client';\n\n// TODO(custom): how full the context is, as a ring the size of an icon with its figure, in a button; ProgressBar's circle is 20px in the brand colour with its own label and is not a control.\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { type ButtonProps } from '@/components/ui/wideset/button/Button.types';\nimport { forwardRef } from 'react';\n\n/** The ring's circle in its 16px box: a 2px stroke, so the radius is 6. */\nconst RADIUS = 6;\nconst AROUND = 2 * Math.PI * RADIUS;\n\ntype ContextMeterProps = Omit<ButtonProps, 'children'> & {\n  /** How full the context window is, from 0 to 1. */\n  share: number;\n};\n\n/**\n * The context meter among the composer's tools in Code: a small grey ring and the share used,\n * quiet because 29% is nothing to act on. The ring is neutral; the brand colour stays with Send.\n * It is a ghost button that forwards its ref and props, so a `Popup.Trigger asChild` can open\n * whatever the block has to say about the context: the short summary, or the whole environment.\n */\nexport const ContextMeter = forwardRef<HTMLButtonElement, ContextMeterProps>(\n  ({ share, ...props }, ref) => {\n    const percent = `${Math.round(share * 100)}%`;\n    return (\n      <Button\n        ref={ref}\n        variant=\"secondary\"\n        preset=\"ghost\"\n        size=\"sm\"\n        aria-label={`Context: ${percent} used`}\n        className=\"tabular-nums\"\n        {...props}\n      >\n        <svg aria-hidden viewBox=\"0 0 16 16\" className=\"size-ws-9 shrink-0 -rotate-90 fill-none\">\n          <circle\n            cx=\"8\"\n            cy=\"8\"\n            r={RADIUS}\n            strokeWidth=\"2\"\n            className=\"stroke-(--border-color-ws-dynamic-secondary-default)\"\n          />\n          <circle\n            cx=\"8\"\n            cy=\"8\"\n            r={RADIUS}\n            strokeWidth=\"2\"\n            strokeLinecap=\"round\"\n            strokeDasharray={AROUND}\n            strokeDashoffset={AROUND * (1 - share)}\n            className=\"stroke-current\"\n          />\n        </svg>\n        {percent}\n      </Button>\n    );\n  },\n);\n\nContextMeter.displayName = 'ContextMeter';\n"
    },
    {
      "path": "src/blocks/agent-code/context-summary.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/context-summary.tsx",
      "content": "'use client';\n\n// TODO(custom): the context in short, opened from its meter (the amount, the limit, a bar, what fills it, Compact); ProgressBar has no neutral variant yet (#58), and Wideset has no usage meter.\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { Popup } from '@/components/ui/wideset/popup/Popup';\nimport { ProgressBar } from '@/components/ui/wideset/progress-bar/ProgressBar';\n\nimport { ContextMeter } from './context-meter';\nimport type { Context } from './model';\n\nconst tokens = new Intl.NumberFormat('en-US', { notation: 'compact' });\n\n/**\n * The context meter and the short summary it opens: built as the billing block's usage meter is\n * (the amount, the limit beside it, a bar, one line of what happens next), then what the context\n * is made of and the one thing to do about it.\n */\nexport function ContextSummary({\n  used,\n  limit,\n  parts,\n  onCompact,\n}: Context & {\n  /** Compacts the conversation; the popup closes after it. Without it there is no Compact button. */\n  onCompact?: () => void;\n}) {\n  return (\n    <Popup>\n      <Popup.Trigger asChild>\n        <ContextMeter share={used / limit} />\n      </Popup.Trigger>\n      <Popup.Container side=\"top\" align=\"start\" aria-label=\"Context\" className=\"ws-block-utility w-[18rem]\">\n        <Popup.Content contentClassName=\"gap-ws-9 flex flex-col\">\n          <div className=\"gap-ws-5 flex flex-col\">\n            <div className=\"gap-ws-3 flex flex-col\">\n              <h3 className=\"typography-label-sm text-ws-static-subtle\">Context</h3>\n              <p className=\"gap-ws-3 flex items-baseline tabular-nums\">\n                <span className=\"typography-subtitle-sm text-ws-static-strong\">\n                  {tokens.format(used)}\n                </span>\n                <span className=\"typography-body-md text-ws-static-subtle\">\n                  / {tokens.format(limit)} tokens\n                </span>\n              </p>\n            </div>\n            <ProgressBar\n              value={used}\n              max={limit}\n              aria-label={`Context: ${tokens.format(used)} of ${tokens.format(limit)} tokens`}\n            />\n            <p className=\"typography-caption-md text-ws-static-subtle\">\n              The conversation is compacted by itself when it is nearly full.\n            </p>\n          </div>\n          <dl className=\"typography-body-md gap-ws-3 flex flex-col\">\n            {parts.map((part) => (\n              <div key={part.label} className=\"gap-ws-7 flex items-baseline justify-between\">\n                <dt className=\"text-ws-static-subtle\">{part.label}</dt>\n                <dd className=\"text-ws-static-base tabular-nums\">{tokens.format(part.tokens)}</dd>\n              </div>\n            ))}\n          </dl>\n          {/* Offered only when something compacts: a button that does nothing is not offered. */}\n          {onCompact && (\n            <Popup.Close asChild>\n              <Button\n                variant=\"secondary\"\n                preset=\"border\"\n                size=\"sm\"\n                className=\"w-full\"\n                onClick={onCompact}\n              >\n                Compact now\n              </Button>\n            </Popup.Close>\n          )}\n        </Popup.Content>\n      </Popup.Container>\n    </Popup>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/copy-button.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/copy-button.tsx",
      "content": "'use client';\n\n// TODO(custom): a copy action that confirms in place (its icon turns into a check for a moment); Wideset has no copy button.\nimport { RiCheckLine, RiFileCopyLine } from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport { type IconButtonProps } from '@/components/ui/wideset/button/IconButton.types';\nimport { useEffect, useState } from 'react';\n\nimport { IconAction } from './icon-action';\nimport { SWAP } from './motion';\n\n/** How long the check stays before the copy icon comes back, in milliseconds. */\nconst SHOWN = 1600;\n\ntype CopyButtonProps = {\n  /** What goes to the clipboard, worked out only when asked for. */\n  text: () => string;\n  label?: string;\n  size?: IconButtonProps['size'];\n  /** Under an answer or in a code block: the icon in the subtle colour. */\n  quiet?: boolean;\n  /** Where the tooltip opens: under the button in a pane's bar. */\n  side?: 'top' | 'bottom';\n};\n\n/**\n * Copy, answered by the button itself: the icon grows into a check and the name reads \"Copied\"\n * for a moment, then both go back, with the same said aloud. A copy that did not happen says\n * \"Copy failed\" the same way. No toast: the result shows where the hand already is.\n */\nexport function CopyButton({\n  text,\n  label = 'Copy',\n  size = 'xs',\n  quiet = false,\n  side = 'top',\n}: CopyButtonProps) {\n  const [result, setResult] = useState<'copied' | 'failed'>();\n  const copied = result === 'copied';\n  const said = copied ? 'Copied' : result === 'failed' ? 'Copy failed' : undefined;\n\n  useEffect(() => {\n    if (!result) return;\n    const id = window.setTimeout(() => setResult(undefined), SHOWN);\n    return () => window.clearTimeout(id);\n  }, [result]);\n\n  return (\n    <>\n      <IconAction\n        label={said ?? label}\n        icon={copied ? RiCheckLine : RiFileCopyLine}\n        iconClassName={cn(quiet && 'text-ws-static-subtle', copied && SWAP)}\n        size={size}\n        side={side}\n        onClick={async () => {\n          // \"Copied\" only once the text is there: an insecure page, a denied permission, a test\n          // with no clipboard or a text that cannot be worked out says the copy failed instead.\n          try {\n            await navigator.clipboard.writeText(text());\n            setResult('copied');\n          } catch {\n            setResult('failed');\n          }\n        }}\n      />\n      <span role=\"status\" className=\"sr-only\">\n        {said ?? ''}\n      </span>\n    </>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/data.ts",
      "content": "import { codeGroups as sessions, withThread } from './canon';\nimport { csvExport } from './session-data';\n\n/*\n  This block opens in Code, on the canon's session \"CSV export for bookings\" in `lumen-app`: its\n  turns in full are in `session-data.ts`. Everything else (the account, the models, the chats and\n  the other sessions) is the canon's.\n*/\n\n/** The session that opens with the block, and whose work the pane shows. */\nexport const OPEN_SESSION = 'csv-export';\n\n/**\n * The canon's sessions, with this block's session in full in its place. It waits for Ines, so it\n * says so; the mark gives way to the pull request once she has answered.\n */\nexport const codeGroups = withThread(sessions, OPEN_SESSION, (thread) => ({\n  ...thread,\n  state: 'needs-you',\n  turns: csvExport,\n}));\n"
    },
    {
      "path": "src/blocks/agent-code/files-code.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/files-code.tsx",
      "content": "'use client';\n\n// TODO(custom): a file's text to read (line numbers, colouring, the changed lines marked in the gutter); Wideset has no code view.\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { Change, RepoFile } from './files-data';\nimport { type Token, TOKEN_COLOUR, tokenize } from './highlight';\n\nconst CODE = 'typography-body-md tracking-ws-normal font-ws-mono whitespace-pre';\n\n/** The bar beside a changed line, as editors draw it: green for a new line, blue for a changed one. */\nconst BAR: Record<Change, string> = {\n  added: 'bg-ws-semantic-inverse-positive',\n  modified: 'bg-ws-semantic-inverse-info',\n};\n\n/**\n * The open file, read only: its lines numbered, coloured by the tokenizer (prose is left plain)\n * and, between the numbers and the code, a bar beside every line the session added or changed.\n * Long lines scroll sideways under numbers that stay put; the region takes the focus, so the\n * keyboard scrolls it too. The numbers and bars are not read aloud: the file's header says how\n * many lines changed.\n */\nexport function FilesCode({ file }: { file: RepoFile }) {\n  const name = file.path.slice(file.path.lastIndexOf('/') + 1);\n  // Prose has nothing to colour: a line of it is one plain run.\n  const tokensOf = (text: string): Token[] =>\n    name.endsWith('.md') ? [{ kind: 'plain', start: 0, text }] : tokenize(text);\n\n  return (\n    <div\n      role=\"region\"\n      aria-label={`Contents of ${name}`}\n      // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- a scrolling region must be reachable by keyboard\n      tabIndex={0}\n      className=\"focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default ws-scrollbar min-h-0 flex-1 overflow-auto -outline-offset-2\"\n    >\n      <div className=\"py-ws-5 flex min-h-full w-max min-w-full\">\n        <div\n          aria-hidden=\"true\"\n          className={cn(\n            CODE,\n            'bg-ws-static-foreground text-ws-static-subtle z-ws-base left-ws-0 sticky text-right tabular-nums select-none',\n          )}\n        >\n          {file.lines.map((line, index) => (\n            <div key={index} className=\"flex\">\n              <span className=\"pl-ws-11 pr-ws-5 flex-1\">{index + 1}</span>\n              <span className={cn('w-ws-2 shrink-0', line.change && BAR[line.change])} />\n            </div>\n          ))}\n        </div>\n        <pre className={cn(CODE, 'pl-ws-7 pr-ws-11 min-w-0 flex-1')}>\n          <code>\n            {file.lines.map((line, index) => (\n              <span key={index} className=\"block\">\n                {/* An empty line still takes its height. */}\n                {line.text === ''\n                  ? ' '\n                  : tokensOf(line.text).map((token) => (\n                      <span key={token.start} className={TOKEN_COLOUR[token.kind]}>\n                        {token.text}\n                      </span>\n                    ))}\n              </span>\n            ))}\n          </code>\n        </pre>\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/files-data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/files-data.ts",
      "content": "'use client';\n\n/** The repository the session works in. */\nexport const REPOSITORY = 'lumen-app';\n\n/** How the session changed a file or a line since `main`. */\nexport type Change = 'added' | 'modified';\n\nexport type Line = { text: string; change?: Change };\n\n/** A file of the repository: its path from the root, how the session changed it, its lines. */\nexport type RepoFile = { path: string; change?: Change; lines: Line[] };\n\n/** A source as it is typed below: between the backticks, one line break in from each end. */\nconst linesOf = (source: string) => source.slice(1, -1).split('\\n');\n\nconst unchanged = (path: string, source: string): RepoFile => ({\n  path,\n  lines: linesOf(source).map((text) => ({ text })),\n});\n\n/** A file that is not on `main`: every line of it is new. */\nconst added = (path: string, source: string): RepoFile => ({\n  path,\n  change: 'added',\n  lines: linesOf(source).map((text) => ({ text, change: 'added' })),\n});\n\nconst MARKS: Record<string, Change> = { '+': 'added', '~': 'modified' };\n\n/**\n * A file changed since `main`, typed with a mark in its first column, as a diff has: `+` a line\n * put in, `~` a line that took the place of others, a space for a line left alone.\n */\nconst modified = (path: string, source: string): RepoFile => ({\n  path,\n  change: 'modified',\n  lines: linesOf(source).map((line) => ({ text: line.slice(1), change: MARKS[line[0]] })),\n});\n\n/*\n  The five files the session changed read, line for line, as the diff in the Changes pane leaves\n  them (+148 −7 in all); the rest is the project around them.\n*/\n\nconst BOOKINGS_EXPORT_SPEC = String.raw`\nimport { expect, test } from '@playwright/test';\n\n// What the export names its file, with the day it was made:\n// bookings-2026-11-10.csv\nconst FILE_NAME = /^bookings-.+\\.csv$/;\n\ntest.describe('bookings export', () => {\n  test.beforeEach(async ({ page }) => {\n    await page.goto('/bookings');\n    await expect(page.getByRole('heading', { name: 'Bookings' })).toBeVisible();\n  });\n\n  test('downloads the file', async ({ page }) => {\n    // Listen first: the download starts the moment the button is pressed.\n    const download = page.waitForEvent('download');\n\n    await page.getByRole('button', { name: 'Export CSV' }).click();\n\n    const file = await download;\n    expect(file.suggestedFilename()).toMatch(FILE_NAME);\n  });\n});\n`;\n\nconst BOOKINGS_SPEC = String.raw`\nimport { expect, test } from '@playwright/test';\n\ntest.describe('bookings', () => {\n  test('lists the bookings for today', async ({ page }) => {\n    await page.goto('/bookings');\n\n    await expect(page.getByRole('heading', { name: 'Bookings' })).toBeVisible();\n    await expect(page.getByRole('row')).not.toHaveCount(0);\n  });\n\n  test('filters by room', async ({ page }) => {\n    await page.goto('/bookings');\n\n    await page.getByLabel('Rooms').click();\n    await page.getByRole('option', { name: 'Atlas' }).click();\n\n    await expect(page.getByRole('cell', { name: 'Cedar' })).toHaveCount(0);\n  });\n});\n`;\n\nconst BOOKINGS_PAGE = String.raw`\n'use client';\n\nimport { BookingsTable } from '@/features/bookings/bookings-table';\n\nexport default function BookingsPage() {\n  return <BookingsTable />;\n}\n`;\n\nconst LAYOUT = String.raw`\nimport type { Metadata } from 'next';\nimport type { ReactNode } from 'react';\n\nimport '@lumen/ui/styles.css';\n\nexport const metadata: Metadata = {\n  title: 'Lumen bookings',\n  description: 'Who has which room, and when.',\n};\n\nexport default function RootLayout({ children }: { children: ReactNode }) {\n  return (\n    <html lang=\"en\">\n      <body>{children}</body>\n    </html>\n  );\n}\n`;\n\nconst BOOKINGS_TABLE_TEST = String.raw`\nimport { render, screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { describe, expect, it, vi } from 'vitest';\n\nimport { BookingsTable } from './bookings-table';\nimport type { Booking } from './types';\n\nconst at = (time: string) => new Date('2026-11-10T' + time + ':00Z');\n\nconst bookings = [\n  { id: 'BK-2041', room: { name: 'Atlas', floor: 3 }, startsAt: at('09:00'), endsAt: at('09:45') },\n  { id: 'BK-2042', room: { name: 'Cedar', floor: 2 }, startsAt: at('09:30'), endsAt: at('10:30') },\n] as Booking[];\n\nconst useBookings = vi.hoisted(() => vi.fn());\nvi.mock('./use-bookings', () => ({ useBookings }));\n\ndescribe('BookingsTable', () => {\n  it('shows a row for each booking', () => {\n    useBookings.mockReturnValue({ bookings, loading: false });\n    render(<BookingsTable />);\n    expect(screen.getAllByRole('row')).toHaveLength(3);\n  });\n\n  it('names the page', () => {\n    useBookings.mockReturnValue({ bookings, loading: false });\n    render(<BookingsTable />);\n    expect(screen.getByRole('heading', { name: 'Bookings' })).toBeVisible();\n  });\n\n  it('says it is loading', () => {\n    useBookings.mockReturnValue({ bookings: [], loading: true });\n    render(<BookingsTable />);\n    expect(screen.getByRole('status')).toHaveTextContent('Loading');\n  });\n\n  it('narrows the rows to the search', async () => {\n    useBookings.mockReturnValue({ bookings, loading: false });\n    render(<BookingsTable />);\n    await userEvent.type(screen.getByRole('searchbox'), 'cedar');\n    expect(screen.queryByRole('cell', { name: 'Atlas' })).toBeNull();\n  });\n\n  it('narrows the rows to a room', async () => {\n    useBookings.mockReturnValue({ bookings, loading: false });\n    render(<BookingsTable />);\n    await userEvent.click(screen.getByLabelText('Rooms'));\n    await userEvent.click(screen.getByRole('option', { name: 'Atlas' }));\n    expect(screen.queryByRole('cell', { name: 'Cedar' })).toBeNull();\n  });\n\n  it('brings every row back when the filters are cleared', async () => {\n    useBookings.mockReturnValue({ bookings, loading: false });\n    render(<BookingsTable />);\n    await userEvent.type(screen.getByRole('searchbox'), 'cedar');\n    await userEvent.click(screen.getByRole('button', { name: 'Clear filters' }));\n    expect(screen.getAllByRole('row')).toHaveLength(3);\n  });\n});\n`;\n\nconst BOOKINGS_TABLE = String.raw`\n import { DataTable } from '@lumen/ui';\n~import { useCallback, useMemo, useState } from 'react';\n~\n~import { downloadFile } from '@/lib/download';\n~import { formatTimestamp } from '@/lib/format-date';\n\n import { BookingsToolbar } from './bookings-toolbar';\n import { COLUMNS } from './columns';\n+import { exportBookingsCsv } from './export-csv';\n import { applyFilters, NO_FILTERS } from './filters';\n import { useBookings } from './use-bookings';\n\n~/** Every room's bookings, with search, filters and CSV export. */\n export function BookingsTable() {\n   const { bookings, loading } = useBookings();\n   const [filters, setFilters] = useState(NO_FILTERS);\n\n   const rows = useMemo(\n     () => applyFilters(bookings, filters),\n     [bookings, filters],\n   );\n\n+  const handleExport = useCallback(() => {\n+    const csv = exportBookingsCsv(rows);\n+    const day = formatTimestamp(new Date()).slice(0, 10);\n+    downloadFile('bookings-' + day + '.csv', csv, 'text/csv');\n+  }, [rows]);\n+\n   return (\n     <section aria-labelledby=\"bookings-title\">\n       <h1 id=\"bookings-title\">Bookings</h1>\n~      <BookingsToolbar\n~        filters={filters}\n~        onChange={setFilters}\n~        onExport={handleExport}\n~        exportDisabled={rows.length === 0}\n~      />\n       <DataTable columns={COLUMNS} rows={rows} loading={loading} />\n     </section>\n   );\n }\n`;\n\nconst BOOKINGS_TOOLBAR_TEST = String.raw`\nimport { render, screen } from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport { describe, expect, it, vi } from 'vitest';\n\nimport { BookingsToolbar } from './bookings-toolbar';\nimport { NO_FILTERS } from './filters';\n\nfunction renderToolbar(filters = NO_FILTERS) {\n  const onChange = vi.fn();\n  render(<BookingsToolbar filters={filters} onChange={onChange} />);\n  return onChange;\n}\n\ndescribe('BookingsToolbar', () => {\n  it('reports what is typed in the search', async () => {\n    const onChange = renderToolbar();\n    await userEvent.type(screen.getByRole('searchbox'), 'a');\n    expect(onChange).toHaveBeenCalledWith({ ...NO_FILTERS, query: 'a' });\n  });\n\n  it('shows the rooms picked', () => {\n    renderToolbar({ ...NO_FILTERS, rooms: ['Atlas'] });\n    expect(screen.getByLabelText('Rooms')).toHaveTextContent('Atlas');\n  });\n\n  it('clears the filters', async () => {\n    const onChange = renderToolbar({ query: 'cedar', rooms: ['Atlas'] });\n    await userEvent.click(screen.getByRole('button', { name: 'Clear filters' }));\n    expect(onChange).toHaveBeenCalledWith(NO_FILTERS);\n  });\n});\n`;\n\nconst BOOKINGS_TOOLBAR = String.raw`\n import { Button, SearchField } from '@lumen/ui';\n\n import { type BookingFilters, NO_FILTERS } from './filters';\n import { RoomFilter } from './room-filter';\n\n type Props = {\n   filters: BookingFilters;\n   onChange: (filters: BookingFilters) => void;\n+  onExport: () => void;\n+  /** True when there is nothing to export. */\n+  exportDisabled?: boolean;\n };\n\n /** Search and filters over the bookings table. */\n~export function BookingsToolbar({\n~  filters,\n~  onChange,\n~  onExport,\n~  exportDisabled,\n~}: Props) {\n   return (\n     <div className=\"flex items-center gap-ws-3\">\n       <SearchField\n         value={filters.query}\n         placeholder=\"Search bookings\"\n         onChange={(query) => onChange({ ...filters, query })}\n       />\n       <RoomFilter\n         value={filters.rooms}\n         onChange={(rooms) => onChange({ ...filters, rooms })}\n       />\n       <Button variant=\"ghost\" onClick={() => onChange(NO_FILTERS)}>\n         Clear filters\n       </Button>\n+      <Button disabled={exportDisabled} onClick={onExport}>\n+        Export CSV\n+      </Button>\n     </div>\n   );\n }\n`;\n\nconst COLUMNS = String.raw`\nimport type { Column } from '@lumen/ui';\n\nimport { formatDay, formatTimeRange } from '@/lib/format-date';\n\nimport type { Booking } from './types';\n\n/** The columns of the bookings table, left to right. */\nexport const COLUMNS: Column<Booking>[] = [\n  { header: 'Room', cell: (booking) => booking.room.name },\n  { header: 'Host', cell: (booking) => booking.host.name },\n  { header: 'Day', cell: (booking) => formatDay(booking.startsAt) },\n  { header: 'Time', cell: (booking) => formatTimeRange(booking.startsAt, booking.endsAt) },\n  { header: 'Attendees', cell: (booking) => booking.attendees.length, align: 'end' },\n  { header: 'Status', cell: (booking) => booking.status },\n];\n`;\n\nconst EXPORT_CSV_TEST = String.raw`\nimport { describe, expect, it } from 'vitest';\n\nimport { escapeField, exportBookingsCsv } from './export-csv';\nimport type { Booking } from './types';\n\nconst booking: Booking = {\n  id: 'BK-2041',\n  room: { name: 'Atlas', floor: 3 },\n  host: { name: 'Priya Raman', email: 'priya@lumenstudio.co' },\n  startsAt: new Date('2026-11-10T09:00:00Z'),\n  endsAt: new Date('2026-11-10T09:45:00Z'),\n  attendees: ['jonas@lumenstudio.co', 'elena@lumenstudio.co'],\n  repeats: false,\n  status: 'confirmed',\n  note: 'Hub 2 demo, bring the adapter',\n};\n\ndescribe('exportBookingsCsv', () => {\n  it('writes a header line and a line for each booking', () => {\n    const lines = exportBookingsCsv([booking]).split('\\r\\n');\n    expect(lines).toHaveLength(3);\n    expect(lines[0]).toContain('Booking,Room,Floor,Host,Email');\n    expect(lines[1]).toContain('BK-2041,Atlas,3,Priya Raman');\n  });\n\n  it('writes start times as UTC ISO strings', () => {\n    const [head, row] = exportBookingsCsv([booking]).split('\\r\\n');\n    const col = head.split(',').indexOf('Starts');\n    const cells = row.split(',');\n    // 10:00 at the office, an hour ahead of UTC.\n    expect(cells[col]).toBe('2026-11-10T09:00:00Z');\n  });\n});\n\ndescribe('escapeField', () => {\n  it('quotes a field with a comma', () => {\n    expect(escapeField('Demo, Hub 2')).toBe('\"Demo, Hub 2\"');\n  });\n\n  it('doubles the quotes inside a quoted field', () => {\n    expect(escapeField('a \"big\" room')).toBe('\"a \"\"big\"\" room\"');\n  });\n\n  it('keeps a formula from running', () => {\n    expect(escapeField('=SUM(A1:A9)')).toBe(\"'=SUM(A1:A9)\");\n    expect(escapeField('-2 seats')).toBe(\"'-2 seats\");\n  });\n});\n`;\n\nconst EXPORT_CSV = String.raw`\nimport { formatTimestamp } from '@/lib/format-date';\n\nimport type { Booking } from './types';\n\n/** A column: its header and what a booking puts under it. */\ntype Column = {\n  header: string;\n  value: (booking: Booking) => string | number;\n};\n\n/** The columns, in the order the finance team reads them. */\nconst COLUMNS: Column[] = [\n  { header: 'Booking', value: (b) => b.id },\n  { header: 'Room', value: (b) => b.room.name },\n  { header: 'Floor', value: (b) => b.room.floor },\n  { header: 'Host', value: (b) => b.host.name },\n  { header: 'Email', value: (b) => b.host.email },\n  { header: 'Starts', value: (b) => formatTimestamp(b.startsAt) },\n  { header: 'Ends', value: (b) => formatTimestamp(b.endsAt) },\n  { header: 'Attendees', value: (b) => b.attendees.length },\n  { header: 'Repeats', value: (b) => (b.repeats ? 'Yes' : 'No') },\n  { header: 'Status', value: (b) => b.status },\n  { header: 'Note', value: (b) => b.note ?? '' },\n];\n\n/** Without this mark Excel misreads UTF-8 names. */\nconst BOM = '\\uFEFF';\n\n/** RFC 4180 ends every line with CRLF. */\nconst LINE_BREAK = '\\r\\n';\n\n/** Text that starts like this runs as a formula in Excel. */\nconst FORMULA = /^[=+\\-@]/;\n\n/**\n * One value as a CSV field. Text that could run as a formula\n * gets a leading apostrophe. A field with a comma or a quote\n * is quoted, and the quotes inside it are doubled.\n */\nexport function escapeField(value: string | number): string {\n  if (typeof value === 'number') return String(value);\n  const text = FORMULA.test(value) ? \"'\" + value : value;\n  const needsQuotes = text.includes(',') || text.includes('\"');\n  if (!needsQuotes) return text;\n  return '\"' + text.replaceAll('\"', '\"\"') + '\"';\n}\n\n/** One line of the file: its fields, escaped and joined. */\nfunction toLine(fields: (string | number)[]): string {\n  return fields.map(escapeField).join(',');\n}\n\n/**\n * The bookings as CSV text: a header line, then a line for each\n * booking, in the order given. Dates are UTC ISO strings, so the\n * file reads the same in every time zone.\n */\nexport function exportBookingsCsv(bookings: Booking[]): string {\n  const header = toLine(COLUMNS.map((column) => column.header));\n  const lines = bookings.map((booking) =>\n    toLine(COLUMNS.map((column) => column.value(booking))),\n  );\n  return BOM + [header, ...lines].join(LINE_BREAK) + LINE_BREAK;\n}\n`;\n\nconst FILTERS = String.raw`\nimport type { Booking } from './types';\n\nexport type BookingFilters = {\n  /** What was typed in the search field. */\n  query: string;\n  /** Room names; none means every room. */\n  rooms: string[];\n};\n\nexport const NO_FILTERS: BookingFilters = { query: '', rooms: [] };\n\n/** The bookings that match the search and sit in one of the rooms picked. */\nexport function applyFilters(bookings: Booking[], filters: BookingFilters): Booking[] {\n  const query = filters.query.trim().toLowerCase();\n  return bookings.filter((booking) => {\n    const inRoom = filters.rooms.length === 0 || filters.rooms.includes(booking.room.name);\n    const text = [booking.id, booking.room.name, booking.host.name].join(' ').toLowerCase();\n    return inRoom && text.includes(query);\n  });\n}\n`;\n\nconst ROOM_FILTER = String.raw`\nimport { MultiSelect } from '@lumen/ui';\n\nimport { useRooms } from '@/features/rooms/use-rooms';\n\ntype Props = {\n  value: string[];\n  onChange: (rooms: string[]) => void;\n};\n\n/** Narrows the table to the rooms picked; none picked means every room. */\nexport function RoomFilter({ value, onChange }: Props) {\n  const { rooms } = useRooms();\n  return (\n    <MultiSelect\n      label=\"Rooms\"\n      options={rooms.map((room) => room.name)}\n      value={value}\n      onChange={onChange}\n    />\n  );\n}\n`;\n\nconst TYPES = String.raw`\nexport type BookingStatus = 'confirmed' | 'tentative' | 'cancelled';\n\nexport type Room = { name: string; floor: number };\n\nexport type Host = { name: string; email: string };\n\n/** A room held for a stretch of time. Its dates are moments, not times on a wall clock. */\nexport type Booking = {\n  id: string;\n  room: Room;\n  host: Host;\n  startsAt: Date;\n  endsAt: Date;\n  /** The addresses of the people invited. */\n  attendees: string[];\n  repeats: boolean;\n  status: BookingStatus;\n  note?: string;\n};\n`;\n\nconst USE_BOOKINGS = String.raw`\nimport { useEffect, useState } from 'react';\n\nimport { getJson } from '@/lib/api-client';\n\nimport type { Booking } from './types';\n\n/** A booking as the API sends it: its dates as ISO strings. */\ntype BookingJson = Omit<Booking, 'startsAt' | 'endsAt'> & { startsAt: string; endsAt: string };\n\nconst toBooking = (json: BookingJson): Booking => ({\n  ...json,\n  startsAt: new Date(json.startsAt),\n  endsAt: new Date(json.endsAt),\n});\n\n/** Every room's bookings, loaded once when the page opens. */\nexport function useBookings() {\n  const [bookings, setBookings] = useState<Booking[]>([]);\n  const [loading, setLoading] = useState(true);\n\n  useEffect(() => {\n    let current = true;\n    getJson<BookingJson[]>('/bookings')\n      .then((rows) => current && setBookings(rows.map(toBooking)))\n      .finally(() => current && setLoading(false));\n    return () => {\n      current = false;\n    };\n  }, []);\n\n  return { bookings, loading };\n}\n`;\n\nconst USE_ROOMS = String.raw`\nimport { useEffect, useState } from 'react';\n\nimport type { Room } from '@/features/bookings/types';\nimport { getJson } from '@/lib/api-client';\n\n/** The rooms of the workspace, by name. */\nexport function useRooms() {\n  const [rooms, setRooms] = useState<Room[]>([]);\n\n  useEffect(() => {\n    let current = true;\n    getJson<Room[]>('/rooms').then((rows) => {\n      if (current) setRooms(rows.sort((a, b) => a.name.localeCompare(b.name)));\n    });\n    return () => {\n      current = false;\n    };\n  }, []);\n\n  return { rooms };\n}\n`;\n\nconst API_CLIENT = String.raw`\nconst BASE_URL = process.env.NEXT_PUBLIC_API_URL ?? '/api';\n\n/** Reads JSON from the Lumen API, or throws with the status when the request fails. */\nexport async function getJson<T>(path: string): Promise<T> {\n  const response = await fetch(BASE_URL + path, { headers: { Accept: 'application/json' } });\n  if (!response.ok) throw new Error('GET ' + path + ' failed with ' + response.status);\n  return (await response.json()) as T;\n}\n`;\n\nconst DOWNLOAD = String.raw`\n/** Hands text to the browser as a file to save, then frees the object URL. */\nexport function downloadFile(name: string, text: string, type: string): void {\n  const url = URL.createObjectURL(new Blob([text], { type }));\n\n  const link = document.createElement('a');\n  link.href = url;\n  link.download = name;\n  link.click();\n\n  URL.revokeObjectURL(url);\n}\n`;\n\nconst FORMAT_DATE = String.raw`\n import { format } from 'date-fns';\n\n /** A time of day as the tables show it: 9:00 AM. */\n export function formatTime(date: Date): string {\n   return format(date, 'h:mm a');\n }\n\n /** A stretch of one day, as the tables show it: 9:00 to 9:45 AM. */\n export function formatTimeRange(start: Date, end: Date): string {\n   const sameHalf = format(start, 'a') === format(end, 'a');\n   const first = format(start, sameHalf ? 'h:mm' : 'h:mm a');\n   const last = formatTime(end);\n   return first + ' to ' + last;\n }\n\n /** A day as the tables show it: Nov 10, 2026. */\n export function formatDay(date: Date): string {\n   return format(date, 'MMM d, yyyy');\n }\n\n~/**\n~ * A moment for a file name or an export: UTC to the second, as\n~ * 2026-11-10T09:00:00Z, wherever the file is written.\n~ */\n export function formatTimestamp(date: Date): string {\n~  if (Number.isNaN(date.getTime())) return '';\n~  return date.toISOString().slice(0, 19) + 'Z';\n }\n\n /** Whether two moments fall on the same calendar day. */\n export function isSameDay(a: Date, b: Date): boolean {\n   return formatDay(a) === formatDay(b);\n }\n`;\n\nconst NEXT_CONFIG = String.raw`\nimport type { NextConfig } from 'next';\n\nconst config: NextConfig = {\n  reactStrictMode: true,\n  transpilePackages: ['@lumen/ui'],\n};\n\nexport default config;\n`;\n\nconst PACKAGE_JSON = String.raw`\n{\n  \"name\": \"lumen-app\",\n  \"version\": \"3.8.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"dev\": \"next dev\",\n    \"build\": \"next build\",\n    \"lint\": \"eslint .\",\n    \"typecheck\": \"tsc --noEmit\",\n    \"test\": \"vitest run\",\n    \"test:e2e\": \"playwright test\"\n  },\n  \"dependencies\": {\n    \"@lumen/ui\": \"^4.2.0\",\n    \"date-fns\": \"^4.1.0\",\n    \"next\": \"^15.1.0\",\n    \"react\": \"^19.0.0\",\n    \"react-dom\": \"^19.0.0\"\n  },\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.49.0\",\n    \"@testing-library/react\": \"^16.1.0\",\n    \"@testing-library/user-event\": \"^14.5.2\",\n    \"typescript\": \"^5.7.2\",\n    \"vitest\": \"^2.1.8\"\n  }\n}\n`;\n\nconst PLAYWRIGHT_CONFIG = String.raw`\nimport { defineConfig } from '@playwright/test';\n\nexport default defineConfig({\n  testDir: './e2e',\n  timeout: 30000,\n  retries: process.env.CI ? 2 : 0,\n  use: {\n    baseURL: 'http://localhost:3000',\n    trace: 'on-first-retry',\n  },\n  webServer: {\n    command: 'pnpm dev',\n    url: 'http://localhost:3000',\n    reuseExistingServer: !process.env.CI,\n  },\n});\n`;\n\nconst README = String.raw`\n# lumen-app\n\nThe booking app for Lumen Display and Lumen Hub: who has which room, and when.\n\n## Develop\n\n    pnpm install\n    pnpm dev\n\nThe app runs on http://localhost:3000.\n\n## Test\n\n    pnpm test        unit tests\n    pnpm test:e2e    end to end, against the dev server\n`;\n\nconst TSCONFIG = String.raw`\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"bundler\",\n    \"jsx\": \"preserve\",\n    \"strict\": true,\n    \"noEmit\": true,\n    \"incremental\": true,\n    \"paths\": { \"@/*\": [\"./src/*\"] }\n  },\n  \"include\": [\"next-env.d.ts\", \"**/*.ts\", \"**/*.tsx\"],\n  \"exclude\": [\"node_modules\", \"**/*.test.ts\", \"**/*.test.tsx\"]\n}\n`;\n\n/** Every file of the repository, by path; the tree sorts them. */\nexport const FILES: RepoFile[] = [\n  unchanged('e2e/bookings-export.spec.ts', BOOKINGS_EXPORT_SPEC),\n  unchanged('e2e/bookings.spec.ts', BOOKINGS_SPEC),\n  unchanged('src/app/bookings/page.tsx', BOOKINGS_PAGE),\n  unchanged('src/app/layout.tsx', LAYOUT),\n  unchanged('src/features/bookings/bookings-table.test.tsx', BOOKINGS_TABLE_TEST),\n  modified('src/features/bookings/bookings-table.tsx', BOOKINGS_TABLE),\n  unchanged('src/features/bookings/bookings-toolbar.test.tsx', BOOKINGS_TOOLBAR_TEST),\n  modified('src/features/bookings/bookings-toolbar.tsx', BOOKINGS_TOOLBAR),\n  unchanged('src/features/bookings/columns.ts', COLUMNS),\n  added('src/features/bookings/export-csv.test.ts', EXPORT_CSV_TEST),\n  added('src/features/bookings/export-csv.ts', EXPORT_CSV),\n  unchanged('src/features/bookings/filters.ts', FILTERS),\n  unchanged('src/features/bookings/room-filter.tsx', ROOM_FILTER),\n  unchanged('src/features/bookings/types.ts', TYPES),\n  unchanged('src/features/bookings/use-bookings.ts', USE_BOOKINGS),\n  unchanged('src/features/rooms/use-rooms.ts', USE_ROOMS),\n  unchanged('src/lib/api-client.ts', API_CLIENT),\n  unchanged('src/lib/download.ts', DOWNLOAD),\n  modified('src/lib/format-date.ts', FORMAT_DATE),\n  unchanged('next.config.ts', NEXT_CONFIG),\n  unchanged('package.json', PACKAGE_JSON),\n  unchanged('playwright.config.ts', PLAYWRIGHT_CONFIG),\n  unchanged('README.md', README),\n  unchanged('tsconfig.json', TSCONFIG),\n];\n\n/** The file open when the pane does: the one the session wrote first. */\nexport const OPEN_ON_LOAD = 'src/features/bookings/export-csv.ts';\n\n/** Folders folded when the pane opens: the ones the session has not been in. */\nexport const FOLDED_ON_LOAD = ['e2e', 'src/app', 'src/features/rooms'];\n\n/** A path as the folders it sits in and its own name. */\nexport function splitPath(path: string) {\n  const folders = path.split('/');\n  const name = folders.pop() ?? path;\n  return { folders, name };\n}\n"
    },
    {
      "path": "src/blocks/agent-code/files-open-file.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/files-open-file.tsx",
      "content": "'use client';\n\nimport { RiChatCheckLine, RiChatNewLine } from '@remixicon/react';\nimport { Breadcrumbs } from '@/components/ui/wideset/breadcrumbs/Breadcrumbs';\n\nimport { BarAction } from './bar-action';\nimport { CopyButton } from './copy-button';\nimport { FilesCode } from './files-code';\nimport { type Change, type RepoFile, splitPath } from './files-data';\n\n/** What the session did to the file, for those who cannot see the gutter. */\nfunction summaryOf(file: RepoFile) {\n  const count = (change: Change) => file.lines.filter((line) => line.change === change).length;\n  if (file.change === 'added') return `New file, ${file.lines.length} lines added`;\n  if (file.change === 'modified')\n    return `${count('added')} lines added, ${count('modified')} changed`;\n  return 'Not changed in this session';\n}\n\ntype FilesOpenFileProps = {\n  file: RepoFile;\n  /** Whether the file is attached to the session's next message. */\n  inConversation: boolean;\n  onConversationChange: (inConversation: boolean) => void;\n  /** A folder of the path was picked: the tree shows it. */\n  onReveal: (folder: string) => void;\n};\n\n/**\n * The file open under the tree: a row with its path as breadcrumbs (a folder picked there is\n * shown in the tree) and, at the end, the two things done with a file here, then its text. Both\n * actions are quiet icon buttons with a tooltip, since the row must hold the whole path in a pane\n * 28rem wide; if a path still runs out of room it is its start that is cut, never the file's\n * name. Adding the file to the conversation is a state, so its button shows it and takes the\n * file out again.\n */\nexport function FilesOpenFile({\n  file,\n  inConversation,\n  onConversationChange,\n  onReveal,\n}: FilesOpenFileProps) {\n  const { folders, name } = splitPath(file.path);\n  const conversationLabel = inConversation\n    ? 'Remove from the conversation'\n    : 'Add to the conversation';\n\n  return (\n    <section aria-label={name} className=\"flex min-h-0 flex-1 flex-col\">\n      <div className=\"h-ws-16 gap-ws-5 pl-ws-7 pr-ws-9 border-ws-static-subtle flex shrink-0 items-center border-b\">\n        <div className=\"flex min-w-0 flex-1\">\n          {/* Only as wide as the path; when the row is narrower, the path's end stays in view. */}\n          <div className=\"flex max-w-full justify-end overflow-hidden\">\n            <Breadcrumbs separator=\"slash\" aria-label=\"Path\" className=\"shrink-0\">\n              {folders.map((folder, index) => (\n                <Breadcrumbs.Item\n                  key={folders.slice(0, index + 1).join('/')}\n                  onClick={() => onReveal(folders.slice(0, index + 1).join('/'))}\n                >\n                  {folder}\n                </Breadcrumbs.Item>\n              ))}\n              <Breadcrumbs.Item>{name}</Breadcrumbs.Item>\n            </Breadcrumbs>\n          </div>\n        </div>\n        <p className=\"sr-only\">{summaryOf(file)}</p>\n        <div className=\"gap-ws-2 flex shrink-0 items-center\">\n          <CopyButton key={file.path} label=\"Copy path\" side=\"bottom\" text={() => file.path} />\n          <BarAction\n            icon={inConversation ? RiChatCheckLine : RiChatNewLine}\n            label={conversationLabel}\n            onClick={() => onConversationChange(!inConversation)}\n          />\n          <span role=\"status\" className=\"sr-only\">\n            {inConversation ? `${name} is in the conversation` : ''}\n          </span>\n        </div>\n      </div>\n      <FilesCode key={file.path} file={file} />\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/files-pane.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/files-pane.tsx",
      "content": "'use client';\n\nimport { useState } from 'react';\n\nimport { FILES, OPEN_ON_LOAD } from './files-data';\nimport { FilesOpenFile } from './files-open-file';\nimport { FilesTree, type Reveal } from './files-tree';\n\n/**\n * The Files pane: the repository as a tree, and under it the file picked there. They are stacked,\n * not side by side, because the pane is 28rem to 48rem wide and code needs the whole of that;\n * the tree takes what its rows need, up to half the pane, and scrolls past it. The session's\n * changes show in both: marked in the tree, and line by line in the open file's gutter.\n */\ntype FilesPaneProps = {\n  /** The files on the composer's tray, by path. */\n  attachments: string[];\n  onAttach: (path: string) => void;\n  onDetach: (path: string) => void;\n};\n\nexport function FilesPane({ attachments, onAttach, onDetach }: FilesPaneProps) {\n  const [open, setOpen] = useState(OPEN_ON_LOAD);\n  const [reveal, setReveal] = useState<Reveal>();\n  const file = FILES.find((candidate) => candidate.path === open) ?? FILES[0];\n\n  return (\n    <div className=\"flex min-h-0 flex-1 flex-col\">\n      <FilesTree files={FILES} active={file.path} onOpen={setOpen} reveal={reveal} />\n      <FilesOpenFile\n        file={file}\n        // In the conversation: on the tray, sent with the next message.\n        inConversation={attachments.includes(file.path)}\n        onConversationChange={(added) => (added ? onAttach(file.path) : onDetach(file.path))}\n        onReveal={(path) => setReveal((current) => ({ path, key: (current?.key ?? 0) + 1 }))}\n      />\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/files-tree.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/files-tree.tsx",
      "content": "'use client';\n\n// TODO(custom): the repository as a tree with a filter over it (folders that fold, the open file selected, changed files marked and their folders with them); Wideset has no tree view.\nimport {\n  RiArrowDownSLine,\n  RiArrowRightSLine,\n  RiBracesLine,\n  RiCodeSSlashLine,\n  RiFolderLine,\n  RiFolderOpenLine,\n  RiMarkdownLine,\n  RiSearchLine,\n} from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { type ReactNode, useEffect, useId, useState } from 'react';\n\nimport { type Change, FOLDED_ON_LOAD, type RepoFile, REPOSITORY } from './files-data';\n\nconst ROW =\n  'gap-ws-3 px-ws-5 h-ws-13 rounded-ws-control-lg typography-label-sm hover:bg-ws-dynamic-tertiary-alpha-strong-default focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default flex w-full cursor-pointer items-center text-left';\n/** A level in: the guide line sits under the chevron above, the rows start under its icon. */\nconst NESTED = 'ml-ws-9 pl-ws-3 border-ws-static-subtle border-l';\nconst ICON = 'size-ws-9 text-ws-static-subtle shrink-0';\n/** The column at the end of a row that a change's mark sits in, so letters and dots line up. */\nconst MARK = 'w-ws-9 flex shrink-0 items-center justify-center';\n\n/** How a change is marked on a file: git's letter, in the colour of its meaning. */\nconst LETTER: Record<Change, { letter: string; label: string; className: string }> = {\n  added: { letter: 'A', label: 'added', className: 'text-ws-semantic-positive' },\n  modified: { letter: 'M', label: 'modified', className: 'text-ws-semantic-info' },\n};\n\n/** A quiet glyph for the kind of file: prose, data or code. */\nconst iconOf = (name: string) =>\n  name.endsWith('.md') ? RiMarkdownLine : name.endsWith('.json') ? RiBracesLine : RiCodeSSlashLine;\n\n/** Folders first, then files, each by name, as an editor's explorer lists them. */\nconst byName = (a: string, b: string) => a.localeCompare(b, 'en-US', { sensitivity: 'base' });\n\n/** A folder to show in the tree; `key` asks again for the same one. */\nexport type Reveal = { path: string; key: number };\n\ntype FilesTreeProps = {\n  files: RepoFile[];\n  /** The path of the file open under the tree. */\n  active: string;\n  onOpen: (path: string) => void;\n  reveal?: Reveal;\n};\n\n/**\n * The repository, the pane's main thing: a filter in the pane's toolbar row and the tree under it.\n * Folders fold with a chevron; a file is a button that opens it under the tree and takes the\n * selected fill, the neutral one the sidebar's current row has. What the session changed carries\n * git's letter at the end of its row, green for a new file and blue for a changed one, and every\n * folder above it a dot, so a change shows however much of the tree is folded. Typing narrows the\n * tree to the files whose path matches, with their folders open.\n */\nexport function FilesTree({ files, active, onOpen, reveal }: FilesTreeProps) {\n  const id = useId();\n  const [query, setQuery] = useState('');\n  const [folded, setFolded] = useState(FOLDED_ON_LOAD);\n\n  const needle = query.trim().toLowerCase();\n  const shown = files.filter((file) => file.path.toLowerCase().includes(needle));\n  // A filter opens every folder it found something in.\n  const isOpen = (path: string) => needle !== '' || !folded.includes(path);\n  const toggle = (path: string) =>\n    setFolded(folded.includes(path) ? folded.filter((p) => p !== path) : [...folded, path]);\n\n  // The file open on load is in view however short the pane is; one opened later was clicked\n  // in the tree, so it is in view already.\n  const [openOnLoad] = useState(active);\n  useEffect(() => {\n    document.getElementById(`${id}-${openOnLoad}`)?.scrollIntoView?.({ block: 'nearest' });\n  }, [id, openOnLoad]);\n\n  // A folder picked in the open file's path: the filter goes, the folders above it open and its\n  // row takes the focus, which also brings it into view.\n  useEffect(() => {\n    if (!reveal) return;\n    setQuery('');\n    setFolded((paths) => paths.filter((path) => !`${reveal.path}/`.startsWith(`${path}/`)));\n    const frame = requestAnimationFrame(() =>\n      document.getElementById(`${id}-${reveal.path}`)?.focus(),\n    );\n    return () => cancelAnimationFrame(frame);\n  }, [reveal, id]);\n\n  const fileRow = (file: RepoFile) => {\n    const name = file.path.slice(file.path.lastIndexOf('/') + 1);\n    const Icon = iconOf(name);\n    const mark = file.change && LETTER[file.change];\n    return (\n      <li key={file.path}>\n        <button\n          type=\"button\"\n          id={`${id}-${file.path}`}\n          aria-current={file.path === active ? 'true' : undefined}\n          onClick={() => onOpen(file.path)}\n          className={cn(\n            ROW,\n            'text-ws-static-strong aria-[current=true]:bg-ws-dynamic-tertiary-alpha-strong-default',\n          )}\n        >\n          {/* No chevron on a file: the space keeps its icon in line with a folder's. */}\n          <span aria-hidden=\"true\" className=\"size-ws-9 shrink-0\" />\n          <Icon aria-hidden=\"true\" className={ICON} />\n          <span className=\"ml-ws-2 min-w-0 flex-1 truncate\">{name}</span>\n          {mark && (\n            <span className={cn(MARK, 'typography-caption-strong-md', mark.className)}>\n              <span aria-hidden=\"true\">{mark.letter}</span>\n              <span className=\"sr-only\">, {mark.label}</span>\n            </span>\n          )}\n        </button>\n      </li>\n    );\n  };\n\n  /** The rows under a folder (`prefix` ends with its slash; the root's is empty). */\n  const rows = (prefix: string): ReactNode[] => {\n    const inside = shown.filter((file) => file.path.startsWith(prefix));\n    const isFile = (file: RepoFile) => !file.path.slice(prefix.length).includes('/');\n    const folders = new Set(\n      inside\n        .filter((file) => !isFile(file))\n        .map((file) => file.path.slice(prefix.length).split('/')[0]),\n    );\n    return [\n      ...[...folders].sort(byName).map((name) => folderRow(name, prefix + name)),\n      ...inside\n        .filter(isFile)\n        .sort((a, b) => byName(a.path, b.path))\n        .map(fileRow),\n    ];\n  };\n\n  const folderRow = (name: string, path: string) => {\n    const open = isOpen(path);\n    const Chevron = open ? RiArrowDownSLine : RiArrowRightSLine;\n    const Icon = open ? RiFolderOpenLine : RiFolderLine;\n    const changed = files.some((file) => file.change && file.path.startsWith(`${path}/`));\n    return (\n      <li key={path}>\n        <button\n          type=\"button\"\n          id={`${id}-${path}`}\n          aria-expanded={open}\n          onClick={() => toggle(path)}\n          className={cn(ROW, 'text-ws-static-base')}\n        >\n          <Chevron aria-hidden=\"true\" className={ICON} />\n          <Icon aria-hidden=\"true\" className={ICON} />\n          <span className=\"ml-ws-2 min-w-0 flex-1 truncate\">{name}</span>\n          {changed && (\n            <span className={MARK}>\n              <span className=\"bg-ws-semantic-inverse-info size-ws-4 rounded-ws-control-full\" />\n              <span className=\"sr-only\">, has changes</span>\n            </span>\n          )}\n        </button>\n        {open && <ul className={NESTED}>{rows(`${path}/`)}</ul>}\n      </li>\n    );\n  };\n\n  return (\n    // ponytail: every row is a tab stop; arrow keys over one stop (a `tree` role) once the tree\n    // is a library component.\n    <nav\n      aria-label={`Files in ${REPOSITORY}`}\n      className=\"border-ws-static-base flex max-h-[50%] shrink-0 flex-col border-b\"\n    >\n      <div className=\"h-ws-16 px-ws-7 border-ws-static-subtle flex shrink-0 items-center border-b\">\n        <TextInput\n          size=\"sm\"\n          preset=\"ghost\"\n          className=\"w-full\"\n          value={query}\n          onChange={(event) => setQuery(event.target.value)}\n        >\n          <TextInput.Prefix inner>\n            <TextInput.Icon icon={RiSearchLine} />\n          </TextInput.Prefix>\n          <TextInput.Input type=\"search\" placeholder=\"Filter files\" aria-label=\"Filter files\" />\n          <TextInput.Suffix inner>\n            <TextInput.ClearButton aria-label=\"Clear filter\" />\n          </TextInput.Suffix>\n        </TextInput>\n      </div>\n\n      <div className=\"px-ws-7 py-ws-5 ws-scrollbar min-h-0 flex-1 overflow-y-auto\">\n        {shown.length > 0 ? (\n          <ul>{rows('')}</ul>\n        ) : (\n          <p role=\"status\" className=\"typography-body-sm text-ws-static-subtle px-ws-5 py-ws-4\">\n            No files match “{query.trim()}”\n          </p>\n        )}\n      </div>\n    </nav>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/fold.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/fold.tsx",
      "content": "'use client';\n\n// TODO(custom): content that folds open and shut under a transcript row; Accordion folds only under its own titled trigger, and the library exports no bare collapsible.\nimport { cn } from '@/lib/wideset/utils';\nimport { type ReactNode, useEffect, useRef } from 'react';\n\n/**\n * What a row opens to. The height runs on a one-row grid going from `0fr` to `1fr`, so it needs\n * no measuring; it opens at the `fast` beat and shuts at `quick`, as menus do. Shut, the content\n * stays in the page but is inert: out of the tab order and unseen by a screen reader.\n */\nexport function Fold({ open, children }: { open: boolean; children: ReactNode }) {\n  const content = useRef<HTMLDivElement>(null);\n  // Set on the element, not as a prop: React 18 drops a boolean `inert` attribute.\n  useEffect(() => {\n    if (content.current) content.current.inert = !open;\n  }, [open]);\n\n  return (\n    <div\n      className={cn(\n        'grid transition-[grid-template-rows,opacity] ease-(--ws-motion-ease-smooth-out)',\n        open\n          ? 'grid-rows-[1fr] opacity-100 duration-(--ws-motion-duration-fast)'\n          : 'grid-rows-[0fr] opacity-0 duration-(--ws-motion-duration-quick)',\n      )}\n    >\n      <div ref={content} className=\"min-h-0 overflow-hidden\">\n        {children}\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/format.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/format.ts",
      "content": "/**\n * A length of time, the one way every agent screen writes it (a run, a thought, a check, a task):\n * \"12s\", \"1m 4s\", \"24m 5s\", then hours and minutes, \"1h 5m\". It keeps its seconds below an hour\n * so a running count never looks stopped.\n */\nexport function formatDuration(seconds: number): string {\n  const minutes = Math.floor(seconds / 60);\n  if (minutes >= 60) return `${Math.floor(minutes / 60)}h ${minutes % 60}m`;\n  return minutes > 0 ? `${minutes}m ${seconds % 60}s` : `${seconds}s`;\n}\n"
    },
    {
      "path": "src/blocks/agent-code/highlight.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/highlight.ts",
      "content": "// TODO(custom): a small TypeScript tokenizer and its colours, for the diff and the open file; Wideset has no code or diff component.\n\nexport type TokenKind = 'comment' | 'string' | 'number' | 'keyword' | 'plain';\n\n/** A run of one line's text, from `start`, and what it is. */\nexport type Token = { kind: TokenKind; start: number; text: string };\n\n/*\n  One alternation, tried left to right at each place: a comment wins over everything inside it,\n  then a string (its closing quote optional, so an unclosed one still reads as a string), a\n  number, a keyword. What matches none of them is plain code. `type` counts only where it\n  declares or imports a type, so an attribute or a property called `type` stays plain.\n*/\nconst TOKEN =\n  /(\\/\\/.*|\\/\\*.*?\\*\\/)|('(?:\\\\.|[^'\\\\])*'?|\"(?:\\\\.|[^\"\\\\])*\"?|`(?:\\\\.|[^`\\\\])*`?)|(\\b\\d+(?:\\.\\d+)?\\b)|(\\b(?:as|async|await|break|case|catch|class|const|default|else|enum|export|extends|false|for|from|function|if|import|in|interface|let|new|null|of|return|switch|throw|true|try|typeof|undefined|var|void|while|type(?=\\s+[\\w${]))\\b)/g;\n\nconst KIND: TokenKind[] = ['comment', 'string', 'number', 'keyword'];\n\n/** A line inside a block comment: it opens one, or goes on with the comment's leading star. */\nconst IN_BLOCK_COMMENT = /^\\s*(?:\\/\\*|\\*(?:\\s|\\/|$))/;\n\n/**\n * One line of TypeScript as runs of comment, string, number, keyword and plain code. Line by\n * line, because a diff shows lines out of their file: a hunk can start in the middle of anything.\n * The Files pane reads whole files the same way, so a line is coloured alike in both.\n */\nexport function tokenize(line: string): Token[] {\n  // ponytail: a line is read on its own, so a block comment is known only by its leading star\n  // (a wrapped multiplication would read as one) and a template string spanning lines colours\n  // as code after its first line; a real lexer over the whole file if that shows.\n  if (IN_BLOCK_COMMENT.test(line)) return [{ kind: 'comment', start: 0, text: line }];\n  const tokens: Token[] = [];\n  let at = 0;\n  for (const match of line.matchAll(TOKEN)) {\n    const start = match.index;\n    if (start > at) tokens.push({ kind: 'plain', start: at, text: line.slice(at, start) });\n    tokens.push({ kind: KIND[match.slice(1).findIndex(Boolean)], start, text: match[0] });\n    at = start + match[0].length;\n  }\n  if (at < line.length) tokens.push({ kind: 'plain', start: at, text: line.slice(at) });\n  return tokens;\n}\n\n/**\n * The colours of code, the same in every pane: keywords take the info colour, literals (strings\n * and numbers) the notice colour, comments the quiet grey. Green and red are kept for what was\n * added and removed, so a string never reads as a change.\n */\nexport const TOKEN_COLOUR: Record<TokenKind, string> = {\n  keyword: 'text-ws-semantic-info',\n  string: 'text-ws-semantic-notice',\n  number: 'text-ws-semantic-notice',\n  comment: 'text-ws-static-subtle',\n  plain: 'text-ws-static-strong',\n};\n"
    },
    {
      "path": "src/blocks/agent-code/home.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/home.tsx",
      "content": "'use client';\n\nimport { RiGitBranchLine, RiGitRepositoryLine } from '@remixicon/react';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { Chip } from '@/components/ui/wideset/chip/Chip';\nimport { Select } from '@/components/ui/wideset/select/Select';\nimport { useState } from 'react';\n\nimport {\n  account,\n  branches,\n  efforts,\n  files,\n  models,\n  permissions,\n  product,\n  repositories,\n  starters,\n} from './canon';\nimport { ChatTools } from './chat-tools';\nimport { CodeTools } from './code-tools';\nimport { Composer } from './composer';\nimport type { Mode, Workplace } from './model';\nimport { ModelMenu } from './model-menu';\n\ntype HomeProps = {\n  mode: Mode;\n  /** Code: the repository the session starts in, the one whose `+` was pressed. */\n  repository?: string;\n  /** Starts the thread with its first message, the files attached to it and, in Code, where. */\n  onSend: (text: string, attachments?: string[], workplace?: Workplace) => void;\n};\n\n/**\n * A new chat or session: the agent's orb (the one place it shows), a small greeting with one\n * quiet line under it, then the composer in the middle of the page, where the eye lands, with\n * the mode's tools, the model and the effort. No gradient text and no glow: the composer is the\n * page, not the greeting. Code asks first where the work happens: the repository and the branch.\n * Under the composer, a few ways to start; picking one writes its opening words into the\n * composer and leaves the cursor at their end.\n */\nexport function Home({ mode, repository: chosen, onSend }: HomeProps) {\n  const [starter, setStarter] = useState({ text: '', id: 0 });\n  const [attached, setAttached] = useState<string[]>([]);\n  const [repository, setRepository] = useState(\n    chosen && repositories.includes(chosen) ? chosen : repositories[0],\n  );\n  const [branch, setBranch] = useState(branches[0]);\n  const code = mode === 'code';\n\n  // From the tray as it is now, so Add files twice in a row adds two.\n  const attach = () =>\n    setAttached((current) => {\n      const next = files.find((name) => !current.includes(name));\n      return next ? [...current, next] : current;\n    });\n\n  return (\n    <div className=\"ws-scrollbar min-h-0 flex-1 overflow-y-auto\">\n      <div className=\"gap-ws-12 px-ws-11 py-ws-14 mx-auto flex min-h-full w-full max-w-[44rem] flex-col justify-center\">\n        <div className=\"gap-ws-9 px-ws-5 flex flex-col items-start\">\n          <Avatar agent size=\"lg\" alt=\"\" />\n          <div className=\"gap-ws-3 flex flex-col\">\n            <h1 className=\"typography-title-md text-ws-static-strong\">\n              Good morning, {account.name.split(' ')[0]}\n            </h1>\n            <p className=\"typography-body-md text-ws-static-subtle\">\n              {code\n                ? 'Choose where the work happens, then say what to change.'\n                : 'Ask a question, hand over a task, or pick a way to start.'}\n            </p>\n          </div>\n        </div>\n\n        <div className=\"gap-ws-7 flex flex-col\">\n          {code && (\n            <div className=\"gap-ws-5 px-ws-3 flex\">\n              <Select\n                size=\"sm\"\n                aria-label=\"Repository\"\n                className=\"w-[14rem]\"\n                options={repositories.map((value) => ({\n                  value,\n                  label: value,\n                  prefix: <RiGitRepositoryLine className=\"size-ws-9\" />,\n                }))}\n                value={repository}\n                onValueChange={setRepository}\n              />\n              <Select\n                size=\"sm\"\n                aria-label=\"Branch\"\n                className=\"w-[16rem]\"\n                options={branches.map((value) => ({\n                  value,\n                  label: value,\n                  prefix: <RiGitBranchLine className=\"size-ws-9\" />,\n                }))}\n                value={branch}\n                onValueChange={setBranch}\n              />\n            </div>\n          )}\n          <Composer\n            label={`Message ${product}`}\n            placeholder={code ? 'Describe the change' : `How can ${product} help?`}\n            draft={starter}\n            attachments={attached}\n            onDetach={(index) => {\n              const name = attached[index];\n              setAttached((current) => current.filter((item) => item !== name));\n            }}\n            tools={\n              code ? (\n                <CodeTools permissions={permissions} onAttach={attach} />\n              ) : (\n                <ChatTools onAttach={attach} />\n              )\n            }\n            model={<ModelMenu models={models} efforts={efforts} />}\n            roomy\n            onSend={(text) =>\n              onSend(\n                text,\n                attached.length > 0 ? attached : undefined,\n                code ? { repository, branch } : undefined,\n              )\n            }\n          />\n          <div role=\"group\" aria-label=\"Ways to start\" className=\"gap-ws-3 px-ws-3 flex flex-wrap\">\n            {starters[mode].map(({ label, icon, prompt }) => (\n              <Chip key={label} variant=\"secondary\" style=\"border\">\n                <Chip.Action\n                  onClick={() => setStarter((current) => ({ text: prompt, id: current.id + 1 }))}\n                >\n                  <Chip.Icon icon={icon} />\n                  <Chip.Label>{label}</Chip.Label>\n                </Chip.Action>\n              </Chip>\n            ))}\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/icon-action.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/icon-action.tsx",
      "content": "'use client';\n\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { type IconButtonProps } from '@/components/ui/wideset/button/IconButton.types';\nimport { Tooltip } from '@/components/ui/wideset/tooltip/Tooltip';\nimport { forwardRef } from 'react';\n\ntype IconActionProps = Omit<IconButtonProps, 'aria-label'> & {\n  /** The action's name: the button's accessible name and the text of its tooltip. */\n  label: string;\n  side?: 'top' | 'right' | 'bottom' | 'left';\n};\n\n/**\n * An icon-only action with its name in a tooltip, so no icon in a bar or under an answer has to\n * be guessed: a ghost `IconButton` at the bar's 32px unless told otherwise. It forwards its ref\n * and props, so it can also be the trigger of a menu.\n */\nexport const IconAction = forwardRef<HTMLButtonElement, IconActionProps>(\n  ({ label, side = 'top', ...props }, ref) => (\n    <Tooltip size=\"sm\">\n      <Tooltip.Trigger asChild>\n        <IconButton\n          ref={ref}\n          variant=\"secondary\"\n          preset=\"ghost\"\n          size=\"sm\"\n          aria-label={label}\n          {...props}\n        />\n      </Tooltip.Trigger>\n      <Tooltip.Content className=\"ws-block-utility\" side={side}>\n        <Tooltip.Label>{label}</Tooltip.Label>\n      </Tooltip.Content>\n    </Tooltip>\n  ),\n);\n\nIconAction.displayName = 'IconAction';\n"
    },
    {
      "path": "src/blocks/agent-code/index.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/index.tsx",
      "content": "'use client';\n\nimport '@/styles/wideset-blocks.css';\n\nimport {\n  RiArrowRightLine,\n  RiFileEditLine,\n  RiGitBranchLine,\n  RiGitPullRequestLine,\n  RiLayoutRightLine,\n  RiRestartLine,\n} from '@remixicon/react';\nimport { AppShell } from '@/components/ui/wideset/app-shell/AppShell';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';\nimport { useEffect, useId, useState } from 'react';\n\nimport {\n  account,\n  chatGroups,\n  context,\n  efforts,\n  fallback,\n  files,\n  models,\n  permissions,\n  product,\n  workspace,\n} from './canon';\nimport { ChangeCounts } from './changes-counts';\nimport { FILES } from './changes-data';\nimport type { Reveal } from './changes-pane';\nimport { ChatTools } from './chat-tools';\nimport { PULL_REQUEST } from './checks-data';\nimport { CodePane, type Pane } from './code-pane';\nimport { CodeTools } from './code-tools';\nimport { codeGroups, OPEN_SESSION } from './data';\nimport { Home } from './home';\nimport { IconAction } from './icon-action';\nimport type { TranscriptView } from './model';\nimport { ModelMenu } from './model-menu';\nimport { PaneCard } from './pane-card';\nimport { PaneLink } from './pane-link';\nimport { PlanCard } from './plan-card';\nimport { Session } from './session';\nimport { plan } from './session-data';\nimport { AgentSidebar } from './sidebar';\nimport { ThreadMenu } from './thread-menu';\nimport { TopBar } from './top-bar';\nimport { useShell } from './use-shell';\n\nexport type { Pane } from './code-pane';\n\nconst ADDED = FILES.reduce((sum, file) => sum + file.added, 0);\nconst REMOVED = FILES.reduce((sum, file) => sum + file.removed, 0);\n\n/**\n * Agent code (Inset direction): Tandem in Code mode. The sidebar on the grey frame lists the\n * sessions by repository, with \"CSV export for bookings\" open. One raised card holds the rest:\n * the session (its transcript and composer) and, behind a vertical line in the same card, the\n * pane with what the session works on: Changes, Terminal, Preview, Files, Tasks, Checks. Each\n * half has its own 48px bar, so their lines meet, and each scrolls inside itself. `pane` picks\n * the pane open on load.\n *\n * The session's bar says where you are (the repository and the session) and, while it has the\n * room, where the work happens: the branch and the branch it goes into. It holds the pull\n * request with its state, Replay, the thread's menu with the transcript views, and the control\n * that shuts and opens the pane. The transcript and the pane lead to each other: a card or a\n * link in the transcript brings up its pane, a comment in Checks opens its line in Changes, and\n * Fix with Tandem and Ask Tandem to fix write the request into the composer.\n *\n * The block opens at rest, on an approval: Allow once is the screen's filled button. Replay\n * plays the newest turn again from the start, and it stops at the approval again.\n */\nexport default function AgentCode({ pane: initial = 'changes' }: { pane?: Pane }) {\n  const sidebarId = useId();\n  const paneId = useId();\n  const [collapsed, setCollapsed] = useState(false);\n  const [view, setView] = useState<TranscriptView>('normal');\n  const [pane, setPane] = useState<Pane>(initial);\n  const [paneOpen, setPaneOpen] = useState(true);\n  const [reveal, setReveal] = useState<Reveal>();\n\n  const shell = useShell({\n    chat: chatGroups,\n    code: codeGroups,\n    mode: 'code',\n    openId: OPEN_SESSION,\n    reply: fallback,\n    files,\n  });\n  const { mode, thread, session } = shell;\n  /** The pane belongs to the session it shows the work of. */\n  const here = thread?.id === OPEN_SESSION;\n  const paneShown = here && paneOpen ? pane : null;\n\n  // A link to a changed file (`#changes/<path>`) or to one of its lines (`#changes/<path>:<line>`,\n  // as a comment in Checks has) brings up Changes there. The address then goes back to the page's\n  // own, so the same link works a second time.\n  useEffect(() => {\n    const route = () => {\n      const [, path, line] = /^#changes\\/(.+?)(?::(\\d+))?$/.exec(window.location.hash) ?? [];\n      if (!path) return;\n      setPane('changes');\n      setPaneOpen(true);\n      setReveal((last) => ({\n        path,\n        line: line === undefined ? undefined : Number(line),\n        key: (last?.key ?? 0) + 1,\n      }));\n      window.history.replaceState(null, '', window.location.pathname + window.location.search);\n    };\n    window.addEventListener('hashchange', route);\n    return () => window.removeEventListener('hashchange', route);\n  }, []);\n\n  const togglePane = (target: Pane) => {\n    setPaneOpen(paneShown !== target);\n    setPane(target);\n  };\n\n  /** What the session made, and the ways from its transcript to the panes. */\n  const card = (name: string) => {\n    switch (name) {\n      case 'plan':\n        return (\n          <PlanCard steps={plan}>\n            <PaneLink\n              label=\"Open in Tasks\"\n              open={paneShown === 'tasks'}\n              paneId={paneId}\n              onToggle={() => togglePane('tasks')}\n            />\n          </PlanCard>\n        );\n      case 'terminal':\n        return (\n          <div className=\"-ml-ws-3 flex\">\n            <PaneLink\n              label=\"Open in Terminal\"\n              open={paneShown === 'terminal'}\n              paneId={paneId}\n              onToggle={() => togglePane('terminal')}\n            />\n          </div>\n        );\n      case 'changes':\n        return (\n          <PaneCard\n            icon={RiFileEditLine}\n            title={`${FILES.length} files changed`}\n            caption={<ChangeCounts added={ADDED} removed={REMOVED} />}\n            open={paneShown === 'changes'}\n            paneId={paneId}\n            onToggle={() => togglePane('changes')}\n          />\n        );\n      case 'pull-request':\n        return (\n          <PaneCard\n            icon={RiGitPullRequestLine}\n            title={PULL_REQUEST.title}\n            caption={`Pull request #${PULL_REQUEST.number} · ${PULL_REQUEST.state}`}\n            open={paneShown === 'checks'}\n            paneId={paneId}\n            onToggle={() => togglePane('checks')}\n          />\n        );\n    }\n  };\n\n  return (\n    <AppShell className=\"ws-block-utility\" direction=\"inset\">\n      <AgentSidebar\n        id={sidebarId}\n        collapsed={collapsed}\n        onCollapsedChange={setCollapsed}\n        product={product}\n        workspace={workspace}\n        account={account}\n        {...shell.sidebar}\n      />\n\n      <AppShell.Main className=\"flex-row overflow-hidden\">\n        <div className=\"flex min-w-0 flex-1 flex-col\">\n          <TopBar\n            sidebarId={sidebarId}\n            collapsed={collapsed}\n            onCollapsedChange={setCollapsed}\n            crumbs={shell.crumbs}\n            meta={\n              here && (\n                <>\n                  <RiGitBranchLine aria-hidden className=\"size-ws-8 shrink-0\" />\n                  <span className=\"font-ws-mono truncate\">{PULL_REQUEST.head}</span>\n                  <RiArrowRightLine role=\"img\" aria-label=\"into\" className=\"size-ws-8 shrink-0\" />\n                  <span className=\"font-ws-mono shrink-0\">{PULL_REQUEST.base}</span>\n                </>\n              )\n            }\n          >\n            {here && (\n              <Button\n                variant=\"secondary\"\n                preset=\"ghost\"\n                size=\"sm\"\n                aria-label={`#${PULL_REQUEST.number} ${PULL_REQUEST.state} pull request: open its checks`}\n                aria-expanded={paneShown === 'checks'}\n                aria-controls={paneId}\n                onClick={() => togglePane('checks')}\n              >\n                <Button.Icon icon={RiGitPullRequestLine} />\n                <span className=\"tabular-nums\">#{PULL_REQUEST.number}</span>\n                <StatusBadge size=\"sm\">{PULL_REQUEST.state}</StatusBadge>\n              </Button>\n            )}\n            {thread && (\n              <>\n                <IconAction\n                  label=\"Replay\"\n                  icon={RiRestartLine}\n                  side=\"bottom\"\n                  onClick={() => session.replay()}\n                />\n                <ThreadMenu view={view} onViewChange={setView} />\n              </>\n            )}\n            {here && (\n              <IconAction\n                label={paneOpen ? 'Close pane' : 'Open pane'}\n                icon={RiLayoutRightLine}\n                iconClassName=\"text-ws-static-subtle size-ws-9\"\n                side=\"bottom\"\n                aria-expanded={paneOpen}\n                aria-controls={paneId}\n                onClick={() => setPaneOpen((value) => !value)}\n              />\n            )}\n          </TopBar>\n\n          {thread ? (\n            <Session\n              session={session}\n              threadId={thread.id}\n              agent={product}\n              view={view}\n              card={card}\n              tools={\n                mode === 'chat' ? (\n                  <ChatTools onAttach={shell.attach} />\n                ) : (\n                  <CodeTools\n                    permissions={permissions}\n                    // A session whose plan was approved goes on in Accept edits, where edits go\n                    // through and a command still asks.\n                    defaultPermission={here ? permissions[1] : undefined}\n                    context={context}\n                    onAttach={shell.attach}\n                  />\n                )\n              }\n              model={<ModelMenu models={models} efforts={efforts} />}\n            />\n          ) : (\n            <Home\n              key={`${mode}-${shell.newIn ?? ''}`}\n              mode={mode}\n              repository={shell.newIn}\n              onSend={shell.begin}\n            />\n          )}\n        </div>\n\n        {/* Closed, the pane stays mounted and hidden: what was done in it is there on reopening. */}\n        {here && (\n          <CodePane\n            id={paneId}\n            pane={pane}\n            hidden={!paneOpen}\n            onPaneChange={setPane}\n            reveal={reveal}\n            // A request from a pane goes into the composer, for Ines to send as it is or change.\n            onAsk={session.write}\n            attachments={session.attachments}\n            onAttach={session.attach}\n            onDetach={(path) => session.detach(session.attachments.indexOf(path))}\n          />\n        )}\n      </AppShell.Main>\n    </AppShell>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/inline.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/inline.tsx",
      "content": "'use client';\n\n// TODO(custom): inline marks in a line of text (code and strong); Wideset has no rich text or Code component.\nimport { cn } from '@/lib/wideset/utils';\nimport { Fragment } from 'react';\n\ntype InlineProps = {\n  text: string;\n  /**\n   * Names in a label rather than in prose (a task's title, a subtitle under it): code keeps the\n   * colour of its line and stays in one piece when the line wraps, so a file is never broken at\n   * its hyphen.\n   */\n  plain?: boolean;\n};\n\n/**\n * A line with its marks drawn: `code` in backticks takes the monospace face, as the article\n * block's inline code does (no chip behind it, so a row of steps stays quiet), and **strong** in\n * asterisks takes the strong colour and weight.\n */\nexport function Inline({ text, plain = false }: InlineProps) {\n  // A mark still open at the end (a text streaming in) already counts, so its signs never show.\n  return text.split(/(`[^`]*`?|\\*\\*[^*]*(?:\\*\\*)?)/).map((part, index) =>\n    part.startsWith('`') ? (\n      <code\n        key={index}\n        className={cn(\n          'font-ws-mono',\n          plain ? 'tracking-ws-normal whitespace-nowrap' : 'text-ws-static-strong',\n        )}\n      >\n        {part.replace(/^`|`$/g, '')}\n      </code>\n    ) : part.startsWith('**') ? (\n      <strong key={index} className=\"font-ws-medium text-ws-static-strong\">\n        {part.replace(/^\\*\\*|\\*\\*$/g, '')}\n      </strong>\n    ) : (\n      <Fragment key={index}>{part}</Fragment>\n    ),\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/keyboard-key.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/keyboard-key.tsx",
      "content": "'use client';\n\n// TODO(custom): keyboard keys (a key chip, and a shortcut as a row of them); Wideset has no Kbd / shortcut component, so the key is the box of Button `xs` Border drawn by hand.\nimport { type RemixiconComponentType, RiCornerDownLeftLine } from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport { useSyncExternalStore } from 'react';\n\nconst never = () => () => {};\nconst apple = () => (/Mac|iPhone|iPad/.test(navigator.userAgent) ? '⌘' : 'Ctrl');\n\n/**\n * ⌘ on Apple keyboards, Ctrl elsewhere. The server, which has no keyboard, renders Ctrl and the\n * browser corrects it after hydration, so a server-rendered page does not mismatch.\n */\nexport const useModifier = () => useSyncExternalStore(never, apple, () => 'Ctrl');\n\n/** Keys drawn as a glyph rather than spelled out. */\nconst GLYPHS: Record<string, RemixiconComponentType> = { Enter: RiCornerDownLeftLine };\n\n/**\n * A key as a `kbd`, 24px high, copied from the command palette's hints. An icon key names itself\n * for screen readers.\n */\nexport function Key({\n  icon: Icon,\n  name,\n  children,\n}: {\n  icon?: RemixiconComponentType;\n  name?: string;\n  children?: string;\n}) {\n  return (\n    <kbd\n      className={cn(\n        'font-ws-body border-ws-dynamic-secondary-default bg-ws-static-highlight-subtle shadow-ws-controls-control rounded-ws-control-md h-ws-12 typography-caption-strong-md text-ws-dynamic-secondary-default flex shrink-0 items-center justify-center border',\n        Icon || children?.length === 1 ? 'min-w-ws-12' : 'px-ws-5',\n      )}\n    >\n      {Icon ? (\n        <>\n          <Icon aria-hidden=\"true\" className=\"size-ws-8 shrink-0\" />\n          <span className=\"sr-only\">{name}</span>\n        </>\n      ) : (\n        children\n      )}\n    </kbd>\n  );\n}\n\n/**\n * A shortcut as the keys pressed together, on the right of a menu row. The keys are text in the\n * row, so a screen reader reads them after its label.\n */\nexport function Shortcut({ keys }: { keys: string[] }) {\n  return (\n    <span className=\"gap-ws-2 flex\">\n      {keys.map((key) =>\n        GLYPHS[key] ? <Key key={key} icon={GLYPHS[key]} name={key} /> : <Key key={key}>{key}</Key>,\n      )}\n    </span>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/menu-choice.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/menu-choice.tsx",
      "content": "'use client';\n\n// TODO(custom): a menu item that is one choice of several, ticked when picked; Wideset exports DropdownMenu.RadioGroup and RadioItem as bare Radix parts with no styling.\nimport { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';\nimport { ListItem } from '@/components/ui/wideset/list-item/ListItem';\nimport type { ReactNode } from 'react';\n\n/**\n * One choice in a `DropdownMenu.RadioGroup` (a workspace, a theme, an account): drawn as\n * `DropdownMenu.Item` draws a row, with `ListItem`'s own tick and selected fill on the one picked,\n * and announced as a radio item, so a screen reader hears which one is on.\n */\nexport function MenuChoice({\n  value,\n  onSelect,\n  children,\n}: {\n  value: string;\n  onSelect?: () => void;\n  children: ReactNode;\n}) {\n  return (\n    <DropdownMenu.RadioItem\n      value={value}\n      onSelect={onSelect}\n      asChild\n      className=\"min-h-ws-14 outline-hidden\"\n    >\n      <ListItem>{children}</ListItem>\n    </DropdownMenu.RadioItem>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/menu-sub.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/menu-sub.tsx",
      "content": "'use client';\n\n// TODO(custom): a submenu (a row with the current value and a chevron, its own panel beside the menu); Wideset exports DropdownMenu.Sub, SubTrigger and SubContent as bare Radix parts with no styling.\nimport { type RemixiconComponentType, RiArrowRightSLine } from '@remixicon/react';\nimport { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';\nimport { ListItem } from '@/components/ui/wideset/list-item/ListItem';\nimport type { ReactNode } from 'react';\n\n/** `DropdownMenu.Content`'s surface, copied so the submenu is drawn as the menu it opens from. */\nconst PANEL =\n  'min-w-ws-28 rounded-ws-container-sm p-ws-3 bg-ws-static-overlay text-ws-dynamic-secondary-default shadow-ws-medium z-ws-popout outline-hidden';\n\ntype MenuSubProps = {\n  icon: RemixiconComponentType;\n  label: string;\n  /** What is chosen inside now, shown quietly before the chevron (\"Match system\"). */\n  value?: string;\n  /** Where the panel portals to: the menu's own container, so it follows the screen's theme. */\n  container?: HTMLElement | null;\n  children: ReactNode;\n};\n\n/**\n * A row that opens a second menu beside the first: hover, → or Enter opens it, ← or Esc goes back.\n * The row is a `ListItem` like every other item, with the choice it holds and a chevron after the\n * label; while its panel is open it keeps the hover fill, so the eye can follow where it came from.\n */\nexport function MenuSub({ icon: Icon, label, value, container, children }: MenuSubProps) {\n  return (\n    <DropdownMenu.Sub>\n      <DropdownMenu.SubTrigger\n        asChild\n        className=\"min-h-ws-14 data-[state=open]:bg-ws-dynamic-secondary-alpha-hover outline-hidden\"\n      >\n        <ListItem>\n          <ListItem.Prefix>\n            <Icon className=\"size-ws-9\" />\n          </ListItem.Prefix>\n          <ListItem.Content>\n            <ListItem.Label>{label}</ListItem.Label>\n          </ListItem.Content>\n          <ListItem.Suffix>\n            {value && <span className=\"text-ws-static-subtle\">{value}</span>}\n            <RiArrowRightSLine aria-hidden=\"true\" className=\"size-ws-9\" />\n          </ListItem.Suffix>\n        </ListItem>\n      </DropdownMenu.SubTrigger>\n      <DropdownMenu.Portal container={container ?? undefined}>\n        <DropdownMenu.SubContent\n          sideOffset={8}\n          alignOffset={-4}\n          collisionPadding={12}\n          className={['ws-block-utility', (PANEL)].filter(Boolean).join(' ')}\n        >\n          {children}\n        </DropdownMenu.SubContent>\n      </DropdownMenu.Portal>\n    </DropdownMenu.Sub>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/message-queue.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/message-queue.tsx",
      "content": "'use client';\n\n// TODO(custom): the messages waiting their turn, as a short list over the composer, each one editable and removable; Wideset has no message or queue part.\nimport { RiCloseLine, RiPencilLine, RiTimeLine } from '@remixicon/react';\n\nimport { IconAction } from './icon-action';\n\ntype MessageQueueProps = {\n  /** In the order they go out. */\n  messages: { id: number; text: string }[];\n  /** Who they wait for: \"Tandem\". */\n  agent: string;\n  /** Takes the message back into the composer to be changed. */\n  onEdit: (index: number) => void;\n  onRemove: (index: number) => void;\n};\n\n/**\n * What you sent while the agent was working: one bordered list attached to the composer, a line\n * a message, in the order they will go out when the run ends. They are not in the transcript\n * yet, because they have not been said yet: each can still be taken back into the composer or\n * removed. Each row is one line; the whole message is its tooltip.\n */\nexport function MessageQueue({ messages, agent, onEdit, onRemove }: MessageQueueProps) {\n  return (\n    <section aria-label=\"Queued messages\" className=\"gap-ws-3 flex flex-col\">\n      <p className=\"typography-label-sm text-ws-static-subtle px-ws-3\">\n        {`Queued, sent in this order when ${agent} is done`}\n      </p>\n      <ol className=\"border-ws-static-base divide-ws-static-base rounded-ws-container-md flex flex-col divide-y border\">\n        {messages.map(({ id, text }, index) => (\n          <li key={id} className=\"gap-ws-5 pl-ws-7 pr-ws-3 min-h-ws-16 flex items-center\">\n            <RiTimeLine aria-hidden className=\"size-ws-9 text-ws-static-subtle shrink-0\" />\n            <span\n              title={text}\n              className=\"typography-body-md text-ws-static-base min-w-0 flex-1 truncate\"\n            >\n              {text}\n            </span>\n            <IconAction\n              label=\"Edit in the composer\"\n              icon={RiPencilLine}\n              iconClassName=\"text-ws-static-subtle\"\n              size=\"xs\"\n              onClick={() => onEdit(index)}\n            />\n            <IconAction\n              label=\"Remove from the queue\"\n              icon={RiCloseLine}\n              iconClassName=\"text-ws-static-subtle\"\n              size=\"xs\"\n              onClick={() => onRemove(index)}\n            />\n          </li>\n        ))}\n      </ol>\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/model-menu.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/model-menu.tsx",
      "content": "'use client';\n\nimport { RiArrowDownSLine } from '@remixicon/react';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';\nimport { ListItem } from '@/components/ui/wideset/list-item/ListItem';\nimport { useState } from 'react';\n\nimport { MenuChoice } from './menu-choice';\nimport type { Model } from './model';\n\ntype ModelMenuProps = {\n  models: Model[];\n  efforts: string[];\n  defaultModel?: string;\n  defaultEffort?: string;\n};\n\n/**\n * The model answering and how hard it thinks, as the bordered button of the AI chat starting\n * point's model switcher, here in the composer, with the chevron of a control that opens a list.\n * It says both (\"Tandem Pro · High\") and opens a menu of the two choices: the models with a line\n * on what each is for, then the effort. It holds its own state: nothing else depends on it.\n */\nexport function ModelMenu({\n  models,\n  efforts,\n  defaultModel = models[0].id,\n  defaultEffort = efforts[efforts.length - 1],\n}: ModelMenuProps) {\n  const [model, setModel] = useState(defaultModel);\n  const [effort, setEffort] = useState(defaultEffort);\n  const { name } = models.find((item) => item.id === model) ?? models[0];\n\n  return (\n    <DropdownMenu>\n      <DropdownMenu.Trigger asChild>\n        <Button\n          variant=\"secondary\"\n          preset=\"border\"\n          size=\"sm\"\n          aria-label={`Model: ${name}, ${effort.toLowerCase()} effort`}\n        >\n          {`${name} · ${effort}`}\n          <Button.Icon icon={RiArrowDownSLine} />\n        </Button>\n      </DropdownMenu.Trigger>\n      <DropdownMenu.Content side=\"top\" align=\"end\" className=\"ws-block-utility w-[16rem]\">\n        <DropdownMenu.Label>Model</DropdownMenu.Label>\n        <DropdownMenu.RadioGroup aria-label=\"Model\" value={model} onValueChange={setModel}>\n          {models.map((item) => (\n            <MenuChoice key={item.id} value={item.id}>\n              <ListItem.Content>\n                <ListItem.Label>{item.name}</ListItem.Label>\n                <ListItem.Description>{item.note}</ListItem.Description>\n              </ListItem.Content>\n            </MenuChoice>\n          ))}\n        </DropdownMenu.RadioGroup>\n        <DropdownMenu.Separator />\n        <DropdownMenu.Label>Effort</DropdownMenu.Label>\n        <DropdownMenu.RadioGroup aria-label=\"Effort\" value={effort} onValueChange={setEffort}>\n          {efforts.map((item) => (\n            <MenuChoice key={item} value={item}>\n              <ListItem.Content>\n                <ListItem.Label>{item}</ListItem.Label>\n              </ListItem.Content>\n            </MenuChoice>\n          ))}\n        </DropdownMenu.RadioGroup>\n      </DropdownMenu.Content>\n    </DropdownMenu>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/model.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/model.ts",
      "content": "/*\n  The model every agent block is written in: threads (chats or sessions) in groups, and each\n  thread's turns. A block's `data.ts` fills these types; the transcript kit draws them, the same\n  way in Chat and in Code.\n*/\n\n/** The two halves of the app: writing, research and analysis, or work in a repository. */\nexport type Mode = 'chat' | 'code';\n\n/** How much of the agent's work the transcript shows. */\nexport type TranscriptView = 'normal' | 'thinking' | 'verbose';\n\n/**\n * Text in an answer or a document. Inside a string, `code` goes in backticks and **strong** in\n * asterisks.\n */\nexport type Prose =\n  | { kind: 'title'; text: string }\n  | { kind: 'heading'; text: string }\n  | { kind: 'paragraph'; text: string }\n  | { kind: 'list'; items: string[] }\n  | { kind: 'code'; language: string; lines: string[] };\n\nexport type StepStatus = 'running' | 'done' | 'failed' | 'waiting' | 'skipped';\n\n/** What a step opens to. A diff line starts with `+`, `-` or a space. */\nexport type StepDetail =\n  | { kind: 'output'; lines: string[]; errors?: number[] }\n  | { kind: 'diff'; lines: string[] }\n  | { kind: 'results'; items: { title: string; source: string }[] };\n\nexport type ApprovalAnswer = 'once' | 'always' | 'denied';\n\n/** The permission a step waits for: what it wants to do, on what, and why. */\nexport type Approval = {\n  title: string;\n  /** The command or path, shown in monospace. */\n  command: string;\n  reason: string;\n  /** Where \"always\" holds: \"this project\", \"this repository\". */\n  scope: string;\n  answer?: ApprovalAnswer;\n};\n\n/** One tool call. `label` is the verb and its object: \"Read `bookings-table.tsx`\". */\nexport type Step = {\n  id: string;\n  label: string;\n  /** The label while it runs: \"Reading `bookings-table.tsx`\". */\n  active?: string;\n  /** The label while it waits to be allowed: \"Run `pnpm test:e2e`\", where `label` says \"Ran\". */\n  pending?: string;\n  /** What came of it, shown quietly at the end: \"14 passed · 3.2s\", \"+18 −4\". */\n  result?: string;\n  status: StepStatus;\n  detail?: StepDetail;\n  approval?: Approval;\n  /**\n   * Something of the block's own under the step, drawn through `card`: what to do about it\n   * (Fix it, Reconnect) or where its whole output is (Open in Terminal).\n   */\n  card?: string;\n  /**\n   * The turn stops once this step has ended, until the block lets it go on (`session.proceed`):\n   * a command that failed and wants a decision. A step that `waiting`s holds the turn before it\n   * runs instead.\n   */\n  holds?: boolean;\n  /** The hold was let go. */\n  released?: boolean;\n  /** As it shows now: the turn stands at this step and waits for you. */\n  holding?: boolean;\n  /** How long it runs when the turn plays, in milliseconds. */\n  ms?: number;\n  /** While it runs: how far it is, from 0 to 1. */\n  progress?: number;\n};\n\n/** One answer the agent offers to its own question, with the fact that decides it. */\nexport type QuestionOption = { value: string; label: string; description?: string };\n\nexport type Block =\n  | { kind: 'reasoning'; id: string; seconds: number; text: string; running?: boolean }\n  | ({ kind: 'step' } & Step)\n  /**\n   * Steps in a row, folded to one line in the Normal view: \"Read 4 files\". `total` is set while\n   * they play or once they were stopped part-way: how many there are in all.\n   */\n  | { kind: 'steps'; id: string; label: string; steps: Step[]; total?: number }\n  | { kind: 'text'; id: string; prose: Prose[]; streaming?: boolean }\n  /**\n   * Something of the block's own (a document, a pull request, a report), drawn by the block.\n   * With `prose` it is written over time like an answer: it streams, stops and is copied with\n   * it. With `holds` the turn stops at it until the block lets it go on (a plan waiting for\n   * Start, a limit reached).\n   */\n  | {\n      kind: 'card';\n      id: string;\n      card: string;\n      prose?: Prose[];\n      streaming?: boolean;\n      holds?: boolean;\n      released?: boolean;\n      holding?: boolean;\n    }\n  /** A decision the agent needs before it goes on. The answer becomes your next message. */\n  | { kind: 'question'; id: string; title: string; options: QuestionOption[]; answer?: string };\n\nexport type CardBlock = Extract<Block, { kind: 'card' }>;\n\n/**\n * What you said, and what it was sent with when that is worth a caption: a tool that explains\n * the answer (\"Research\"), the files attached.\n */\nexport type UserTurn = { id: string; role: 'user'; text: string; sentWith?: string[] };\n\nexport type AgentTurn = {\n  id: string;\n  role: 'agent';\n  blocks: Block[];\n  /** Stopped this far into its run, in milliseconds: the rest was never written. */\n  stoppedAt?: number;\n  /** As it shows now: cut where it was stopped. */\n  stopped?: boolean;\n  /** As it shows now: not finished, held at a step, a question or a card that waits for you. */\n  held?: boolean;\n  rating?: 'up' | 'down';\n};\n\n/** A line across the transcript where something changed for everything after it. */\nexport type DividerTurn = {\n  id: string;\n  role: 'divider';\n  /** \"Earlier messages were summarized\". */\n  label: string;\n  /** What stands in for the turns no longer here: one row that opens to it. */\n  summary?: { label: string; prose: Prose[] };\n};\n\n/**\n * Turn = what you said, or what the agent did about it (its blocks, in the order they happened),\n * or a divider between turns.\n */\nexport type Turn = UserTurn | AgentTurn | DividerTurn;\n\nexport type ThreadState = 'working' | 'needs-you' | 'paused' | 'unread' | 'failed';\n\n/** A chat or a session in the sidebar. */\nexport type Thread = {\n  id: string;\n  title: string;\n  state?: ThreadState;\n  /** Its open pull request and the review comments not yet resolved (Code). */\n  pullRequest?: { number: number; comments: number };\n  /** A fork or a subagent of the thread above it: indented under it. */\n  child?: boolean;\n  /** Code: the branch the session works on, as chosen when it started. */\n  branch?: string;\n  turns: Turn[];\n};\n\n/** Code: where a new session works, as chosen on the new-session screen. */\nexport type Workplace = { repository: string; branch: string };\n\n/** A model to answer with, and a line on what it is for. */\nexport type Model = { id: string; name: string; note: string };\n\n/** How full a session's context is: the tokens in it, how many it holds, what it is made of. */\nexport type Context = { used: number; limit: number; parts: { label: string; tokens: number }[] };\n\n/** A project or a repository and its threads; `fixed` for Recents, which takes no new ones. */\nexport type ThreadGroup = { id: string; label: string; fixed?: boolean; threads: Thread[] };\n"
    },
    {
      "path": "src/blocks/agent-code/motion.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/motion.ts",
      "content": "// TODO(custom): the transcript's motion as class recipes built from the motion tokens; Wideset keeps its recipes inside its components.\n\n/** A part arriving in the transcript (a step, a card, the working line): a few pixels up, fading in. */\nexport const ARRIVE =\n  'animate-in fade-in-0 slide-in-from-bottom-ws-4 duration-(--ws-motion-duration-fast) ease-(--ws-motion-ease-smooth-out)';\n\n/** An icon taking another's place (a spinner's check, Send's Stop, Copy's tick): it fades and grows in. */\nexport const SWAP =\n  'animate-in fade-in-0 zoom-in-75 duration-(--ws-motion-duration-fast) ease-(--ws-motion-ease-in-out)';\n"
    },
    {
      "path": "src/blocks/agent-code/pane-card.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/pane-card.tsx",
      "content": "'use client';\n\n// TODO(custom): something a turn made (a document, its changes, a pull request), as a card in the transcript that opens it in the pane; FileItem is an upload row with a remove action, not a link to a pane.\nimport { type RemixiconComponentType, RiLayoutRightLine } from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport type { ReactNode } from 'react';\n\ntype PaneCardProps = {\n  icon: RemixiconComponentType;\n  title: string;\n  /** One quiet line under the title: what it is and how it stands. */\n  caption: ReactNode;\n  /** Its pane is the one showing. */\n  open: boolean;\n  paneId: string;\n  onToggle: () => void;\n};\n\n/**\n * What a turn made, where the turn made it: a tile with its icon, its name, one line about it.\n * The whole card is one button that brings its pane up beside the session, and closes the pane\n * again; while that pane shows it keeps the quiet fill.\n */\nexport function PaneCard({ icon: Icon, title, caption, open, paneId, onToggle }: PaneCardProps) {\n  return (\n    <button\n      type=\"button\"\n      aria-expanded={open}\n      aria-controls={paneId}\n      onClick={onToggle}\n      className={cn(\n        'border-ws-static-base rounded-ws-container-md gap-ws-7 p-ws-5 pr-ws-7 flex w-full max-w-[24rem] cursor-pointer items-center border text-left',\n        'hover:bg-ws-static-alpha-subtle focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default transition-[background-color] duration-(--ws-motion-duration-quick) ease-(--ws-motion-ease-out)',\n        open && 'bg-ws-static-alpha-subtle',\n      )}\n    >\n      <span className=\"bg-ws-static-alpha-base rounded-ws-control-lg size-ws-16 flex shrink-0 items-center justify-center\">\n        <Icon aria-hidden className=\"size-ws-11 text-ws-static-base\" />\n      </span>\n      <span className=\"flex min-w-0 flex-1 flex-col\">\n        <span className=\"typography-label-strong-sm text-ws-static-strong truncate\">{title}</span>\n        <span className=\"typography-caption-md text-ws-static-subtle truncate\">{caption}</span>\n      </span>\n      <RiLayoutRightLine aria-hidden className=\"size-ws-9 text-ws-static-subtle shrink-0\" />\n    </button>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/pane-link.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/pane-link.tsx",
      "content": "'use client';\n\nimport { RiLayoutRightLine } from '@remixicon/react';\nimport { Button } from '@/components/ui/wideset/button/Button';\n\ntype PaneLinkProps = {\n  /** Where it leads: \"Open in Terminal\". */\n  label: string;\n  /** Its pane is the one showing. */\n  open: boolean;\n  paneId: string;\n  onToggle: () => void;\n};\n\n/**\n * The way from a line of the transcript to the pane that holds the whole of it (a test run's\n * output in the Terminal, the plan's progress in Tasks): the smallest quiet button, with the\n * pane's own sign. A card is kept for what a turn made; this only points.\n */\nexport function PaneLink({ label, open, paneId, onToggle }: PaneLinkProps) {\n  return (\n    <Button\n      variant=\"secondary\"\n      preset=\"ghost\"\n      size=\"xs\"\n      aria-expanded={open}\n      aria-controls={paneId}\n      onClick={onToggle}\n    >\n      <Button.Icon icon={RiLayoutRightLine} />\n      {label}\n    </Button>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/people.assets.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/people.assets.ts",
      "content": "// Portraits of the sample people as small JPEG data URLs (a block ships only .ts and .tsx).\n// Exported from the Wideset Core Figma file by people.cjs: do not edit by hand.\n\n/** A person’s photo by name. People who are not here show their initials. */\nexport const PHOTOS: Record<string, string | undefined> = {\n  'Ines Navarro':\n    'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADb/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4RERAOEA8SFBoWEhMYEw8QFh8XGBsbHR0dERYgIh8cIhocHRz/2wBDAQUFBQcGBw0HBw0cEhASHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBz/wAARCABgAGADASIAAhEBAxEB/8QAHQAAAQQDAQEAAAAAAAAAAAAABwABBggCBAUDCf/EADkQAAEDAwIDBQUGBQUAAAAAAAECAwQABREGIQcSMRMiQVFhFDJxgaEVM5Gx0fAIJELB4RYjUoKS/8QAGwEAAgMBAQEAAAAAAAAAAAAABQYAAgQDBwH/xAAnEQABBAEEAQQCAwAAAAAAAAABAAIDBBEFEiExExRBUXGB8CKx4f/aAAwDAQACEQMRAD8Al1KlSrxJeupUqVeEqU1EZW68sIbSMkmoovYqCdydq58i+W+LntZjKMbHKxtQF4i8U5F0mrt9rfW1CSeUqbOC58/KuDdIlwY09DdQx7xKlq8/LPpRuDRnvaHSnbn2QqbVGtcWxjOFZONqS1THAhmcwpR6Dm611Qciqo2W83BBQh5e3hsCk0atL6vU1DaErKmB3SfFH+K529KMQzGcq9fUBJw8YRFpVg04l1CVoIKSMgis6EIklSpUqiiVNT0qiiYnFA/jTrJyOoWeM6UkjmdKevoKNEyQiLGdfcVyttpKlE+AFVA1BdhqDVMp9asmQ93U+ITnb+1GdFrCaYvcMhv9oZqk5ji2tPLlKeGOhTqmX2j4UljPeWPyq1dm4ZWj7MEJUfnZI/q33of8P2oNqhMMJcaYQgAYUoAqPiaPVhdbWylSHErSdwQc0wPzI/JQ2NojZwgXrTgKmztuXO1tqciJ7z7A6hP/ACT6ioRHjNsx+yQsOcycAnbm8j8fA+uKuet6MIa0yHmkIUCDzkAEfOqta100ixaqkphLbcgPntmOVWU4PvJ/En8RXKxHsAdlWjO/IwvXQl3W+w5CeJ7Rg4GeuKm2aFqblHtV8gqCwFPDlX5kHzomsOB1pKh0IpYvRbJNw6KM1X7mYPYXrSpUqxLUlSpUxqKKLcQ5fsekbqsEcymSlOemTtVbdE2aFdHRKcWBMj3DHORuscoPL8NqNvGaatFjbhtnd5XMQPHHT61X/h/e4tjvUmPdldm2+sONu74Q4MgZ9CCRTdoMR9M9w7JS/qr2+dgd0rBGy3ppLKLZEhFTyeZciUnn/wCoHQH94qb6RXeNOz4EWY6wpuWsJUWBgA/D9K6+h5bSbfzSFJ7IDJKq0nr3Cm6whhZU1EaXhKik7nHX0Fbt5LduFXxAODg5SLiULo2lgWtqO8tR7ipCcpTuPPaohqK16on6NmPzItvRcbcA9HeipwHBjKklPh5bE0YTdGGYjz3ZOPxUHdQScgeeD1HwrS1BPhTNPSXYygUezrVt4gJJqjyCzGAvrWEOzkqitzvjt2uEeRH5w64odwH3VelWQ0jMXLs0ZTn3gSAfwoEwdJotM0uOv/zaQVob8Sr9n6UYdDynHIaO1wFY3FBdV2OjHj6C2UA5rzu91NKVMKegCKpViaemNRRCPi426660oHCEoGT5Ak/3Aqu2orfh8uNklKUElY88/qfrVk+L7rH2a2yFhMpxeE+qcb/UCq8XhLrERxJHMhv3seR6H86cdBeRGMJb1hgLjlWm4Uaihav0e3lzkecYLSyg95p5I3/UfKtzR/tcN0sXa5Pl5hagH/ZEupWN8EpGCD0GwI/sC+Asp2Ei6BBIR2yVD/zVo9My7dLIU+hJJ94K863zNEcjmjpVqSb2Au7/AH8KQTnrleW2IFmvElpClJLkhcNCAG87gJVk5I2386g/F7VELhloGQwysKuVyc9nYQojmIUrvHHkEk/Siou4wosbEJPO4R3UJHj61Rrj3cZty4olM15S0MMoDaD7qO9k4HrVY2CWTB6CliTxsyxSSxMqut5kyJKlFJUpSFg+B8PiDUy0PPW7cnmCeYI7mQMZx02oV2m9yo0ZTjSAuM83hQ6EbncHwPn8KJPC5rsS6pZBWo5yetA70ZbG7KIVZA57cIrinrEdBWVLqLJqY9KySlS1BKRlR2AqUW3QVwuCQXCGAfMZNa6tGxbOIGE/vys1i3DWGZnYVb+J8Zz7RXLWguMobKOUdEnAxn0NCZzSd/nBEiNbJTkV9JR2hbIQvOf6jsf8V9CYXC2zxv8AclMCY/nZTwCgPl0rs3HSkW7WtyCpCUKAyhWPdI6fv1p40/S5q8OJMbsdJUu6nDNL/DO35VLuGei3dOxSxIIL7y+ZZA2zgDAo3adsBRJAWjKTvnFe1w0g/apxZfZ7NackK8FfA1L9PsF23tv47ycpPnWWR7nOO7tbYw1rRt6XURBQ1GyEpGE+VUP/AIhEOJ4jTXMHs0oCQR8M/nV9S9zMLBOAOtVG456WfnXidPTHWpjk++5Ty8wHTPTOBVq8gjkDlSZhfGQh1pudInxo4iJQpoIQjA3xjqPmcmiJopbtruK4zjiXFu4A5DuCaCNrt91s0lqRb1uISFAuI6gj1HiNqKfDlMm+6shSHT2S1L9e8fL865Xq4IOwjBV6k543DkI9WqQqTEStYwoEg/Kt8VMkcL324gVAlJe2zyqTjJ8d/jUQdZcjuLadQUOIJSpJ6g0rXKM9UjzNwD18I7WuQ2QfE7JHakWjrYmbM7RachJ2oxW5A9hQrxQS2flQ80uybfFQ7j3FcyvUAjP0NTi3SggXVgn7pwLHwKQc16TptRtSu2IDn3+/dIV+ybMzpD+Ppb5SAc+BpcgyD400ZwSGEq8cVmNtq3rEsHo0aa0WZTCHWz4LGRWojStrQ2UM87KT4JV+tdEDNZp6VzfDHJy9oK6smkj4Y4hc2PpK0se+lb2+cLWSD8hQ84+WFq46FktRY6UljvIQlIA9dh6UWBXE1LbU3W3PR1+6ofhvXGWuwROaxoGV2isPMrXPcThfL525T4NwcZSgoQ0QlRIzvsQfpRJ0Bb/5qHLbmj2xsJWyjOEHlwQPoakl+0L7br27PR2UiI0otFWO6pfiPkN/lXH0bb3P9bNW9vuoS4rKB1R47fvxpbndkYATFCMckq+GkXvbLe1IKeVLzLb3Kf6SoZIqEcVrIiO9HubKAA6ezdx4nGQfwBHyoj2Rphi1siOQpogBJB8AMCudrO2G7afmMpTzLCedHxTvRnUafqaLozycZH2Of8QWla8Fxsg4GcH6K//Z',\n  'Priya Raman':\n    'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADb/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4RERAOEA8SFBoWEhMYEw8QFh8XGBsbHR0dERYgIh8cIhocHRz/2wBDAQUFBQcGBw0HBw0cEhASHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBz/wAARCABgAGADASIAAhEBAxEB/8QAHQAAAQMFAQAAAAAAAAAAAAAAAgYHCAABAwQFCf/EADkQAAEDAwIDBAgEBQUAAAAAAAECAwQABREGIQcSMRNBYYEIFBUiUXGRoTJCscEWI1JygmKS0fDx/8QAGwEAAQUBAQAAAAAAAAAAAAAAAgABAwUGBAf/xAAuEQABBAECAwYFBQAAAAAAAAABAAIDBBEhMQUSEwYyQVFxgSJhkbHBFELR4fD/2gAMAwEAAhEDEQA/AHBNWq5q2arl7SqqqrNVmkkqqxUE9SBTNcU+N7GlJLlnsobkXZOzrq924/hjvV4d3f8ACmHu/EDUN2UuRNvMxajuEB4to8kJIH2owwlUV7j9aq8xgczhvjb6qbgWlXQgjwos1CKHxX1bbrbGW3dZCY4dKACeY9B3nO1Pbw243puz0e239baXniEsy07BRPRKh3HxpcpSq9oKs7xGctJ89k9+avQAgjIq+aFXqKjFAKNNJMhV1oSaJVBTJKqbvjJr3+BdJPOx1D2lNyxGH9JI3X5D74pxM1Dj0h9VKvuulW9teYlpR2KR3dod1n9B/jRNGSqvjNw1KrnNPxHQe6by3RZ15noZjIU9NkrPvK3OSdyafPTfo7S5raF3GcocwyoJFcLgdZ2Ehd2kPMNFS+RCnlBI5R1xnxqX+nBGfZbU2+y4MZBQoEfaqy9dlbJ04tAFlOH0InR9WbUnwTOXzgBbn9M+oNMkLZBW24NiF467dai1qa33DTEkwZaOV5lWAsfmHca9J5jjMeG6ZMmOygDALiwn9ajNxv4exdX2mVc7PJjvz4gLnKysK5wOo2PWgqWnRPDZDlpR3qbJYy6IAOHl4hd7gbr06z0k23KXm5W8hh3J3UMe6rzH3FOjUKfR+1KuwcQosRasRbmhUdYJ/N1SfnkY86mtVu8YK0vBLht1Gl3ebofb+kQoxQijTQq3WNVAaJRoDTJ1q3Gai3W+VLcOG47SnFHwAz+1eeV8ujt4u8+4Okl6W8tw/NRzj71N/i9cfZfDq/vBXKpTBbH+Rx+9QRRn1mPnvcB+9SxjcrGdqpiXxw+/10T82WP/AA3Z4cJOl27rJcY7VTkhOU4x+FOxwc/AfOnJ0C85ZdQW5DNsVBbmn+Y2hwqSgnu+fkKcDhzDtl20/EE5tlxKUDHOkHArXem2+VrSJFgdi1Dir5cnCeZXXYVnZJy9paRr6qSKqGOa4HT0H33SZ4yLWbyVCz+0FAfy0uLUEqI7sbjPlQ6cVLujKWpGl27UuMgKS9HQlIII3QrABPmMfrTwXNVvEiSiYGJDAPMsjCgnxIreurNpg2JKoPZpBRkhAwKDqnp8mNR80XRAk5/P5D77rzhltvab1k7OTlHqNzISnGx5V5/bFegMV0PR2nEnmSpIIPx2qHXHBqMzeLZb44QZDaVynyn4uKyAfHrUrdFyDK0lZHiclURrJ8eQZrQMeZI2vKPs6BFLNCDnY/ylAKNNAmsiadagrCqgNETQmkiTMekpchG0MxBCsKmykpx8UpBJ/aom3dsw0MOte64k5Bp/fSduvaXezW9JGI6C4oeKv/B9aYq7JL0VvO4xU0ey867RSF9xwH7QB+VKTQL7t+0mHbdL5Vrjh1DfNgKIG6SR0rZ0Jp2drh0SH2rNEnxnSktvSVtuDG+QrvqP3CPXU3S01yIVFUPPOB3oPfjwNSe0lbYN7cbuECYthTgyrlPQ1QTxCvKQ4ZCsac/6mJpBwUr7/b52mYvZxWrBLuEnDfqzLy1Lcz1Kl4IwOpJpMXua7ozRlyn3KVsw2t1DHMSlJx7qEk7nJ6fOl7MiwNPsKnSZfrD4QAFqOT4AfD5VFX0k9T3GV7GhlSmYUguPKa71FPKEk/7jtQxxNmmaxowCiszmCBz85ITPm8zr7c5U66SVyJTgTzuL64AwPtU4uGTgd0JYlA5Hq6RtUDUvIRGPL+MpAP3qcPBh7t+G9iVnJDOD5E1oJAAAAoeyzyZ5M7kflOAKMUAo01EtsVrmhJq+FLUEpBKjsAO+upP07Kt9rcmyCByo5ggbnpTgE7Lmt3oKgBmdjO3mVBjjldVXLiHcgTlMdXYgHu5QB+1ISY4lxhpH5gBn/vnXQ1lcV3jVN0mq95T8la+nia48lSWmwnq4rrUzRovM7s/WnfJ5lKDQttE69LIBLfKATUh9M6Xn2+QgxZT7DTn9B2+lcbh1wtl2vT1tuMyMtpM9lL7bpT7qgoZG/wAfCns0va3/AFUFYwps4ye+s7xCYmUgLQcMha2EErNaNKlQD0152SU7jtDsPKmg4+cPJWrYjL1uQFToJKm0HbnSeqfnsPpUiUFQawtYA761GrI5f7giPAjrfdOxIT7qR8SegFccL5GSB7NSuuwyN8bmSaNXnJO0xd7NH7a426VFZK+yDjrZCCsAEp5umcEHHjUtPRyugl6FEQq96I6QB3gEZ/XNS6j6DtLOn02WXbY06OrKnkPspWhxR6kgjHcPoKT0DgnpmzLkuWa2ptSpOCtMZRCCRnHudB1PTFa3lc5g5hqqHhF6KjbL3E8moykSDmsiaU0/h/cYgKmFokAdw91VJgZBwRgjYg1EQRut/WuwWm80Ds4Sq0PakOlct1IJ6Iz3Ch40X5nTOg7lOX+JDCktgDdSzslI8yBSk08wIMOMk/hxyK89s/XFMr6U14RF4ftc5yrnUlI/18qwPod/Kp8Ybhea3bTrdl0xO509PBQC9YCC885u4tRH/Nacfmm3BlJGS44kY+ZoHllRI+BzSo4c2JV91Vbo6BkIeQ4v5BQp9guPHMV6taLs8aHo602p5ht2OzFbaKFoBBASBuDW2dBWF0YQwtkfBtZwPrXQtSAmG0nGAEiukgY6GmfDHJ32gp2TyRH4HELhx9CWKOc9i45/cs4+1d2OxHhMhmIw2y2PyoSBR52q3WlHDHH3GgJpJ5Je+4lUDVwnnOKIJrI0nl3qVRLXS0CpWR0GKbLiJYW4TzdwYQEpdVyOhP8AV3H7U6WAOf8AuNcPVVv9oWSWyBlRQVJ+Y3H6ULhkKx4VbNW0yQHTOD6H/ZX/2Q==',\n  'Jonas Weber':\n    'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADb/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4RERAOEA8SFBoWEhMYEw8QFh8XGBsbHR0dERYgIh8cIhocHRz/2wBDAQUFBQcGBw0HBw0cEhASHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBz/wAARCABgAGADASIAAhEBAxEB/8QAHQAAAQQDAQEAAAAAAAAAAAAAAAEEBQYDBwgCCf/EADQQAAEDAwMCBAQFAwUAAAAAAAECAwQABREGEiExQQcTUXEUImGBMpGhwdEIYrEWQ1JTcv/EABsBAAICAwEAAAAAAAAAAAAAAAEGAgUAAwQH/8QAKBEAAgIBBAEDAwUAAAAAAAAAAQIAAxEEBRIhMTJBYVFxsRMikaHw/9oADAMBAAIRAxEAPwDpqiiiraZCloIqMv8AfYem7RKuk9wNxYyCtR/YfU0CQBkwgEnAj2TKYhsrekOoaaQMqWtQSB9zVPuHizpC2hRcvLTgHdlKnB+aQRXM2qfEm4+JF7WXlKYtLSsMRgv5R9Vep9arV4iTSlYaSt1KRlOE/KDj0pd1O+lX40gY+plvTteV5WH+J2LZvE/SN+X5cK+xC7/1uK8tR9grGftVtStKwFJIIPII7186bJ4f6jvrylsQ31OKPylWePatn6b1JrbwauLEaa47Jt6sebDeWVN4PdBOdp9qnTvqFgtuPuILNps480/udk0Go2w3qLqG0RLlDXujyUBafUeoP1FSNXwIYAjwZUkEHBi4oooNGCJRRRRmQ7VzX/UxqCVOuVq0pEXtSpv4l70ySUpz7AKP3rpSuYf6hmhE8QrDIQkbpUPYo/8Alav2NVu7My6VuPxOzQAG8Ays6N8N4kmJHadeWTg/MPWtuaa8JmoU1t5UxTjCerah1qsaDkMtxEuyHkNIbV+JR7Vuuy3CHMjoUxIQtJGApJ60hceTHlHYFVQcRHUTTMaK0BGbQgAdQKrmqNLRr1GXFltpVkYSojlJq4OT4cJoGRLQ1noFKxmoy4ykOpQpshQPII71OxFA6ka7GJIPiU/wgjSLM3crS8TsZXvQk9s8fxW0aoeinviL7eFKRtKAkD2JP8VfM07bKzNok5fP5iduYA1LAfH4hiiiirWcESiiijMhXHPihJuF08TZiJ8lahElqbjNLUcIa2g/KO1djVzV446ZXbNaMX8JPw0xsJzjhKxgEfkAfuapt7Vjpwy+Ae5b7OU/WZW8kdfeetOWXUiGltWp2LHQpAKXHo/nAk+oqUtbMmweIkeN8YHIT6d7jSU7U7senbmpbR+omEWMPKO3YnBx3Iqn6d1hCla38y5IdaKipLWEEjOeMn60l8mI4gdxuWtQQxPU2pqKDdJTvn2mQht0g7S615iUK7ZHpUxAZuTkZIuL0d9aUAlbKCgbsc8HtSRJpUzIdjsuLS2fwrSUFXtnrUgzdos6374+eeCD1B7g1LP7cHqQdMHIkPpu1mHIXKDyw69JUFoB4KfmxkVd6jIkZJ8gpcCglIJx0HHT9akqb9hrZNMeXgnqKu9OrXAL7DuLR/ijtSZq7lPCiiijMhTG721m7W+REfbbcS4ggb0ghJxwfcU+pCeKBAIwYQSDkTm63RW5ulLzaWpRh3aMVFt0JCsEnnjuAoY9jWHw0jXNt1Ld0msokIBy6LeXW3MeikklJ9wKrAuLkW/zHUHOXnNyf+SSo5Fbb0nboktXnQ3D5CwHD6pPcV5zgIxXHWZ6BS3Nezg/76y03SFdZiRGtF1bbc3Jy85DwlKc84BVycdOKlW4SYmWQre6sgKcIAK1EAZ4/OnTS2YbJPTA4J717isKWpuS4CCpQ2A+/Wpqi2WqmPcTTdYURiD7SYSkAACloor0SIkWkpe1JQmQopCcU6ZgOvDJBAqFlyV+oyQUnxGilpQMqIAqj+Ierp+n7A7KtUcLdCkpLricpQCcbgO/OOvrWyV2xCUkkZI9aj5mmmLpaVxZCAtDqFIUMdR/NVmp1ljqVq6+Z001orAv2JyE3aH5eZKcl0kqV9TV30PAuT8gtR5QY3cEFPWrTJ0NJ0xK2uNlyMThLoHBH7H6VMWexIjSQ6BtTnckgdKTmDBuLCN6urKGQyzWuxmMEGU+qQ6O6ug+1Ss07UI28FJGKSMc9Dkipq3WJ66KBIKGe6yOPt61urRmOK/M0WWKo5WHqYolslyLeJZbGNxG0HqB3/zTZQKSQoEEdQa2KGW48dDLYwhAwBUTNtrEnO5I3eo6036fVOihbe/mKdiqzEoMCVCipGVZ3mAVN5cR7c1HEEHB4NWCOrjKmaSCPMkLfbsLStw7lK6VOpaCUnjpTRJS06Gx/tvJwP7VdP4+1SBO2Ups9CKos5OTOqMHRsWfQ1nbbHlp4xjmsbqC7IS2Oxyad42rKfpWCZPHkMvoKHmwpJ4PGQfcVh/01bVjCWEAeiDj9KztnBPvTpODQatX9QzCtjp6TiYIWnrdDVuSyCf7yT+lS+8JGEgAU0QOay1JEVOlGJF3ZzlzmelJ3ck14DaQoDFZB0xWMnhSvsKlIw2AjoOairpZkSG1uIGHEjIx3qWzhzHZCayK/Dj1qSMVORAe5//Z',\n  'Elena Silva':\n    'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAAAAACSgAAAPhAAAts9YWVogAAAAAAAA9tYAAQAAAADTLXBhcmEAAAAAAAQAAAACZmYAAPKnAAANWQAAE9AAAApbAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAACAAAAAcAEcAbwBvAGcAbABlACAASQBuAGMALgAgADIAMAAxADb/2wBDAAQDAwQDAwQEBAQFBQQFBwsHBwYGBw4KCggLEA4RERAOEA8SFBoWEhMYEw8QFh8XGBsbHR0dERYgIh8cIhocHRz/2wBDAQUFBQcGBw0HBw0cEhASHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBz/wAARCABgAGADASIAAhEBAxEB/8QAHQAAAQQDAQEAAAAAAAAAAAAACAACBgcBBAUDCf/EADsQAAEDAwEFBAgEBAcAAAAAAAECAwQABREGBxIhMUETIlFhFDJScYGRobEII0LBFRYz8CRDcpLC0eH/xAAbAQACAwEBAQAAAAAAAAAAAAAFBgACBAEHA//EAC8RAAEDAgQEBgEEAwAAAAAAAAEAAgMEEQUSIUEGMVGBEyJhcbHB0ZGh4fAUMkL/2gAMAwEAAhEDEQA/AO1ilinUqekOTcVnFOxWvNls2+K9JkLCGWklSlHoBUJsLldAvoF6khIyTgVznb9bGSsLnxgUesO0GRQ+a32m3HU0xyJCdcjWrO6lKTuqd81Hw8qhV0afTFd9HKwhogLUB6yj50sVPErGSZIW5h1Jsi8WEOczPIbeiLOHqezz3Ozj3GM4v2QsZrrDjQX2GTLbWElxfPgFHhVw6W1/MsLrLM9S3YCsBQUclA8QT9qpTcTMMoiqG2vuOXdfSXBXeH4kJv6FXfilimR5DUtht5lYW04ApKh1FemKagQRdA7WTcUsU7FYxUUT8UqzSqKJVTm2vU5QyxYo7h3nPzJGPD9Kfnxq3JklEOK6+4cIbSVE+QoR9W6gN3vcyao531nd8h0pe4hrDFAIWc3/ABv+EVwqnD5fEdyb8qQbPtEv6rvARuL9Hawpxaftmizs+yq1O2pERyE0UkYPdyTw6moDsdj27TmmYa50qOxKlDtVhxYB48uflREWOVGdjpW0+24k8lIUCK84eC9+qcmnIzQIbNof4fFWiHIuNnZKm2wVra5kDxFUc68ENBCldw8Mn9Jr6OyJMQRXEyH2UIUCD2igAfnXz725adb0nq+SILqHLbLUXWi2oEJzzTw8Dn6VYReYC6glu0kjkprsg1MZDL1mfcytjvM59nqPgfvVrUHultULsd+hzwo4QsBYHVPI/Si7hym5sVmQ0oKbdSFAjkQa9H4eqjLTeE86s07bfhJuLQBk2dvJ3yvelSpUfQpOpVmsVF1Qba3dlWnRU1SDhb5S0D7zx+maF+xNfx3UtuhpThhUhtKlK4b2Tx+1ERtxV2unGIntudoT5AY+6hQ52bUUXT9/TJdYU4wgjG7zSQeB6UjY88yVha3UtA/P2mLDmhlOHONgSiwv9p1PEjNo07Dtymm28/4hveLqs+rnoMZ41MtER7nZbnAampZZTMA7RDJOEnAJwPI5FdzTV9hsRWHlqHFIJBrU/maHJ1OHJSHWW0KwkhBPDHPPLHSlBztimhsW99F57ULbeVxlTbNHjzZCf6TUgnd4EdOWSMn4VU+0awakvGzqQu9WqEH4m5IQ7FTu44d5PwyRzwcURrN+ZjRjJ7BxcIqwpS0EbozzIPTzqO7U7/bGdC3uQVJTHTDcJI4/pNQOGmXndcLCLlx0t2XzpeJSAts76D1FFXsXvSrvoqKlwkriqLJPiBy+mKFdUNWQ40lQZeJUgH2c8KJ/Yha123Siivm86V48OApzwF5FVlbuDf8AvulbEm3gzHqFZtKlWRTql9O6VismsGooqw20R1LsBfAyEAo92VJP/GhhuNt3Y6Xsd1RxmiP22XtDVubtiT33O+sDw6VQkrf9AQyocd7IHhSDjco/zzk9AUz4dFmpbO9bIodimrIOutHpgPOlu7xWRHcUhe64FJGAof6gPnmpbpmLMtz3o93ukntmlHdkJS3+YnPDKVDGfcelCRsilS7dq1cmG4ptQGOHXjyNGlp3V0SU2lUqGpT+BvAJyCaWaqNrJCBujtDMXRjOF33rbLvUhlqLebi1b2l77y1Bo9snHqDCcDzNUd+IvVdqtOm3NJ24pM2ZgupSc9kyk54+GSMAeANEC/cHrlFLUFgxGCO+sjCiPAeFAlteKhtEvKCScjdBJ54TVadodKD01Xah/kI66LiMOj0COlDYJQyAD8qIrZVcGpOnW2EqHaskhQ64PI0M+n7oylPo8g7q0A9mojmPCp3suvcqPq0NNEht0Y3R6p4jh8qP4LM6mrhcaHT9UJxJrZ6XQ8vpE1SrA5Cs16OlBPNMVypwSpxW6kfGth21pcZKVOHKuGRS1jvFNDg3kmOZ55NHPvsPn0RPD8JqK7WMWb1KFbaG6/J1JIclOZAUokZ9UA4CagM6UXeCBkqO6PKrh2o6Idjly4NJV6JlQcI5gpOD9apJySng0gYSgcTSPS1rMQvUs3PLp7pnmhNK0RFW5sY0suQpc7cJAWnj5caKmxaeQy4hwDCFAVBPw/ad9I0RElhoEPZznyJohoFoZYt4Kxgp6msj7yvJK0aRNAC0RHbahLSkccc6Ajb3bnIOsZMhIIUshQPnmvoEn8xhxDKN5XTPKg6/EzpyQ1IEsgKwSFbo5cjVopGxytJ30VXsL43Ae6H2KqJcba4kYRM3hwPL4VeGwzRMtLj17lsqLSE7jJxnJ6qqgIyENtuOb2Fo5DxJop9guvUqske0zCnKFbjSjw5nlWqsxCXC8tVEzOGnUH6Wanpm1rTC82JHMKyhyrNSmTboc5veCS26eO8kc/8Auo5LjOQpC2HB3k9fEeNO/D/FNHjYLYrteBctPTqDuP39EuYjhM9AQX6tO62ISN1kKI7zigPcM4/9r2jOhxdu5Ye3nMeRST+9ObTuKQgckoVj4CufaXO1l2JA9UwifcQlINeE45XHEK6WpP8A0Tb21t+wT/hsAp6dsfT+lVvtN1XEg2OZbFJ33HXnQT0AKif3odoOlX7xPjMRGlLU84BugchRT612Yo1BbLiuJkzgs7mTwPI4+YribENHSbDc7kxdbY83ObcCu1cGUhBHIHqfdW/DsSio6J74j59wd77+y7UU/jygP5K6tl1pTpyxQrUnk22P93WrGyp1rcPIdKhENwwpKVD/AC1ZHmKshhhCmUuJOUqG8DWnh+qdUROjedQb9j/N1nr2CN4cBoVyJDqbXAeexxSnPvNU3r3S6NS2hxmT3nXDvFR9o86tTU8pK1tQ0EHdO+sD6D9/lUZmR/SVoZ6YJPyodj9c4TthiP8Apr3/AIWigjswvdv8IABZAxdJoU0r0WM8W1LKcpODU20dGLmqYCLZ3oq1b2E54EDr4YOKnGv9nV4scS5xosbtoM94LS6gZW2c5/v31MNjezB3TzMm6TlBTz7Q7MeG8QT/AH76K1eLxvpTJmuSLAduZ6KkNIY5AANOd/pW0lJjwY5J7yS2SfHKhWrqyLjsJIHD+mfuP3rduZ7JqO37TjY+WDWxfWu2tkhPUJCx8ONDOEa40WLQybFwafZ2n3fsqY1B49G9voT+mq//2Q==',\n};\n"
    },
    {
      "path": "src/blocks/agent-code/person-avatar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/person-avatar.tsx",
      "content": "'use client';\n\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { type AvatarColor } from '@/components/ui/wideset/avatar/Avatar.colors';\nimport { type AvatarProps } from '@/components/ui/wideset/avatar/Avatar.types';\n\nimport { PHOTOS } from './people.assets';\n\ntype PersonAvatarProps = Pick<\n  AvatarProps,\n  'size' | 'shape' | 'status' | 'className' | 'style' | 'title' | 'aria-hidden' | 'aria-label'\n> & {\n  /** The person's full name: the key their photo is filed under. */\n  name: string;\n  initials: string;\n  /** The colour of the initials. A photo takes none. */\n  color?: AvatarColor;\n  /** Empty beside the person's name (the default); their name when the avatar stands alone. */\n  alt?: string;\n};\n\n/**\n * A person's avatar: their photo when they have one, their initials when not. The choice lives\n * here so every place the block draws a person mixes the two the same way. The rest of the props\n * go to the `Avatar`, so it also sits in an `Avatar.Group`.\n */\nexport function PersonAvatar({ name, initials, color, alt = '', ...avatar }: PersonAvatarProps) {\n  const photo = PHOTOS[name];\n  return photo ? (\n    <Avatar src={photo} alt={alt} initials={initials} {...avatar} />\n  ) : (\n    // Initials carry no name of their own: a standalone avatar is named by `alt`, as a photo is.\n    <Avatar initials={initials} color={color} aria-label={alt || undefined} {...avatar} />\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/plan-card.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/plan-card.tsx",
      "content": "'use client';\n\n// TODO(custom): a plan the agent proposed, with how it was answered (its steps in order, Approved, the way to its tasks); Wideset has no plan or proposal part, and ProgressTracker draws progress, not a proposal.\nimport { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';\nimport type { ReactNode } from 'react';\n\nimport { Inline } from './inline';\n\ntype PlanCardProps = {\n  /** The steps, in the order the agent means to take them. A name in backticks is code. */\n  steps: string[];\n  /** The way on, under the steps: the link to the Tasks pane. */\n  children?: ReactNode;\n};\n\n/**\n * What Plan mode leaves in the transcript: the steps the agent proposed before it changed\n * anything, in a bordered card as an approval is, and the answer they got. Approved is a\n * decision made, so its badge is positive. The plan stays as it was approved; how far the work\n * has come since is the Tasks pane's to say, one click away.\n */\nexport function PlanCard({ steps, children }: PlanCardProps) {\n  return (\n    <section\n      aria-label=\"Plan\"\n      className=\"border-ws-static-base rounded-ws-container-md p-ws-9 gap-ws-7 flex flex-col border\"\n    >\n      <div className=\"gap-ws-5 flex items-center\">\n        <h3 className=\"typography-label-strong-sm text-ws-static-strong min-w-0 flex-1\">Plan</h3>\n        <StatusBadge size=\"sm\" color=\"positive\">\n          Approved\n        </StatusBadge>\n      </div>\n      <ol className=\"typography-body-md text-ws-static-base marker:text-ws-static-subtle gap-ws-3 pl-ws-11 flex list-decimal flex-col marker:tabular-nums\">\n        {steps.map((step) => (\n          <li key={step}>\n            <Inline text={step} />\n          </li>\n        ))}\n      </ol>\n      {children && <div className=\"-ml-ws-3 flex\">{children}</div>}\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/preview-bookings.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/preview-bookings.tsx",
      "content": "'use client';\n\nimport { RiDownloadLine, RiSearchLine } from '@remixicon/react';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';\nimport { Table } from '@/components/ui/wideset/table/Table';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { Toast } from '@/components/ui/wideset/toast/Toast';\nimport { useEffect, useState } from 'react';\n\nimport { PersonAvatar } from './person-avatar';\nimport { BOOKINGS, STATUS } from './preview-data';\nimport { formatTimeRange } from './preview-format';\n\n/** How long the page's toast stays, in milliseconds. */\nconst TOAST = 4000;\n\n/** Under this width of the page the table drops who booked, and keeps room, time and state. */\nconst WIDE = 'hidden @[34rem]:table-cell';\n\ntype PreviewBookingsProps = {\n  /** The export ran: how many rows it wrote. */\n  onExport: (rows: number) => void;\n};\n\n/**\n * The page the session is changing, as the dev server serves it: today's bookings in a table that\n * runs the page's width, a search over it and the new Export CSV button. The button is bordered:\n * this small app has no filled action of its own here. Export answers as the feature does, with a\n * toast at the foot of the page (and a line in the console, which the pane adds). The page lays\n * itself out by its own width, not the window's, so the viewport switch really reflows it.\n */\nexport function PreviewBookings({ onExport }: PreviewBookingsProps) {\n  const [query, setQuery] = useState('');\n  // An object, so a second export restarts the toast's time even with the same number of rows.\n  const [exported, setExported] = useState<{ rows: number }>();\n\n  useEffect(() => {\n    if (!exported) return;\n    const id = window.setTimeout(() => setExported(undefined), TOAST);\n    return () => window.clearTimeout(id);\n  }, [exported]);\n\n  const needle = query.trim().toLowerCase();\n  const rows = BOOKINGS.filter(({ room, by }) =>\n    `${room} ${by.name}`.toLowerCase().includes(needle),\n  );\n\n  return (\n    <>\n      <div className=\"gap-ws-9 px-ws-11 pt-ws-12 pb-ws-9 flex flex-col\">\n        <div className=\"gap-ws-2 flex flex-col\">\n          <h3 className=\"typography-title-sm text-ws-static-strong\">Bookings</h3>\n          <p className=\"typography-body-md text-ws-static-subtle\">\n            Every room booked today, Tuesday, November 10\n          </p>\n        </div>\n        <div className=\"gap-ws-5 flex items-center\">\n          <TextInput\n            size=\"sm\"\n            value={query}\n            onChange={(event) => setQuery(event.target.value)}\n            className=\"min-w-0 flex-1\"\n          >\n            <TextInput.Prefix inner>\n              <TextInput.Icon icon={RiSearchLine} />\n            </TextInput.Prefix>\n            <TextInput.Input\n              type=\"search\"\n              placeholder=\"Search rooms or people\"\n              aria-label=\"Search rooms or people\"\n            />\n            <TextInput.Suffix inner>\n              <TextInput.ClearButton />\n            </TextInput.Suffix>\n          </TextInput>\n          <Button\n            size=\"sm\"\n            variant=\"secondary\"\n            preset=\"border\"\n            disabled={rows.length === 0}\n            onClick={() => {\n              setExported({ rows: rows.length });\n              onExport(rows.length);\n            }}\n          >\n            <Button.Icon icon={RiDownloadLine} />\n            Export CSV\n          </Button>\n        </div>\n      </div>\n\n      {/* The first and last cells give up their padding, so the rows' lines and text keep the\n          page's gutter. */}\n      <div className=\"px-ws-11 pb-ws-11\">\n        <Table className=\"table-fixed\">\n          <Table.Head>\n            <Table.Row>\n              <Table.Header flushMargin className=\"w-[24%]\">\n                Room\n              </Table.Header>\n              <Table.Header className={WIDE}>Booked by</Table.Header>\n              <Table.Header>Time</Table.Header>\n              <Table.Header flushMargin className=\"w-[6.5rem]\">\n                Status\n              </Table.Header>\n            </Table.Row>\n          </Table.Head>\n          <Table.Body>\n            {rows.length === 0 ? (\n              <Table.Row>\n                <Table.Cell colSpan={4}>\n                  <p className=\"text-ws-static-subtle py-ws-14 text-center\">\n                    No booking matches “{query.trim()}”\n                  </p>\n                </Table.Cell>\n              </Table.Row>\n            ) : (\n              rows.map(({ id, room, by, start, end, status }) => (\n                <Table.Row key={id}>\n                  <Table.Cell flushMargin>\n                    <span className=\"text-ws-static-strong\">{room}</span>\n                  </Table.Cell>\n                  <Table.Cell className={WIDE}>\n                    <div className=\"gap-ws-5 flex items-center\">\n                      <PersonAvatar size=\"sm\" {...by} aria-hidden=\"true\" />\n                      <span className=\"truncate\">{by.name}</span>\n                    </div>\n                  </Table.Cell>\n                  <Table.Cell className=\"tabular-nums\">\n                    <time dateTime={start}>{formatTimeRange(start, end)}</time>\n                  </Table.Cell>\n                  <Table.Cell flushMargin>\n                    <StatusBadge color={STATUS[status].color}>{STATUS[status].label}</StatusBadge>\n                  </Table.Cell>\n                </Table.Row>\n              ))\n            )}\n          </Table.Body>\n        </Table>\n      </div>\n\n      {exported && (\n        // Laid over the foot of the page's viewport, not the pane: it is the page's own toast.\n        <div className=\"inset-x-ws-11 bottom-ws-11 animate-in fade-in-0 slide-in-from-bottom-ws-5 absolute flex justify-center duration-(--ws-motion-duration-fast) ease-(--ws-motion-ease-smooth-out)\">\n          <Toast status=\"success\" onDismiss={() => setExported(undefined)} className=\"w-auto\">\n            <Toast.Message>\n              {`Exported ${exported.rows} ${exported.rows === 1 ? 'booking' : 'bookings'}`}\n            </Toast.Message>\n          </Toast>\n        </div>\n      )}\n    </>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/preview-console.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/preview-console.tsx",
      "content": "'use client';\n\n// TODO(custom): a console drawer (a bar with Clear and Close over the page's messages in monospace, each with its level and source); Wideset has no console or log part and no drawer that is not modal.\nimport {\n  type RemixiconComponentType,\n  RiAlertLine,\n  RiArrowRightSLine,\n  RiCloseCircleLine,\n  RiCloseLine,\n  RiEraserLine,\n} from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport { useEffect, useRef } from 'react';\n\nimport { BarAction } from './bar-action';\nimport type { ConsoleMessage } from './preview-data';\n\n/** A level's mark, in its meaning's colour, and its name for a screen reader. */\nconst LEVEL: Record<\n  ConsoleMessage['level'],\n  { Icon: RemixiconComponentType; className: string; name: string }\n> = {\n  log: { Icon: RiArrowRightSLine, className: 'text-ws-static-subtle', name: 'Log' },\n  warning: { Icon: RiAlertLine, className: 'text-ws-semantic-notice', name: 'Warning' },\n  error: { Icon: RiCloseCircleLine, className: 'text-ws-semantic-negative', name: 'Error' },\n};\n\ntype PreviewConsoleProps = {\n  id: string;\n  messages: ConsoleMessage[];\n  onClear: () => void;\n  onClose: () => void;\n};\n\n/**\n * The page's console, in a drawer under the page: what it logged since it loaded, a line each,\n * the level as a mark in its meaning's colour and the file that logged it at the end. It takes a\n * third of the pane at most and scrolls inside itself, following the newest line.\n */\nexport function PreviewConsole({ id, messages, onClear, onClose }: PreviewConsoleProps) {\n  const scroller = useRef<HTMLOListElement>(null);\n\n  useEffect(() => {\n    if (scroller.current) scroller.current.scrollTop = scroller.current.scrollHeight;\n  }, [messages]);\n\n  return (\n    <section\n      id={id}\n      aria-label=\"Console\"\n      className=\"border-ws-static-base animate-in fade-in-0 slide-in-from-bottom-ws-5 flex max-h-[33%] shrink-0 flex-col border-t duration-(--ws-motion-duration-fast) ease-(--ws-motion-ease-smooth-out)\"\n    >\n      <div className=\"h-ws-16 px-ws-11 flex shrink-0 items-center justify-between\">\n        <h3 className=\"typography-label-strong-sm text-ws-static-strong\">Console</h3>\n        <div className=\"gap-ws-2 flex items-center\">\n          <BarAction\n            icon={RiEraserLine}\n            label=\"Clear console\"\n            disabled={messages.length === 0}\n            onClick={onClear}\n          />\n          <BarAction icon={RiCloseLine} label=\"Close console\" onClick={onClose} />\n        </div>\n      </div>\n      {messages.length === 0 ? (\n        <p className=\"typography-body-md text-ws-static-subtle px-ws-11 pb-ws-9\">\n          Nothing logged since the page loaded\n        </p>\n      ) : (\n        <ol\n          ref={scroller}\n          role=\"log\"\n          aria-label=\"Messages\"\n          className=\"font-ws-mono typography-body-sm tracking-ws-normal text-ws-static-base pb-ws-5 ws-scrollbar min-h-0 overflow-y-auto\"\n        >\n          {messages.map(({ id: key, level, text, source }) => {\n            const { Icon, className, name } = LEVEL[level];\n            return (\n              <li\n                key={key}\n                className=\"border-ws-static-subtle gap-ws-5 px-ws-11 py-ws-4 flex items-start border-t\"\n              >\n                <Icon aria-hidden=\"true\" className={cn('w-ws-8 h-[1lh] shrink-0', className)} />\n                <span className=\"sr-only\">{name}:</span>\n                <span className=\"min-w-0 flex-1 wrap-anywhere\">{text}</span>\n                {source && <span className=\"text-ws-static-subtle shrink-0\">{source}</span>}\n              </li>\n            );\n          })}\n        </ol>\n      )}\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/preview-data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/preview-data.ts",
      "content": "import type { AvatarColor } from '@/components/ui/wideset/avatar/Avatar.colors';\n\n/** The page the dev server opens on: the route the session is changing. */\nexport const HOME = 'localhost:3000/bookings';\n\nexport type Viewport = 'desktop' | 'tablet' | 'phone';\n\nexport type BookingStatus = 'checked-in' | 'confirmed' | 'pending' | 'no-show' | 'cancelled';\n\n/** A state in words and in its meaning's colour: arrived, scheduled, waiting, missed, called off. */\nexport const STATUS = {\n  'checked-in': { label: 'Checked in', color: 'positive' },\n  confirmed: { label: 'Confirmed', color: 'info' },\n  pending: { label: 'Pending', color: 'notice' },\n  'no-show': { label: 'No-show', color: 'negative' },\n  cancelled: { label: 'Cancelled', color: 'neutral' },\n} as const satisfies Record<BookingStatus, { label: string; color: string }>;\n\nexport type Person = { name: string; initials: string; color: AvatarColor };\n\nconst PRIYA: Person = { name: 'Priya Raman', initials: 'PR', color: 'purple' };\nconst TOM: Person = { name: 'Tom Becker', initials: 'TB', color: 'orange' };\nconst ELENA: Person = { name: 'Elena Silva', initials: 'ES', color: 'blue' };\nconst JONAS: Person = { name: 'Jonas Weber', initials: 'JW', color: 'lime' };\n/** Signed in to the preview, as to Tandem. */\nexport const INES: Person = { name: 'Ines Navarro', initials: 'IN', color: 'teal' };\n\nexport type Booking = {\n  id: string;\n  room: string;\n  by: Person;\n  /** UTC, as the API returns them and as the export writes them. */\n  start: string;\n  end: string;\n  status: BookingStatus;\n};\n\nconst at = (time: string) => `2026-11-10T${time}:00Z`;\n\n/** Today's bookings at Lumen Studio. The first starts at 09:00 UTC: 10:00 on the page. */\nexport const BOOKINGS: Booking[] = [\n  {\n    id: 'b1',\n    room: 'Atlas',\n    by: PRIYA,\n    start: at('09:00'),\n    end: at('09:30'),\n    status: 'checked-in',\n  },\n  { id: 'b2', room: 'Cedar', by: TOM, start: at('09:30'), end: at('10:30'), status: 'checked-in' },\n  { id: 'b3', room: 'Fjord', by: ELENA, start: at('09:45'), end: at('10:45'), status: 'no-show' },\n  {\n    id: 'b4',\n    room: 'Atlas',\n    by: JONAS,\n    start: at('12:00'),\n    end: at('13:00'),\n    status: 'checked-in',\n  },\n  { id: 'b5', room: 'Dune', by: INES, start: at('13:00'), end: at('13:45'), status: 'confirmed' },\n  { id: 'b6', room: 'Cedar', by: PRIYA, start: at('14:00'), end: at('15:00'), status: 'pending' },\n  { id: 'b7', room: 'Ember', by: TOM, start: at('14:30'), end: at('15:00'), status: 'cancelled' },\n  { id: 'b8', room: 'Fjord', by: ELENA, start: at('15:30'), end: at('16:30'), status: 'confirmed' },\n];\n\n/** The file the export names: the day it covers. */\nexport const EXPORT_FILE = 'bookings-2026-11-10.csv';\n\nexport type ConsoleMessage = {\n  id: string;\n  level: 'log' | 'warning' | 'error';\n  text: string;\n  /** The file and line that logged it. */\n  source?: string;\n};\n\n/** Logged whenever the bookings page loads. */\nexport const ZONE_WARNING: ConsoleMessage = {\n  id: 'zone',\n  level: 'warning',\n  text: 'Workspace time zone is not set: times are shown in the browser zone',\n  source: 'format-date.ts:14',\n};\n\n/** What the export logs when it has written the file. */\nexport const exportLog = (id: string, rows: number): ConsoleMessage => ({\n  id,\n  level: 'log',\n  text: `[export] ${EXPORT_FILE}: ${rows} ${rows === 1 ? 'row' : 'rows'}, times as UTC`,\n  source: 'export-csv.ts:52',\n});\n\n/** What the browser logs for an address the app has no page for. */\nexport const notFoundError = (address: string): ConsoleMessage => ({\n  id: 'not-found',\n  level: 'error',\n  text: `GET http://${address} 404 (Not Found)`,\n});\n\n/** The console as the session left it: the page loaded, and the agent tried the export once. */\nexport const MESSAGES: ConsoleMessage[] = [ZONE_WARNING, exportLog('export-0', BOOKINGS.length)];\n"
    },
    {
      "path": "src/blocks/agent-code/preview-format.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/preview-format.ts",
      "content": "/** The preview's browser sits an hour ahead of UTC, so the 09:00Z booking reads 10:00 on the page. */\nconst TIME = new Intl.DateTimeFormat('en-US', {\n  hour: 'numeric',\n  minute: '2-digit',\n  timeZone: 'Europe/Berlin',\n});\n\n/** A booking's hours as the page shows them: `10:00 – 10:30 AM`. */\nexport const formatTimeRange = (start: string, end: string) =>\n  TIME.formatRange(new Date(start), new Date(end));\n"
    },
    {
      "path": "src/blocks/agent-code/preview-page.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/preview-page.tsx",
      "content": "'use client';\n\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { PersonAvatar } from './person-avatar';\nimport { PreviewBookings } from './preview-bookings';\nimport { HOME, INES } from './preview-data';\n\ntype PreviewPageProps = {\n  /** The address loaded: the bookings page, or one the app has no page for. */\n  address: string;\n  /** The width the viewport gives the page. */\n  className?: string;\n  onExport: (rows: number) => void;\n  onHome: () => void;\n};\n\n/**\n * What the dev server serves, drawn with Wideset at the width the viewport gives it: Lumen's\n * booking app, its own small product with its own bar (the mark, who is signed in) over the page.\n * It is a size container, so the page inside answers to the preview's width and not the window's.\n * It scrolls inside itself; the page's toast is laid over its foot and stays put.\n */\nexport function PreviewPage({ address, className, onExport, onHome }: PreviewPageProps) {\n  return (\n    <div className={cn('bg-ws-static-foreground shadow-ws-low @container relative', className)}>\n      <div className=\"ws-scrollbar flex h-full flex-col overflow-y-auto\">\n        <div className=\"h-ws-18 border-ws-static-subtle px-ws-11 gap-ws-5 flex shrink-0 items-center border-b\">\n          <Avatar shape=\"square\" size=\"sm\" initials=\"L\" color=\"yellow\" aria-hidden=\"true\" />\n          <span className=\"typography-label-strong-md text-ws-static-strong\">Lumen</span>\n          <span className=\"ml-auto flex\">\n            <PersonAvatar size=\"sm\" {...INES} title={INES.name} alt={INES.name} />\n          </span>\n        </div>\n        {address === HOME ? (\n          <PreviewBookings onExport={onExport} />\n        ) : (\n          <div className=\"gap-ws-9 px-ws-11 flex flex-1 flex-col items-center justify-center text-center\">\n            <div className=\"gap-ws-2 flex flex-col\">\n              <h3 className=\"typography-subtitle-xs text-ws-static-strong\">Page not found</h3>\n              <p className=\"typography-body-md text-ws-static-subtle wrap-anywhere\">\n                Lumen has no page at {address}\n              </p>\n            </div>\n            <Button size=\"sm\" variant=\"secondary\" preset=\"border\" onClick={onHome}>\n              Back to bookings\n            </Button>\n          </div>\n        )}\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/preview-pane.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/preview-pane.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\nimport { useId, useRef, useState } from 'react';\n\nimport { PreviewConsole } from './preview-console';\nimport {\n  exportLog,\n  HOME,\n  MESSAGES,\n  notFoundError,\n  type Viewport,\n  ZONE_WARNING,\n} from './preview-data';\nimport { PreviewPage } from './preview-page';\nimport { PreviewToolbar } from './preview-toolbar';\n\n/**\n * The width each viewport gives the page. Desktop is the pane itself; the others are narrower\n * than it and never wider, so in a pane narrower than a tablet the two look the same.\n */\nconst WIDTH: Record<Viewport, string> = {\n  desktop: 'w-full',\n  tablet: 'w-[30rem] max-w-full',\n  phone: 'w-[24.375rem] max-w-full',\n};\n\n/** An address as typed, without the scheme or a trailing slash. */\nconst tidy = (typed: string) =>\n  typed\n    .trim()\n    .replace(/^https?:\\/\\//, '')\n    .replace(/\\/+$/, '');\n\n/**\n * The Preview pane: the dev server's page in a small browser. The bar on top goes back, forward\n * and reloads, takes an address, switches the viewport and opens the console; under it the page,\n * centred on the frame's grey when its viewport is narrower than the pane; at the foot the\n * console's drawer, open on load with what the page logged. A load starts the page and its\n * console over; Export CSV in the page adds its line to the console.\n */\nexport function PreviewPane() {\n  const consoleId = useId();\n  const [history, setHistory] = useState({ entries: [HOME], index: 0 });\n  const [address, setAddress] = useState(HOME);\n  const [viewport, setViewport] = useState<Viewport>('desktop');\n  const [messages, setMessages] = useState(MESSAGES);\n  const [consoleOpen, setConsoleOpen] = useState(true);\n  // Counts the loads, to start the page over, and the lines the export logged, to tell them apart.\n  const [loads, setLoads] = useState(0);\n  const logged = useRef(0);\n\n  const { entries, index } = history;\n  const current = entries[index];\n\n  const load = (to: string[], at: number) => {\n    setHistory({ entries: to, index: at });\n    setAddress(to[at]);\n    setLoads((count) => count + 1);\n    setMessages(to[at] === HOME ? [ZONE_WARNING] : [notFoundError(to[at])]);\n  };\n\n  const go = (typed: string) => {\n    const next = tidy(typed) || current;\n    // The same address again is a reload; a new one drops whatever was ahead.\n    if (next === current) load(entries, index);\n    else load([...entries.slice(0, index + 1), next], index + 1);\n  };\n\n  return (\n    <div className=\"flex min-h-0 flex-1 flex-col\">\n      <PreviewToolbar\n        address={address}\n        onAddressChange={setAddress}\n        onGo={() => go(address)}\n        current={current}\n        onBack={index > 0 ? () => load(entries, index - 1) : undefined}\n        onForward={index < entries.length - 1 ? () => load(entries, index + 1) : undefined}\n        onReload={() => load(entries, index)}\n        viewport={viewport}\n        onViewportChange={setViewport}\n        console={{\n          id: consoleId,\n          open: consoleOpen,\n          count: messages.length,\n          onToggle: () => setConsoleOpen((value) => !value),\n        }}\n      />\n\n      <div className=\"bg-ws-static-background flex min-h-0 flex-1 justify-center overflow-hidden\">\n        <PreviewPage\n          key={loads}\n          address={current}\n          className={cn('h-full', WIDTH[viewport])}\n          onExport={(rows) => {\n            // The id is taken here, in the event, so the state updater stays pure.\n            const message = exportLog(`export-${(logged.current += 1)}`, rows);\n            setMessages((all) => [...all, message]);\n          }}\n          onHome={() => go(HOME)}\n        />\n      </div>\n\n      {consoleOpen && (\n        <PreviewConsole\n          id={consoleId}\n          messages={messages}\n          onClear={() => setMessages([])}\n          onClose={() => setConsoleOpen(false)}\n        />\n      )}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/preview-toolbar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/preview-toolbar.tsx",
      "content": "'use client';\n\nimport {\n  RiArrowLeftLine,\n  RiArrowRightLine,\n  RiComputerLine,\n  RiExternalLinkLine,\n  RiRefreshLine,\n  RiSmartphoneLine,\n  RiTabletLine,\n  RiTerminalBoxLine,\n} from '@remixicon/react';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { SegmentedControl } from '@/components/ui/wideset/segmented-control/SegmentedControl';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { Tooltip } from '@/components/ui/wideset/tooltip/Tooltip';\n\nimport { BarAction } from './bar-action';\nimport type { Viewport } from './preview-data';\n\ntype PreviewToolbarProps = {\n  /** What the address field holds: the page's address, or what is being typed over it. */\n  address: string;\n  onAddressChange: (address: string) => void;\n  /** Enter in the address field. */\n  onGo: () => void;\n  /** The page open now, for the link that opens it in a window of its own. */\n  current: string;\n  onBack?: () => void;\n  onForward?: () => void;\n  onReload: () => void;\n  viewport: Viewport;\n  onViewportChange: (viewport: Viewport) => void;\n  console: { id: string; open: boolean; count: number; onToggle: () => void };\n};\n\n/**\n * The small browser's bar: back, forward and reload, the address (Enter goes there), the viewport\n * the page is shown at, the console's count, which opens its drawer, and the way out to a real\n * window. Everything is quiet: the bar serves the page under it.\n */\nexport function PreviewToolbar({\n  address,\n  onAddressChange,\n  onGo,\n  current,\n  onBack,\n  onForward,\n  onReload,\n  viewport,\n  onViewportChange,\n  console: drawer,\n}: PreviewToolbarProps) {\n  return (\n    <div className=\"h-ws-16 border-ws-static-subtle px-ws-9 gap-ws-5 flex shrink-0 items-center border-b\">\n      <div className=\"gap-ws-2 flex shrink-0 items-center\">\n        {/* With nowhere to go they are disabled, and keep their place. */}\n        <BarAction\n          icon={RiArrowLeftLine}\n          label=\"Back\"\n          disabled={!onBack}\n          onClick={() => onBack?.()}\n        />\n        <BarAction\n          icon={RiArrowRightLine}\n          label=\"Forward\"\n          disabled={!onForward}\n          onClick={() => onForward?.()}\n        />\n        <BarAction icon={RiRefreshLine} label=\"Reload\" onClick={onReload} />\n      </div>\n\n      <form\n        className=\"min-w-0 flex-1\"\n        onSubmit={(event) => {\n          event.preventDefault();\n          onGo();\n        }}\n      >\n        <TextInput\n          size=\"sm\"\n          value={address}\n          onChange={(event) => onAddressChange(event.target.value)}\n          aria-label=\"Address\"\n          autoComplete=\"off\"\n          autoCapitalize=\"off\"\n          spellCheck={false}\n        />\n      </form>\n\n      <SegmentedControl\n        size=\"sm\"\n        value={viewport}\n        onValueChange={(value) => onViewportChange(value as Viewport)}\n        aria-label=\"Viewport\"\n        className=\"shrink-0\"\n      >\n        <SegmentedControl.Item value=\"desktop\" icon={RiComputerLine} aria-label=\"Desktop\" />\n        <SegmentedControl.Item value=\"tablet\" icon={RiTabletLine} aria-label=\"Tablet\" />\n        <SegmentedControl.Item value=\"phone\" icon={RiSmartphoneLine} aria-label=\"Phone\" />\n      </SegmentedControl>\n\n      <div className=\"gap-ws-2 flex shrink-0 items-center\">\n        <Tooltip size=\"sm\">\n          <Tooltip.Trigger asChild>\n            <Button\n              size=\"xs\"\n              variant=\"secondary\"\n              preset=\"ghost\"\n              aria-expanded={drawer.open}\n              aria-controls={drawer.open ? drawer.id : undefined}\n              aria-label={`Console, ${drawer.count} ${drawer.count === 1 ? 'message' : 'messages'}`}\n              onClick={drawer.onToggle}\n            >\n              <Button.Icon icon={RiTerminalBoxLine} />\n              <span className=\"tabular-nums\">{drawer.count}</span>\n            </Button>\n          </Tooltip.Trigger>\n          <Tooltip.Content className=\"ws-block-utility\" side=\"bottom\">\n            <Tooltip.Label>{drawer.open ? 'Close console' : 'Open console'}</Tooltip.Label>\n          </Tooltip.Content>\n        </Tooltip>\n        <BarAction asChild icon={RiExternalLinkLine} label=\"Open in a new window\">\n          {/* eslint-disable-next-line jsx-a11y/anchor-has-content -- IconButton slots its icon into the anchor, which BarAction names by its label */}\n          <a href={`http://${current}`} target=\"_blank\" rel=\"noreferrer\" />\n        </BarAction>\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/prose.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/prose.tsx",
      "content": "'use client';\n\n// TODO(custom): prose the agent writes (title, headings, paragraphs, lists, code) at a reading rhythm; Wideset has the type styles but no prose or rich text component.\nimport { cn } from '@/lib/wideset/utils';\n\nimport { CodeBlock } from './code-block';\nimport { Inline } from './inline';\nimport type { Prose as ProseBlock } from './model';\n\n/** An answer in the transcript reads at 14px; a document in a pane at 16px, with more air. */\nconst SIZE = {\n  md: { root: 'gap-ws-5', text: 'typography-body-md', heading: 'typography-label-strong-sm' },\n  lg: { root: 'gap-ws-9', text: 'typography-body-lg', heading: 'typography-subtitle-xs mt-ws-7' },\n};\n\n/** The elements of a title and of a heading, which sits one level under it. */\nconst LEVEL = { 2: ['h2', 'h3'], 3: ['h3', 'h4'] } as const;\n\ntype ProseProps = {\n  blocks: ProseBlock[];\n  size?: 'md' | 'lg';\n  /** The level of a title: 2 in the transcript, 3 in a pane under the pane's own heading. */\n  level?: keyof typeof LEVEL;\n};\n\n/**\n * Written text as its blocks, in order. A partly streamed text is the same blocks cut short, so\n * it grows in place: a paragraph by its words, a list by its items, code by its lines.\n */\nexport function Prose({ blocks, size = 'md', level = 2 }: ProseProps) {\n  const { root, text, heading } = SIZE[size];\n  const [Title, Heading] = LEVEL[level];\n  return (\n    <div className={cn('text-ws-static-base flex flex-col', root)}>\n      {blocks.map((block, index) => {\n        switch (block.kind) {\n          case 'title':\n            return (\n              <Title key={index} className=\"typography-title-sm text-ws-static-strong\">\n                {block.text}\n              </Title>\n            );\n          case 'heading':\n            return (\n              <Heading key={index} className={cn(heading, 'text-ws-static-strong')}>\n                {block.text}\n              </Heading>\n            );\n          case 'paragraph':\n            return (\n              <p key={index} className={text}>\n                <Inline text={block.text} />\n              </p>\n            );\n          case 'list':\n            return (\n              <ul\n                key={index}\n                className={cn(\n                  text,\n                  'marker:text-ws-static-subtle gap-ws-3 pl-ws-11 flex list-disc flex-col',\n                )}\n              >\n                {block.items.map((item, at) => (\n                  <li key={at}>\n                    <Inline text={item} />\n                  </li>\n                ))}\n              </ul>\n            );\n          case 'code':\n            return <CodeBlock key={index} language={block.language} lines={block.lines} />;\n        }\n      })}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/question-card.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/question-card.tsx",
      "content": "'use client';\n\n// TODO(custom): a question the agent needs answered before it goes on (the question, a few answers to pick from, Continue); Wideset has no card for a decision inside a transcript.\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { RadioButton } from '@/components/ui/wideset/radio-button/RadioButton';\nimport { RadioButtonGroup } from '@/components/ui/wideset/radio-button/RadioButtonGroup';\nimport { type FormEvent, useId, useState } from 'react';\n\nimport type { QuestionOption } from './model';\n\ntype QuestionCardProps = {\n  title: string;\n  options: QuestionOption[];\n  /** Answers with the option's own words, as if they had been typed. */\n  onAnswer: (text: string) => void;\n};\n\n/**\n * What the agent asks when the next step is your decision, not its own: a bordered card in the\n * transcript, like an approval, with the question, two or three answers it can act on at once\n * (each with the fact that decides it), and Continue. Nothing is picked for you, so Continue\n * waits for a choice; it is the screen's filled button while the card waits. Any other answer\n * goes in the composer, as the last line says. Either way the answer becomes your message.\n */\nexport function QuestionCard({ title, options, onAnswer }: QuestionCardProps) {\n  const titleId = useId();\n  const [value, setValue] = useState('');\n\n  const submit = (event: FormEvent) => {\n    event.preventDefault();\n    const picked = options.find((option) => option.value === value);\n    if (picked) onAnswer(picked.label);\n  };\n\n  return (\n    <form\n      onSubmit={submit}\n      aria-labelledby={titleId}\n      className=\"border-ws-static-base rounded-ws-container-md p-ws-9 gap-ws-9 flex flex-col border\"\n    >\n      <p id={titleId} className=\"typography-label-strong-sm text-ws-static-strong\">\n        {title}\n      </p>\n      <RadioButtonGroup aria-labelledby={titleId} value={value} onValueChange={setValue}>\n        {options.map((option) => (\n          <RadioButton\n            key={option.value}\n            size=\"sm\"\n            value={option.value}\n            label={option.label}\n            description={option.description}\n          />\n        ))}\n      </RadioButtonGroup>\n      <div className=\"gap-ws-7 flex items-center\">\n        <Button type=\"submit\" size=\"sm\" disabled={!value}>\n          Continue\n        </Button>\n        <p className=\"typography-body-md text-ws-static-subtle\">\n          Or answer in your own words below.\n        </p>\n      </div>\n    </form>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/reasoning.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/reasoning.tsx",
      "content": "'use client';\n\n// TODO(custom): the agent's reasoning as one line (a shimmering \"Thinking\" with the seconds, then \"Thought for 12s\") that opens to its text; Wideset has no reasoning or disclosure-line part.\nimport { RiBrainLine } from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport { useEffect, useState } from 'react';\n\nimport { Fold } from './fold';\nimport { formatDuration } from './format';\nimport type { Block } from './model';\nimport { ARRIVE } from './motion';\nimport { Row } from './row';\nimport { Shimmer } from './shimmer';\n\ntype ReasoningProps = {\n  block: Extract<Block, { kind: 'reasoning' }>;\n  /** The Thinking and Verbose views: the text starts open and stays open. */\n  defaultOpen: boolean;\n  live: boolean;\n};\n\n/**\n * What the agent thought before it acted. While it thinks: \"Thinking\" with a light passing over\n * it and the seconds counting; a click opens the text as it is written, quiet, behind a line on\n * its left. Once done it folds itself to \"Thought for 12s\", which opens again on a click.\n */\nexport function Reasoning({ block, defaultOpen, live }: ReasoningProps) {\n  const [open, setOpen] = useState(defaultOpen);\n  const running = Boolean(block.running);\n\n  // Done thinking: the text folds away by itself, unless the view keeps reasoning open.\n  useEffect(() => {\n    if (!running && !defaultOpen) setOpen(false);\n  }, [running, defaultOpen]);\n\n  return (\n    <div className={cn(live && ARRIVE)}>\n      <Row\n        mark={<RiBrainLine aria-hidden className=\"size-ws-9 text-ws-static-subtle shrink-0\" />}\n        open={open}\n        onToggle={() => setOpen((value) => !value)}\n      >\n        {running ? (\n          <span className=\"gap-ws-3 flex items-baseline\">\n            <Shimmer>Thinking</Shimmer>\n            <span className=\"text-ws-static-subtle tabular-nums\">\n              {formatDuration(block.seconds)}\n            </span>\n          </span>\n        ) : (\n          <span className=\"text-ws-static-subtle tabular-nums\">\n            Thought for {formatDuration(block.seconds)}\n          </span>\n        )}\n      </Row>\n      <Fold open={open}>\n        <p className=\"typography-body-md text-ws-static-subtle border-ws-static-base ml-ws-7 my-ws-3 border-l pl-[calc(var(--spacing-ws-9)-1px)] whitespace-pre-line\">\n          {block.text}\n        </p>\n      </Fold>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/row.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/row.tsx",
      "content": "'use client';\n\n// TODO(custom): a quiet one-line row in the transcript (a thought, a step) that opens what is under it; Accordion's trigger is a full-width title with its chevron at the far end.\nimport { RiArrowRightSLine } from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport type { ReactNode } from 'react';\n\ntype RowProps = {\n  /** The 16px mark the row starts with: what it is, or how it went. */\n  mark: ReactNode;\n  children: ReactNode;\n  /** Given `onToggle`, the row is a button that opens and shuts what is under it. */\n  open?: boolean;\n  onToggle?: () => void;\n};\n\n/**\n * One line of the agent's work. A row with something under it is one target across its whole\n * width, with a chevron after its text that turns when it opens; a row with nothing to open is\n * plain text.\n */\nexport function Row({ mark, children, open = false, onToggle }: RowProps) {\n  const className =\n    'gap-ws-5 px-ws-3 min-h-ws-13 rounded-ws-control-md typography-body-md flex w-full items-center text-left';\n  if (!onToggle) {\n    return (\n      <div className={className}>\n        {mark}\n        {children}\n      </div>\n    );\n  }\n  return (\n    <button\n      type=\"button\"\n      aria-expanded={open}\n      onClick={onToggle}\n      className={cn(\n        className,\n        'hover:bg-ws-static-alpha-subtle focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default cursor-pointer transition-[background-color] duration-(--ws-motion-duration-quick) ease-(--ws-motion-ease-out) focus-visible:-outline-offset-2',\n      )}\n    >\n      {mark}\n      {children}\n      <RiArrowRightSLine\n        aria-hidden\n        className={cn(\n          'size-ws-9 text-ws-static-subtle shrink-0 transition-transform duration-(--ws-motion-duration-fast) ease-(--ws-motion-ease-smooth-out)',\n          open && 'rotate-90',\n        )}\n      />\n    </button>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/run.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/run.ts",
      "content": "// TODO(custom): playing a turn over time (thinking, steps, streaming) as a pure function of the clock; Wideset has no agent or streaming parts.\nimport type { AgentTurn, ApprovalAnswer, Block, Prose, Step } from './model';\n\n/** How long a step runs when its data does not say, and how long one word of an answer takes. */\nconst STEP_MS = 1400;\nconst WORD_MS = 32;\n\n/** A text in the pieces it streams in: each word with the space before it. */\nconst pieces = (text: string) => text.match(/\\s*\\S+/g) ?? [];\n\nconst takeWords = (text: string, count: number) => pieces(text).slice(0, count).join('');\n\nconst lines = (block: Prose) =>\n  block.kind === 'list' ? block.items : block.kind === 'code' ? block.lines : [block.text];\n\nexport const countWords = (prose: Prose[]) =>\n  prose.reduce(\n    (sum, block) => sum + lines(block).reduce((n, line) => n + pieces(line).length, 0),\n    0,\n  );\n\n/** The prose as plain text, for the clipboard. */\nexport const proseText = (prose: Prose[]) =>\n  prose.map((block) => lines(block).join('\\n')).join('\\n\\n');\n\n/**\n * The first `count` words of the prose, in its own structure: what has streamed in so far. With\n * `whole`, a line that has begun is there in full (a paragraph, a list item, a line of code), so\n * the text arrives in steps and no word moves: how it is written when motion is reduced.\n */\nexport function takeProse(prose: Prose[], count: number, whole = false): Prose[] {\n  const taken: Prose[] = [];\n  let left = count;\n  const take = (source: string[]) => {\n    const part: string[] = [];\n    for (const line of source) {\n      if (left <= 0) break;\n      part.push(whole ? line : takeWords(line, left));\n      left -= pieces(line).length;\n    }\n    return part;\n  };\n  for (const block of prose) {\n    if (left <= 0) break;\n    if (block.kind === 'list') taken.push({ ...block, items: take(block.items) });\n    else if (block.kind === 'code') taken.push({ ...block, lines: take(block.lines) });\n    else taken.push({ ...block, text: take([block.text])[0] });\n  }\n  return taken;\n}\n\nexport type Playback = {\n  /** The turn as far as it has come. */\n  turn: AgentTurn;\n  /** What the agent is doing now: \"Thinking\", \"Running `pnpm typecheck`\", \"Writing\". */\n  activity: string;\n  /** It waits for you (an approval, a question, a card that holds): the clock stands still. */\n  waiting: boolean;\n  /** Where the clock stood when the turn stopped to wait, or ended. */\n  clock: number;\n  done: boolean;\n};\n\n/**\n * The turn `at` milliseconds into its run: the blocks that are there by then, the one in progress\n * cut to what it has so far (seconds thought, a step running, words written), nothing after it.\n * Whatever waits for you holds everything behind it, however late it is: a step that waits to be\n * allowed, a step or a card that `holds`, a question not yet answered. `whole` writes text a line\n * at a time, for reduced motion; the clock is the same either way.\n */\nexport function playTurn(turn: AgentTurn, at: number, whole = false): Playback {\n  const blocks: Block[] = [];\n  let clock = 0;\n  const pause = (activity: string, waiting = false): Playback => ({\n    turn: { ...turn, blocks },\n    activity,\n    waiting,\n    clock,\n    done: false,\n  });\n\n  /** One step at the clock: as it shows now, and what holds the turn there, if anything. */\n  const play = (step: Step): { step: Step; activity?: string; waiting?: boolean } => {\n    if (step.status === 'waiting') {\n      const activity = step.approval ? 'Waiting for your approval' : 'Waiting for you';\n      return { step: { ...step, holding: true }, activity, waiting: true };\n    }\n    if (step.status === 'skipped') return { step };\n    const length = step.ms ?? STEP_MS;\n    if (at < clock + length) {\n      const progress = (at - clock) / length;\n      return {\n        step: { ...step, status: 'running', progress },\n        activity: step.active ?? step.label,\n      };\n    }\n    clock += length;\n    if (step.holds && !step.released) {\n      return { step: { ...step, holding: true }, activity: 'Waiting for you', waiting: true };\n    }\n    return { step };\n  };\n\n  /** Text written over time: as much as there is by now, and whether more is to come. */\n  const write = (prose: Prose[]) => {\n    const total = countWords(prose);\n    const shown = Math.floor((at - clock) / WORD_MS);\n    if (shown < total) return { prose: takeProse(prose, shown, whole), streaming: true };\n    clock += total * WORD_MS;\n    return { prose, streaming: false };\n  };\n\n  for (const block of turn.blocks) {\n    if (block.kind === 'reasoning') {\n      const length = block.seconds * 1000;\n      if (at < clock + length) {\n        const part = (at - clock) / length;\n        blocks.push({\n          ...block,\n          running: true,\n          seconds: Math.floor((at - clock) / 1000),\n          text: takeWords(block.text, Math.ceil(pieces(block.text).length * part)),\n        });\n        return pause('Thinking');\n      }\n      clock += length;\n      blocks.push(block);\n    } else if (block.kind === 'step') {\n      const played = play(block);\n      blocks.push({ ...played.step, kind: 'step' });\n      if (played.activity) return pause(played.activity, played.waiting);\n    } else if (block.kind === 'steps') {\n      const steps: Step[] = [];\n      for (const step of block.steps) {\n        const played = play(step);\n        steps.push(played.step);\n        if (played.activity) {\n          blocks.push({ ...block, steps, total: block.steps.length });\n          return pause(played.activity, played.waiting);\n        }\n      }\n      blocks.push(block);\n    } else if (block.kind === 'text') {\n      const written = write(block.prose);\n      if (written.streaming) {\n        blocks.push({ ...block, ...written });\n        return pause('Writing');\n      }\n      blocks.push(block);\n    } else if (block.kind === 'card') {\n      const written = block.prose && write(block.prose);\n      if (written?.streaming) {\n        blocks.push({ ...block, ...written });\n        return pause('Writing');\n      }\n      if (block.holds && !block.released) {\n        blocks.push({ ...block, holding: true });\n        return pause('Waiting for you', true);\n      }\n      blocks.push(block);\n    } else {\n      blocks.push(block);\n      if (block.answer === undefined) return pause('Waiting for your answer', true);\n    }\n  }\n  return { turn, activity: '', waiting: false, clock, done: true };\n}\n\nconst eachBlock = (turn: AgentTurn, change: (block: Block) => Block): AgentTurn => ({\n  ...turn,\n  blocks: turn.blocks.map(change),\n});\n\nconst eachStep = (turn: AgentTurn, change: (step: Step) => Step): AgentTurn =>\n  eachBlock(turn, (block) =>\n    block.kind === 'step'\n      ? { ...change(block), kind: 'step' }\n      : block.kind === 'steps'\n        ? { ...block, steps: block.steps.map(change) }\n        : block,\n  );\n\n/** The turn with one waiting step answered: allowed, it runs; denied, it is skipped. */\nexport const answerApproval = (turn: AgentTurn, stepId: string, answer: ApprovalAnswer) =>\n  eachStep(turn, (step) =>\n    step.id === stepId && step.approval\n      ? {\n          ...step,\n          status: answer === 'denied' ? 'skipped' : 'done',\n          approval: { ...step.approval, answer },\n        }\n      : step,\n  );\n\n/** The turn let go at the step or the card that held it: a step that waited now runs. */\nexport const release = (turn: AgentTurn, id: string) =>\n  eachBlock(\n    eachStep(turn, (step) =>\n      step.id !== id\n        ? step\n        : { ...step, released: true, status: step.status === 'waiting' ? 'done' : step.status },\n    ),\n    (block) => (block.kind === 'card' && block.id === id ? { ...block, released: true } : block),\n  );\n\n/**\n * The turn with its open question answered, in your words or one of its own. Without an `id`\n * every question still open takes the answer: a message sent instead of picking one.\n */\nexport const answerQuestion = (turn: AgentTurn, text: string, id?: string) =>\n  eachBlock(turn, (block) =>\n    block.kind === 'question' && block.answer === undefined && (!id || block.id === id)\n      ? { ...block, answer: text }\n      : block,\n  );\n\n/** The turn as it was before anyone answered it: for playing it again from its start. */\nexport const rewind = (turn: AgentTurn): AgentTurn =>\n  eachBlock(\n    eachStep({ ...turn, stoppedAt: undefined }, (step) => ({\n      ...step,\n      released: undefined,\n      ...(step.approval && {\n        status: 'waiting',\n        approval: { ...step.approval, answer: undefined },\n      }),\n    })),\n    (block) =>\n      block.kind === 'card'\n        ? { ...block, released: undefined }\n        : block.kind === 'question'\n          ? { ...block, answer: undefined }\n          : block,\n  );\n\n/** A turn cut short: whatever was in progress ends there, and the turn says it was stopped. */\nfunction settle(turn: AgentTurn): AgentTurn {\n  const cut = eachStep(turn, (step) =>\n    step.status === 'running' || step.status === 'waiting'\n      ? { ...step, status: 'skipped', result: 'Not finished', holding: false }\n      : { ...step, holding: false },\n  );\n  return {\n    ...eachBlock(cut, (block) =>\n      block.kind === 'reasoning'\n        ? { ...block, running: false }\n        : block.kind === 'text'\n          ? { ...block, streaming: false }\n          : block.kind === 'card'\n            ? { ...block, streaming: false, holding: false }\n            : block,\n    ),\n    stopped: true,\n  };\n}\n\n/**\n * A turn as the transcript shows it: `at` into its run while it plays; cut where it was stopped;\n * otherwise whole, or held at whatever it still waits for.\n */\nexport function showTurn(turn: AgentTurn, at?: number, whole = false): AgentTurn {\n  if (at !== undefined) return playTurn(turn, at, whole).turn;\n  if (turn.stoppedAt !== undefined) return settle(playTurn(turn, turn.stoppedAt, whole).turn);\n  const rest = playTurn(turn, Infinity);\n  return rest.done ? turn : { ...rest.turn, held: true };\n}\n"
    },
    {
      "path": "src/blocks/agent-code/session-data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/session-data.ts",
      "content": "import { FILES } from './changes-data';\nimport { CHECKS } from './checks-data';\nimport type { StepDetail, Turn } from './model';\nimport { SHELLS } from './terminal-data';\n\n/*\n  The open session, \"CSV export for bookings\" in `lumen-app`, as its turns. Ines asked for the\n  export with Plan mode on; Tandem read the files, proposed a plan she approved, made the\n  changes, ran the unit tests (one failed on a start time in local time), fixed it, and opened\n  draft pull request #482. Then E2E failed on the pull request: the newest turn stops at the\n  command Tandem wants to run, with a subagent already on the timeout.\n\n  What a step opens to is read from the panes' own data (the diff, the shells, the checks), so\n  the transcript and the panes cannot disagree.\n*/\n\nconst SIGN = { added: '+', removed: '-', context: ' ' };\n\n/** A changed file's step: its counts as the result, its diff as the detail. */\nconst change = (name: string): { result: string; detail: StepDetail } => {\n  const file = FILES.find(({ path }) => path.endsWith(`/${name}`))!;\n  return {\n    result: file.removed ? `+${file.added} −${file.removed}` : `+${file.added}`,\n    detail: {\n      kind: 'diff',\n      lines: file.hunks.flatMap((hunk) => hunk.lines.map((line) => SIGN[line.kind] + line.text)),\n    },\n  };\n};\n\n/** A run in the tests' shell as a step's output: its lines, the failures marked. */\nconst testRun = (at: number): StepDetail => {\n  const { command, output } = SHELLS[0].runs[at];\n  const lines = output.filter((line) => line.length > 0);\n  return {\n    kind: 'output',\n    lines: [\n      `$ ${command}`,\n      ...lines.map((line) =>\n        line.map((span) => (typeof span === 'string' ? span : span[1])).join(''),\n      ),\n    ],\n    errors: lines.flatMap((line, index) =>\n      line.some((span) => typeof span !== 'string' && span[0] === 'negative') ? [index + 1] : [],\n    ),\n  };\n};\n\n/** The lines of the E2E check's log that say why it failed. */\nconst e2eLog = CHECKS.find((check) => check.id === 'e2e')?.log ?? [];\n\n/** The plan Ines approved, before anything was changed. The Tasks pane shows how it went on. */\nexport const plan = [\n  'Add `exportBookingsCsv` in `export-csv.ts`: the rows in, the CSV text out.',\n  'Put an Export CSV button in the toolbar, disabled when no row matches.',\n  'Cover quoting, empty values and dates with unit tests.',\n  'Open a draft pull request, and mark it ready once its checks pass.',\n];\n\n/** The session's turns, oldest first; the newest waits for an approval. */\nexport const csvExport: Turn[] = [\n  {\n    id: 'csv-1',\n    role: 'user',\n    text: 'Add a CSV export to the bookings table: the rows the filters show, for Finance. Open a draft pull request when the tests pass.',\n  },\n  {\n    id: 'csv-2',\n    role: 'agent',\n    blocks: [\n      {\n        kind: 'reasoning',\n        id: 'csv-2-thought',\n        seconds: 9,\n        text: 'The table already holds its filtered rows, so the export can be one function over them and the button only has to call it. Finance opens the file in a spreadsheet: a value with a comma or a quote needs quoting, and dates should sort as text. Plan mode is on, so I read first and propose the steps before I change anything.',\n      },\n      {\n        kind: 'steps',\n        id: 'csv-2-read',\n        label: 'Read 3 files',\n        steps: [\n          {\n            id: 'read-table',\n            label: 'Read `bookings-table.tsx`',\n            active: 'Reading `bookings-table.tsx`',\n            result: '31 lines',\n            status: 'done',\n          },\n          {\n            id: 'read-types',\n            label: 'Read `types.ts`',\n            active: 'Reading `types.ts`',\n            result: '46 lines',\n            status: 'done',\n          },\n          {\n            id: 'read-toolbar',\n            label: 'Read `bookings-toolbar.tsx`',\n            active: 'Reading `bookings-toolbar.tsx`',\n            result: '38 lines',\n            status: 'done',\n          },\n        ],\n      },\n      { kind: 'card', id: 'csv-2-plan', card: 'plan' },\n      {\n        kind: 'steps',\n        id: 'csv-2-changes',\n        label: 'Changed 4 files',\n        steps: [\n          {\n            id: 'write-export',\n            label: 'Wrote `export-csv.ts`',\n            active: 'Writing `export-csv.ts`',\n            status: 'done',\n            ...change('export-csv.ts'),\n          },\n          {\n            id: 'edit-toolbar',\n            label: 'Edited `bookings-toolbar.tsx`',\n            active: 'Editing `bookings-toolbar.tsx`',\n            status: 'done',\n            ...change('bookings-toolbar.tsx'),\n          },\n          {\n            id: 'edit-table',\n            label: 'Edited `bookings-table.tsx`',\n            active: 'Editing `bookings-table.tsx`',\n            status: 'done',\n            ...change('bookings-table.tsx'),\n          },\n          {\n            id: 'write-test',\n            label: 'Wrote `export-csv.test.ts`',\n            active: 'Writing `export-csv.test.ts`',\n            status: 'done',\n            ...change('export-csv.test.ts'),\n          },\n        ],\n      },\n      {\n        kind: 'step',\n        id: 'test-failed',\n        label: 'Ran `pnpm test bookings`',\n        active: 'Running `pnpm test bookings`',\n        result: '13 passed, 1 failed · 3.4s',\n        status: 'failed',\n        detail: testRun(0),\n        card: 'terminal',\n      },\n      {\n        kind: 'step',\n        id: 'edit-format-date',\n        label: 'Edited `format-date.ts`',\n        active: 'Editing `format-date.ts`',\n        status: 'done',\n        ...change('format-date.ts'),\n      },\n      {\n        kind: 'step',\n        id: 'test-passed',\n        label: 'Ran `pnpm test bookings`',\n        active: 'Running `pnpm test bookings`',\n        result: '14 passed · 3.2s',\n        status: 'done',\n        detail: testRun(1),\n        // Under its output: the way to the shell the run is in.\n        card: 'terminal',\n      },\n      {\n        kind: 'text',\n        id: 'csv-2-answer',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'The export is in: **Export CSV** in the toolbar downloads the rows the filters show. The first test run caught start times written in local time, so `formatTimestamp` now writes UTC, as `2026-11-10T09:00:00Z`.',\n          },\n        ],\n      },\n      { kind: 'card', id: 'csv-2-files', card: 'changes' },\n      {\n        kind: 'step',\n        id: 'open-pull-request',\n        label: 'Opened a draft pull request',\n        active: 'Opening a draft pull request',\n        result: '#482',\n        status: 'done',\n      },\n      { kind: 'card', id: 'csv-2-pull-request', card: 'pull-request' },\n    ],\n  },\n  {\n    id: 'csv-3',\n    role: 'user',\n    text: 'E2E failed on the pull request. Find out why and fix it.',\n  },\n  {\n    id: 'csv-4',\n    role: 'agent',\n    blocks: [\n      {\n        kind: 'reasoning',\n        id: 'csv-4-thought',\n        seconds: 5,\n        text: 'Lint, typecheck, the unit tests and the preview deploy passed; only E2E failed. The unit tests cover the CSV text, so this is about the download itself, in a real browser. The log will say which test; a trace will say which step.',\n      },\n      {\n        kind: 'step',\n        id: 'read-log',\n        label: 'Read the log of the E2E check',\n        active: 'Reading the log of the E2E check',\n        result: 'Timed out',\n        status: 'done',\n        detail: {\n          kind: 'output',\n          lines: e2eLog.map(({ text }) => text),\n          errors: e2eLog.flatMap(({ error }, index) => (error ? [index] : [])),\n        },\n      },\n      {\n        kind: 'step',\n        id: 'read-spec',\n        label: 'Read `bookings-export.spec.ts`',\n        active: 'Reading `bookings-export.spec.ts`',\n        result: '42 lines',\n        status: 'done',\n      },\n      {\n        kind: 'step',\n        id: 'subagent',\n        label: 'Started a subagent on the timeout',\n        active: 'Subagent investigating the timeout',\n        status: 'running',\n        ms: 1200,\n      },\n      {\n        kind: 'text',\n        id: 'csv-4-finding',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'The test clicks **Export CSV**, then waits 30 seconds for a download that never starts. A subagent is reading how the file is saved; to see where the click goes, I want to run the tests once with a trace.',\n          },\n        ],\n      },\n      {\n        kind: 'step',\n        id: 'run-trace',\n        label: 'Ran `pnpm test:e2e bookings --trace on`',\n        active: 'Running `pnpm test:e2e bookings --trace on`',\n        pending: 'Run `pnpm test:e2e bookings --trace on`',\n        result: '1 of 3 failed',\n        status: 'waiting',\n        ms: 3600,\n        approval: {\n          title: 'Run a command',\n          command: 'pnpm test:e2e bookings --trace on',\n          reason:\n            'A trace records every step of the failing test. The command runs the three E2E tests against the dev server and writes the trace to test-results.',\n          scope: 'this repository',\n        },\n        detail: {\n          kind: 'output',\n          lines: [\n            '$ pnpm test:e2e bookings --trace on',\n            'Running 3 tests using 1 worker',\n            ' ✓ bookings › lists the bookings for today (1.9s)',\n            ' ✓ bookings › filters by room (2.3s)',\n            ' × bookings export › downloads the file (30.0s)',\n            '   Test timeout of 30000ms exceeded while waiting for the download',\n            ' 1 failed | 2 passed (36.9s)',\n            ' Trace: test-results/bookings-export-downloads-the-file/trace.zip',\n          ],\n          errors: [4, 5],\n        },\n      },\n      {\n        kind: 'text',\n        id: 'csv-4-answer',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'The trace shows it: the click on **Export CSV** opens the file in a new tab, so no download ever starts. The subagent is changing the export to a link with the `download` attribute; I will run E2E again when it is done.',\n          },\n        ],\n      },\n    ],\n  },\n];\n"
    },
    {
      "path": "src/blocks/agent-code/session.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/session.tsx",
      "content": "'use client';\n\n// TODO(custom): the session column (the transcript that scrolls; under it the working line, the queue and the composer); Wideset has no chat or transcript layout.\nimport { cn } from '@/lib/wideset/utils';\nimport { type ReactNode, useEffect, useRef } from 'react';\n\nimport { Composer } from './composer';\nimport { MessageQueue } from './message-queue';\nimport type { TranscriptView } from './model';\nimport type { CardRender } from './step-row';\nimport { Transcript } from './transcript';\nimport type { Session as SessionState } from './use-session';\nimport { WorkingLine } from './working-line';\n\n/** The transcript and the composer share one reading column, 48rem at most. */\nconst COLUMN = 'px-ws-11 mx-auto w-full max-w-[48rem]';\n\ntype SessionProps = {\n  /** The thread in use, from `useSession`. */\n  session: SessionState;\n  /** Changes with the thread on the page: a new one starts at its newest line. */\n  threadId: string;\n  /** The agent's name, for the composer's labels. */\n  agent: string;\n  view: TranscriptView;\n  card?: CardRender;\n  /** The mode's tools and the model menu, for the composer. */\n  tools?: ReactNode;\n  model?: ReactNode;\n  /** Over the composer, above the working line: what is about what you can send next. */\n  notice?: ReactNode;\n  /** Why nothing can be sent right now. Send is disabled and says it; the text stays editable. */\n  blocked?: string;\n};\n\n/**\n * The session under its top bar: the transcript, which alone scrolls and stays on its newest\n * line, and under it, always in reach, whatever is about the next message: a notice of the\n * block's own, the working line (working, or stopped with Continue), the\n * messages that wait their turn, and the composer. Send is the filled button, Stop while a turn\n * runs, and both step back for the way out of whatever waits for you.\n */\nexport function Session({\n  session,\n  threadId,\n  agent,\n  view,\n  card,\n  tools,\n  model,\n  notice,\n  blocked,\n}: SessionProps) {\n  const scroller = useRef<HTMLDivElement>(null);\n  const log = useRef<HTMLDivElement>(null);\n  /** The log is on its newest line and nothing in it was touched: it stays there as it resizes. */\n  const pinned = useRef(true);\n  const { shown, playback, at, running, stopped, queue } = session;\n\n  const toEnd = () => {\n    if (scroller.current) scroller.current.scrollTop = scroller.current.scrollHeight;\n    pinned.current = true;\n  };\n\n  // The log goes to its newest line on opening, in another view and with each new turn.\n  useEffect(toEnd, [threadId, shown.length, view]);\n  // While a turn plays it follows only if you left it there: scrolled up, it stays put.\n  useEffect(() => {\n    if (pinned.current) toEnd();\n  }, [at]);\n\n  // And it stays there when its size changes under it: a font that lands late, a composer that\n  // grows, a notice that comes or goes. It lets go only when you do something in it: press a\n  // row, which is then left where it is, or scroll away from the end. A scroll that the layout\n  // caused is not yours, so it does not count.\n  useEffect(() => {\n    const box = scroller.current;\n    if (typeof ResizeObserver !== 'function' || !box || !log.current) return;\n    const observer = new ResizeObserver(() => pinned.current && toEnd());\n    observer.observe(box);\n    observer.observe(log.current);\n    let touched = 0;\n    const act = () => {\n      touched = performance.now();\n    };\n    const release = () => {\n      act();\n      pinned.current = false;\n    };\n    const follow = () => {\n      if (box.scrollHeight - box.scrollTop - box.clientHeight < 2) pinned.current = true;\n      else if (performance.now() - touched < 600) pinned.current = false;\n    };\n    box.addEventListener('pointerdown', release);\n    box.addEventListener('keydown', release);\n    box.addEventListener('wheel', act, { passive: true });\n    box.addEventListener('touchmove', act, { passive: true });\n    box.addEventListener('scroll', follow);\n    return () => {\n      observer.disconnect();\n      box.removeEventListener('pointerdown', release);\n      box.removeEventListener('keydown', release);\n      box.removeEventListener('wheel', act);\n      box.removeEventListener('touchmove', act);\n      box.removeEventListener('scroll', follow);\n    };\n  }, []);\n\n  return (\n    <>\n      {/* `relative`: the transcript's screen-reader text is absolutely placed, and with no\n          positioned parent it would fall outside the scroller and stretch the page. */}\n      <div ref={scroller} className=\"ws-scrollbar relative min-h-0 flex-1 overflow-y-auto\">\n        <div\n          ref={log}\n          className={cn(COLUMN, 'pt-ws-5 pb-ws-12 flex min-h-full flex-col justify-end')}\n        >\n          <Transcript\n            turns={shown}\n            view={view}\n            liveId={playback?.turn.id}\n            card={card}\n            onAnswer={session.answer}\n            onChoose={session.choose}\n            onRate={session.rate}\n            onRetry={() => session.replay()}\n          />\n        </div>\n      </div>\n      <div className={cn(COLUMN, 'gap-ws-5 pb-ws-7 flex shrink-0 flex-col')}>\n        {notice}\n        {playback ? (\n          <WorkingLine state=\"working\" label=\"Working\" seconds={Math.floor(at / 1000)} />\n        ) : (\n          stopped && (\n            <WorkingLine\n              state=\"stopped\"\n              label={\n                stopped.activity\n                  ? `Stopped while ${stopped.activity[0].toLowerCase()}${stopped.activity.slice(1)}`\n                  : 'Stopped'\n              }\n              onContinue={session.resume}\n            />\n          )\n        )}\n        {queue.length > 0 && (\n          <MessageQueue\n            messages={queue}\n            agent={agent}\n            onEdit={session.edit}\n            onRemove={session.unqueue}\n          />\n        )}\n        <Composer\n          key={threadId}\n          label={`Message ${agent}`}\n          placeholder={running ? 'Queue a message' : `Reply to ${agent}`}\n          draft={session.draft}\n          attachments={session.attachments}\n          onDetach={session.detach}\n          tools={tools}\n          model={model}\n          running={running}\n          primary={!session.awaiting || Boolean(blocked)}\n          blocked={blocked}\n          onSend={session.send}\n          onStop={session.stop}\n        />\n      </div>\n    </>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/shimmer.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/shimmer.tsx",
      "content": "'use client';\n\n// TODO(custom): shimmering text for work in progress (\"Thinking\"); Wideset has no shimmer keyframes and a block cannot add CSS, so the sweep runs on the Web Animations API.\nimport { type ReactNode, useEffect, useRef } from 'react';\n\n/** A CSS time (\"400ms\", \"0.4s\") in milliseconds. */\nconst toMs = (value: string) => parseFloat(value) * (/\\ds$/.test(value.trim()) ? 1000 : 1);\n\n/**\n * Text a light passes over while something is still running: greys only, from the subtle text\n * colour to the strong one and back. One pass takes four `slow` beats of the motion tokens, at\n * their linear easing. Under reduced motion the tokens drop to 1ms, and where there is no Web\n * Animations API (a test) nothing runs: the text then stands still in the subtle colour.\n */\nexport function Shimmer({ children }: { children: ReactNode }) {\n  const ref = useRef<HTMLSpanElement>(null);\n\n  useEffect(() => {\n    const node = ref.current;\n    if (!node || typeof node.animate !== 'function') return;\n    let sweep: Animation | undefined;\n    const run = () => {\n      sweep?.cancel();\n      sweep = undefined;\n      const tokens = getComputedStyle(node);\n      // Reduced motion sets the beat to zero: no sweep.\n      const beat = toMs(tokens.getPropertyValue('--ws-motion-duration-slow'));\n      if (!(beat > 1)) return;\n      // The gradient is two texts wide and repeats, so moving it by its own width loops unseen.\n      sweep = node.animate(\n        { backgroundPosition: ['200% 0', '0% 0'] },\n        {\n          duration: beat * 4,\n          iterations: Infinity,\n          easing: tokens.getPropertyValue('--ws-motion-ease-linear').trim() || 'linear',\n        },\n      );\n    };\n    run();\n    // Reduced motion turned on (or off) while it shows: the beat changed, so start again.\n    const query = window.matchMedia?.('(prefers-reduced-motion: reduce)');\n    query?.addEventListener('change', run);\n    return () => {\n      query?.removeEventListener('change', run);\n      sweep?.cancel();\n    };\n  }, []);\n\n  return (\n    <span\n      ref={ref}\n      className=\"bg-[linear-gradient(90deg,var(--ws-static-text-subtle)_35%,var(--ws-static-text-strong)_50%,var(--ws-static-text-subtle)_65%)] bg-[length:200%_100%] bg-clip-text bg-[position:130%_0] text-transparent\"\n    >\n      {children}\n    </span>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/sidebar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/sidebar.tsx",
      "content": "'use client';\n\n// TODO(custom): the account menu is composed by hand, and the Search row turns into a TextInput in place; a thread group cannot fold (Sidebar.SectionHeader is a heading only) and Sidebar has no search part.\nimport {\n  RiAddLine,\n  RiArrowDownSLine,\n  RiChat1Line,\n  RiCodeSSlashLine,\n  RiLogoutBoxRLine,\n  RiSearchLine,\n  RiSettingsLine,\n  RiStackLine,\n} from '@remixicon/react';\nimport { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { ListItem } from '@/components/ui/wideset/list-item/ListItem';\nimport { SegmentedControl } from '@/components/ui/wideset/segmented-control/SegmentedControl';\nimport { Sidebar } from '@/components/ui/wideset/sidebar/Sidebar';\nimport { type SidebarProps } from '@/components/ui/wideset/sidebar/Sidebar.types';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { type MouseEvent, useEffect, useId, useRef, useState } from 'react';\n\nimport { BrandMark } from './brand-mark';\nimport { useModifier } from './keyboard-key';\nimport type { Mode, ThreadGroup } from './model';\nimport { PersonAvatar } from './person-avatar';\nimport { ThreadMark } from './thread-mark';\n\ntype AgentSidebarProps = Pick<SidebarProps, 'id' | 'collapsed' | 'onCollapsedChange'> & {\n  product: string;\n  workspace: string;\n  account: { name: string; email: string; initials: string };\n  mode: Mode;\n  onModeChange: (mode: Mode) => void;\n  /** The mode's threads: projects or repositories, then Recents. */\n  groups: ThreadGroup[];\n  /** The thread on the page; none on the new-chat screen. */\n  openId: string | null;\n  /** The thread the agent is working in right now: its row shows the spinner. */\n  workingId?: string;\n  onOpen: (id: string) => void;\n  /** Starts a new thread, in a group when its `+` was pressed. */\n  onNew: (groupId?: string) => void;\n  /** Code: the page that lists every session is the one open. */\n  allOpen?: boolean;\n  /** Code: opens that page in place; without it the row is a plain link to `#sessions`. */\n  onAll?: () => void;\n};\n\n/**\n * The app's sidebar on the grey frame: the brand, the Chat | Code switch, then a short list of\n * rows that read as navigation, icon and label, with no borders: New chat, Search and, in Code,\n * All sessions. Search turns into the search field in place, focused; Esc, clearing it or\n * leaving it empty brings the row back. Under them the mode's threads in their groups, with one\n * state mark at the end of a row and a child thread indented under its parent; a thread's name\n * starts on the same left edge as the rows' icons. The account sits at the foot. Its toggle is\n * in the page bar, so the screen holds `collapsed`; collapsed, it keeps the mark, the rows as\n * icons and the avatar.\n */\nexport function AgentSidebar({\n  product,\n  workspace,\n  account,\n  mode,\n  onModeChange,\n  groups,\n  openId,\n  workingId,\n  onOpen,\n  onNew,\n  allOpen = false,\n  onAll,\n  ...props\n}: AgentSidebarProps) {\n  const [query, setQuery] = useState('');\n  const [searching, setSearching] = useState(false);\n  const field = useRef<HTMLInputElement>(null);\n  const searchRow = useRef<HTMLButtonElement>(null);\n  /** Search was left from the keyboard: the cursor goes back to the Search row it came from. */\n  const backToRow = useRef(false);\n  const groupId = useId();\n  const thread = mode === 'chat' ? 'chat' : 'session';\n  const modifier = useModifier();\n  /** A shortcut as a row's hint: \"⌘K\" on Apple keyboards, \"Ctrl K\" elsewhere. */\n  const shortcut = (...keys: string[]) =>\n    modifier === '⌘' ? `⌘${keys.join('')}` : `Ctrl ${keys.join(' ')}`;\n  const { collapsed, onCollapsedChange } = props;\n\n  const needle = query.trim().toLowerCase();\n  const shown = groups\n    .map((group) => ({\n      ...group,\n      threads: group.threads.filter((item) => item.title.toLowerCase().includes(needle)),\n    }))\n    // A search shows only the groups it found something in; without one, an empty project or\n    // repository stays, with its `+` for the first thread in it.\n    .filter((group) => group.threads.length > 0 || (needle === '' && !group.fixed));\n  const nothingFound = needle !== '' && shown.length === 0;\n\n  const search = () => {\n    onCollapsedChange?.(false);\n    setSearching(true);\n  };\n\n  const endSearch = (refocus = false) => {\n    // Only ever set here: a blur as the field leaves must not cancel the way back.\n    if (refocus) backToRow.current = true;\n    setQuery('');\n    setSearching(false);\n  };\n\n  // The row became the field to be typed in: the cursor is there. Back from the field by Escape\n  // or Clear, the cursor goes to the Search row again rather than to the page.\n  useEffect(() => {\n    if (searching && !collapsed) field.current?.focus();\n    else if (!searching && backToRow.current) {\n      backToRow.current = false;\n      searchRow.current?.focus();\n    }\n  }, [searching, collapsed]);\n\n  // The rows' shortcuts, the ones their hints show.\n  useEffect(() => {\n    const onKey = (event: KeyboardEvent) => {\n      if (!(event.metaKey || event.ctrlKey) || event.altKey) return;\n      const key = event.key.toLowerCase();\n      if (key === 'k' && !event.shiftKey) {\n        event.preventDefault();\n        onCollapsedChange?.(false);\n        setSearching(true);\n        // Already open (a query kept it after the field lost focus): the effect will not run again.\n        field.current?.focus();\n      } else if (key === 'o' && event.shiftKey) {\n        event.preventDefault();\n        onNew();\n      }\n    };\n    window.addEventListener('keydown', onKey);\n    return () => window.removeEventListener('keydown', onKey);\n  }, [onCollapsedChange, onNew]);\n\n  /** A row is a link for its look and its place in the tab order; here it acts in place. */\n  const act = (action: () => void) => (event: MouseEvent) => {\n    event.preventDefault();\n    action();\n  };\n\n  return (\n    <Sidebar {...props}>\n      <Sidebar.Header>\n        <div className=\"gap-ws-7 flex flex-col\">\n          <Sidebar.Expanded>\n            <div className=\"gap-ws-7 flex flex-col\">\n              <div className=\"gap-ws-7 pt-ws-3 pb-ws-3 flex items-center\">\n                <BrandMark className=\"size-ws-15\" />\n                <div className=\"flex min-w-0 flex-1 flex-col\">\n                  <span className=\"typography-label-strong-sm text-ws-static-strong truncate\">\n                    {product}\n                  </span>\n                  <span className=\"typography-caption-md text-ws-static-subtle truncate\">\n                    {workspace}\n                  </span>\n                </div>\n              </div>\n              <SegmentedControl\n                size=\"sm\"\n                variant=\"fullWidth\"\n                aria-label=\"Mode\"\n                value={mode}\n                onValueChange={(value) => onModeChange(value as Mode)}\n              >\n                <SegmentedControl.Item value=\"chat\">\n                  <SegmentedControl.Icon icon={RiChat1Line} />\n                  Chat\n                </SegmentedControl.Item>\n                <SegmentedControl.Item value=\"code\">\n                  <SegmentedControl.Icon icon={RiCodeSSlashLine} />\n                  Code\n                </SegmentedControl.Item>\n              </SegmentedControl>\n            </div>\n          </Sidebar.Expanded>\n          <Sidebar.Collapsed>\n            <div className=\"pt-ws-3 pb-ws-3 flex justify-center\">\n              <BrandMark className=\"size-ws-15\" label={product} />\n            </div>\n          </Sidebar.Collapsed>\n\n          <nav aria-label={mode === 'chat' ? 'Chat' : 'Code'} className=\"gap-ws-2 flex flex-col\">\n            {/* New and Search act in place, so they are buttons dressed as the rows around them. */}\n            <Sidebar.Item\n              asChild\n              icon={RiAddLine}\n              label={`New ${thread}`}\n              suffix={shortcut('⇧', 'O')}\n              suffixOnHover\n            >\n              <button type=\"button\" onClick={() => onNew()} />\n            </Sidebar.Item>\n            {searching && !collapsed ? (\n              <TextInput\n                size=\"sm\"\n                value={query}\n                onChange={(event) => setQuery(event.target.value)}\n                onKeyDown={(event) => {\n                  if (event.key !== 'Escape') return;\n                  // Escape is spent closing the search: it does not also stop a running turn.\n                  event.preventDefault();\n                  endSearch(true);\n                }}\n                onBlur={() => query.trim() === '' && endSearch()}\n              >\n                <TextInput.Prefix inner>\n                  <TextInput.Icon icon={RiSearchLine} />\n                </TextInput.Prefix>\n                <TextInput.Input\n                  ref={field}\n                  type=\"search\"\n                  placeholder={`Search ${thread}s`}\n                  aria-label={`Search ${thread}s`}\n                />\n                <TextInput.Suffix inner>\n                  <TextInput.ClearButton\n                    aria-label=\"Clear search\"\n                    onClear={() => endSearch(true)}\n                  />\n                </TextInput.Suffix>\n              </TextInput>\n            ) : (\n              <Sidebar.Item\n                asChild\n                icon={RiSearchLine}\n                label=\"Search\"\n                suffix={shortcut('K')}\n                suffixOnHover\n              >\n                <button ref={searchRow} type=\"button\" onClick={search} />\n              </Sidebar.Item>\n            )}\n            {mode === 'code' && (\n              <Sidebar.Item\n                href=\"#sessions\"\n                icon={RiStackLine}\n                label=\"All sessions\"\n                active={allOpen}\n                // With no handler it is a plain link to #sessions, for the app's router.\n                onClick={onAll ? act(onAll) : undefined}\n              />\n            )}\n          </nav>\n        </div>\n      </Sidebar.Header>\n\n      {/* A section draws only the slot for the state it is in. Thread rows have no icon, so the\n          collapsed rail leaves the list to the expanded sidebar. The scroll area sizes its\n          content to the longest row, so a long title would widen the whole list instead of\n          truncating: `contain-inline-size` keeps the list as wide as its column. */}\n      <Sidebar.Section scrollable>\n        <Sidebar.Expanded>\n          <nav\n            aria-label={mode === 'chat' ? 'Chats' : 'Sessions'}\n            className=\"gap-ws-9 flex flex-col contain-inline-size\"\n          >\n            {shown.map((group) => (\n              <div\n                key={group.id}\n                role=\"group\"\n                aria-labelledby={`${groupId}-${group.id}`}\n                className=\"gap-ws-2 flex flex-col\"\n              >\n                {/* The header's one action ends the row 4px in, its icon on the suffixes' edge. */}\n                <div className=\"flex items-end\">\n                  <Sidebar.SectionHeader id={`${groupId}-${group.id}`} className=\"flex-1\">\n                    {group.label}\n                  </Sidebar.SectionHeader>\n                  {!group.fixed && (\n                    <IconButton\n                      icon={RiAddLine}\n                      variant=\"secondary\"\n                      preset=\"ghost\"\n                      size=\"xs\"\n                      aria-label={`New ${thread} in ${group.label}`}\n                      className=\"mr-ws-3\"\n                      onClick={() => onNew(group.id)}\n                    />\n                  )}\n                </div>\n                {group.threads.map((item) => {\n                  const working = item.id === workingId;\n                  return (\n                    <Sidebar.Item\n                      key={item.id}\n                      href={`#${item.id}`}\n                      label={item.title}\n                      nested={item.child}\n                      active={item.id === openId}\n                      suffix={\n                        working || item.state || item.pullRequest ? (\n                          <ThreadMark thread={item} working={working} />\n                        ) : undefined\n                      }\n                      onClick={act(() => onOpen(item.id))}\n                    />\n                  );\n                })}\n              </div>\n            ))}\n            {/* Always there, so a screen reader hears when the search finds nothing. */}\n            <p\n              role=\"status\"\n              className={\n                nothingFound ? 'typography-body-md text-ws-static-subtle px-ws-5' : 'sr-only'\n              }\n            >\n              {nothingFound ? `No ${thread}s match “${query.trim()}”` : ''}\n            </p>\n          </nav>\n        </Sidebar.Expanded>\n      </Sidebar.Section>\n\n      <Sidebar.Footer>\n        {/* On the grey ground the line keeps the nav's inset: run edge to edge, it would stop\n            short of the page and read as broken. */}\n        <div className=\"border-ws-static-base pt-ws-5 border-t\">\n          <Sidebar.Expanded>\n            <DropdownMenu>\n              <DropdownMenu.Trigger asChild>\n                <button\n                  type=\"button\"\n                  className=\"gap-ws-5 px-ws-5 py-ws-3 rounded-ws-control-lg hover:bg-ws-dynamic-tertiary-alpha-strong-default focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default flex w-full items-center text-left\"\n                >\n                  <PersonAvatar name={account.name} initials={account.initials} color=\"teal\" />\n                  <span className=\"flex min-w-0 flex-1 flex-col\">\n                    <span className=\"typography-label-strong-sm text-ws-static-base truncate\">\n                      {account.name}\n                    </span>\n                    <span className=\"typography-caption-md text-ws-static-subtle truncate\">\n                      {account.email}\n                    </span>\n                  </span>\n                  <RiArrowDownSLine\n                    aria-hidden=\"true\"\n                    className=\"size-ws-9 text-ws-static-strong\"\n                  />\n                </button>\n              </DropdownMenu.Trigger>\n              <DropdownMenu.Content side=\"top\" align=\"start\" className=\"ws-block-utility w-[14rem]\">\n                <DropdownMenu.Item>\n                  <ListItem.Prefix>\n                    <RiSettingsLine className=\"size-ws-9\" />\n                  </ListItem.Prefix>\n                  <ListItem.Content>\n                    <ListItem.Label>Account settings</ListItem.Label>\n                  </ListItem.Content>\n                </DropdownMenu.Item>\n                <DropdownMenu.Separator />\n                <DropdownMenu.Item variant=\"danger\">\n                  <ListItem.Prefix>\n                    <RiLogoutBoxRLine className=\"size-ws-9\" />\n                  </ListItem.Prefix>\n                  <ListItem.Content>\n                    <ListItem.Label>Log out</ListItem.Label>\n                  </ListItem.Content>\n                </DropdownMenu.Item>\n              </DropdownMenu.Content>\n            </DropdownMenu>\n          </Sidebar.Expanded>\n          <Sidebar.Collapsed>\n            <div className=\"flex justify-center\">\n              <PersonAvatar\n                name={account.name}\n                initials={account.initials}\n                color=\"teal\"\n                title={account.name}\n                alt={account.name}\n              />\n            </div>\n          </Sidebar.Collapsed>\n        </div>\n      </Sidebar.Footer>\n    </Sidebar>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/step-detail.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/step-detail.tsx",
      "content": "'use client';\n\n// TODO(custom): what a step opens to (a log, a diff, search results), in monospace where it is code; Wideset has no code, diff or console part.\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { StepDetail as Detail } from './model';\n\n/** A diff line in the colour of what it does: added positive, removed negative, the rest plain. */\nconst DIFF: Record<string, string> = {\n  '+': 'bg-ws-semantic-positive text-ws-semantic-on-subtle-positive',\n  '-': 'bg-ws-semantic-negative text-ws-semantic-on-subtle-negative',\n};\n\n/**\n * The detail under a step, in an outlined box that follows the theme: output as a log with its\n * error lines in the negative colour, a diff with added and removed lines tinted, or the results\n * of a search as titles with where they are from. Long content scrolls inside the box.\n */\nconst NAME: Record<Detail['kind'], string> = { output: 'Output', diff: 'Diff', results: 'Results' };\n\nexport function StepDetail({ detail }: { detail: Detail }) {\n  return (\n    // Long content scrolls, so the box takes the keyboard's focus to be scrolled with the arrows.\n    <div\n      role=\"region\"\n      aria-label={NAME[detail.kind]}\n      // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- a scrolling region must be reachable by keyboard\n      tabIndex={0}\n      className=\"border-ws-static-base rounded-ws-container-sm ml-ws-12 mt-ws-2 mb-ws-3 focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default ws-scrollbar max-h-[15rem] overflow-auto border\"\n    >\n      {detail.kind === 'results' ? (\n        <ul className=\"px-ws-7 py-ws-5 typography-body-md flex flex-col\">\n          {detail.items.map((item, index) => (\n            // Two results can share a title; the list is fixed once the step has ended.\n            <li key={index} className=\"gap-ws-7 py-ws-2 flex items-baseline\">\n              <span className=\"text-ws-static-base min-w-0 flex-1 truncate\">{item.title}</span>\n              <span className=\"text-ws-static-subtle shrink-0\">{item.source}</span>\n            </li>\n          ))}\n        </ul>\n      ) : (\n        <pre className=\"font-ws-mono typography-body-sm tracking-ws-normal py-ws-5 text-ws-static-base flex flex-col\">\n          {detail.lines.map((line, index) => (\n            <span\n              key={index}\n              className={cn(\n                'px-ws-7 whitespace-pre-wrap',\n                detail.kind === 'diff' && DIFF[line[0]],\n                detail.kind === 'output' &&\n                  detail.errors?.includes(index) &&\n                  'text-ws-semantic-negative',\n              )}\n            >\n              {line || ' '}\n            </span>\n          ))}\n        </pre>\n      )}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/step-group.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/step-group.tsx",
      "content": "'use client';\n\n// TODO(custom): several steps in a row folded to one line (\"Read 4 files\") that opens to them; Wideset has no step, log or tool-call part.\nimport { cn } from '@/lib/wideset/utils';\nimport { useState } from 'react';\n\nimport { ApprovalCard } from './approval-card';\nimport { Fold } from './fold';\nimport { Inline } from './inline';\nimport type { ApprovalAnswer, Block } from './model';\nimport { ARRIVE } from './motion';\nimport { Row } from './row';\nimport { StepMark } from './step-mark';\nimport { type CardRender, StepRow } from './step-row';\n\ntype StepGroupProps = {\n  block: Extract<Block, { kind: 'steps' }>;\n  /** The Verbose view: the group starts open, and so does each step's detail. */\n  defaultOpen: boolean;\n  live: boolean;\n  card?: CardRender;\n  onAnswer: (stepId: string, answer: ApprovalAnswer) => void;\n};\n\n/**\n * How far a group came when it was cut short, in its own words: \"Read 9 sources\" stopped after\n * two reads \"Read 2 of 9 sources\".\n */\nfunction partial(label: string, done: number, total: number) {\n  // ponytail: the count is the first number in the label; a label without one gets it appended.\n  const counted = label.replace(/\\d+/, `${done} of ${total}`);\n  return counted === label ? `${label} · ${done} of ${total}` : counted;\n}\n\n/**\n * Steps that follow one another, as one line. While they run the line says what the current step\n * is doing, in place, so the transcript does not jump; when they are done it says what they came\n * to, and stopped part-way it says how far they got. It opens to the steps. What one of them\n * waits for (an approval, something of the block's own) sits under the line, not inside the\n * fold, so it is never hidden.\n */\nexport function StepGroup({ block, defaultOpen, live, card, onAnswer }: StepGroupProps) {\n  const [open, setOpen] = useState(defaultOpen);\n  // Playback never makes an empty group, but turns passed in from outside could.\n  if (block.steps.length === 0) return null;\n  const current = block.steps[block.steps.length - 1];\n  const busy = current.status === 'running' || current.status === 'waiting';\n  const finished = block.steps.filter(({ status }) => status === 'done' || status === 'failed');\n  const status = busy\n    ? current.status\n    : block.steps.some((step) => step.status === 'failed')\n      ? 'failed'\n      : current.status === 'skipped'\n        ? 'skipped'\n        : 'done';\n  const label =\n    current.status === 'running'\n      ? (current.active ?? current.label)\n      : current.status === 'waiting'\n        ? (current.pending ?? current.label)\n        : block.total !== undefined && !current.holding\n          ? partial(block.label, finished.length, block.total)\n          : block.label;\n  const aside = current.holding && current.card ? card?.(current.card, current) : null;\n\n  return (\n    <div className={cn(live && ARRIVE)}>\n      <Row\n        mark={<StepMark status={status} live={live} />}\n        open={open}\n        onToggle={() => setOpen((value) => !value)}\n      >\n        <span className=\"text-ws-static-base min-w-0 truncate\">\n          <Inline text={label} />\n        </span>\n        {current.status === 'waiting' && (\n          <span className=\"text-ws-semantic-notice shrink-0\">Waiting for you</span>\n        )}\n      </Row>\n      {current.approval && (\n        <Fold open={current.status === 'waiting'}>\n          <ApprovalCard\n            approval={current.approval}\n            onAnswer={(answer) => onAnswer(current.id, answer)}\n          />\n        </Fold>\n      )}\n      {aside && <div className=\"gap-ws-5 ml-ws-12 mt-ws-3 mb-ws-3 flex flex-col\">{aside}</div>}\n      <Fold open={open}>\n        <div className=\"pl-ws-12\">\n          {block.steps.map((step) => (\n            <StepRow\n              key={step.id}\n              step={step}\n              defaultOpen={defaultOpen}\n              live={live}\n              nested\n              card={card}\n              onAnswer={onAnswer}\n            />\n          ))}\n        </div>\n      </Fold>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/step-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/step-mark.tsx",
      "content": "'use client';\n\n// TODO(custom): how a step went, as a 16px mark (running, done, failed, waiting, skipped); Wideset has no spinner and StatusBadge is a labelled badge.\nimport {\n  type RemixiconComponentType,\n  RiCheckLine,\n  RiCloseCircleLine,\n  RiLoader4Line,\n  RiSubtractLine,\n  RiTimeLine,\n} from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { StepStatus } from './model';\nimport { SWAP } from './motion';\n\nconst MARK: Record<StepStatus, { icon: RemixiconComponentType; name: string; className: string }> =\n  {\n    running: {\n      icon: RiLoader4Line,\n      name: 'Running',\n      className: 'text-ws-static-subtle motion-safe:animate-spin',\n    },\n    done: { icon: RiCheckLine, name: 'Done', className: 'text-ws-static-subtle' },\n    failed: { icon: RiCloseCircleLine, name: 'Failed', className: 'text-ws-semantic-negative' },\n    waiting: { icon: RiTimeLine, name: 'Waiting for you', className: 'text-ws-semantic-notice' },\n    skipped: { icon: RiSubtractLine, name: 'Skipped', className: 'text-ws-static-subtle' },\n  };\n\n/**\n * The mark a step row starts with. Done is a quiet grey check: colour is kept for what needs a\n * look (failed, waiting for you). In a running turn the mark that follows the spinner grows in.\n */\nexport function StepMark({ status, live = false }: { status: StepStatus; live?: boolean }) {\n  const { icon: Icon, name, className } = MARK[status];\n  return (\n    <>\n      <Icon\n        aria-hidden\n        className={cn('size-ws-9 shrink-0', className, live && status !== 'running' && SWAP)}\n      />\n      <span className=\"sr-only\">{name}:</span>\n    </>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/step-row.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/step-row.tsx",
      "content": "'use client';\n\n// TODO(custom): one tool call as a transcript row (how it went, what it did, what came of it, its detail under it); Wideset has no step, log or tool-call part.\nimport { cn } from '@/lib/wideset/utils';\nimport { type ReactNode, useEffect, useState } from 'react';\n\nimport { ApprovalCard } from './approval-card';\nimport { Fold } from './fold';\nimport { Inline } from './inline';\nimport type { ApprovalAnswer, CardBlock, Step, StepStatus } from './model';\nimport { ARRIVE } from './motion';\nimport { Row } from './row';\nimport { StepDetail } from './step-detail';\nimport { StepMark } from './step-mark';\n\n/** Draws something of the block's own: a `card` block, or what a step carries under its detail. */\nexport type CardRender = (card: string, of: CardBlock | Step) => ReactNode;\n\nconst ALLOWED: Record<ApprovalAnswer, string | undefined> = {\n  once: 'Allowed once',\n  always: 'Always allowed',\n  denied: 'Denied',\n};\n\n/** The result takes colour only where the step needs a look. */\nconst TONE: Partial<Record<StepStatus, string>> = {\n  failed: 'text-ws-semantic-negative',\n  waiting: 'text-ws-semantic-notice',\n};\n\n/** What a step says at its end: nothing while it runs, then its result and how it was allowed. */\nfunction resultOf({ status, result, approval }: Step) {\n  const allowed = approval?.answer && ALLOWED[approval.answer];\n  if (status === 'running') return undefined;\n  if (status === 'waiting') return 'Waiting for you';\n  if (status === 'skipped') return allowed ?? result ?? 'Skipped';\n  return [result, allowed].filter(Boolean).join(' · ');\n}\n\n/** A step's words for the state it is in: what it will do, is doing, or did. */\nconst labelOf = ({ status, label, active, pending }: Step) =>\n  status === 'running' ? (active ?? label) : status === 'waiting' ? (pending ?? label) : label;\n\ntype StepRowProps = {\n  step: Step;\n  /** The Verbose view: the detail starts open. */\n  defaultOpen: boolean;\n  /** Its turn is running: the row arrives with a short rise and its spinner turns into a check. */\n  live: boolean;\n  /** Inside a group, which shows what the step waits for itself. */\n  nested?: boolean;\n  card?: CardRender;\n  onAnswer: (stepId: string, answer: ApprovalAnswer) => void;\n};\n\n/**\n * A step: the mark for how it went, the verb and its object, a quiet result. Once it has ended it\n * opens to its detail and, under that, whatever the block hangs on it (what to do about it, the\n * way to its whole output). The step the turn stands at opens by itself, so what it needs from\n * you is in view. While it waits to be allowed it reads as what it will do (\"Run\", not \"Ran\")\n * and the approval sits under it; answered, that folds away and leaves the row.\n */\nexport function StepRow({ step, defaultOpen, live, nested = false, card, onAnswer }: StepRowProps) {\n  const holding = Boolean(step.holding);\n  const [open, setOpen] = useState(defaultOpen || holding);\n  const ended = step.status === 'done' || step.status === 'failed';\n  const detail = ended ? step.detail : undefined;\n  // What the step waits with is the group's to show while it is inside one.\n  const aside = step.card && !(nested && holding) ? card?.(step.card, step) : null;\n  const result = resultOf(step);\n\n  // The run has come to stand at this step: it opens.\n  useEffect(() => {\n    if (holding) setOpen(true);\n  }, [holding]);\n\n  return (\n    <div className={cn(live && ARRIVE)}>\n      <Row\n        mark={<StepMark status={step.status} live={live} />}\n        open={open}\n        onToggle={detail || aside ? () => setOpen((value) => !value) : undefined}\n      >\n        <span\n          className={cn(\n            'min-w-0 truncate',\n            step.status === 'skipped' ? 'text-ws-static-subtle' : 'text-ws-static-base',\n          )}\n        >\n          <Inline text={labelOf(step)} />\n        </span>\n        {result && (\n          <span\n            className={cn('shrink-0 tabular-nums', TONE[step.status] ?? 'text-ws-static-subtle')}\n          >\n            {result}\n          </span>\n        )}\n      </Row>\n      {step.approval && !nested && (\n        <Fold open={step.status === 'waiting'}>\n          <ApprovalCard approval={step.approval} onAnswer={(answer) => onAnswer(step.id, answer)} />\n        </Fold>\n      )}\n      {(detail || aside) && (\n        <Fold open={open}>\n          {detail && <StepDetail detail={detail} />}\n          {aside && <div className=\"gap-ws-5 ml-ws-12 mt-ws-3 mb-ws-3 flex flex-col\">{aside}</div>}\n        </Fold>\n      )}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/tasks-background.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/tasks-background.tsx",
      "content": "'use client';\n\n// TODO(custom): what the session left running in the background, as rows (state mark, name, what it is, time, Stop); Wideset has no process or subagent row.\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { Card } from '@/components/ui/wideset/card/Card';\nimport { useId, useState } from 'react';\n\nimport { formatDuration } from './format';\nimport { Inline } from './inline';\nimport type { BackgroundRun } from './tasks-data';\nimport { TasksStateMark } from './tasks-state-mark';\n\ntype TasksBackgroundProps = {\n  runs: BackgroundRun[];\n  /** Seconds since the pane opened: what the running times count on. */\n  elapsed: number;\n};\n\n/**\n * What runs beside the plan, in a card like it: the dev server and the subagents, each with the\n * plan's state mark, its name, a line saying what it is and where it has got to, and its time\n * (still counting while it runs, the time it took once done). What is running can be stopped:\n * Stop is bordered, never filled, since the session's composer owns the screen's one filled\n * button. A stopped run stays in the list, grey, so the list does not jump; the stop is said\n * aloud.\n */\nexport function TasksBackground({ runs, elapsed }: TasksBackgroundProps) {\n  const titleId = useId();\n  const [stopped, setStopped] = useState<string[]>([]);\n  // Plain text for a spoken name: the backticks only mark what is set as code.\n  const nameOf = (run: BackgroundRun) => run.title.replaceAll('`', '');\n\n  return (\n    <Card role=\"region\" aria-labelledby={titleId}>\n      <Card.Header>\n        <h3 id={titleId} className=\"typography-label-strong-md text-ws-static-strong\">\n          Background\n        </h3>\n      </Card.Header>\n      {/* Straight in the card, not in Card.Content: its scroll area reserves a scrollbar gutter\n          and wraps what it holds in display: table (a library bug). */}\n      <ul>\n        {runs.map((run) => {\n          const state = stopped.includes(run.id) ? 'stopped' : run.state;\n          return (\n            <li\n              key={run.id}\n              className=\"gap-ws-5 px-ws-11 py-ws-7 border-ws-static-base flex items-start border-b last:border-b-0\"\n            >\n              <TasksStateMark state={state} />\n              <div className=\"flex min-w-0 flex-1 flex-col\">\n                <span\n                  className={\n                    state === 'running'\n                      ? 'typography-label-strong-sm text-ws-static-strong'\n                      : 'typography-label-sm text-ws-static-base'\n                  }\n                >\n                  <Inline plain text={run.title} />\n                </span>\n                <span className=\"typography-caption-md text-ws-static-subtle text-pretty\">\n                  <Inline plain text={run.detail} />\n                </span>\n              </div>\n              <span className=\"typography-label-sm text-ws-static-subtle shrink-0 tabular-nums\">\n                {state === 'stopped' ? (\n                  'Stopped'\n                ) : (\n                  <>\n                    <span className=\"sr-only\">\n                      {state === 'running' ? 'Running for ' : 'Took '}\n                    </span>\n                    {formatDuration(run.seconds + (state === 'running' ? elapsed : 0))}\n                  </>\n                )}\n              </span>\n              {state === 'running' && (\n                <Button\n                  variant=\"secondary\"\n                  preset=\"border\"\n                  size=\"sm\"\n                  aria-label={`Stop: ${nameOf(run)}`}\n                  onClick={() => setStopped((current) => [...current, run.id])}\n                  className=\"-my-ws-4 ml-ws-3 shrink-0\"\n                >\n                  Stop\n                </Button>\n              )}\n            </li>\n          );\n        })}\n      </ul>\n      <p role=\"status\" className=\"sr-only\">\n        {stopped.length > 0 &&\n          `${nameOf(runs.find((run) => run.id === stopped.at(-1)) ?? runs[0])} stopped`}\n      </p>\n    </Card>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/tasks-data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/tasks-data.ts",
      "content": "/** How a task or a background run stands. */\nexport type RunState = 'todo' | 'running' | 'done' | 'stopped';\n\n/** What a step did, which picks its icon. */\nexport type StepKind = 'read' | 'write' | 'edit' | 'run' | 'agent';\n\n/** One thing the agent did for a task. A name in backticks is code. */\nexport type Step = {\n  kind: StepKind;\n  label: string;\n  /** What came of it, said quietly at the end of the row: lines changed, tests passed. */\n  result?: string;\n  /** The result is a failure, so it takes the failure's colour. */\n  failed?: boolean;\n};\n\n/** A file a task wrote or changed, from the repository root. */\nexport type TouchedFile = { path: string; change: 'added' | 'modified' };\n\nexport type Task = {\n  id: string;\n  /** A name in backticks is code. */\n  title: string;\n  state: Exclude<RunState, 'stopped'>;\n  /** What a running task is doing right now. */\n  now?: string;\n  /** How long a running task had been going when the pane opened, in seconds. */\n  seconds?: number;\n  steps: Step[];\n  files: TouchedFile[];\n};\n\nconst BOOKINGS = 'src/features/bookings';\n\n/**\n * The session's plan, in the order the agent set it. The first unit test run failed on a start\n * time written in local time; the agent put \"Dates as UTC ISO strings\" before the tests and ran\n * them again.\n */\nexport const TASKS: Task[] = [\n  {\n    id: 'export',\n    title: 'Add `exportBookingsCsv`',\n    state: 'done',\n    steps: [\n      { kind: 'read', label: 'Read `bookings-table.tsx`' },\n      { kind: 'read', label: 'Read `types.ts`' },\n      { kind: 'write', label: 'Wrote `export-csv.ts`', result: '+64' },\n    ],\n    files: [{ path: `${BOOKINGS}/export-csv.ts`, change: 'added' }],\n  },\n  {\n    id: 'button',\n    title: 'Export button in the toolbar',\n    state: 'done',\n    steps: [\n      { kind: 'read', label: 'Read `bookings-toolbar.tsx`' },\n      { kind: 'edit', label: 'Edited `bookings-toolbar.tsx`', result: '+12 −1' },\n      { kind: 'edit', label: 'Edited `bookings-table.tsx`', result: '+18 −4' },\n    ],\n    files: [\n      { path: `${BOOKINGS}/bookings-toolbar.tsx`, change: 'modified' },\n      { path: `${BOOKINGS}/bookings-table.tsx`, change: 'modified' },\n    ],\n  },\n  {\n    id: 'utc',\n    title: 'Dates as UTC ISO strings',\n    state: 'done',\n    steps: [\n      { kind: 'read', label: 'Read `format-date.ts`' },\n      { kind: 'edit', label: 'Edited `format-date.ts`', result: '+6 −2' },\n    ],\n    files: [{ path: 'src/lib/format-date.ts', change: 'modified' }],\n  },\n  {\n    id: 'tests',\n    title: 'Unit tests',\n    state: 'done',\n    steps: [\n      { kind: 'write', label: 'Wrote `export-csv.test.ts`', result: '+48' },\n      {\n        kind: 'run',\n        label: 'Ran `pnpm test bookings`',\n        result: '13 passed, 1 failed',\n        failed: true,\n      },\n      { kind: 'run', label: 'Ran `pnpm test bookings`', result: '14 passed · 3.2s' },\n    ],\n    files: [{ path: `${BOOKINGS}/export-csv.test.ts`, change: 'added' }],\n  },\n  {\n    id: 'e2e',\n    title: 'Fix the failing E2E test',\n    state: 'running',\n    now: 'Waiting for your approval to run `pnpm test:e2e bookings` with a trace',\n    seconds: 134,\n    steps: [\n      { kind: 'read', label: 'Read the log of the E2E check', result: 'timed out' },\n      { kind: 'read', label: 'Read `bookings-export.spec.ts`' },\n      { kind: 'agent', label: 'Started a subagent on the timeout' },\n    ],\n    files: [],\n  },\n  {\n    id: 'ready',\n    title: 'Mark the PR ready for review',\n    state: 'todo',\n    steps: [],\n    files: [],\n  },\n];\n\n/** Something the session left going beside the plan: a process, or a subagent with its own task. */\nexport type BackgroundRun = {\n  id: string;\n  /** A name in backticks is code. */\n  title: string;\n  /** What it is and where it has got to. A name in backticks is code. */\n  detail: string;\n  state: 'running' | 'done';\n  /** How long it had been going when the pane opened, or how long it took, in seconds. */\n  seconds: number;\n};\n\n/** What is still going first, then what finished. */\nexport const BACKGROUND: BackgroundRun[] = [\n  {\n    id: 'dev',\n    title: 'Dev server',\n    detail: '`pnpm dev` on localhost:3000',\n    state: 'running',\n    seconds: 1445,\n  },\n  {\n    id: 'timeout',\n    title: 'Debug the E2E timeout',\n    detail: 'Subagent · read `bookings-export.spec.ts` and 5 more files',\n    state: 'running',\n    seconds: 98,\n  },\n  {\n    id: 'uses',\n    title: 'Find every use of `formatTimestamp`',\n    detail: 'Subagent · used in `export-csv.ts` and `bookings-table.tsx`, nowhere else',\n    state: 'done',\n    seconds: 52,\n  },\n];\n"
    },
    {
      "path": "src/blocks/agent-code/tasks-pane.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/tasks-pane.tsx",
      "content": "'use client';\n\nimport { TasksBackground } from './tasks-background';\nimport { BACKGROUND, TASKS } from './tasks-data';\nimport { TasksPlan } from './tasks-plan';\nimport { useSeconds } from './tasks-use-seconds';\n\n/**\n * The Tasks pane: what the agent is doing. Two cards, as the Checks pane has, scrolling inside\n * the pane: the plan first, its task in progress open on what it has done so far, then what runs\n * in the background. Everything still running counts its time on one clock; nothing here is\n * ticked by hand, so the pane has no checkbox and no filled button.\n */\nexport function TasksPane() {\n  const elapsed = useSeconds();\n\n  return (\n    <div className=\"flex min-h-0 flex-1 flex-col\">\n      <div className=\"ws-scrollbar min-h-0 flex-1 overflow-y-auto\">\n        <div className=\"gap-ws-9 p-ws-11 flex flex-col\">\n          <TasksPlan tasks={TASKS} elapsed={elapsed} />\n          <TasksBackground runs={BACKGROUND} elapsed={elapsed} />\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/tasks-plan.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/tasks-plan.tsx",
      "content": "'use client';\n\n// TODO(custom): the agent's plan as rows that open onto what each task did (state mark, title, what it is doing now, time); Wideset has no task list, and Accordion has no state mark or row fill.\nimport { RiArrowRightSLine } from '@remixicon/react';\nimport { Card } from '@/components/ui/wideset/card/Card';\nimport { cn } from '@/lib/wideset/utils';\nimport { useId, useState } from 'react';\n\nimport { formatDuration } from './format';\nimport { Inline } from './inline';\nimport type { Task } from './tasks-data';\nimport { TasksStateMark } from './tasks-state-mark';\nimport { TasksTaskDetail } from './tasks-task-detail';\n\ntype TaskRowProps = {\n  task: Task;\n  /** Seconds since the pane opened: what the running task's time counts on. */\n  elapsed: number;\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n};\n\n/**\n * One task: its state's mark, its title and, while it runs, what it is doing right now under the\n * title and for how long at the end. A task with something to show opens onto it: its title is a\n * button stretched over the whole row, the hover runs across it and the chevron turns. The one in\n * progress is the only strong title, so the eye lands on what is happening now. A task not yet\n * started has nothing to open, so it is a plain row.\n */\nfunction TaskRow({ task, elapsed, open, onOpenChange }: TaskRowProps) {\n  const detailId = useId();\n  const opens = task.steps.length > 0 || task.files.length > 0;\n  const title =\n    task.state === 'running'\n      ? 'typography-label-strong-sm text-ws-static-strong'\n      : 'typography-label-sm text-ws-static-base';\n\n  return (\n    <li className=\"border-ws-static-base border-b last:border-b-0\">\n      <div\n        className={cn(\n          'gap-ws-5 px-ws-11 py-ws-7 relative flex items-start',\n          opens && 'hover:bg-ws-dynamic-secondary-alpha-hover',\n        )}\n      >\n        <TasksStateMark state={task.state} />\n        <div className=\"flex min-w-0 flex-1 flex-col\">\n          {opens ? (\n            <button\n              type=\"button\"\n              aria-expanded={open}\n              aria-controls={detailId}\n              onClick={() => onOpenChange(!open)}\n              className={cn(\n                title,\n                'focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default after:inset-ws-0 w-fit cursor-pointer text-left after:absolute',\n              )}\n            >\n              <Inline plain text={task.title} />\n            </button>\n          ) : (\n            <span className={title}>\n              <Inline plain text={task.title} />\n            </span>\n          )}\n          {task.now && (\n            <span className=\"typography-caption-md text-ws-static-subtle text-pretty\">\n              <Inline plain text={task.now} />\n            </span>\n          )}\n        </div>\n        {task.seconds !== undefined && (\n          <span className=\"typography-label-sm text-ws-static-subtle shrink-0 tabular-nums\">\n            <span className=\"sr-only\">Running for </span>\n            {formatDuration(task.seconds + elapsed)}\n          </span>\n        )}\n        {/* Rows that do not open keep the chevron's room, so the times stand in one column. */}\n        <span className=\"size-ws-9 my-ws-2 shrink-0\">\n          {opens && (\n            <RiArrowRightSLine\n              aria-hidden=\"true\"\n              className={cn(\n                'size-ws-9 text-ws-dynamic-secondary-default transition-transform duration-(--ws-motion-duration-quick) ease-(--ws-motion-ease-smooth-out)',\n                open && 'rotate-90',\n              )}\n            />\n          )}\n        </span>\n      </div>\n\n      {opens && open && <TasksTaskDetail id={detailId} task={task} />}\n    </li>\n  );\n}\n\ntype TasksPlanProps = {\n  tasks: Task[];\n  /** Seconds since the pane opened. */\n  elapsed: number;\n};\n\n/**\n * The plan, the pane's main thing, in a card: a quiet count of what is done beside its title,\n * then the tasks in the agent's order, split by lines that run edge to edge. The marks down the\n * left already draw the progress, so the count is words, not a bar. The task in progress opens on\n * load; any number may be open at once.\n */\nexport function TasksPlan({ tasks, elapsed }: TasksPlanProps) {\n  const titleId = useId();\n  const [open, setOpen] = useState(() =>\n    tasks.filter((task) => task.state === 'running').map((task) => task.id),\n  );\n  const done = tasks.filter((task) => task.state === 'done').length;\n\n  return (\n    <Card role=\"region\" aria-labelledby={titleId}>\n      <Card.Header>\n        <div className=\"gap-ws-9 flex items-baseline justify-between\">\n          <h3 id={titleId} className=\"typography-label-strong-md text-ws-static-strong\">\n            Plan\n          </h3>\n          <p className=\"typography-label-sm text-ws-static-subtle tabular-nums\">\n            {done} of {tasks.length} done\n          </p>\n        </div>\n      </Card.Header>\n      {/* Straight in the card, not in Card.Content: its scroll area reserves a scrollbar gutter\n          and wraps what it holds in display: table (a library bug). */}\n      <ol>\n        {tasks.map((task) => (\n          <TaskRow\n            key={task.id}\n            task={task}\n            elapsed={elapsed}\n            open={open.includes(task.id)}\n            onOpenChange={(next) =>\n              setOpen((current) =>\n                next ? [...current, task.id] : current.filter((id) => id !== task.id),\n              )\n            }\n          />\n        ))}\n      </ol>\n    </Card>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/tasks-state-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/tasks-state-mark.tsx",
      "content": "'use client';\n\n// TODO(custom): how a task or a run stands, as one mark (to do, running, done, stopped); Wideset has no state mark and no spinner.\nimport {\n  RiCheckboxBlankCircleLine,\n  RiCheckboxCircleFill,\n  RiLoader4Line,\n  RiStopCircleLine,\n} from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { RunState } from './tasks-data';\n\nconst MARK: Record<RunState, { Icon: typeof RiLoader4Line; className: string; label: string }> = {\n  todo: { Icon: RiCheckboxBlankCircleLine, className: 'text-ws-static-subtle', label: 'To do' },\n  running: {\n    Icon: RiLoader4Line,\n    className: 'text-ws-semantic-info motion-safe:animate-spin',\n    label: 'Running',\n  },\n  done: { Icon: RiCheckboxCircleFill, className: 'text-ws-semantic-positive', label: 'Done' },\n  stopped: { Icon: RiStopCircleLine, className: 'text-ws-static-subtle', label: 'Stopped' },\n};\n\n/**\n * A state as a mark at the head of a row, the size and family of the Checks pane's: an empty\n * circle to do, a check on a filled circle done, a loader that turns while the thing is really\n * still running (it stands still under reduced motion) and a stop sign once stopped by hand. The\n * colour is the meaning's: in progress, done; nothing to signal stays grey. It is a mark, not a\n * checkbox: the agent ticks its own tasks. The state is also said in words for screen readers.\n */\nexport function TasksStateMark({ state }: { state: RunState }) {\n  const { Icon, className, label } = MARK[state];\n  return (\n    <>\n      <Icon aria-hidden=\"true\" className={cn('size-ws-11 shrink-0', className)} />\n      <span className=\"sr-only\">{label}:</span>\n    </>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/tasks-task-detail.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/tasks-task-detail.tsx",
      "content": "'use client';\n\n// TODO(custom): what a task did, as step rows (icon, verb and object, a quiet result) and the files it touched; Wideset has no step row or file reference.\nimport {\n  RiFileAddLine,\n  RiFileTextLine,\n  RiPencilLine,\n  RiRobot2Line,\n  RiTerminalLine,\n} from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { Inline } from './inline';\nimport type { StepKind, Task, TouchedFile } from './tasks-data';\n\nconst ICON: Record<StepKind, typeof RiFileTextLine> = {\n  read: RiFileTextLine,\n  write: RiFileAddLine,\n  edit: RiPencilLine,\n  run: RiTerminalLine,\n  agent: RiRobot2Line,\n};\n\n/** Git's letter for a change, in the colour of its meaning, as the Files pane marks its tree. */\nconst LETTER: Record<TouchedFile['change'], { letter: string; label: string; className: string }> =\n  {\n    added: { letter: 'A', label: 'added', className: 'text-ws-semantic-positive' },\n    modified: { letter: 'M', label: 'modified', className: 'text-ws-semantic-info' },\n  };\n\n/**\n * A task opened: the steps taken for it so far, in the transcript's grammar (an icon for the kind\n * of step, the verb and its object, a quiet result at the end, in the failure's colour when it\n * is one), then the files it wrote or changed, each with git's letter. It hangs under the task's\n * title, and arrives a few pixels down with a fade, on the motion tokens.\n */\nexport function TasksTaskDetail({ id, task }: { id: string; task: Task }) {\n  return (\n    <div\n      id={id}\n      className=\"gap-ws-7 pt-ws-3 pb-ws-9 pl-ws-18 pr-ws-11 animate-in fade-in-0 ws-slide-in-from-top-3 flex flex-col duration-(--ws-motion-duration-fast) ease-(--ws-motion-ease-smooth-out)\"\n    >\n      {task.steps.length > 0 && (\n        <ul aria-label=\"Steps\" className=\"gap-ws-3 flex flex-col\">\n          {task.steps.map((step, index) => {\n            const Icon = ICON[step.kind];\n            return (\n              <li key={index} className=\"gap-ws-5 typography-label-sm flex items-center\">\n                <Icon aria-hidden=\"true\" className=\"size-ws-9 text-ws-static-subtle shrink-0\" />\n                <span className=\"text-ws-static-base min-w-0 flex-1 truncate\">\n                  <Inline plain text={step.label} />\n                </span>\n                {step.result && (\n                  <span\n                    className={cn(\n                      'shrink-0 tabular-nums',\n                      step.failed ? 'text-ws-semantic-negative' : 'text-ws-static-subtle',\n                    )}\n                  >\n                    {step.result}\n                  </span>\n                )}\n              </li>\n            );\n          })}\n        </ul>\n      )}\n\n      {task.files.length > 0 && (\n        <div className=\"gap-ws-3 flex flex-col\">\n          <h4 className=\"typography-caption-md text-ws-static-subtle\">Files</h4>\n          <ul className=\"gap-ws-3 flex flex-col\">\n            {task.files.map(({ path, change }) => {\n              const at = path.lastIndexOf('/') + 1;\n              const { letter, label, className } = LETTER[change];\n              return (\n                <li\n                  key={path}\n                  className=\"typography-body-sm tracking-ws-normal font-ws-mono flex items-center\"\n                >\n                  {/* The folder gives way first: the name is what the eye looks for. */}\n                  <span className=\"text-ws-static-subtle truncate\">{path.slice(0, at)}</span>\n                  <span className=\"text-ws-static-strong shrink-0\">{path.slice(at)}</span>\n                  <span\n                    className={cn(\n                      'typography-caption-strong-md font-ws-body pl-ws-5 ml-auto shrink-0',\n                      className,\n                    )}\n                  >\n                    <span aria-hidden=\"true\">{letter}</span>\n                    <span className=\"sr-only\">, {label}</span>\n                  </span>\n                </li>\n              );\n            })}\n          </ul>\n        </div>\n      )}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/tasks-use-seconds.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/tasks-use-seconds.ts",
      "content": "'use client';\n\nimport { useEffect, useState } from 'react';\n\n/**\n * Whole seconds since the pane opened, for the times of what is still running to count on. Read\n * from the clock on every tick, so a tab left in the background catches up when it comes back.\n */\nexport function useSeconds(): number {\n  const [start] = useState(() => Date.now());\n  const [now, setNow] = useState(start);\n\n  useEffect(() => {\n    const timer = window.setInterval(() => setNow(Date.now()), 1000);\n    return () => window.clearInterval(timer);\n  }, []);\n\n  return Math.floor((now - start) / 1000);\n}\n"
    },
    {
      "path": "src/blocks/agent-code/terminal-data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/terminal-data.ts",
      "content": "/** How a stretch of output is coloured: the handful of colours a terminal theme gives a log. */\nexport type Tone = 'subtle' | 'strong' | 'positive' | 'negative' | 'notice' | 'link';\n\n/** A stretch of one line: plain, or in a tone. A `link` is an address, and opens it. */\nexport type Span = string | [tone: Tone, text: string];\n\n/** One line of output; an empty one is a blank line. */\nexport type Line = Span[];\n\n/** A process still going, one stopped by hand, or the code it exited with. */\nexport type RunState = 'running' | 'stopped' | number;\n\n/** One command and what it printed. */\nexport type Run = {\n  id: string;\n  /** Who typed it: the agent, as a step of the session, or Ines at the prompt. */\n  by: 'tandem' | 'you';\n  command: string;\n  state: RunState;\n  output: Line[];\n};\n\nexport type Shell = { id: string; name: string; runs: Run[] };\n\n/** A state in words and in its meaning's colour: running is in progress, 0 is done, the rest failed. */\nexport const stateOf = (state: RunState) =>\n  state === 'running'\n    ? ({ label: 'Running', color: 'info' } as const)\n    : state === 'stopped'\n      ? ({ label: 'Stopped', color: 'neutral' } as const)\n      : ({ label: `Exited ${state}`, color: state === 0 ? 'positive' : 'negative' } as const);\n\nconst DIR = 'src/features/bookings';\n\nconst file = (mark: Span, name: string, tests: string, ms: number): Line => [\n  mark,\n  `${DIR}/${name} `,\n  ['subtle', `(${tests}) ${ms}ms`],\n];\nconst PASS: Span = ['positive', ' ✓ '];\nconst FAIL: Span = ['negative', ' × '];\n\nconst summary = (label: string, ...counts: Span[]): Line => [['subtle', label], ...counts];\nconst OR: Span = ['subtle', ' | '];\n\n/** `pnpm test bookings` once the dates are written as UTC: what the prompt answers with, too. */\nexport const PASSING_TESTS: Line[] = [\n  file(PASS, 'bookings-table.test.tsx', '6 tests', 36),\n  file(PASS, 'bookings-toolbar.test.tsx', '3 tests', 19),\n  file(PASS, 'export-csv.test.ts', '5 tests', 15),\n  [],\n  summary(' Test files  ', ['positive', '3 passed'], ['subtle', ' (3)']),\n  summary('      Tests  ', ['positive', '14 passed'], ['subtle', ' (14)']),\n  summary('   Duration  ', '3.2s'),\n];\n\n/** The first run: the CSV wrote the start time in local time. */\nconst FAILING_TESTS: Line[] = [\n  file(PASS, 'bookings-table.test.tsx', '6 tests', 38),\n  file(PASS, 'bookings-toolbar.test.tsx', '3 tests', 21),\n  file(FAIL, 'export-csv.test.ts', '5 tests | 1 failed', 17),\n  [['negative', '   × exportBookingsCsv › writes start times as UTC ISO strings']],\n  [],\n  [\n    [\n      'negative',\n      \"     AssertionError: expected '2026-11-10T10:00:00+01:00' to be '2026-11-10T09:00:00Z'\",\n    ],\n  ],\n  [],\n  [['positive', '     - Expected  2026-11-10T09:00:00Z']],\n  [['negative', '     + Received  2026-11-10T10:00:00+01:00']],\n  [],\n  [['subtle', `     at ${DIR}/export-csv.test.ts:31:24`]],\n  [],\n  summary(\n    ' Test files  ',\n    ['negative', '1 failed'],\n    OR,\n    ['positive', '2 passed'],\n    ['subtle', ' (3)'],\n  ),\n  summary(\n    '      Tests  ',\n    ['negative', '1 failed'],\n    OR,\n    ['positive', '13 passed'],\n    ['subtle', ' (14)'],\n  ),\n  summary('   Duration  ', '3.4s'),\n];\n\nconst request = (path: string, ms: number): Line => [\n  ' GET ',\n  path,\n  ' ',\n  ['positive', '200'],\n  ['subtle', ` in ${ms}ms`],\n];\n\nconst DEV_SERVER: Line[] = [\n  [['subtle', '> lumen-app@3.8.0 dev']],\n  [['subtle', '> next dev']],\n  [],\n  ['   Local    ', ['link', 'http://localhost:3000']],\n  [],\n  [PASS, 'Ready in 1.4s'],\n  [['subtle', ' ○ Compiling /bookings ...']],\n  [PASS, 'Compiled /bookings in 812ms'],\n  request('/bookings', 946),\n  request(\n    '/api/bookings?from=2026-11-10T00:00:00Z&to=2026-11-10T23:59:59Z&room=all&sort=start',\n    38,\n  ),\n  [['notice', ' ⚠ '], 'Workspace time zone is not set: times are shown in the browser zone'],\n  [PASS, 'Compiled in 164ms'],\n  request('/bookings', 52),\n];\n\nconst E2E: Line[] = [\n  [['subtle', 'Running 3 tests using 1 worker']],\n  [],\n  [PASS, 'bookings › lists the bookings for today ', ['subtle', '(1.9s)']],\n  [PASS, 'bookings › filters by room ', ['subtle', '(2.3s)']],\n  [FAIL, 'bookings export › downloads the file ', ['subtle', '(30.0s)']],\n  [],\n  [['negative', '   Test timeout of 30000ms exceeded while waiting for the download']],\n  [],\n  [' ', ['negative', '1 failed'], OR, ['positive', '2 passed'], ['subtle', ' (36.4s)']],\n];\n\n/** The session's shells: the tests the agent ran, the dev server it left up, and Ines's own. */\nexport const SHELLS: Shell[] = [\n  {\n    id: 'tests',\n    name: 'pnpm test',\n    runs: [\n      {\n        id: 'tests-1',\n        by: 'tandem',\n        command: 'pnpm test bookings',\n        state: 1,\n        output: FAILING_TESTS,\n      },\n      {\n        id: 'tests-2',\n        by: 'tandem',\n        command: 'pnpm test bookings',\n        state: 0,\n        output: PASSING_TESTS,\n      },\n    ],\n  },\n  {\n    id: 'dev',\n    name: 'pnpm dev',\n    runs: [\n      { id: 'dev-1', by: 'tandem', command: 'pnpm dev', state: 'running', output: DEV_SERVER },\n    ],\n  },\n  {\n    id: 'zsh',\n    name: 'zsh',\n    runs: [\n      {\n        id: 'zsh-1',\n        by: 'you',\n        command: 'git branch --show-current',\n        state: 0,\n        output: [['feature/bookings-csv-export']],\n      },\n      { id: 'zsh-2', by: 'you', command: 'pnpm test:e2e bookings', state: 1, output: E2E },\n    ],\n  },\n];\n\n/** A shell's text as it would be selected and copied: the commands and what they printed. */\nexport const textOf = (shell: Shell) =>\n  shell.runs\n    .map(({ command, output }) =>\n      [\n        `$ ${command}`,\n        ...output.map((line) =>\n          line.map((span) => (typeof span === 'string' ? span : span[1])).join(''),\n        ),\n      ].join('\\n'),\n    )\n    .join('\\n\\n');\n"
    },
    {
      "path": "src/blocks/agent-code/terminal-output.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/terminal-output.tsx",
      "content": "'use client';\n\n// TODO(custom): a shell's log (each command with who ran it and how it ended, then what it printed, in monospace); Wideset has no terminal or log part.\nimport { RiRobot2Line } from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\nimport { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';\nimport { useEffect, useRef } from 'react';\n\nimport { type Line, type Run, type Span, stateOf, type Tone } from './terminal-data';\n\nconst TONE: Record<Exclude<Tone, 'link'>, string> = {\n  subtle: 'text-ws-static-subtle',\n  strong: 'text-ws-static-strong',\n  positive: 'text-ws-semantic-positive',\n  negative: 'text-ws-semantic-negative',\n  notice: 'text-ws-semantic-notice',\n};\n\n/** Monospace for the command and its output only: the marks beside them keep the interface's type. */\nconst MONO = 'font-ws-mono tracking-ws-normal';\n\nfunction OutputSpan({ span }: { span: Span }) {\n  if (typeof span === 'string') return span;\n  const [tone, text] = span;\n  return tone === 'link' ? (\n    <a\n      href={text}\n      target=\"_blank\"\n      rel=\"noreferrer\"\n      className=\"text-ws-static-strong focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default rounded-ws-control-sm underline decoration-from-font\"\n    >\n      {text}\n    </a>\n  ) : (\n    <span className={TONE[tone]}>{text}</span>\n  );\n}\n\n/** A line keeps its spaces and breaks anywhere, as a terminal wraps; a blank one keeps its height. */\nfunction OutputLine({ line }: { line: Line }) {\n  return (\n    <div className=\"min-h-[1lh] wrap-anywhere whitespace-pre-wrap\">\n      {line.map((span, index) => (\n        // Output is only ever added to, so a span's place is its identity.\n        <OutputSpan key={index} span={span} />\n      ))}\n    </div>\n  );\n}\n\n/**\n * One shell's log, on the pane's own surface so it follows the theme: every command is a line\n * with the prompt, who ran it (the agent, or you) and how it ended in its meaning's colour, then\n * its output in monospace with the few colours a terminal gives a log. It stays scrolled to the\n * newest line, and a long line wraps instead of scrolling sideways.\n */\nexport function TerminalOutput({ runs }: { runs: Run[] }) {\n  const scroller = useRef<HTMLDivElement>(null);\n\n  useEffect(() => {\n    if (scroller.current) scroller.current.scrollTop = scroller.current.scrollHeight;\n  }, [runs]);\n\n  return (\n    <div ref={scroller} className=\"ws-scrollbar h-full overflow-y-auto\">\n      <div\n        role=\"log\"\n        aria-label=\"Output\"\n        className=\"typography-body-sm text-ws-static-base gap-ws-11 px-ws-11 py-ws-9 flex flex-col\"\n      >\n        {runs.map(({ id, by, command, state, output }) => {\n          const { label, color } = stateOf(state);\n          return (\n            <section key={id} aria-label={command} className=\"gap-ws-3 flex flex-col\">\n              {/* The marks sit on the command's first line, however far the command wraps. */}\n              <div className=\"gap-ws-7 flex items-start\">\n                <p className={cn(MONO, 'text-ws-static-strong min-w-0 flex-1 wrap-anywhere')}>\n                  <span aria-hidden=\"true\" className=\"text-ws-static-subtle select-none\">\n                    ${' '}\n                  </span>\n                  {command}\n                </p>\n                <div className=\"gap-ws-5 flex h-[1lh] shrink-0 items-center\">\n                  <span className=\"typography-caption-md text-ws-static-subtle gap-ws-2 flex items-center\">\n                    {by === 'tandem' && <RiRobot2Line aria-hidden=\"true\" className=\"size-ws-8\" />}\n                    {by === 'tandem' ? 'Tandem' : 'You'}\n                  </span>\n                  <StatusBadge size=\"sm\" color={color}>\n                    {label}\n                  </StatusBadge>\n                </div>\n              </div>\n              {output.length > 0 && (\n                <div className={MONO}>\n                  {output.map((line, index) => (\n                    <OutputLine key={index} line={line} />\n                  ))}\n                </div>\n              )}\n            </section>\n          );\n        })}\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/terminal-pane.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/terminal-pane.tsx",
      "content": "'use client';\n\nimport { RiAddLine, RiEraserLine, RiStopLine } from '@remixicon/react';\nimport { Tabs } from '@/components/ui/wideset/tabs/Tabs';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { type FormEvent, useEffect, useRef, useState } from 'react';\n\nimport { BarAction } from './bar-action';\nimport { CopyButton } from './copy-button';\nimport { PASSING_TESTS, type Run, SHELLS, stateOf, textOf } from './terminal-data';\nimport { TerminalOutput } from './terminal-output';\nimport { TerminalStateMark } from './terminal-state-mark';\n\n/** How long the tests take to answer at the prompt. */\nconst TEST_RUN = 1200;\n\n/**\n * The Terminal pane: the session's shells as quiet tabs, each with the state of its last command\n * (the tests the agent ran, the dev server it left running, your own shell) and a `+` for another;\n * on the right Stop for a running process, Clear and Copy output. Under the bar the open shell's\n * log, and at the foot a command field: `clear` and `pnpm test bookings` answer, anything else is\n * not found. A shell with a process in the foreground takes no command until it is stopped.\n * The field is the library's, with the prompt sign as its prefix; only its type is monospace.\n */\nexport function TerminalPane() {\n  const [shells, setShells] = useState(SHELLS);\n  const [active, setActive] = useState(SHELLS[0].id);\n  const [draft, setDraft] = useState('');\n  // Numbers the shells and commands added here; the timers are the test runs still going.\n  const added = useRef(0);\n  const timers = useRef<number[]>([]);\n  const prompt = useRef<HTMLInputElement>(null);\n\n  useEffect(() => () => timers.current.forEach((id) => window.clearTimeout(id)), []);\n\n  const shell = shells.find(({ id }) => id === active) ?? shells[0];\n  const running = shell.runs.find(({ state }) => state === 'running');\n\n  const update = (id: string, change: (runs: Run[]) => Run[]) =>\n    setShells((all) =>\n      all.map((one) => (one.id === id ? { ...one, runs: change(one.runs) } : one)),\n    );\n\n  // A process still going keeps its line; what it printed so far goes with the rest.\n  const clear = () =>\n    update(shell.id, (runs) =>\n      runs.filter(({ state }) => state === 'running').map((one) => ({ ...one, output: [] })),\n    );\n\n  const run = (event: FormEvent) => {\n    event.preventDefault();\n    const command = draft.trim();\n    if (!command || running) return;\n    setDraft('');\n    if (command === 'clear') return clear();\n\n    const id = `run-${(added.current += 1)}`;\n    const mine = { id, by: 'you', command } as const;\n    if (command !== 'pnpm test bookings') {\n      const [name] = command.split(/\\s+/);\n      const output = [[`zsh: command not found: ${name}`]];\n      return update(shell.id, (runs) => [...runs, { ...mine, state: 127, output }]);\n    }\n    // The tests take a moment: the shell is busy and can be stopped until they answer.\n    update(shell.id, (runs) => [...runs, { ...mine, state: 'running', output: [] }]);\n    timers.current.push(\n      window.setTimeout(\n        () =>\n          update(shell.id, (runs) =>\n            runs.map((one) =>\n              one.id === id && one.state === 'running'\n                ? { ...one, state: 0, output: PASSING_TESTS }\n                : one,\n            ),\n          ),\n        TEST_RUN,\n      ),\n    );\n  };\n\n  const stop = () =>\n    update(shell.id, (runs) =>\n      runs.map((one) =>\n        one.state === 'running'\n          ? { ...one, state: 'stopped', output: [...one.output, [['subtle', '^C']]] }\n          : one,\n      ),\n    );\n\n  const open = () => {\n    const id = `shell-${(added.current += 1)}`;\n    setShells((current) => [...current, { id, name: 'zsh', runs: [] }]);\n    setActive(id);\n    // A new shell is opened to type in.\n    prompt.current?.focus();\n  };\n\n  return (\n    <Tabs\n      type=\"ghost\"\n      value={shell.id}\n      onValueChange={setActive}\n      className=\"flex min-h-0 flex-1 flex-col\"\n    >\n      <div className=\"h-ws-16 border-ws-static-subtle px-ws-11 gap-ws-5 flex shrink-0 items-center border-b\">\n        {/* More shells than fit scroll sideways inside the bar; the actions keep their place. */}\n        <div className=\"gap-ws-3 ws-scrollbar flex min-w-0 items-center overflow-x-auto\">\n          <Tabs.List aria-label=\"Shells\">\n            {shells.map(({ id, name, runs }) => {\n              const state = runs.at(-1)?.state;\n              return (\n                <Tabs.Item key={id} value={id} className=\"shrink-0\">\n                  <TerminalStateMark state={state} />\n                  <Tabs.Label>{name}</Tabs.Label>\n                  {state !== undefined && (\n                    <span className=\"sr-only\">, {stateOf(state).label.toLowerCase()}</span>\n                  )}\n                </Tabs.Item>\n              );\n            })}\n          </Tabs.List>\n          <BarAction icon={RiAddLine} label=\"New shell\" onClick={open} />\n        </div>\n        <div className=\"gap-ws-2 ml-auto flex shrink-0 items-center\">\n          {/* Disabled while nothing runs, so the bar keeps its layout. */}\n          <BarAction icon={RiStopLine} label=\"Stop\" disabled={!running} onClick={stop} />\n          <BarAction\n            icon={RiEraserLine}\n            label=\"Clear\"\n            disabled={shell.runs.length === 0}\n            onClick={clear}\n          />\n          <CopyButton label=\"Copy output\" side=\"bottom\" text={() => textOf(shell)} />\n        </div>\n      </div>\n\n      {shells.map(({ id, runs }) => (\n        <Tabs.Content key={id} value={id} className=\"min-h-0 flex-1\">\n          <TerminalOutput runs={runs} />\n        </Tabs.Content>\n      ))}\n\n      <form onSubmit={run} className=\"px-ws-11 pb-ws-9 pt-ws-5 shrink-0\">\n        {/* Read-only, not disabled, while a process runs: the field keeps the focus for the next\n            command and says why it takes none. */}\n        <TextInput\n          size=\"sm\"\n          value={draft}\n          onChange={(event) => setDraft(event.target.value)}\n          readOnly={Boolean(running)}\n        >\n          <TextInput.Prefix>$</TextInput.Prefix>\n          <TextInput.Input\n            ref={prompt}\n            aria-label=\"Command\"\n            placeholder={running ? `Stop ${running.command} to type here` : 'Type a command'}\n            autoComplete=\"off\"\n            autoCapitalize=\"off\"\n            spellCheck={false}\n            className=\"font-ws-mono\"\n          />\n        </TextInput>\n      </form>\n    </Tabs>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/terminal-state-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/terminal-state-mark.tsx",
      "content": "'use client';\n\n// TODO(custom): a shell's state as one small mark in its tab (running, exited 0, exited with an error); Tabs has an icon and a count part but no state mark.\nimport { RiCheckLine, RiCloseLine, RiLoader4Line } from '@remixicon/react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { type RunState, stateOf } from './terminal-data';\n\nconst MARK = {\n  info: { Icon: RiLoader4Line, className: 'text-ws-semantic-info' },\n  positive: { Icon: RiCheckLine, className: 'text-ws-semantic-positive' },\n  negative: { Icon: RiCloseLine, className: 'text-ws-semantic-negative' },\n};\n\n/**\n * How a shell's last command stands, before its name in the tab: turning while it runs, a check\n * for exit 0, a cross for an error; nothing for an idle shell. The tab draws its icons in its own\n * text colour, so the meaning's colour sits on a wrapper. The words are the tab's to say.\n */\nexport function TerminalStateMark({ state }: { state?: RunState }) {\n  if (state === undefined || state === 'stopped') return null;\n  const { Icon, className } = MARK[stateOf(state).color as keyof typeof MARK];\n  return (\n    <span aria-hidden=\"true\" className={cn('flex shrink-0', className)}>\n      <Icon className={cn('size-ws-8', state === 'running' && 'motion-safe:animate-spin')} />\n    </span>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/thread-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/thread-mark.tsx",
      "content": "'use client';\n\n// TODO(custom): the state of a chat or session as one small mark at the end of its sidebar row (working, needs you, paused, unread, a pull request, failed); Wideset has no spinner, and StatusBadge is a labelled badge.\nimport {\n  RiCloseCircleFill,\n  RiErrorWarningFill,\n  RiGitPullRequestLine,\n  RiLoader4Line,\n  RiPauseCircleLine,\n} from '@remixicon/react';\n\nimport type { Thread } from './model';\n\n/**\n * One mark per row, each a different shape, so the state reads without its colour: a spinner\n * while the agent works, the notice sign when it waits for you, a grey pause when it stands\n * still by itself (a limit reached, stopped by you), Figma's unread dot for an answer not yet\n * read, the negative sign when it failed. A session with a pull request shows it with the review\n * comments still open. Every mark has its name for screen readers.\n */\nexport function ThreadMark({ thread, working }: { thread: Thread; working: boolean }) {\n  const state = working ? 'working' : thread.state;\n\n  if (state === 'working') {\n    return (\n      <>\n        <RiLoader4Line aria-hidden className=\"size-ws-8 motion-safe:animate-spin\" />\n        <span className=\"sr-only\">Working</span>\n      </>\n    );\n  }\n  if (state === 'needs-you') {\n    return (\n      <RiErrorWarningFill\n        role=\"img\"\n        aria-label=\"Needs you\"\n        className=\"size-ws-8 text-ws-semantic-notice\"\n      />\n    );\n  }\n  if (state === 'failed') {\n    return (\n      <RiCloseCircleFill\n        role=\"img\"\n        aria-label=\"Failed\"\n        className=\"size-ws-8 text-ws-semantic-negative\"\n      />\n    );\n  }\n  if (state === 'paused') {\n    return <RiPauseCircleLine role=\"img\" aria-label=\"Paused\" className=\"size-ws-8\" />;\n  }\n  if (thread.pullRequest) {\n    const { number, comments } = thread.pullRequest;\n    return (\n      <span className=\"gap-ws-2 flex items-center\">\n        <RiGitPullRequestLine aria-hidden className=\"size-ws-8\" />\n        <span className=\"sr-only\">Pull request {number}, open comments:</span>\n        {comments}\n      </span>\n    );\n  }\n  if (state === 'unread') {\n    return (\n      <span className=\"bg-ws-non-semantic-indigo-strong rounded-ws-control-full size-ws-4 mx-ws-2\">\n        <span className=\"sr-only\">Unread</span>\n      </span>\n    );\n  }\n  return null;\n}\n"
    },
    {
      "path": "src/blocks/agent-code/thread-menu.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/thread-menu.tsx",
      "content": "'use client';\n\nimport {\n  RiArchiveLine,\n  RiDeleteBinLine,\n  RiEyeLine,\n  RiMoreLine,\n  RiPencilLine,\n} from '@remixicon/react';\nimport { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';\nimport { ListItem } from '@/components/ui/wideset/list-item/ListItem';\n\nimport { IconAction } from './icon-action';\nimport { MenuChoice } from './menu-choice';\nimport { MenuSub } from './menu-sub';\nimport type { TranscriptView } from './model';\n\nconst VIEWS: { id: TranscriptView; label: string; note: string }[] = [\n  { id: 'normal', label: 'Normal', note: 'Steps and reasoning folded' },\n  { id: 'thinking', label: 'Thinking', note: 'Reasoning open' },\n  { id: 'verbose', label: 'Verbose', note: 'Every step open with its output' },\n];\n\ntype ThreadMenuProps = {\n  view: TranscriptView;\n  onViewChange: (view: TranscriptView) => void;\n};\n\n/**\n * The \"…\" at the end of the top bar: what can be done with the open thread, and, in a submenu\n * that shows the current choice, how much of the agent's work its transcript shows. Icons on\n * every item, the one destructive action last, after a line.\n */\nexport function ThreadMenu({ view, onViewChange }: ThreadMenuProps) {\n  return (\n    <DropdownMenu>\n      <DropdownMenu.Trigger asChild>\n        <IconAction label=\"More\" icon={RiMoreLine} side=\"bottom\" />\n      </DropdownMenu.Trigger>\n      <DropdownMenu.Content align=\"end\" className=\"ws-block-utility w-[15rem]\">\n        <DropdownMenu.Item>\n          <ListItem.Prefix>\n            <RiPencilLine className=\"size-ws-9\" />\n          </ListItem.Prefix>\n          <ListItem.Content>\n            <ListItem.Label>Rename</ListItem.Label>\n          </ListItem.Content>\n        </DropdownMenu.Item>\n        <MenuSub\n          icon={RiEyeLine}\n          label=\"Transcript view\"\n          value={VIEWS.find((item) => item.id === view)?.label}\n        >\n          <DropdownMenu.RadioGroup\n            aria-label=\"Transcript view\"\n            value={view}\n            onValueChange={(value) => onViewChange(value as TranscriptView)}\n          >\n            {VIEWS.map((item) => (\n              <MenuChoice key={item.id} value={item.id}>\n                <ListItem.Content>\n                  <ListItem.Label>{item.label}</ListItem.Label>\n                  <ListItem.Description>{item.note}</ListItem.Description>\n                </ListItem.Content>\n              </MenuChoice>\n            ))}\n          </DropdownMenu.RadioGroup>\n        </MenuSub>\n        <DropdownMenu.Item>\n          <ListItem.Prefix>\n            <RiArchiveLine className=\"size-ws-9\" />\n          </ListItem.Prefix>\n          <ListItem.Content>\n            <ListItem.Label>Archive</ListItem.Label>\n          </ListItem.Content>\n        </DropdownMenu.Item>\n        <DropdownMenu.Separator />\n        <DropdownMenu.Item variant=\"danger\">\n          <ListItem.Prefix>\n            <RiDeleteBinLine className=\"size-ws-9\" />\n          </ListItem.Prefix>\n          <ListItem.Content>\n            <ListItem.Label>Delete</ListItem.Label>\n          </ListItem.Content>\n        </DropdownMenu.Item>\n      </DropdownMenu.Content>\n    </DropdownMenu>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/tools-menu.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/tools-menu.tsx",
      "content": "'use client';\n\nimport { RiAttachment2, RiMoreFill, RiPlugLine } from '@remixicon/react';\nimport { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';\nimport { ListItem } from '@/components/ui/wideset/list-item/ListItem';\n\nimport { IconAction } from './icon-action';\n\n/**\n * The \"…\" at the end of the composer's tools: what is used now and then and needs no place of its\n * own in the bar. Add files puts a file on the composer's tray, on a screen that takes files; the\n * connectors are managed from here. Its rows are the AI chat starting point's: a 20px slot with a 16px subtle glyph.\n */\nexport function ToolsMenu({ onAttach }: { onAttach?: () => void }) {\n  return (\n    <DropdownMenu>\n      <DropdownMenu.Trigger asChild>\n        <IconAction label=\"More tools\" icon={RiMoreFill} />\n      </DropdownMenu.Trigger>\n      <DropdownMenu.Content side=\"top\" align=\"start\" className=\"ws-block-utility w-[14rem]\">\n        {onAttach && (\n          <DropdownMenu.Item onSelect={onAttach}>\n            <ListItem.Prefix className=\"size-ws-11 justify-center\">\n              <RiAttachment2 aria-hidden className=\"size-ws-9 text-ws-static-subtle\" />\n            </ListItem.Prefix>\n            <ListItem.Content>\n              <ListItem.Label>Add files</ListItem.Label>\n            </ListItem.Content>\n          </DropdownMenu.Item>\n        )}\n        {/* A placeholder: wire it to your app's connector settings; the sample has none. */}\n        <DropdownMenu.Item>\n          <ListItem.Prefix className=\"size-ws-11 justify-center\">\n            <RiPlugLine aria-hidden className=\"size-ws-9 text-ws-static-subtle\" />\n          </ListItem.Prefix>\n          <ListItem.Content>\n            <ListItem.Label>Manage connectors</ListItem.Label>\n          </ListItem.Content>\n        </DropdownMenu.Item>\n      </DropdownMenu.Content>\n    </DropdownMenu>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/top-bar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/top-bar.tsx",
      "content": "'use client';\n\nimport { RiSideBarLine } from '@remixicon/react';\nimport { Breadcrumbs } from '@/components/ui/wideset/breadcrumbs/Breadcrumbs';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport type { ReactNode } from 'react';\n\ntype TopBarProps = {\n  sidebarId: string;\n  collapsed: boolean;\n  onCollapsedChange: (collapsed: boolean) => void;\n  /** Where you are, outermost first: the project or repository, then the thread. */\n  crumbs: string[];\n  /**\n   * More about where the work happens, after the crumbs: a branch and the one it goes into. It\n   * is the first to give way: it shows only while the bar is wide enough for it.\n   */\n  meta?: ReactNode;\n  /** The thread's actions, at the right end. */\n  children?: ReactNode;\n};\n\n/**\n * The bar at the top of the session's half of the card. It belongs to the surround: edge to\n * edge, 48px, a line under it that meets the line of the pane's bar across the divider. The\n * sidebar's toggle is pulled left so its glyph, not its box, sits 20px from the edge; then where\n * you are; the actions at the far end. Nothing in it wraps: the thread's name, the last crumb,\n * truncates, and `meta` leaves when the bar is narrower than 44rem, so the name and the actions\n * always have their room.\n */\nexport function TopBar({\n  sidebarId,\n  collapsed,\n  onCollapsedChange,\n  crumbs,\n  meta,\n  children,\n}: TopBarProps) {\n  return (\n    <header className=\"h-ws-18 border-ws-static-base gap-ws-5 px-ws-11 @container flex shrink-0 items-center border-b\">\n      <IconButton\n        icon={RiSideBarLine}\n        variant=\"secondary\"\n        preset=\"ghost\"\n        size=\"sm\"\n        iconClassName=\"text-ws-static-subtle size-ws-9\"\n        aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n        aria-expanded={!collapsed}\n        aria-controls={sidebarId}\n        onClick={() => onCollapsedChange(!collapsed)}\n        className=\"-ml-ws-5 shrink-0\"\n      />\n      {/* Only the last crumb gives way: its list item may shrink, and its text truncates. */}\n      <Breadcrumbs separator=\"arrow\" className=\"min-w-0 [&_li:last-child]:min-w-0 [&_ol]:min-w-0\">\n        {crumbs.map((crumb, index) =>\n          index < crumbs.length - 1 ? (\n            <Breadcrumbs.Item key={crumb} asChild>\n              <a href={`#${crumb.toLowerCase().replace(/\\s+/g, '-')}`}>{crumb}</a>\n            </Breadcrumbs.Item>\n          ) : (\n            <Breadcrumbs.Item key={crumb} className=\"min-w-0\">\n              <span className=\"px-ws-2 truncate\">{crumb}</span>\n            </Breadcrumbs.Item>\n          ),\n        )}\n      </Breadcrumbs>\n      {meta && (\n        <div className=\"typography-caption-md text-ws-static-subtle gap-ws-3 hidden min-w-0 items-center @min-[44rem]:flex\">\n          {meta}\n        </div>\n      )}\n      <div className=\"gap-ws-3 ml-auto flex shrink-0 items-center\">{children}</div>\n    </header>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/transcript-break.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/transcript-break.tsx",
      "content": "'use client';\n\nimport { RiFileList2Line } from '@remixicon/react';\nimport { Divider } from '@/components/ui/wideset/divider/Divider';\nimport { useState } from 'react';\n\nimport { Fold } from './fold';\nimport type { DividerTurn } from './model';\nimport { Prose } from './prose';\nimport { Row } from './row';\n\n/**\n * Where the transcript changes for everything after it: a labelled line, so it is plain that\n * what came before is no longer here word for word, and, when there is a summary, one row that\n * opens to what the agent works from instead. The turns under it are the ones kept in full.\n */\nexport function TranscriptBreak({ turn }: { turn: DividerTurn }) {\n  const [open, setOpen] = useState(false);\n\n  return (\n    <div className=\"gap-ws-5 flex flex-col\">\n      <Divider text={turn.label} aria-label={turn.label} weight=\"thin\" />\n      {turn.summary && (\n        <div>\n          <Row\n            mark={\n              <RiFileList2Line aria-hidden className=\"size-ws-9 text-ws-static-subtle shrink-0\" />\n            }\n            open={open}\n            onToggle={() => setOpen((value) => !value)}\n          >\n            <span className=\"text-ws-static-subtle\">{turn.summary.label}</span>\n          </Row>\n          <Fold open={open}>\n            <div className=\"px-ws-3 py-ws-3\">\n              <Prose blocks={turn.summary.prose} />\n            </div>\n          </Fold>\n        </div>\n      )}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/transcript.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/transcript.tsx",
      "content": "'use client';\n\n// TODO(custom): the transcript of a thread (your messages, the agent's turns and the dividers between them, in one of three views); Wideset has no message or transcript component.\nimport { AgentTurn } from './agent-turn';\nimport type { ApprovalAnswer, TranscriptView, Turn } from './model';\nimport type { CardRender } from './step-row';\nimport { TranscriptBreak } from './transcript-break';\nimport { UserMessage } from './user-message';\n\ntype TranscriptProps = {\n  /** The turns as they show now (see `showTurn`). */\n  turns: Turn[];\n  view: TranscriptView;\n  /** The agent turn that is running, if one is. */\n  liveId?: string;\n  card?: CardRender;\n  onAnswer: (turnId: string, stepId: string, answer: ApprovalAnswer) => void;\n  onChoose: (turnId: string, questionId: string, text: string) => void;\n  onRate: (turnId: string, rating?: 'up' | 'down') => void;\n  /** Runs the newest answer again. */\n  onRetry: () => void;\n};\n\n/**\n * A thread as a log, oldest first. It knows nothing of Chat or Code: it draws the turn model, and\n * hands what is the block's own (`card` blocks, what a step carries) back to the block that owns\n * it. Changing the view starts every fold from that view's default, so what was opened by hand\n * does not linger.\n */\nexport function Transcript({\n  turns,\n  view,\n  liveId,\n  card,\n  onAnswer,\n  onChoose,\n  onRate,\n  onRetry,\n}: TranscriptProps) {\n  const latest = turns.filter((turn) => turn.role === 'agent').at(-1)?.id;\n\n  return (\n    <div key={view} role=\"log\" aria-label=\"Transcript\" className=\"gap-ws-9 flex flex-col\">\n      {turns.map((turn) =>\n        turn.role === 'user' ? (\n          <UserMessage key={turn.id} turn={turn} />\n        ) : turn.role === 'divider' ? (\n          <TranscriptBreak key={turn.id} turn={turn} />\n        ) : (\n          <AgentTurn\n            key={turn.id}\n            turn={turn}\n            view={view}\n            live={turn.id === liveId}\n            latest={turn.id === latest}\n            card={card}\n            onAnswer={(stepId, answer) => onAnswer(turn.id, stepId, answer)}\n            onChoose={(questionId, text) => onChoose(turn.id, questionId, text)}\n            onRate={(rating) => onRate(turn.id, rating)}\n            onRetry={turn.id === latest ? onRetry : undefined}\n          />\n        ),\n      )}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/use-run.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/use-run.ts",
      "content": "'use client';\n\n// TODO(custom): the clock a turn plays on (start, stop, a pause while it waits for you); Wideset has no agent or streaming parts.\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { Turn } from './model';\nimport { playTurn } from './run';\n\n/** How often the clock moves on, in milliseconds. */\nconst TICK = 50;\n\n/** Whether the device asks for less motion; where there is no `matchMedia` (a test), it does not. */\nexport const reducedMotion = () =>\n  typeof window !== 'undefined' &&\n  typeof window.matchMedia === 'function' &&\n  window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n\n/**\n * Plays one of the thread's agent turns: `start` sets its clock going, from its beginning or from\n * a point in it, and `playback` is the turn as far as it has come, until it is all there or it\n * comes to something it waits for from you: then the run ends, and whoever answers starts it\n * again from that point. Reduced motion does not stop the clock: the agent takes the time it\n * takes; only the text arrives a line at a time and nothing animates. `at` is where the clock\n * stands; `stop` ends the run there. With `opening` the thread opens in the middle of a run.\n */\nexport function useRun(turns: Turn[], opening?: { id: string; at: number }) {\n  const [run, setRun] = useState<{ id: string; at: number } | null>(opening ?? null);\n  const turn = run && turns.find((item) => item.id === run.id);\n  const playback = run && turn?.role === 'agent' ? playTurn(turn, run.at, reducedMotion()) : null;\n  // A turn that has come to something it waits for from you is at rest, like one that is done:\n  // the transcript holds it there, and answering sets it going again from that point.\n  const done = Boolean(playback?.done || playback?.waiting);\n  const ticking = playback !== null && !done;\n\n  // The clock reads real time, tick by tick, so a slow frame does not slow the run down.\n  useEffect(() => {\n    if (!ticking) return;\n    let last = performance.now();\n    const id = window.setInterval(() => {\n      const now = performance.now();\n      const passed = now - last;\n      last = now;\n      setRun((current) => current && { ...current, at: current.at + passed });\n    }, TICK);\n    return () => window.clearInterval(id);\n  }, [ticking]);\n\n  useEffect(() => {\n    if (done) setRun(null);\n  }, [done]);\n\n  const start = useCallback((id: string, from = 0) => setRun({ id, at: from }), []);\n  const stop = useCallback(() => setRun(null), []);\n\n  return {\n    playback: done ? null : playback,\n    /** Milliseconds into the run. */\n    at: run?.at ?? 0,\n    start,\n    stop,\n  };\n}\n"
    },
    {
      "path": "src/blocks/agent-code/use-session.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/use-session.ts",
      "content": "'use client';\n\n// TODO(custom): what can be done in a thread (send, queue, stop, continue, replay, answer what it waits for, rate) over the turn model; Wideset has no agent or chat state.\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { AgentTurn, ApprovalAnswer, Step, Turn } from './model';\nimport { answerApproval, answerQuestion, playTurn, release, rewind, showTurn } from './run';\nimport { reducedMotion, useRun } from './use-run';\n\nconst stepsOf = (turn: Turn): Step[] =>\n  turn.role !== 'agent'\n    ? []\n    : turn.blocks.flatMap((block) =>\n        block.kind === 'step' ? [block] : block.kind === 'steps' ? block.steps : [],\n      );\n\n/** A turn that still waits for you, left behind by a new message: it ends where it stands. */\nconst abandon = (turn: AgentTurn): AgentTurn => {\n  const rest = playTurn(turn, Infinity);\n  return rest.done || turn.stoppedAt !== undefined ? turn : { ...turn, stoppedAt: rest.clock };\n};\n\n/** A question on the page still open: the turn that asks it, and its id in that turn. */\ntype OpenQuestion = { turn: string; id: string };\n\n/** A message waiting its turn: an id that stays with it while others go, its words, its files. */\nexport type QueuedMessage = { id: number; text: string; sentWith?: string[] };\n\ntype SessionOptions = {\n  /** The open thread's turns, whole, as its data holds them. */\n  turns: Turn[];\n  /** Writes the turns back to wherever the thread is kept. */\n  onChange: (change: (turns: Turn[]) => Turn[]) => void;\n  /** The agent's turn in answer to a message; a sample has one for everything. */\n  reply: (id: string, text: string) => AgentTurn;\n  /** Messages already waiting their turn when the session opens. */\n  queue?: string[];\n  /** What is in the composer when the session opens. */\n  draft?: string;\n  /** The session opens in the middle of a run: the turn, and how far into it, in milliseconds. */\n  playing?: { id: string; at: number };\n};\n\n/**\n * One thread in use, the same in Chat and in Code. It keeps the turns whole in the block's own\n * state and works out what shows: the running turn as far as it has come, a stopped one cut\n * where it stopped, one that waits for you held at that point.\n *\n * - `send`: answered at once. While the agent works the message joins `queue` (over the\n *   composer, not in the transcript: it has not been said yet) and goes out when the run ends;\n *   `edit` takes one back into the composer, `unqueue` drops it. A message sent while a turn\n *   waits for you answers its question, or leaves the turn where it stands, ahead of the queue.\n * - `stop` keeps what is there and marks the turn stopped; `resume` goes on from there. `replay`\n *   plays the newest turn (or a named one) again from its start, as before anyone answered it.\n * - What a turn waits for: `answer` (an approval), `choose` (a question: the answer becomes your\n *   message), `proceed` (a step or a card that holds the turn). A turn that waits is at rest;\n *   each of these sets it going again from that point.\n * - `write` puts words in the composer for you to send or change; `attach` and `detach` keep\n *   the files that go with the next message.\n * - `start` and `leave` are for the shell: a thread still working when it is opened, and one\n *   that is left mid-run (it is simply finished on return).\n */\nexport function useSession({\n  turns,\n  onChange,\n  reply,\n  queue: waiting,\n  draft: opening,\n  playing,\n}: SessionOptions) {\n  const ids = useRef(0);\n  /** The thread's turns as last shown, for the ids already taken in it. */\n  const latest = useRef(turns);\n  useEffect(() => {\n    latest.current = turns;\n  });\n  const queued = useRef(waiting?.length ?? 0);\n  /**\n   * The queued messages already sent, by id. StrictMode sets an effect up twice in development, and\n   * a send can come before the render that drops a message the run's end just sent: neither may\n   * send it again.\n   */\n  const claimed = useRef(new Set<number>());\n  const [queue, setQueue] = useState<QueuedMessage[]>(() =>\n    (waiting ?? []).map((text, index) => ({ id: index + 1, text })),\n  );\n  const [draft, setDraft] = useState({ text: opening ?? '', id: 0 });\n  const [attachments, setAttachments] = useState<string[]>([]);\n  /**\n   * The tray as it is now, ahead of the next render: a handler that attaches, sends or edits more\n   * than once sees what its own earlier calls did.\n   */\n  const tray = useRef<string[]>([]);\n  const changeTray = (change: (files: string[]) => string[]) => {\n    tray.current = change(tray.current);\n    setAttachments(tray.current);\n  };\n  const { playback, at, start: play, stop: end } = useRun(turns, playing);\n  const running = playback !== null;\n  /**\n   * Whether a turn is playing, as of now: set the moment one starts or stops, so a second send in\n   * the same handler waits in the queue instead of cutting the first reply short.\n   */\n  const busy = useRef(running);\n  useEffect(() => {\n    busy.current = running;\n  });\n  const whole = reducedMotion();\n  /** The turn last set playing: the one Continue goes on with once stopped, wherever it stands. */\n  const [played, setPlayed] = useState(playing?.id);\n  const start = useCallback(\n    (id: string, from?: number) => {\n      busy.current = true;\n      setPlayed(id);\n      play(id, from);\n    },\n    [play],\n  );\n  const halt = () => {\n    busy.current = false;\n    end();\n  };\n\n  const shown = turns.map((turn) =>\n    turn.role !== 'agent'\n      ? turn\n      : turn.id === playback?.turn.id\n        ? playback.turn\n        : showTurn(turn, undefined, whole),\n  );\n  const steps = shown.flatMap(stepsOf);\n  // The turn stopped: the one last played (a replay of an earlier turn too), else the newest.\n  const target = played ? turns.find((turn) => turn.id === played) : turns.at(-1);\n  const cut =\n    !running && target?.role === 'agent' && target.stoppedAt !== undefined ? target : null;\n  /**\n   * The questions on the page still open: a message sent answers these, never one not shown yet,\n   * nor one a stopped turn no longer shows.\n   */\n  const open: OpenQuestion[] = shown.flatMap((turn) =>\n    turn.role !== 'agent' || turn.stopped\n      ? []\n      : turn.blocks.flatMap((block) =>\n          block.kind === 'question' && block.answer === undefined\n            ? [{ turn: turn.id, id: block.id }]\n            : [],\n        ),\n  );\n\n  const awaiting = shown.some((turn) => turn.role === 'agent' && turn.held);\n\n  const changeTurn = (id: string, change: (turn: AgentTurn) => AgentTurn) =>\n    onChange((all) =>\n      all.map((turn) => (turn.id === id && turn.role === 'agent' ? change(turn) : turn)),\n    );\n\n  const deliver = useCallback(\n    (text: string, sentWith?: string[], answering: OpenQuestion[] = []) => {\n      // An id no turn in the thread has: a thread kept and opened again holds those made before.\n      const newId = () => {\n        let id: string;\n        do id = `sent-${(ids.current += 1)}`;\n        while (latest.current.some((turn) => turn.id === id));\n        return id;\n      };\n      const answer = reply(newId(), text);\n      const answered = (turn: AgentTurn) =>\n        // Each answer goes to the turn whose question it is: two turns may use the same id.\n        answering\n          .filter((question) => question.turn === turn.id)\n          .reduce((item, question) => answerQuestion(item, text, question.id), turn);\n      onChange((all) => [\n        ...all.map((turn) => (turn.role === 'agent' ? abandon(answered(turn)) : turn)),\n        { id: newId(), role: 'user', text, sentWith },\n        answer,\n      ]);\n      start(answer.id);\n    },\n    [onChange, reply, start],\n  );\n\n  /** Sends a message; it answers the questions named, the ones open on the page when it is sent. */\n  const post = (text: string, answering: OpenQuestion[]) => {\n    // The files go with this message only: the tray is emptied before another send can read it.\n    const sentWith = tray.current.length > 0 ? tray.current : undefined;\n    changeTray(() => []);\n    // While the agent works the files wait with the message, not on the tray for the next one.\n    const message = { id: (queued.current += 1), text, sentWith };\n    // The queue is changed from what it holds now, so two sends in one handler both stay.\n    const behind = () => setQueue((current) => [...current, message]);\n    if (busy.current) return behind();\n    // Stopped with messages waiting: sending goes on in order, the first that waited goes now.\n    // A turn that waits for you is answered by what you send now; the queue goes after it.\n    if (queue.length > 0 && !awaiting) {\n      const [first] = queue;\n      // Already sent as the run ended: this message waits behind it instead.\n      if (claimed.current.has(first.id)) return behind();\n      claimed.current.add(first.id);\n      setQueue((current) => [...current.filter((item) => item.id !== first.id), message]);\n      return deliver(first.text, first.sentWith, answering);\n    }\n    deliver(text, sentWith, answering);\n  };\n\n  const send = (text: string) => post(text, open);\n\n  /** Sets a turn that was held going again from where it stood. */\n  const go = (turn: AgentTurn) => start(turn.id, playTurn(turn, Infinity).clock);\n\n  const agentTurn = (id: string) => {\n    const turn = turns.find((item) => item.id === id);\n    return turn?.role === 'agent' ? turn : undefined;\n  };\n\n  // When a run ends, the first message that waited goes out; not while the turn waits for you,\n  // and not after you stopped it: the queue waits for Continue, or for what you send next.\n  const stopped = cut !== null;\n  // As text, so the effect below runs again only when the open questions change.\n  const answering = JSON.stringify(open);\n  useEffect(() => {\n    if (running || awaiting || stopped || queue.length === 0) return;\n    const [next] = queue;\n    if (claimed.current.has(next.id)) return;\n    claimed.current.add(next.id);\n    deliver(next.text, next.sentWith, JSON.parse(answering) as OpenQuestion[]);\n    setQueue((current) => current.filter((item) => item.id !== next.id));\n  }, [running, awaiting, stopped, queue, deliver, answering]);\n\n  return {\n    /** The turns as the transcript shows them now. */\n    shown,\n    /** Every step on the page, as it shows now. */\n    steps,\n    /** The run in progress, or null at rest. */\n    playback,\n    /** Milliseconds into the run. */\n    at,\n    running,\n    /** Something on the page waits for you: its way out is the filled button, so Send steps back. */\n    awaiting,\n    /** The turn last played (an earlier one too) was stopped: what it was in the middle of. */\n    stopped: cut && { activity: playTurn(cut, cut.stoppedAt ?? 0).activity },\n    /** The messages waiting their turn, in the order they go out. */\n    queue,\n    /** What was last put in the composer from outside; a new `id` puts it there again. */\n    draft,\n    /** The files attached to the next message, by name. */\n    attachments,\n    start,\n    send,\n\n    leave() {\n      halt();\n      setPlayed(undefined);\n      setQueue([]);\n      changeTray(() => []);\n      setDraft((current) => ({ text: '', id: current.id + 1 }));\n    },\n\n    /** Puts a file on the tray, once. */\n    attach(name: string) {\n      changeTray((files) => (files.includes(name) ? files : [...files, name]));\n    },\n\n    /** Puts the first of these files not on the tray yet there; none when all are. */\n    attachNext(names: string[]) {\n      changeTray((files) => {\n        const next = names.find((name) => !files.includes(name));\n        return next ? [...files, next] : files;\n      });\n    },\n\n    /** Takes the file at this place on the tray, as it shows, off it. */\n    detach(index: number) {\n      const name = attachments[index];\n      changeTray((files) => files.filter((item) => item !== name));\n    },\n\n    write(text: string) {\n      setDraft((current) => ({ text, id: current.id + 1 }));\n    },\n\n    /** Takes the message at this place in the queue, as it shows, back into the composer. */\n    edit(index: number) {\n      const message = queue[index];\n      if (!message) return;\n      const { id, text, sentWith = [] } = message;\n      setDraft((current) => ({ text, id: current.id + 1 }));\n      // Its files go back on the tray with it.\n      changeTray((files) => [...files, ...sentWith.filter((name) => !files.includes(name))]);\n      setQueue((current) => current.filter((item) => item.id !== id));\n    },\n\n    /** Drops the message at this place in the queue, as it shows. */\n    unqueue(index: number) {\n      const message = queue[index];\n      if (!message) return;\n      setQueue((current) => current.filter((item) => item.id !== message.id));\n    },\n\n    stop() {\n      if (!playback) return;\n      changeTurn(playback.turn.id, (turn) => ({ ...turn, stoppedAt: at }));\n      halt();\n    },\n\n    resume() {\n      if (!cut) return;\n      changeTurn(cut.id, (turn) => ({ ...turn, stoppedAt: undefined }));\n      start(cut.id, cut.stoppedAt);\n    },\n\n    /** Plays a turn again from its start: the newest agent turn, or the one named. */\n    replay(turnId?: string) {\n      const turn = turnId\n        ? agentTurn(turnId)\n        : turns.filter((item) => item.role === 'agent').at(-1);\n      if (!turn) return;\n      changeTurn(turn.id, rewind);\n      start(turn.id);\n    },\n\n    answer(turnId: string, stepId: string, answer: ApprovalAnswer) {\n      const turn = agentTurn(turnId);\n      if (!turn) return;\n      changeTurn(turnId, (item) => answerApproval(item, stepId, answer));\n      go(turn);\n    },\n\n    proceed(turnId: string, id: string) {\n      const turn = agentTurn(turnId);\n      if (!turn) return;\n      changeTurn(turnId, (item) => release(item, id));\n      go(turn);\n    },\n\n    choose(turnId: string, id: string, text: string) {\n      changeTurn(turnId, (item) => answerQuestion(item, text, id));\n      // The choice answers its own question only.\n      post(text, []);\n    },\n\n    rate(turnId: string, rating?: 'up' | 'down') {\n      changeTurn(turnId, (turn) => ({ ...turn, rating }));\n    },\n  };\n}\n\nexport type Session = ReturnType<typeof useSession>;\n"
    },
    {
      "path": "src/blocks/agent-code/use-shell.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/use-shell.ts",
      "content": "'use client';\n\n// TODO(custom): the app's state around the open thread (the mode, the threads by group, which one is open, starting a new one); Wideset has no app shell state.\nimport { useEffect, useRef, useState } from 'react';\n\nimport type { AgentTurn, Mode, Thread, ThreadGroup, Turn, Workplace } from './model';\nimport { useSession } from './use-session';\n\n/** A thread that is still working when it is opened has been at it for a moment already. */\nconst HEAD_START = 3000;\n\nconst NOUN: Record<Mode, string> = { chat: 'chat', code: 'session' };\n\nconst mapThread = (groups: ThreadGroup[], id: string, change: (thread: Thread) => Thread) =>\n  groups.map((group) => ({\n    ...group,\n    threads: group.threads.map((thread) => (thread.id === id ? change(thread) : thread)),\n  }));\n\ntype ShellOptions = {\n  /** The threads of each mode, in their groups. */\n  chat: ThreadGroup[];\n  code: ThreadGroup[];\n  /** The mode and the thread the block opens on; no thread is the new-thread screen. */\n  mode: Mode;\n  openId: string | null;\n  /** The agent's turn in answer to a message. */\n  reply: (id: string, text: string) => AgentTurn;\n  /** Files in the workspace, by name: Add files attaches them one after another. */\n  files?: string[];\n};\n\n/**\n * Everything a block's shell holds, the same in every block that lets you move about: the mode,\n * each mode's threads, the one that is open and its session, and the new-thread screen.\n *\n * - Opening a thread reads it. One that was still working goes on from where it is; the one left\n *   behind ends its run without a mark, so back there its turn is simply finished.\n * - A thread that waited for you stops saying so once nothing in it waits any more.\n * - The first message on the new-thread screen makes the thread: it takes its name from the\n *   message and joins the group whose `+` was pressed, or Recents.\n * - `sidebar` is what `AgentSidebar` needs; `crumbs` is where you are, for the top bar.\n */\nexport function useShell({\n  chat,\n  code,\n  mode: firstMode,\n  openId: firstId,\n  reply,\n  files,\n}: ShellOptions) {\n  const [mode, setMode] = useState(firstMode);\n  const [groups, setGroups] = useState({ chat, code });\n  const [openIds, setOpenIds] = useState<Record<Mode, string | null>>({\n    chat: null,\n    code: null,\n    [firstMode]: firstId,\n  });\n  /** The group whose `+` started the new thread; without one it goes to Recents. */\n  const [newIn, setNewIn] = useState<string>();\n  const ids = useRef(0);\n\n  const openId = openIds[mode];\n  const group = groups[mode].find((item) => item.threads.some((thread) => thread.id === openId));\n  const thread = group?.threads.find((item) => item.id === openId);\n\n  const changeThread = (id: string, change: (thread: Thread) => Thread) =>\n    setGroups((current) => ({ ...current, [mode]: mapThread(current[mode], id, change) }));\n\n  const session = useSession({\n    turns: thread?.turns ?? [],\n    onChange: (change: (turns: Turn[]) => Turn[]) =>\n      openId && changeThread(openId, (item) => ({ ...item, turns: change(item.turns) })),\n    reply,\n  });\n\n  // Whatever the thread waited for has been dealt with: it no longer says it needs you.\n  const waited = thread?.state === 'needs-you' && !session.awaiting;\n  useEffect(() => {\n    if (!waited || !openId) return;\n    setGroups((current) => ({\n      ...current,\n      [mode]: mapThread(current[mode], openId, (item) => ({ ...item, state: undefined })),\n    }));\n  }, [waited, openId, mode]);\n\n  // Something in the open thread waits for you (a replayed approval too): the thread says so, and\n  // keeps saying so when you open another one.\n  const waits = thread !== undefined && thread.state !== 'needs-you' && session.awaiting;\n  useEffect(() => {\n    if (!waits || !openId) return;\n    setGroups((current) => ({\n      ...current,\n      [mode]: mapThread(current[mode], openId, (item) => ({ ...item, state: 'needs-you' })),\n    }));\n  }, [waits, openId, mode]);\n\n  const nextId = () => `new-${(ids.current += 1)}`;\n\n  const open = (id: string) => {\n    // The thread is open already: nothing to leave, so the draft and the queue stay.\n    if (id === openId) return;\n    session.leave();\n    setOpenIds((current) => ({ ...current, [mode]: id }));\n    const target = groups[mode].flatMap((item) => item.threads).find((item) => item.id === id);\n    if (target?.state === 'unread' || target?.state === 'working') {\n      changeThread(id, (item) => ({ ...item, state: undefined }));\n    }\n    const last = target?.turns.filter((turn) => turn.role === 'agent').at(-1);\n    if (target?.state === 'working' && last) session.start(last.id, HEAD_START);\n  };\n\n  const startNew = (groupId?: string) => {\n    session.leave();\n    setNewIn(groupId);\n    setOpenIds((current) => ({ ...current, [mode]: null }));\n  };\n\n  return {\n    mode,\n    /** The open thread and its group; none on the new-thread screen. */\n    thread,\n    group,\n    session,\n    changeThread,\n    startNew,\n    /** The group whose `+` started the new thread: in Code, the repository it starts in. */\n    newIn,\n\n    crumbs:\n      thread && group\n        ? [group.label, thread.title]\n        : [\n            ...groups[mode].filter((item) => item.id === newIn).map((item) => item.label),\n            `New ${NOUN[mode]}`,\n          ],\n\n    sidebar: {\n      mode,\n      onModeChange: (next: Mode) => {\n        session.leave();\n        setNewIn(undefined);\n        setMode(next);\n      },\n      groups: groups[mode],\n      openId,\n      workingId: session.running ? (openId ?? undefined) : undefined,\n      onOpen: open,\n      onNew: startNew,\n    },\n\n    /** Attaches the next file of the workspace that is not on the tray yet. */\n    attach() {\n      // From the tray as it is now, so Add files twice in a row adds two.\n      session.attachNext(files ?? []);\n    },\n\n    /**\n     * The first message of a new thread, with the files attached on the new-thread screen. In Code\n     * the session goes under the repository chosen there and keeps its branch.\n     */\n    begin(text: string, sentWith?: string[], workplace?: Workplace) {\n      const id = nextId();\n      const answer = reply(nextId(), text);\n      const created: Thread = {\n        id,\n        title: text.length > 32 ? `${text.slice(0, 32).trimEnd()}…` : text,\n        branch: workplace?.branch,\n        turns: [{ id: nextId(), role: 'user', text, sentWith }, answer],\n      };\n      setGroups((current) => {\n        // The chosen repository's group, else the group whose + was pressed, else Recents.\n        const wanted = workplace?.repository ?? newIn;\n        const home = current[mode].some((item) => item.id === wanted) ? wanted : undefined;\n        return {\n          ...current,\n          [mode]: current[mode].map((item) =>\n            (home ? item.id === home : item.fixed)\n              ? { ...item, threads: [created, ...item.threads] }\n              : item,\n          ),\n        };\n      });\n      setOpenIds((current) => ({ ...current, [mode]: id }));\n      session.start(answer.id);\n    },\n  };\n}\n"
    },
    {
      "path": "src/blocks/agent-code/user-message.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/user-message.tsx",
      "content": "'use client';\n\n// TODO(custom): your message in the transcript (a brand-tinted bubble on the right, with what it was sent with); Wideset has no message component.\nimport type { UserTurn } from './model';\n\n/**\n * What you wrote, as Figma draws a sent message (the Communication and AI chat screens): a\n * bubble in the brand tint on the right, no avatar and no name, since everything on the left is\n * the agent's. It may run wider than Figma's 356px: what is asked of an agent is often a\n * paragraph, and a narrow bubble would stand taller than the answer. What it was sent with (a\n * tool that explains the answer, the files attached) is a quiet caption under it.\n */\nexport function UserMessage({ turn }: { turn: UserTurn }) {\n  return (\n    <div className=\"gap-ws-3 flex flex-col items-end\">\n      <p className=\"typography-body-md text-ws-non-semantic-indigo-on-subtle bg-ws-dynamic-primary-alpha-strong-default rounded-ws-container-sm p-ws-5 max-w-[85%] break-words whitespace-pre-line\">\n        <span className=\"sr-only\">You: </span>\n        {turn.text}\n      </p>\n      {turn.sentWith && turn.sentWith.length > 0 && (\n        <p className=\"typography-caption-md text-ws-static-subtle\">\n          <span className=\"sr-only\">Sent with </span>\n          {turn.sentWith.join(' · ')}\n        </p>\n      )}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-code/working-line.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-code/working-line.tsx",
      "content": "'use client';\n\n// TODO(custom): the line over the composer while the agent works or was stopped (a mark, a few words, the time, the way to stop or go on); Wideset has no activity line, and ProgressBar has no mode without a value.\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { formatDuration } from './format';\nimport { Inline } from './inline';\nimport { Key } from './keyboard-key';\nimport { ARRIVE } from './motion';\n\ntype WorkingLineProps = {\n  /** `working`: the agent is at it. `stopped`: you stopped it, and it can go on from there. */\n  state: 'working' | 'stopped';\n  /** What it says: \"Working\", \"Stopped while writing\". */\n  label: string;\n  /** Seconds since the turn began. */\n  seconds?: number;\n  /** Stopped: goes on from where it stopped. */\n  onContinue?: () => void;\n};\n\n/**\n * One quiet line right where the next message is written. While the agent works it says only\n * that: the transcript above already shows the step as it happens, so the line does not repeat\n * its words. A small mark pulses for as long as the run does (the one loop on the screen), then\n * the time so far and the key that stops it. A turn that waits for you has no line: what it\n * waits for is in the transcript, with its own way out. Stopped, the mark is hollow, the line\n * says what the run was in the middle of, and Continue takes the place of the key: bordered,\n * since after a stop the next thing is as likely a new message, so Send keeps the fill.\n */\nexport function WorkingLine({ state, label, seconds, onContinue }: WorkingLineProps) {\n  return (\n    <div\n      className={cn(\n        'gap-ws-5 px-ws-3 typography-label-sm text-ws-static-subtle flex items-center',\n        state !== 'stopped' && ARRIVE,\n      )}\n    >\n      <span\n        aria-hidden\n        className={cn(\n          'size-ws-4 rounded-ws-control-full mx-ws-2 shrink-0',\n          state === 'working'\n            ? 'bg-ws-static-inverse-background motion-safe:animate-pulse'\n            : 'border-ws-static-inverse-background border',\n        )}\n      />\n      <span aria-live=\"polite\" className=\"min-w-0 truncate\">\n        <Inline text={label} />\n      </span>\n      {state !== 'stopped' && seconds !== undefined && (\n        <span className=\"shrink-0 tabular-nums\">{formatDuration(seconds)}</span>\n      )}\n      {state === 'stopped' ? (\n        <Button\n          size=\"xs\"\n          variant=\"secondary\"\n          preset=\"border\"\n          className=\"ml-auto shrink-0\"\n          onClick={onContinue}\n        >\n          Continue\n        </Button>\n      ) : (\n        <span className=\"gap-ws-3 ml-auto flex shrink-0 items-center\">\n          <Key>Esc</Key>\n          to stop\n        </span>\n      )}\n    </div>\n  );\n}\n"
    }
  ],
  "meta": {
    "version": "1.1.0",
    "commit": "a734f9f0"
  }
}
