{
  "antiPatterns": [
    "Using array positions as message IDs during insertions.",
    "Passing untrusted HTML to a renderer without sanitizing it."
  ],
  "api": {
    "importPath": "@ancrel/workspace/transcript",
    "props": [
      {
        "name": "className",
        "required": false,
        "type": "string"
      },
      {
        "name": "key",
        "required": false,
        "type": "React.Key | null | undefined"
      },
      {
        "name": "label",
        "required": false,
        "type": "string"
      },
      {
        "name": "messages",
        "required": true,
        "type": "readonly TranscriptMessage[]"
      },
      {
        "name": "ref",
        "required": false,
        "type": "React.Ref<HTMLDivElement> | undefined"
      },
      {
        "name": "renderMessage",
        "required": false,
        "type": "((message: TranscriptMessage) => React.ReactNode) | undefined"
      }
    ],
    "symbol": "Transcript",
    "typeRef": "api/workspace/transcript/index.d.ts"
  },
  "constraints": [
    "Use unique, stable message IDs and pass updated arrays when content changes.",
    "Give the pane a bounded height to follow incoming text while preserving a reader’s scroll position."
  ],
  "docs": "raw/frontend/transcript.md",
  "examples": [
    {
      "code": "'use client'\n\nimport { useState } from 'react'\nimport { Button, EmptyState, LoadingState } from '@ancrel/ui'\nimport { SimpleMarkdown } from '@ancrel/workspace/markdown'\nimport { Transcript, type TranscriptMessage } from '@ancrel/workspace/transcript'\nimport '@ancrel/tokens/css'\nimport '@ancrel/ui/styles.css'\nimport '@ancrel/workspace/styles.css'\n\nexport default function App() {\n  const [phase, setPhase] = useState<'empty' | 'streaming' | 'done'>('empty')\n  const messages: TranscriptMessage[] = [\n    { id: 'q', role: 'Reader', content: 'What changed?' },\n    { id: 'trace', role: 'trace', content: 'Compared two revisions.' },\n    { id: 'reply', role: 'Editor', content: phase === 'done' ? '**Added** an index.' : 'Comparing…' },\n  ]\n  return <>\n    <Button disabled={phase === 'done'} onClick={() => setPhase(phase === 'empty' ? 'streaming' : 'done')}>\n      {phase === 'empty' ? 'Start review' : 'Finish review'}\n    </Button>\n    {phase === 'empty' ? <EmptyState title=\"Start a review to see the conversation\" /> :\n      <Transcript label=\"Review conversation\" messages={messages} renderMessage={message =>\n        typeof message.content === 'string'\n          ? <SimpleMarkdown source={message.content} streaming={phase === 'streaming' && message.id === 'reply'} />\n          : message.content} />}\n    {phase === 'streaming' && <LoadingState label=\"Receiving reply\" inline />}\n  </>\n}\n",
      "command": "pnpm test",
      "entry": "examples/fe.transcript/App.tsx",
      "fixture": "examples/fe.transcript/",
      "id": "minimal"
    }
  ],
  "id": "fe.transcript",
  "kind": "react-component",
  "language": "typescript",
  "layer": "frontend",
  "owner": "frontend-infra",
  "package": {
    "ecosystem": "npm",
    "name": "@ancrel/workspace",
    "version": "0.2.0"
  },
  "provenance": {
    "changes": "Adapted the transcript and scroll-following shell from lines 120–275. Replaced application state and controls with message view models and a body renderer, and limited automatic scrolling to readers at the bottom of the pane.",
    "commit": "4cc384c3bdbd09a3a50268adf81ba23f53aac93e",
    "mode": "extracted",
    "origin": "rule-studio",
    "path": "frontend/src/components/ChatWorkspace.tsx",
    "rights": "org-internal; approved-by=owner; ref=item-19"
  },
  "schemaVersion": 1,
  "stability": "experimental",
  "summary": "Role-labelled message history with collapsible traces, rich body rendering and scroll following.",
  "tokenDependencies": [
    "ref.color.x16161a",
    "ref.color.x202025",
    "ref.color.x292930",
    "ref.color.x393941",
    "ref.color.x684a84",
    "ref.color.xc0c0c9",
    "ref.color.xcdb2ea",
    "ref.color.xe6e6ea",
    "ref.color.xededef",
    "ref.color.xffffff",
    "ref.family.mono",
    "ref.fontFeature.tnum",
    "ref.space.px12",
    "ref.space.px2",
    "ref.space.px4",
    "ref.space.px6",
    "ref.space.px8",
    "sys.action.focus",
    "sys.border.subtle",
    "sys.ink.primary",
    "sys.ink.secondary",
    "sys.space.hair",
    "sys.space.inset",
    "sys.space.snug",
    "sys.space.tight",
    "sys.surface.panel",
    "sys.type.family.mono",
    "sys.type.numeric"
  ]
}
