{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "block-agent-context",
  "type": "registry:block",
  "title": "Agent context",
  "description": "A session’s environment in a popover from the context meter in the composer: how full the context is and what fills it with a way to compact it, the connectors with the one to reconnect, the files and the document the session produced, and the pull request it opened.",
  "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/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/text-input.json",
    "https://wideset.co/r/tooltip.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/agent-context/agent-turn.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/answer-actions.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/approval-card.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/brand-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/canon.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/changes-counts.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/code-block.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/code-tools.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/composer.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/connector-list.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/connector-list.tsx",
      "content": "'use client';\n\n// TODO(custom): a connector as a row (what it is, its state, the way to reconnect it); Wideset has no row for a connection, and InlineAlert is a message, not a list item.\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';\nimport { useEffect, useRef, useState } from 'react';\n\nimport type { Connector } from './data';\n\ntype ConnectorListProps = {\n  connectors: Connector[];\n  onReconnect: (id: string) => void;\n};\n\n/**\n * What the session can reach beyond the repository, one row each: its icon and name, then its\n * state in the colour of its meaning. A connector whose sign-in ran out says so in the notice\n * colour, as the step that needs it does in agent-states (nothing is broken, it needs you), and\n * has Reconnect beside it, bordered: the way to fix it is on the row that has the problem.\n * Reconnected, the button gives way to the badge: the focus goes to the badge, and the change\n * is said aloud.\n */\nexport function ConnectorList({ connectors, onReconnect }: ConnectorListProps) {\n  const [reconnected, setReconnected] = useState<string>();\n  const badges = useRef(new Map<string, HTMLSpanElement>());\n  const back = connectors.find((item) => item.id === reconnected && item.state === 'connected');\n\n  // Once, when the connector is back: the rows are new objects on every render of the popover.\n  const backId = back?.id;\n  useEffect(() => {\n    if (backId) badges.current.get(backId)?.focus();\n  }, [backId]);\n\n  return (\n    <>\n      <ul className=\"flex flex-col\">\n        {connectors.map(({ id, name, icon: Icon, state }) => (\n          <li key={id} className=\"gap-ws-5 min-h-ws-15 flex items-center\">\n            <Icon aria-hidden=\"true\" className=\"size-ws-9 text-ws-static-subtle shrink-0\" />\n            <span className=\"typography-label-sm text-ws-static-strong min-w-0 flex-1 truncate\">\n              {name}\n            </span>\n            {state === 'connected' ? (\n              <span\n                ref={(node) => {\n                  if (node) badges.current.set(id, node);\n                  else badges.current.delete(id);\n                }}\n                tabIndex={-1}\n                className=\"focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default rounded-ws-control-sm flex\"\n              >\n                <StatusBadge size=\"sm\" color=\"positive\">\n                  Connected\n                </StatusBadge>\n              </span>\n            ) : (\n              <>\n                <StatusBadge size=\"sm\" color=\"notice\">\n                  Sign-in expired\n                </StatusBadge>\n                <Button\n                  variant=\"secondary\"\n                  preset=\"border\"\n                  size=\"sm\"\n                  aria-label={`Reconnect ${name}`}\n                  onClick={() => {\n                    setReconnected(id);\n                    onReconnect(id);\n                  }}\n                >\n                  Reconnect\n                </Button>\n              </>\n            )}\n          </li>\n        ))}\n      </ul>\n      <span role=\"status\" className=\"sr-only\">\n        {back ? `${back.name} is connected` : ''}\n      </span>\n    </>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-context/context-format.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/context-format.ts",
      "content": "const compact = new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: 1 });\nconst percent = new Intl.NumberFormat('en-US', { style: 'percent', maximumFractionDigits: 0 });\n\n/** A number of tokens as it is read: \"21.4K\", \"200K\". */\nexport const formatTokens = (tokens: number) => compact.format(tokens);\n\n/** A share of the window: \"29%\". */\nexport const formatShare = (share: number) => percent.format(share);\n"
    },
    {
      "path": "src/blocks/agent-context/context-meter.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/context-popover.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/context-popover.tsx",
      "content": "'use client';\n\nimport { Popup } from '@/components/ui/wideset/popup/Popup';\nimport { useState } from 'react';\n\nimport { ConnectorList } from './connector-list';\nimport { ContextMeter } from './context-meter';\nimport { ContextSection } from './context-section';\nimport { ContextUsage } from './context-usage';\nimport { changedFiles, connectors, context, documents, pullRequests } from './data';\nimport { ProducedList } from './produced-list';\nimport { PullRequestList } from './pull-request-list';\n\n/**\n * The context meter and what it opens: the session's environment in a popover over the composer,\n * so the transcript stays in view behind it. Four sections under one another, most pressing\n * first: how full the context is and the way to free it, the connectors with the one to\n * reconnect, what the session produced, the pull requests it opened. It informs and fixes in\n * place, so it has no footer and no filled button: Send stays the screen's one. It opens with\n * the block; the meter opens it again.\n */\nexport function ContextPopover() {\n  const [open, setOpen] = useState(true);\n  const [compacted, setCompacted] = useState(false);\n  const [reconnected, setReconnected] = useState<string[]>([]);\n\n  const parts = context.parts.map(({ label, tokens, compacted: left }) => ({\n    label,\n    tokens: compacted && left !== undefined ? left : tokens,\n  }));\n  const used = parts.reduce((sum, part) => sum + part.tokens, 0);\n\n  return (\n    <Popup open={open} onOpenChange={setOpen}>\n      <Popup.Trigger asChild>\n        <ContextMeter share={used / context.window} />\n      </Popup.Trigger>\n      <Popup.Container\n        side=\"top\"\n        align=\"start\"\n        collisionPadding={12}\n        aria-label=\"Session context\"\n        // Focus the popover itself, not its first button: nothing looks pressed before anything\n        // is, and Tab starts from the top.\n        onOpenAutoFocus={(event) => {\n          event.preventDefault();\n          (event.currentTarget as HTMLElement).focus();\n        }}\n        className=\"ws-block-utility max-h-[calc(100dvh-7rem)] w-[26rem]\"\n      >\n        {/* The sections scroll in a plain box, not in Popup.Content: its scrollbar gutter would stop\n            their lines short of the right edge. */}\n        <div className=\"ws-scrollbar min-h-0 overflow-y-auto\">\n          <ContextSection title=\"Context\">\n            <ContextUsage\n              window={context.window}\n              parts={parts}\n              compacted={compacted}\n              onCompact={() => setCompacted(true)}\n            />\n          </ContextSection>\n          <ContextSection title=\"Connectors\">\n            <ConnectorList\n              connectors={connectors.map((connector) =>\n                reconnected.includes(connector.id)\n                  ? { ...connector, state: 'connected' }\n                  : connector,\n              )}\n              onReconnect={(id) => setReconnected((current) => [...current, id])}\n            />\n          </ContextSection>\n          <ContextSection title=\"Produced\">\n            <ProducedList files={changedFiles} documents={documents} />\n          </ContextSection>\n          <ContextSection title=\"Pull requests\">\n            <PullRequestList pullRequests={pullRequests} />\n          </ContextSection>\n        </div>\n      </Popup.Container>\n    </Popup>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-context/context-section.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/context-section.tsx",
      "content": "'use client';\n\n// TODO(custom): a titled section of a popover, set off from the one above by a line; Popup has a header, a content and a footer, no sections.\nimport { type ReactNode, useId } from 'react';\n\ntype ContextSectionProps = {\n  title: string;\n  children: ReactNode;\n};\n\n/**\n * One part of the session's environment: a quiet title over its rows. Sections follow one\n * another with a line between them, edge to edge, and every one keeps the popover's 20px inset,\n * so the titles, the rows and the meter share one left edge.\n */\nexport function ContextSection({ title, children }: ContextSectionProps) {\n  const titleId = useId();\n\n  return (\n    <section\n      aria-labelledby={titleId}\n      className=\"border-ws-static-base gap-ws-5 px-ws-11 py-ws-9 flex flex-col border-t first:border-t-0\"\n    >\n      <h3 id={titleId} className=\"typography-label-sm text-ws-static-subtle\">\n        {title}\n      </h3>\n      {children}\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-context/context-summary.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/context-usage.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/context-usage.tsx",
      "content": "'use client';\n\n// TODO(custom): usage of a window as one meter with what fills it listed under it; ProgressBar has no neutral variant yet (#58), and Wideset has no usage meter.\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { ProgressBar } from '@/components/ui/wideset/progress-bar/ProgressBar';\n\nimport { formatShare, formatTokens } from './context-format';\n\ntype ContextUsageProps = {\n  /** The size of the window, in tokens. */\n  window: number;\n  /** What fills it, largest first. */\n  parts: { label: string; tokens: number }[];\n  /** The conversation has been compacted: there is nothing more to free. */\n  compacted: boolean;\n  onCompact: () => void;\n};\n\n/**\n * How full the context is: the share as the figure, one bar for it, and under the bar what fills\n * it as plain rows of figures (the value has its one visual; the breakdown is read, not drawn).\n * The way to free space sits with the meter it changes: Compact, bordered, with one line saying\n * what it does and what it keeps. Once used, the figures drop and the line says so.\n */\nexport function ContextUsage({ window, parts, compacted, onCompact }: ContextUsageProps) {\n  const used = parts.reduce((sum, part) => sum + part.tokens, 0);\n  const share = formatShare(used / window);\n\n  return (\n    <div className=\"gap-ws-9 flex flex-col\">\n      <div className=\"gap-ws-5 flex flex-col\">\n        <p className=\"gap-ws-5 flex items-baseline justify-between tabular-nums\">\n          <span className=\"typography-label-strong-md text-ws-static-strong\">\n            {share} of the window used\n          </span>\n          <span className=\"typography-body-sm text-ws-static-subtle\">\n            {formatTokens(used)} of {formatTokens(window)} tokens\n          </span>\n        </p>\n        <ProgressBar\n          value={used}\n          max={window}\n          aria-label={`Context: ${share} of the window used`}\n        />\n        <dl className=\"gap-ws-2 pt-ws-2 flex flex-col\">\n          {parts.map((part) => (\n            <div key={part.label} className=\"typography-body-sm flex justify-between\">\n              <dt className=\"text-ws-static-subtle\">{part.label}</dt>\n              <dd className=\"text-ws-static-base tabular-nums\">{formatTokens(part.tokens)}</dd>\n            </div>\n          ))}\n        </dl>\n      </div>\n      <div className=\"gap-ws-5 flex flex-col items-start\">\n        <p role=\"status\" className=\"typography-body-sm text-ws-static-subtle text-pretty\">\n          {compacted\n            ? 'Compacted. The earlier turns are now a summary.'\n            : 'Compacting replaces the earlier turns with a summary. Files and instructions stay.'}\n        </p>\n        <Button\n          variant=\"secondary\"\n          preset=\"border\"\n          size=\"sm\"\n          disabled={compacted}\n          onClick={onCompact}\n        >\n          Compact conversation\n        </Button>\n      </div>\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-context/copy-button.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/data.ts",
      "content": "import {\n  type RemixiconComponentType,\n  RiBugLine,\n  RiChat3Line,\n  RiGitRepositoryLine,\n} from '@remixicon/react';\n\nimport { codeGroups as sessions, withThread } from './canon';\nimport type { Turn } from './model';\n\n/*\n  This block opens on the canon's session \"CSV export for bookings\" in `lumen-app`, at rest: the\n  export is written, the unit tests pass and draft pull request #482 is open. The block is about\n  what surrounds that session: how full its context is, the connectors it can reach, what it\n  produced. Everything else (the account, the models, the chats and the other sessions) is the\n  canon's; the other threads are listed, not opened. Every figure agrees with the Code canon:\n  five files, +148 −7, 14 tests in 3.2s, #482.\n*/\n\n/* The session's environment, as the popover shows it. */\n\n/**\n * What fills the context window, in tokens. Compacting replaces the earlier messages and tool\n * results with a summary (`compacted` is what is left of them); files and instructions stay.\n */\nexport const context = {\n  window: 200_000,\n  parts: [\n    { label: 'Messages', tokens: 21_400, compacted: 4_200 },\n    { label: 'Tools', tokens: 18_600, compacted: 2_600 },\n    { label: 'Files', tokens: 12_200 },\n    { label: 'Instructions', tokens: 5_800 },\n  ],\n};\n\nexport type Connector = {\n  id: string;\n  /** Named for what it is, as the Checks pane says \"the git host\". */\n  name: string;\n  icon: RemixiconComponentType;\n  /** `expired`: its sign-in ran out, so the session cannot reach it until it is reconnected. */\n  state: 'connected' | 'expired';\n};\n\nexport const connectors: Connector[] = [\n  { id: 'git', name: 'Git host', icon: RiGitRepositoryLine, state: 'connected' },\n  { id: 'issues', name: 'Issue tracker', icon: RiBugLine, state: 'connected' },\n  { id: 'chat', name: 'Team chat', icon: RiChat3Line, state: 'expired' },\n];\n\n/** A file the session wrote or changed; nothing removed in a new file. */\nexport type ChangedFile = { path: string; added: number; removed: number };\n\nexport const changedFiles: ChangedFile[] = [\n  { path: 'src/features/bookings/export-csv.ts', added: 64, removed: 0 },\n  { path: 'src/features/bookings/export-csv.test.ts', added: 48, removed: 0 },\n  { path: 'src/features/bookings/bookings-table.tsx', added: 18, removed: 4 },\n  { path: 'src/features/bookings/bookings-toolbar.tsx', added: 12, removed: 1 },\n  { path: 'src/lib/format-date.ts', added: 6, removed: 2 },\n];\n\n/** The document the session wrote beside the code: the file's format, for whoever reads it. */\nexport const documents = [{ id: 'csv-format', title: 'Bookings CSV format' }];\n\nexport const pullRequests = [\n  { number: 482, title: 'Add CSV export to the bookings table', state: 'Draft' },\n];\n\n/* The open session: short, and at rest. */\n\nconst csvExport: Turn[] = [\n  { id: 'csv-1', role: 'user', text: 'Add a CSV export to the bookings table.' },\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 has the rows it shows, so the export can be built from them: one function that turns bookings into CSV, and a button in the toolbar. Start times should be UTC ISO strings, so the file reads the same in every time zone. The format is worth writing down for whoever opens the file.',\n      },\n      {\n        kind: 'steps',\n        id: 'csv-2-files',\n        label: 'Edited 5 files',\n        steps: [\n          {\n            id: 'write-export',\n            label: 'Wrote `export-csv.ts`',\n            active: 'Writing `export-csv.ts`',\n            result: '+64',\n            status: 'done',\n          },\n          {\n            id: 'write-test',\n            label: 'Wrote `export-csv.test.ts`',\n            active: 'Writing `export-csv.test.ts`',\n            result: '+48',\n            status: 'done',\n          },\n          {\n            id: 'edit-table',\n            label: 'Edited `bookings-table.tsx`',\n            active: 'Editing `bookings-table.tsx`',\n            result: '+18 −4',\n            status: 'done',\n          },\n          {\n            id: 'edit-toolbar',\n            label: 'Edited `bookings-toolbar.tsx`',\n            active: 'Editing `bookings-toolbar.tsx`',\n            result: '+12 −1',\n            status: 'done',\n          },\n          {\n            id: 'edit-format',\n            label: 'Edited `format-date.ts`',\n            active: 'Editing `format-date.ts`',\n            result: '+6 −2',\n            status: 'done',\n          },\n        ],\n      },\n      {\n        kind: 'step',\n        id: 'run-tests',\n        label: 'Ran `pnpm test bookings`',\n        active: 'Running `pnpm test bookings`',\n        result: '14 passed · 3.2s',\n        status: 'done',\n        ms: 2400,\n        detail: {\n          kind: 'output',\n          lines: [\n            '$ pnpm test bookings',\n            ' ✓ bookings-table.test.tsx (6)',\n            ' ✓ bookings-toolbar.test.tsx (3)',\n            ' ✓ export-csv.test.ts (5)',\n            ' 14 passed (3.2s)',\n          ],\n        },\n      },\n      {\n        kind: 'step',\n        id: 'write-document',\n        label: 'Wrote the document **Bookings CSV format**',\n        active: 'Writing the document **Bookings CSV format**',\n        status: 'done',\n      },\n      {\n        kind: 'step',\n        id: 'open-pull-request',\n        label: 'Opened pull request #482',\n        active: 'Opening a pull request',\n        result: 'Draft',\n        status: 'done',\n      },\n      {\n        kind: 'text',\n        id: 'csv-2-answer',\n        prose: [\n          {\n            kind: 'paragraph',\n            text: 'The export is on `feature/bookings-csv-export` as draft pull request #482: five files, +148 −7. The unit tests pass, 14 of 14, and the columns and the UTC dates are written down in **Bookings CSV format**.',\n          },\n          {\n            kind: 'paragraph',\n            text: 'Two things are open: the E2E test “bookings export › downloads the file” times out, and Tom Becker left two comments.',\n          },\n        ],\n      },\n    ],\n  },\n];\n\n/** The session that opens with the block. */\nexport const OPEN_SESSION = 'csv-export';\n\n/** The canon's sessions, with this block's session in its place: the short transcript at rest. */\nexport const codeGroups = withThread(sessions, OPEN_SESSION, (thread) => ({\n  ...thread,\n  turns: csvExport,\n}));\n"
    },
    {
      "path": "src/blocks/agent-context/fold.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/format.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/icon-action.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/index.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/index.tsx",
      "content": "'use client';\n\nimport '@/styles/wideset-blocks.css';\n\nimport { RiRestartLine } from '@remixicon/react';\nimport { AppShell } from '@/components/ui/wideset/app-shell/AppShell';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { useId, useState } from 'react';\n\nimport {\n  account,\n  chatGroups,\n  efforts,\n  fallback,\n  models,\n  permissions,\n  product,\n  workspace,\n} from './canon';\nimport { CodeTools } from './code-tools';\nimport { ContextPopover } from './context-popover';\nimport { codeGroups, OPEN_SESSION } from './data';\nimport type { Mode, TranscriptView } from './model';\nimport { ModelMenu } from './model-menu';\nimport { Session } from './session';\nimport { AgentSidebar } from './sidebar';\nimport { ThreadMenu } from './thread-menu';\nimport { TopBar } from './top-bar';\nimport { useSession } from './use-session';\n\nconst GROUPS = { chat: chatGroups, code: codeGroups };\nconst repository = codeGroups.find((group) =>\n  group.threads.some((thread) => thread.id === OPEN_SESSION),\n)!;\nconst opened = repository.threads.find((thread) => thread.id === OPEN_SESSION)!;\n\n/**\n * Agent context (a panel over the Inset agent shell): the session's environment, open on load as\n * a popover from the context meter in the composer. Behind it is a quiet Code session in\n * Tandem's shell: the sessions by repository on the grey frame, one raised card with the top bar,\n * a short transcript at rest and the composer, whose tools end with the meter (29% used). The\n * popover says how full the context is and what fills it, offers to compact the conversation,\n * lists the connectors with Reconnect beside the one whose sign-in ran out, then what the session\n * produced and the pull request it opened.\n *\n * The session works as in every agent block (send, Replay, the transcript views). The other\n * sessions are listed, not opened, and the Chat | Code switch changes the sidebar's list only:\n * this block is the one session and its popover.\n */\nexport default function AgentContext() {\n  const sidebarId = useId();\n  const [collapsed, setCollapsed] = useState(false);\n  const [mode, setMode] = useState<Mode>('code');\n  const [turns, setTurns] = useState(opened.turns);\n  const [view, setView] = useState<TranscriptView>('normal');\n\n  const session = useSession({ turns, onChange: setTurns, reply: fallback });\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        mode={mode}\n        onModeChange={setMode}\n        groups={GROUPS[mode]}\n        openId={OPEN_SESSION}\n        workingId={session.running ? OPEN_SESSION : undefined}\n        onOpen={() => {}}\n        onNew={() => {}}\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={[repository.label, opened.title]}\n          >\n            <Button variant=\"secondary\" preset=\"ghost\" size=\"sm\" onClick={() => session.replay()}>\n              <Button.Icon icon={RiRestartLine} />\n              Replay\n            </Button>\n            <Button variant=\"secondary\" preset=\"border\" size=\"sm\">\n              Share\n            </Button>\n            <ThreadMenu view={view} onViewChange={setView} />\n          </TopBar>\n\n          <Session\n            session={session}\n            threadId={OPEN_SESSION}\n            agent={product}\n            view={view}\n            // The tools end with the context meter, which here opens the session's environment.\n            tools={<CodeTools permissions={permissions} meter={<ContextPopover />} />}\n            model={<ModelMenu models={models} efforts={efforts} />}\n          />\n        </div>\n      </AppShell.Main>\n    </AppShell>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-context/inline.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/keyboard-key.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/menu-choice.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/menu-sub.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/message-queue.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/model-menu.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/model.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/motion.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/people.assets.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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/EADk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4cBoVyJDqbXAeexxSnPvNU3r3S6NS2hxmT3nXDvFR9o86tTU8pK1tQ0EHdO+sD6D9/lUZmR/SVoZ6YJPyodj9c4TthiP8Apr3/AIWigjswvdv8IABZAxdJoU0r0WM8W1LKcpODU20dGLmqYCLZ3oq1b2E54EDr4YOKnGv9nV4scS5xosbtoM94LS6gZW2c5/v31MNjezB3TzMm6TlBTz7Q7MeG8QT/AH76K1eLxvpTJmuSLAduZ6KkNIY5AANOd/pW0lJjwY5J7yS2SfHKhWrqyLjsJIHD+mfuP3rduZ7JqO37TjY+WDWxfWu2tkhPUJCx8ONDOEa40WLQybFwafZ2n3fsqY1B49G9voT+mq//2Q==',\n};\n"
    },
    {
      "path": "src/blocks/agent-context/person-avatar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/produced-list.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/produced-list.tsx",
      "content": "'use client';\n\n// TODO(custom): what a session produced as rows that open it (a changed file with its diff stat, a document); FileItem is an upload row with a thumbnail and a remove action.\nimport { RiFileCodeLine, RiFileTextLine } from '@remixicon/react';\n\nimport { ChangeCounts } from './changes-counts';\nimport type { ChangedFile } from './data';\n\nconst ROW =\n  'gap-ws-5 -mx-ws-3 px-ws-3 min-h-ws-13 rounded-ws-control-md hover:bg-ws-static-alpha-subtle focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default flex items-center focus-visible:-outline-offset-2';\n\ntype ProducedListProps = {\n  files: ChangedFile[];\n  documents: { id: string; title: string }[];\n};\n\n/**\n * What the session made, each row one link across its width: the files it wrote or changed, by\n * name in monospace with the lines added and removed (the folder is in the link's title), then\n * the documents it wrote, named as they are titled. A file opens in Changes, a document in its\n * own pane.\n */\nexport function ProducedList({ files, documents }: ProducedListProps) {\n  return (\n    <ul className=\"flex flex-col\">\n      {files.map(({ path, added, removed }) => (\n        <li key={path}>\n          <a href={`#changes/${path}`} title={path} className={ROW}>\n            <RiFileCodeLine\n              aria-hidden=\"true\"\n              className=\"size-ws-9 text-ws-static-subtle shrink-0\"\n            />\n            <span className=\"font-ws-mono typography-body-sm tracking-ws-normal text-ws-static-strong min-w-0 flex-1 truncate\">\n              {path.split('/').at(-1)}\n            </span>\n            <ChangeCounts added={added} removed={removed} />\n          </a>\n        </li>\n      ))}\n      {documents.map(({ id, title }) => (\n        <li key={id}>\n          <a href={`#document/${id}`} className={ROW}>\n            <RiFileTextLine\n              aria-hidden=\"true\"\n              className=\"size-ws-9 text-ws-static-subtle shrink-0\"\n            />\n            <span className=\"typography-label-sm text-ws-static-strong min-w-0 flex-1 truncate\">\n              {title}\n            </span>\n            <span className=\"typography-label-sm text-ws-static-subtle shrink-0\">Document</span>\n          </a>\n        </li>\n      ))}\n    </ul>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-context/prose.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/pull-request-list.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/pull-request-list.tsx",
      "content": "'use client';\n\n// TODO(custom): a pull request as a row that opens it (number, title, state); Wideset has no row for a record with its state.\nimport { RiGitPullRequestLine } from '@remixicon/react';\nimport { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';\nimport { type StatusBadgeProps } from '@/components/ui/wideset/status-badge/StatusBadge.types';\n\n/** A state in the colour of its meaning: a draft signals nothing yet, merged is done. */\nconst STATE: Record<string, StatusBadgeProps['color']> = {\n  Draft: 'neutral',\n  Open: 'info',\n  Merged: 'positive',\n  Closed: 'neutral',\n};\n\ntype PullRequestListProps = {\n  pullRequests: { number: number; title: string; state: string }[];\n};\n\n/**\n * The pull requests the session opened, each row one link to its checks: the number, the title\n * cut to one line, and the state as a badge at the end.\n */\nexport function PullRequestList({ pullRequests }: PullRequestListProps) {\n  return (\n    <ul className=\"flex flex-col\">\n      {pullRequests.map(({ number, title, state }) => (\n        <li key={number}>\n          <a\n            href={`#checks/${number}`}\n            className=\"gap-ws-5 -mx-ws-3 px-ws-3 min-h-ws-13 rounded-ws-control-md hover:bg-ws-static-alpha-subtle focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default typography-label-sm flex items-center focus-visible:-outline-offset-2\"\n          >\n            <RiGitPullRequestLine\n              aria-hidden=\"true\"\n              className=\"size-ws-9 text-ws-static-subtle shrink-0\"\n            />\n            <span className=\"text-ws-static-subtle tabular-nums\">#{number}</span>\n            <span className=\"text-ws-static-strong min-w-0 flex-1 truncate\">{title}</span>\n            <StatusBadge size=\"sm\" color={STATE[state]}>\n              {state}\n            </StatusBadge>\n          </a>\n        </li>\n      ))}\n    </ul>\n  );\n}\n"
    },
    {
      "path": "src/blocks/agent-context/question-card.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/reasoning.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/row.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/run.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/session.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/shimmer.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/sidebar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/step-detail.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/step-group.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/step-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/step-row.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/thread-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/thread-menu.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/tools-menu.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/top-bar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/transcript-break.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/transcript.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/use-run.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/use-session.ts",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/user-message.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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-context/working-line.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/agent-context/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"
  }
}
