{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "agent-ops-02",
  "title": "Evals before shipping",
  "description": "A candidate prompt against the one in production: Run evals fills the grid cell by cell while the pass rate rolls, a regression opens both replies side by side with the failing part marked, and Ship waits until each one is decided.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/agent-run.json",
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/brand-logos.json",
    "https://ui.ndekocode.dev/r/brand-tile.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/morph-button.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/motion-presets.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/segments.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-02/index.tsx",
      "content": "'use client';\n\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport {\n  pressedSolidOf,\n  spokenUnless,\n} from '@/registry/ndeko/lib/demonstration';\nimport { PlayIcon, RocketIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { BrandTile } from '@/registry/ndeko/ui/brand-tile';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { MorphButton, type MorphState } from '@/registry/ndeko/ui/morph-button';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\nimport { Segments, type Segment } from '@/registry/ndeko/ui/segments';\n\nimport { CaseDetail } from './case-detail';\nimport { CaseGrid } from './case-grid';\nimport { CELL_WORD, StatusCell } from './cells';\nimport { caseOf, CASES, PROMPT, TARGETS, type EvalCase } from './data';\nimport {\n  blockedCountOf,\n  candidateStatusOf,\n  canShip,\n  INITIAL,\n  isRegression,\n  LOOP_AFTER_MS,\n  matchesFilter,\n  reducer,\n  RESTING,\n  SCRIPT,\n  undecidedCountOf,\n  type CellStatus,\n  type EvalState,\n  type Filter,\n  type RunPhase,\n} from './session';\nimport { Versions } from './versions';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\nconst FILTERS: Segment<Filter>[] = [\n  { value: 'all', label: 'All' },\n  { value: 'failing', label: 'Failing' },\n  { value: 'regressions', label: 'Regressions' },\n];\n\nconst RUN_STATE: Record<RunPhase, MorphState> = {\n  idle: 'idle',\n  running: 'busy',\n  done: 'done',\n};\n\nconst RUN_LABELS: Record<MorphState, string> = {\n  idle: 'Run evals',\n  busy: 'Running',\n  done: `Ran ${CASES.length} cases`,\n};\n\nconst SHIP_LABELS: Record<MorphState, string> = {\n  idle: `Ship ${TARGETS.candidate.version}`,\n  busy: 'Shipping',\n  done: 'Shipped',\n};\n\nconst LEGEND: { status: CellStatus; meaning: string }[] = [\n  { status: 'pass', meaning: 'The grader accepted the reply' },\n  { status: 'fail', meaning: 'The reply misses what was expected' },\n  { status: 'flaky', meaning: 'It passes on some runs only' },\n  { status: 'running', meaning: 'The case is with the model now' },\n  { status: 'queued', meaning: 'It waits for a free slot' },\n];\n\nfunction regressionsWordOf(count: number) {\n  if (count === 1) {\n    return '1 regression';\n  }\n  return `${count} regressions`;\n}\n\nfunction casesWordOf(count: number) {\n  if (count === 1) {\n    return '1 case';\n  }\n  return `${count} cases`;\n}\n\nfunction shipHintOf(state: EvalState) {\n  const version = TARGETS.candidate.version;\n  if (state.ship === 'done') {\n    return `${version} answers every new conversation`;\n  }\n  if (state.ship === 'busy') {\n    return `Moving conversations to ${version}`;\n  }\n  if (state.phase === 'idle') {\n    return `Run the evals before ${version} ships`;\n  }\n  if (state.phase === 'running') {\n    return 'Shipping waits for the run to end';\n  }\n  const undecided = undecidedCountOf(state);\n  if (undecided > 0) {\n    return `${regressionsWordOf(undecided)} to decide`;\n  }\n  const blocked = blockedCountOf(state);\n  if (blocked > 0) {\n    return `${regressionsWordOf(blocked)} blocked: fix the prompt and run again`;\n  }\n  return 'Every regression is decided';\n}\n\nfunction runVariantOf(phase: RunPhase) {\n  if (phase === 'idle') {\n    return 'default';\n  }\n  return 'outline';\n}\n\nfunction shipVariantOf(isReady: boolean) {\n  if (isReady) {\n    return 'default';\n  }\n  return 'outline';\n}\n\nfunction Legend() {\n  return (\n    <div className='flex flex-col gap-3'>\n      <div className='flex flex-col gap-1'>\n        <h2 className='text-sm font-medium'>\n          Pick a case to read both replies\n        </h2>\n        <p className='text-muted-foreground text-[13px]'>\n          A regression opens with the part that fails marked, and waits for your\n          decision.\n        </p>\n      </div>\n      <ul className='flex flex-col'>\n        {LEGEND.map((entry) => (\n          <li\n            key={entry.status}\n            className='flex min-h-9 items-center gap-2.5 text-[13px]'\n          >\n            <StatusCell status={entry.status} size='sm' />\n            <span className='w-16 shrink-0 font-medium'>\n              {CELL_WORD[entry.status]}\n            </span>\n            <span className='text-muted-foreground min-w-0'>\n              {entry.meaning}\n            </span>\n          </li>\n        ))}\n      </ul>\n    </div>\n  );\n}\n\nexport default function AgentOps02() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n  } = useSession(SESSION);\n  const cases = CASES.filter((entry) => matchesFilter(state, entry));\n  const isReady = canShip(state);\n  const shipHint = shipHintOf(state);\n  const message = spokenUnless(isAutoplaying, shipHint);\n  const canReplay = isFinished && !isAutoplaying;\n  const isLocked = state.ship !== 'idle';\n  const shownWord = `${cases.length} of ${casesWordOf(CASES.length)}`;\n  let openCase: EvalCase | null = null;\n  if (state.openId !== null) {\n    openCase = caseOf(state.openId);\n  }\n\n  function renderDetail(entry: EvalCase) {\n    return (\n      <CaseDetail\n        entry={entry}\n        candidateStatus={candidateStatusOf(state, entry.id)}\n        isRegression={isRegression(state, entry.id)}\n        verdict={state.verdicts[entry.id]}\n        isLocked={isLocked}\n        pressed={pressed}\n        onVerdict={(verdict) => act({ type: 'verdict', id: entry.id, verdict })}\n      />\n    );\n  }\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-background text-foreground @container min-h-dvh w-full'\n      >\n        <div className='mx-auto flex max-w-6xl flex-col gap-4 p-4 @3xl:gap-5 @3xl:p-8'>\n          <header className='flex flex-wrap items-center gap-x-3 gap-y-2'>\n            <BrandTile brand={PROMPT.brand} size='lg' title={PROMPT.model} />\n            <div className='flex min-w-40 flex-1 flex-col leading-tight'>\n              <h1 className='text-lg font-semibold text-balance'>\n                {PROMPT.name}\n              </h1>\n              <p className='text-muted-foreground text-xs'>\n                {PROMPT.team} · {PROMPT.model}\n              </p>\n            </div>\n            <ReplayButton\n              isShown={canReplay}\n              onReplay={restart}\n              label='Replay the run'\n            />\n            <MorphButton\n              type='button'\n              state={RUN_STATE[state.phase]}\n              labels={RUN_LABELS}\n              idleIcon={<PlayIcon />}\n              variant={runVariantOf(state.phase)}\n              onClick={() => act({ type: 'run' })}\n              className={pressedSolidOf(pressed === 'run')}\n            />\n          </header>\n\n          <Versions state={state} />\n\n          <div className='flex flex-col gap-4 @4xl:flex-row @4xl:items-start @4xl:gap-5'>\n            <div className='flex min-w-0 flex-1 flex-col gap-3'>\n              <div className='flex flex-wrap items-center justify-between gap-2'>\n                <Segments\n                  value={state.filter}\n                  segments={FILTERS}\n                  onValueChange={(filter) => act({ type: 'filter', filter })}\n                  label='Show cases'\n                  className='w-full @sm:w-72'\n                />\n                <span className='text-muted-foreground text-xs tabular-nums'>\n                  {shownWord}\n                </span>\n              </div>\n              <CaseGrid\n                state={state}\n                cases={cases}\n                pressed={pressed}\n                onOpen={(id) => act({ type: 'opened', id })}\n                onShowAll={() => act({ type: 'filter', filter: 'all' })}\n                renderDetail={renderDetail}\n              />\n              <div className='flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-1'>\n                <p className='text-muted-foreground min-w-0 text-[13px]'>\n                  <Swap swapKey={shipHint}>{shipHint}</Swap>\n                </p>\n                <MorphButton\n                  type='button'\n                  size='lg'\n                  state={state.ship}\n                  labels={SHIP_LABELS}\n                  idleIcon={<RocketIcon />}\n                  variant={shipVariantOf(isReady)}\n                  disabled={!isReady}\n                  onClick={() => act({ type: 'ship' })}\n                  className={pressedSolidOf(pressed === 'ship')}\n                />\n              </div>\n            </div>\n\n            <aside\n              aria-label='Case'\n              className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] hidden w-[28rem] shrink-0 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)] @4xl:block'\n            >\n              <AnimatedSize>\n                {!openCase && <Legend />}\n                {openCase && (\n                  <div\n                    key={openCase.id}\n                    className='flex flex-col gap-3 transition-opacity duration-300 starting:opacity-0'\n                  >\n                    <div className='flex items-start justify-between gap-2'>\n                      <h2 className='text-sm leading-7 font-medium'>\n                        {openCase.name}\n                      </h2>\n                      <Button\n                        type='button'\n                        variant='ghost'\n                        size='icon-sm'\n                        aria-label='Close the case'\n                        onClick={() => act({ type: 'closed' })}\n                        className='text-muted-foreground'\n                      >\n                        <XIcon />\n                      </Button>\n                    </div>\n                    {renderDetail(openCase)}\n                  </div>\n                )}\n              </AnimatedSize>\n            </aside>\n          </div>\n        </div>\n        <LiveRegion message={message} />\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-02/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-02/versions.tsx",
      "content": "'use client';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { TrendingDownIcon, TrendingUpIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\n\nimport { CASES, TARGETS, type Target } from './data';\nimport {\n  candidateRateOf,\n  PRODUCTION_RATE,\n  type EvalState,\n  type PassRate,\n} from './session';\n\ntype Change = {\n  text: string;\n  tone: string;\n  trend: 'up' | 'down' | 'level';\n};\n\nfunction pointsOf(count: number) {\n  if (count === 1) {\n    return '1 point';\n  }\n  return `${count} points`;\n}\n\nfunction changeOf(candidate: PassRate): Change {\n  const difference = candidate.percent - PRODUCTION_RATE.percent;\n  const points = pointsOf(Math.abs(difference));\n  if (difference < 0) {\n    return {\n      text: `${points} under production`,\n      tone: 'text-warning-foreground',\n      trend: 'down',\n    };\n  }\n  if (difference > 0) {\n    return {\n      text: `${points} above production`,\n      tone: 'text-success-foreground',\n      trend: 'up',\n    };\n  }\n  return {\n    text: 'Level with production',\n    tone: 'text-muted-foreground',\n    trend: 'level',\n  };\n}\n\nfunction candidateNoteOf(state: EvalState, rate: PassRate): Change {\n  if (state.phase === 'idle') {\n    return {\n      text: 'Not compared with production yet',\n      tone: 'text-muted-foreground',\n      trend: 'level',\n    };\n  }\n  if (state.phase === 'running') {\n    return {\n      text: `${state.landed} of ${CASES.length} cases run`,\n      tone: 'text-muted-foreground',\n      trend: 'level',\n    };\n  }\n  return changeOf(rate);\n}\n\n/** While the run counts its cases the note stays in place; it swaps when its sentence changes. */\nfunction noteKeyOf(state: EvalState, note: Change) {\n  if (state.phase === 'running') {\n    return 'running';\n  }\n  return note.text;\n}\n\nfunction productionNoteOf(isReplaced: boolean) {\n  if (isReplaced) {\n    return 'Kept for a rollback';\n  }\n  return 'Answers every conversation today';\n}\n\nfunction badgeWordOf(isLive: boolean, restingWord: string) {\n  if (isLive) {\n    return 'Live';\n  }\n  return restingWord;\n}\n\nfunction badgeVariantOf(isLive: boolean) {\n  if (isLive) {\n    return 'success';\n  }\n  return 'secondary';\n}\n\nfunction fillOf(percent: number) {\n  const share = percent / 100;\n  return { transform: `scaleX(${share})` };\n}\n\ntype VersionCardProps = {\n  target: Target;\n  rate: PassRate | null;\n  badgeWord: string;\n  isLive: boolean;\n  note: React.ReactNode;\n};\n\nfunction VersionCard({\n  target,\n  rate,\n  badgeWord,\n  isLive,\n  note,\n}: VersionCardProps) {\n  const percent = rate?.percent ?? 0;\n\n  return (\n    <div className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex min-w-0 flex-col gap-2 rounded-xl p-4 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'>\n      <p className='flex flex-wrap items-center gap-x-2 gap-y-1'>\n        <span className='text-[13px] font-medium'>{target.label}</span>\n        <code className='text-muted-foreground font-mono text-xs'>\n          {target.version}\n        </code>\n        <Badge\n          variant={badgeVariantOf(isLive)}\n          className='ms-auto transition-colors duration-300'\n        >\n          <Swap swapKey={badgeWord}>{badgeWord}</Swap>\n        </Badge>\n      </p>\n      <div className='flex min-h-9 flex-wrap items-baseline gap-x-2'>\n        {rate && (\n          <>\n            <MotionNumber\n              value={rate.percent}\n              suffix='%'\n              className='text-[28px] leading-9 font-semibold'\n            />\n            <span className='text-muted-foreground text-xs tabular-nums'>\n              {rate.passed} of {rate.total} passed\n            </span>\n          </>\n        )}\n        {!rate && (\n          <span className='text-muted-foreground text-xl leading-9 font-medium'>\n            Not run yet\n          </span>\n        )}\n      </div>\n      <div\n        role='progressbar'\n        aria-label={`${target.label} pass rate`}\n        aria-valuemin={0}\n        aria-valuemax={100}\n        aria-valuenow={percent}\n        className='bg-foreground/[0.06] h-1.5 overflow-hidden rounded-full'\n      >\n        <div\n          style={fillOf(percent)}\n          className='bg-success h-full origin-left rounded-full transition-transform duration-500 ease-(--ease-out-strong)'\n        />\n      </div>\n      <div className='flex min-h-5 items-center text-xs'>{note}</div>\n    </div>\n  );\n}\n\nfunction TrendGlyph({ trend }: { trend: Change['trend'] }) {\n  if (trend === 'up') {\n    return <TrendingUpIcon className='size-3.5 shrink-0' />;\n  }\n  if (trend === 'down') {\n    return <TrendingDownIcon className='size-3.5 shrink-0' />;\n  }\n  return null;\n}\n\ntype VersionsProps = {\n  state: EvalState;\n};\n\nexport function Versions({ state }: VersionsProps) {\n  const isShipped = state.ship === 'done';\n  const hasFigure = state.landed > 0;\n  const landedRate = candidateRateOf(state);\n  let candidateRate: PassRate | null = null;\n  if (hasFigure) {\n    candidateRate = landedRate;\n  }\n  const candidateNote = candidateNoteOf(state, landedRate);\n  const productionNote = productionNoteOf(isShipped);\n\n  return (\n    <div className='grid grid-cols-1 gap-3 @md:grid-cols-2'>\n      <VersionCard\n        target={TARGETS.production}\n        rate={PRODUCTION_RATE}\n        badgeWord={badgeWordOf(!isShipped, 'Previous')}\n        isLive={!isShipped}\n        note={\n          <span className='text-muted-foreground'>\n            <Swap swapKey={productionNote}>{productionNote}</Swap>\n          </span>\n        }\n      />\n      <VersionCard\n        target={TARGETS.candidate}\n        rate={candidateRate}\n        badgeWord={badgeWordOf(isShipped, 'Candidate')}\n        isLive={isShipped}\n        note={\n          <span\n            className={cn(\n              'tabular-nums transition-colors duration-200',\n              candidateNote.tone\n            )}\n          >\n            <Swap swapKey={noteKeyOf(state, candidateNote)}>\n              <span className='flex items-center gap-1.5'>\n                <TrendGlyph trend={candidateNote.trend} />\n                {candidateNote.text}\n              </span>\n            </Swap>\n          </span>\n        }\n      />\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-02/versions.tsx"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-02/case-grid.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { rowPresenceOf } from '@/registry/ndeko/lib/motion-presets';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\n\nimport { CELL_WORD, StatusCell } from './cells';\nimport { TARGETS, type EvalCase } from './data';\nimport {\n  candidateStatusOf,\n  isRegression,\n  type CellStatus,\n  type EvalState,\n  type Filter,\n  type Verdict,\n} from './session';\n\nconst GRID =\n  'grid grid-cols-[minmax(0,1fr)_2.75rem_2.75rem] items-center gap-2';\n\ntype RowMark = {\n  word: string;\n  variant: 'warning' | 'secondary' | 'destructive' | 'success';\n};\n\nconst VERDICT_MARK: Record<Verdict, RowMark> = {\n  accepted: { word: 'Accepted', variant: 'secondary' },\n  blocked: { word: 'Blocked', variant: 'destructive' },\n};\n\nconst REGRESSION_MARK: RowMark = { word: 'Regression', variant: 'warning' };\n\nconst FIXED_MARK: RowMark = { word: 'Fixed', variant: 'success' };\n\nconst EMPTY_LINE: Record<Filter, string> = {\n  all: 'No case in this suite',\n  failing: 'No case is failing',\n  regressions:\n    'No regression so far. They show here once the candidate has run',\n};\n\nfunction isFixedBy(entry: EvalCase, candidate: CellStatus) {\n  const failedBefore = entry.production.outcome === 'fail';\n  const passesNow = candidate === 'pass';\n  return failedBefore && passesNow;\n}\n\nfunction rowMarkOf(state: EvalState, entry: EvalCase, candidate: CellStatus) {\n  if (isRegression(state, entry.id)) {\n    const verdict = state.verdicts[entry.id];\n    if (verdict) {\n      return VERDICT_MARK[verdict];\n    }\n    return REGRESSION_MARK;\n  }\n  if (isFixedBy(entry, candidate)) {\n    return FIXED_MARK;\n  }\n  return null;\n}\n\nfunction rowLabelOf(\n  entry: EvalCase,\n  candidate: CellStatus,\n  mark: RowMark | null\n) {\n  const production = CELL_WORD[entry.production.outcome].toLowerCase();\n  const candidateWord = CELL_WORD[candidate].toLowerCase();\n  const summary = `${entry.name}: production ${production}, candidate ${candidateWord}`;\n  if (mark) {\n    return `${summary}, ${mark.word.toLowerCase()}`;\n  }\n  return summary;\n}\n\nfunction rowToneOf(isOpen: boolean) {\n  if (isOpen) {\n    return 'bg-foreground/[0.05]';\n  }\n  return 'hover:bg-foreground/[0.03]';\n}\n\nfunction pressedQuietOf(isPressed: boolean) {\n  if (isPressed) {\n    return 'scale-[0.985] bg-foreground/[0.07]';\n  }\n  return undefined;\n}\n\n/** The arrow keys walk the rows; Tab still reaches the buttons inside an open case. */\nfunction moveBetweenRows(event: React.KeyboardEvent<HTMLUListElement>) {\n  const isDown = event.key === 'ArrowDown';\n  const isUp = event.key === 'ArrowUp';\n  if (!isDown && !isUp) {\n    return;\n  }\n  const found =\n    event.currentTarget.querySelectorAll<HTMLElement>('[data-case]');\n  const rows = Array.from(found);\n  const current = rows.findIndex((row) => row === document.activeElement);\n  if (current === -1) {\n    return;\n  }\n  let next = current - 1;\n  if (isDown) {\n    next = current + 1;\n  }\n  const target = rows[next];\n  if (target) {\n    event.preventDefault();\n    target.focus();\n  }\n}\n\ntype CaseRowProps = {\n  entry: EvalCase;\n  state: EvalState;\n  isPressed: boolean;\n  onOpen: (id: string) => void;\n  renderDetail: (entry: EvalCase) => React.ReactNode;\n};\n\nfunction CaseRow({\n  entry,\n  state,\n  isPressed,\n  onOpen,\n  renderDetail,\n}: CaseRowProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowPresence = rowPresenceOf(shouldReduceMotion);\n  const candidate = candidateStatusOf(state, entry.id);\n  const mark = rowMarkOf(state, entry, candidate);\n  const isOpen = state.openId === entry.id;\n\n  return (\n    <>\n      <button\n        type='button'\n        data-case={entry.id}\n        aria-expanded={isOpen}\n        aria-label={rowLabelOf(entry, candidate, mark)}\n        onClick={() => onOpen(entry.id)}\n        className={cn(\n          GRID,\n          'focus-visible:ring-ring/25 min-h-9 w-full cursor-pointer rounded-lg px-2 py-1 text-start transition-[background-color,scale] duration-150 outline-none focus-visible:ring-[3px] focus-visible:ring-inset',\n          rowToneOf(isOpen),\n          pressedQuietOf(isPressed)\n        )}\n      >\n        <span className='flex min-w-0 items-center gap-2'>\n          <span className='truncate text-[13px]'>{entry.name}</span>\n          {mark && (\n            <Badge\n              variant={mark.variant}\n              className='transition-colors duration-300 starting:opacity-0'\n            >\n              <Swap swapKey={mark.word}>{mark.word}</Swap>\n            </Badge>\n          )}\n        </span>\n        <span className='flex justify-center'>\n          <StatusCell status={entry.production.outcome} />\n        </span>\n        <span className='flex justify-center'>\n          <StatusCell status={candidate} />\n        </span>\n      </button>\n      <AnimatePresence initial={false}>\n        {isOpen && (\n          <motion.div\n            key='detail'\n            className='overflow-hidden @4xl:hidden'\n            {...rowPresence}\n          >\n            <div className='px-2 pt-2 pb-3'>{renderDetail(entry)}</div>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </>\n  );\n}\n\ntype CaseGridProps = {\n  state: EvalState;\n  cases: EvalCase[];\n  pressed: string | null;\n  onOpen: (id: string) => void;\n  onShowAll: () => void;\n  renderDetail: (entry: EvalCase) => React.ReactNode;\n};\n\nexport function CaseGrid({\n  state,\n  cases,\n  pressed,\n  onOpen,\n  onShowAll,\n  renderDetail,\n}: CaseGridProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowPresence = rowPresenceOf(shouldReduceMotion);\n  const isEmpty = cases.length === 0;\n\n  return (\n    <section\n      aria-label='Cases'\n      className='bg-card hairline-ring ring-border dark:bg-foreground/[0.03] flex flex-col rounded-xl p-1 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <div\n        aria-hidden='true'\n        className={cn(GRID, 'text-muted-foreground h-8 px-2 text-xs')}\n      >\n        <span>Case</span>\n        <span className='text-center font-mono'>\n          {TARGETS.production.version}\n        </span>\n        <span className='text-center font-mono'>\n          {TARGETS.candidate.version}\n        </span>\n      </div>\n      <ul className='flex flex-col' onKeyDown={moveBetweenRows}>\n        <AnimatePresence initial={false}>\n          {cases.map((entry) => (\n            <motion.li\n              key={entry.id}\n              className='overflow-hidden'\n              {...rowPresence}\n            >\n              <CaseRow\n                entry={entry}\n                state={state}\n                isPressed={pressed === `case-${entry.id}`}\n                onOpen={onOpen}\n                renderDetail={renderDetail}\n              />\n            </motion.li>\n          ))}\n        </AnimatePresence>\n      </ul>\n      {isEmpty && (\n        <div className='flex flex-col items-start gap-3 px-2 pt-1 pb-3 transition-opacity duration-300 starting:opacity-0'>\n          <p className='text-muted-foreground text-[13px]'>\n            {EMPTY_LINE[state.filter]}\n          </p>\n          <Button type='button' variant='outline' size='sm' onClick={onShowAll}>\n            Show all cases\n          </Button>\n        </div>\n      )}\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-02/case-grid.tsx"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-02/case-detail.tsx",
      "content": "'use client';\n\nimport { formatCost, formatTokens } from '@/registry/ndeko/lib/agent-run';\nimport { pressedSolidOf } from '@/registry/ndeko/lib/demonstration';\nimport { CheckIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport { CELL_WORD, StatusCell } from './cells';\nimport { TARGETS, type EvalCase, type Output, type Target } from './data';\nimport type { CellStatus, Verdict } from './session';\n\nfunction hasResult(status: CellStatus) {\n  const isPass = status === 'pass';\n  const isFail = status === 'fail';\n  const isFlaky = status === 'flaky';\n  return isPass || isFail || isFlaky;\n}\n\ntype MarkedTextProps = {\n  text: string;\n  marked?: string;\n  isMarked: boolean;\n};\n\nfunction markedRangeOf(text: string, marked: string | undefined) {\n  if (marked === undefined) {\n    return null;\n  }\n  const start = text.indexOf(marked);\n  if (start === -1) {\n    return null;\n  }\n  return { start, end: start + marked.length };\n}\n\nfunction MarkedText({ text, marked, isMarked }: MarkedTextProps) {\n  const range = markedRangeOf(text, marked);\n  if (!isMarked || range === null) {\n    return <p className='text-[13px] leading-relaxed'>{text}</p>;\n  }\n  const before = text.slice(0, range.start);\n  const failing = text.slice(range.start, range.end);\n  const after = text.slice(range.end);\n\n  return (\n    <p className='text-[13px] leading-relaxed'>\n      {before}\n      <mark className='bg-destructive/10 text-destructive-ink rounded-sm px-0.5'>\n        {failing}\n      </mark>\n      {after}\n    </p>\n  );\n}\n\ntype OutputColumnProps = {\n  target: Target;\n  output: Output;\n  status: CellStatus;\n};\n\nfunction OutputColumn({ target, output, status }: OutputColumnProps) {\n  const isShown = hasResult(status);\n  const isPass = status === 'pass';\n  const hasNote = output.note !== undefined;\n  const showsNote = hasNote && !isPass;\n  const tokens = formatTokens(output.tokens);\n  const cost = formatCost(output.costUsd);\n\n  return (\n    <div className='bg-foreground/[0.03] dark:bg-foreground/[0.05] flex min-w-0 flex-col gap-2 rounded-lg p-3'>\n      <p className='flex items-center gap-2 text-xs'>\n        <StatusCell status={status} size='sm' />\n        <span className='font-medium'>{target.label}</span>\n        <code className='text-muted-foreground font-mono'>\n          {target.version}\n        </code>\n        <span className='text-muted-foreground ms-auto'>\n          {CELL_WORD[status]}\n        </span>\n      </p>\n      {isShown && (\n        <>\n          <MarkedText\n            text={output.text}\n            marked={output.marked}\n            isMarked={!isPass}\n          />\n          {showsNote && (\n            <p className='text-muted-foreground text-xs leading-5'>\n              {output.note}\n            </p>\n          )}\n          <p className='text-muted-foreground mt-auto text-xs tabular-nums'>\n            {tokens} tokens · {cost}\n          </p>\n        </>\n      )}\n      {!isShown && (\n        <p className='text-muted-foreground text-[13px]'>\n          The reply shows here once this case has run\n        </p>\n      )}\n    </div>\n  );\n}\n\ntype VerdictBarProps = {\n  verdict: Verdict | undefined;\n  isLocked: boolean;\n  isAcceptPressed: boolean;\n  onVerdict: (verdict: Verdict) => void;\n};\n\nfunction VerdictBar({\n  verdict,\n  isLocked,\n  isAcceptPressed,\n  onVerdict,\n}: VerdictBarProps) {\n  const isUndecided = verdict === undefined;\n  const isAccepted = verdict === 'accepted';\n  const isBlocked = verdict === 'blocked';\n\n  return (\n    <div className='flex flex-col gap-2'>\n      {isUndecided && (\n        <div className='flex flex-wrap items-center gap-2'>\n          <Button\n            type='button'\n            size='sm'\n            onClick={() => onVerdict('accepted')}\n            className={pressedSolidOf(isAcceptPressed)}\n          >\n            Accept the change\n          </Button>\n          <Button\n            type='button'\n            size='sm'\n            variant='outline'\n            onClick={() => onVerdict('blocked')}\n          >\n            Block\n          </Button>\n          <span className='text-muted-foreground text-xs'>\n            Shipping waits for your decision\n          </span>\n        </div>\n      )}\n      {isAccepted && (\n        <div className='flex flex-wrap items-center gap-x-3 gap-y-1.5 transition-opacity duration-300 starting:opacity-0'>\n          <p className='flex min-w-0 items-center gap-1.5 text-xs'>\n            <CheckIcon className='text-success-foreground size-3.5 shrink-0' />\n            Accepted by you. The expected answer now follows v13\n          </p>\n          <Button\n            type='button'\n            size='sm'\n            variant='ghost'\n            disabled={isLocked}\n            onClick={() => onVerdict('blocked')}\n            className='text-muted-foreground -my-1'\n          >\n            Block instead\n          </Button>\n        </div>\n      )}\n      {isBlocked && (\n        <div className='flex flex-wrap items-center gap-x-3 gap-y-1.5 transition-opacity duration-300 starting:opacity-0'>\n          <p className='flex min-w-0 items-center gap-1.5 text-xs'>\n            <XIcon className='text-destructive-ink size-3.5 shrink-0' />\n            Blocked by you. v13 cannot ship with this reply\n          </p>\n          <Button\n            type='button'\n            size='sm'\n            variant='ghost'\n            disabled={isLocked}\n            onClick={() => onVerdict('accepted')}\n            className='text-muted-foreground -my-1'\n          >\n            Accept instead\n          </Button>\n        </div>\n      )}\n    </div>\n  );\n}\n\nexport type CaseDetailProps = {\n  entry: EvalCase;\n  candidateStatus: CellStatus;\n  isRegression: boolean;\n  verdict: Verdict | undefined;\n  isLocked: boolean;\n  pressed: string | null;\n  onVerdict: (verdict: Verdict) => void;\n  className?: string;\n};\n\nexport function CaseDetail({\n  entry,\n  candidateStatus,\n  isRegression,\n  verdict,\n  isLocked,\n  pressed,\n  onVerdict,\n  className,\n}: CaseDetailProps) {\n  const isAccepted = verdict === 'accepted';\n\n  return (\n    <div className={cn('@container flex flex-col gap-3', className)}>\n      <div className='flex flex-col gap-1'>\n        <h3 className='text-muted-foreground text-xs'>Customer</h3>\n        <p className='text-[13px] leading-relaxed'>{entry.input}</p>\n      </div>\n      <div className='flex flex-col gap-1'>\n        <h3 className='text-muted-foreground text-xs'>Expected</h3>\n        <p className='text-[13px] leading-relaxed'>{entry.expected}</p>\n        {isAccepted && (\n          <p className='text-muted-foreground text-xs transition-opacity duration-300 starting:opacity-0'>\n            Replaced by the v13 reply when you accepted the change\n          </p>\n        )}\n      </div>\n      <div className='grid grid-cols-1 gap-2 @sm:grid-cols-2'>\n        <OutputColumn\n          target={TARGETS.production}\n          output={entry.production}\n          status={entry.production.outcome}\n        />\n        <OutputColumn\n          target={TARGETS.candidate}\n          output={entry.candidate}\n          status={candidateStatus}\n        />\n      </div>\n      {isRegression && (\n        <VerdictBar\n          verdict={verdict}\n          isLocked={isLocked}\n          isAcceptPressed={pressed === 'accept'}\n          onVerdict={onVerdict}\n        />\n      )}\n      <Badge variant='secondary' className='self-start'>\n        Illustrative tokens and costs\n      </Badge>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-02/case-detail.tsx"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-02/cells.tsx",
      "content": "'use client';\n\nimport { CheckIcon, ShuffleIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\n\nimport type { CellStatus } from './session';\n\nexport const CELL_WORD: Record<CellStatus, string> = {\n  none: 'Not run',\n  queued: 'Queued',\n  running: 'Running',\n  pass: 'Passed',\n  fail: 'Failed',\n  flaky: 'Flaky',\n};\n\n/** A running cell breathes; at most two run at the same time. */\nconst CELL_TONE: Record<CellStatus, string> = {\n  none: 'hairline-border border-foreground/20 border-dashed',\n  queued: 'bg-foreground/[0.04]',\n  running: 'bg-info/10 animate-pulse',\n  pass: 'bg-success/10 text-success-foreground',\n  fail: 'bg-destructive/10 text-destructive-ink',\n  flaky: 'bg-warning/10 text-warning-foreground',\n};\n\nconst SIZE_CLASS = {\n  sm: 'size-5 rounded-[5px] [&_svg]:size-3',\n  md: 'size-7 rounded-md [&_svg]:size-3.5',\n} as const;\n\nfunction CellGlyph({ status }: { status: CellStatus }) {\n  if (status === 'pass') {\n    return <CheckIcon strokeWidth={2.25} />;\n  }\n  if (status === 'fail') {\n    return <XIcon strokeWidth={2.25} />;\n  }\n  if (status === 'flaky') {\n    return <ShuffleIcon strokeWidth={2.25} />;\n  }\n  if (status === 'running') {\n    return <span className='bg-info size-1.5 rounded-full' />;\n  }\n  if (status === 'queued') {\n    return <span className='bg-muted-foreground/40 size-1 rounded-full' />;\n  }\n  return null;\n}\n\ntype StatusCellProps = {\n  status: CellStatus;\n  size?: keyof typeof SIZE_CLASS;\n  /** Without a visible word next to it, the cell says its state to screen readers. */\n  isLabelled?: boolean;\n  className?: string;\n};\n\nexport function StatusCell({\n  status,\n  size = 'md',\n  isLabelled = false,\n  className,\n}: StatusCellProps) {\n  return (\n    <span\n      className={cn(\n        'inline-flex shrink-0 items-center justify-center transition-colors duration-300',\n        SIZE_CLASS[size],\n        CELL_TONE[status],\n        className\n      )}\n    >\n      <Swap swapKey={status}>\n        <CellGlyph status={status} />\n      </Swap>\n      {isLabelled && <span className='sr-only'>{CELL_WORD[status]}</span>}\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-02/cells.tsx"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-02/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\n\nimport {\n  CASES,\n  FIRST_REGRESSION,\n  SECOND_REGRESSION,\n  type EvalCase,\n  type Outcome,\n} from './data';\n\nexport type RunPhase = 'idle' | 'running' | 'done';\n\nexport type Verdict = 'accepted' | 'blocked';\n\nexport type ShipStatus = 'idle' | 'busy' | 'done';\n\nexport type Filter = 'all' | 'failing' | 'regressions';\n\nexport type CellStatus = 'none' | 'queued' | 'running' | Outcome;\n\nexport type EvalState = {\n  phase: RunPhase;\n  /** How many cases the candidate has finished, in the order of the list. */\n  landed: number;\n  filter: Filter;\n  openId: string | null;\n  verdicts: Record<string, Verdict>;\n  ship: ShipStatus;\n};\n\nexport type EvalAction =\n  | { type: 'run' }\n  | { type: 'landed' }\n  | { type: 'filter'; filter: Filter }\n  | { type: 'opened'; id: string }\n  | { type: 'closed' }\n  | { type: 'verdict'; id: string; verdict: Verdict }\n  | { type: 'ship' }\n  | { type: 'shipped' };\n\ntype Step = SessionStep<EvalState, EvalAction>;\n\n/** How many cases run at the same time. */\nconst CONCURRENCY = 2;\n\nexport const INITIAL: EvalState = {\n  phase: 'idle',\n  landed: 0,\n  filter: 'all',\n  openId: null,\n  verdicts: {},\n  ship: 'idle',\n};\n\nfunction indexOfCase(id: string) {\n  return CASES.findIndex((candidate) => candidate.id === id);\n}\n\nfunction hasLanded(state: EvalState, id: string) {\n  const index = indexOfCase(id);\n  return index < state.landed;\n}\n\n/** A change a person accepted counts as a pass: the expected answer follows the new reply. */\nexport function candidateStatusOf(state: EvalState, id: string): CellStatus {\n  if (state.phase === 'idle') {\n    return 'none';\n  }\n  const index = indexOfCase(id);\n  if (index < state.landed) {\n    if (state.verdicts[id] === 'accepted') {\n      return 'pass';\n    }\n    return CASES[index].candidate.outcome;\n  }\n  const isRunning = index < state.landed + CONCURRENCY;\n  if (isRunning) {\n    return 'running';\n  }\n  return 'queued';\n}\n\nfunction isRegressionCase(entry: EvalCase) {\n  const passedBefore = entry.production.outcome === 'pass';\n  const failsNow = entry.candidate.outcome === 'fail';\n  return passedBefore && failsNow;\n}\n\nexport function isRegression(state: EvalState, id: string) {\n  const index = indexOfCase(id);\n  const entry = CASES[index];\n  return hasLanded(state, id) && isRegressionCase(entry);\n}\n\nexport function regressionsOf(state: EvalState) {\n  return CASES.filter((entry) => isRegression(state, entry.id));\n}\n\nexport function undecidedCountOf(state: EvalState) {\n  const regressions = regressionsOf(state);\n  const undecided = regressions.filter(\n    (entry) => state.verdicts[entry.id] === undefined\n  );\n  return undecided.length;\n}\n\nexport function blockedCountOf(state: EvalState) {\n  const regressions = regressionsOf(state);\n  const blocked = regressions.filter(\n    (entry) => state.verdicts[entry.id] === 'blocked'\n  );\n  return blocked.length;\n}\n\nexport function canShip(state: EvalState) {\n  const isDone = state.phase === 'done';\n  const undecided = undecidedCountOf(state);\n  const blocked = blockedCountOf(state);\n  const isClear = undecided + blocked === 0;\n  return isDone && isClear;\n}\n\nexport function isFailing(state: EvalState, entry: EvalCase) {\n  const status = candidateStatusOf(state, entry.id);\n  const candidateFails = status === 'fail' || status === 'flaky';\n  const productionFails = entry.production.outcome === 'fail';\n  return candidateFails || productionFails;\n}\n\nexport function matchesFilter(state: EvalState, entry: EvalCase) {\n  if (state.filter === 'failing') {\n    return isFailing(state, entry);\n  }\n  if (state.filter === 'regressions') {\n    return isRegression(state, entry.id);\n  }\n  return true;\n}\n\nfunction passCountOf(outcomes: CellStatus[]) {\n  const passes = outcomes.filter((outcome) => outcome === 'pass');\n  return passes.length;\n}\n\nexport type PassRate = {\n  passed: number;\n  total: number;\n  percent: number;\n};\n\nfunction rateOf(passed: number, total: number): PassRate {\n  if (total === 0) {\n    return { passed, total, percent: 0 };\n  }\n  const share = passed / total;\n  const percent = Math.round(share * 100);\n  return { passed, total, percent };\n}\n\nexport const PRODUCTION_RATE = rateOf(\n  passCountOf(CASES.map((entry) => entry.production.outcome)),\n  CASES.length\n);\n\n/** Counted over the cases run so far, so the figure is a pass rate at every moment of the run. */\nexport function candidateRateOf(state: EvalState) {\n  const landed = CASES.slice(0, state.landed);\n  const statuses = landed.map((entry) => candidateStatusOf(state, entry.id));\n  return rateOf(passCountOf(statuses), landed.length);\n}\n\nfunction run(state: EvalState): EvalState {\n  if (state.phase !== 'idle') {\n    return state;\n  }\n  return { ...state, phase: 'running' };\n}\n\nfunction landed(state: EvalState): EvalState {\n  if (state.phase !== 'running') {\n    return state;\n  }\n  const count = state.landed + 1;\n  if (count < CASES.length) {\n    return { ...state, landed: count };\n  }\n  return { ...state, landed: count, phase: 'done' };\n}\n\nfunction opened(state: EvalState, id: string): EvalState {\n  if (state.openId === id) {\n    return { ...state, openId: null };\n  }\n  return { ...state, openId: id };\n}\n\nfunction verdict(state: EvalState, id: string, next: Verdict): EvalState {\n  const canDecide = isRegression(state, id) && state.ship === 'idle';\n  if (!canDecide) {\n    return state;\n  }\n  return { ...state, verdicts: { ...state.verdicts, [id]: next } };\n}\n\nfunction ship(state: EvalState): EvalState {\n  const isReady = canShip(state) && state.ship === 'idle';\n  if (!isReady) {\n    return state;\n  }\n  return { ...state, ship: 'busy' };\n}\n\nfunction shipped(state: EvalState): EvalState {\n  if (state.ship !== 'busy') {\n    return state;\n  }\n  return { ...state, ship: 'done' };\n}\n\nexport function reducer(state: EvalState, action: EvalAction): EvalState {\n  switch (action.type) {\n    case 'run':\n      return run(state);\n    case 'landed':\n      return landed(state);\n    case 'filter':\n      return { ...state, filter: action.filter };\n    case 'opened':\n      return opened(state, action.id);\n    case 'closed':\n      return { ...state, openId: null };\n    case 'verdict':\n      return verdict(state, action.id, action.verdict);\n    case 'ship':\n      return ship(state);\n    case 'shipped':\n      return shipped(state);\n  }\n}\n\nfunction hasStarted(state: EvalState) {\n  return state.phase !== 'idle';\n}\n\nfunction hasVerdictOn(id: string) {\n  return (state: EvalState) => state.verdicts[id] !== undefined;\n}\n\nfunction hasPressedShip(state: EvalState) {\n  return state.ship !== 'idle';\n}\n\n/** A request that waits on a person is answered by the demonstration after this long. */\nconst DECIDE_AFTER_MS = 2500;\n\nconst LAND_EVERY_MS = 340;\n\nconst LANDINGS: Step[] = CASES.map(() => ({\n  after: LAND_EVERY_MS,\n  action: { type: 'landed' },\n}));\n\nconst RUN_STEP: Step = {\n  after: 1400,\n  by: 'person',\n  press: 'run',\n  action: { type: 'run' },\n  isAnswered: hasStarted,\n};\n\nexport const SCRIPT: Step[] = [\n  RUN_STEP,\n  ...LANDINGS,\n  {\n    after: 1200,\n    by: 'demo',\n    action: { type: 'filter', filter: 'regressions' },\n  },\n  {\n    after: 1100,\n    by: 'demo',\n    press: `case-${FIRST_REGRESSION}`,\n    action: { type: 'opened', id: FIRST_REGRESSION },\n  },\n  {\n    after: DECIDE_AFTER_MS,\n    by: 'person',\n    press: 'accept',\n    action: { type: 'verdict', id: FIRST_REGRESSION, verdict: 'accepted' },\n    isAnswered: hasVerdictOn(FIRST_REGRESSION),\n  },\n  {\n    after: 1200,\n    by: 'demo',\n    press: `case-${SECOND_REGRESSION}`,\n    action: { type: 'opened', id: SECOND_REGRESSION },\n  },\n  {\n    after: DECIDE_AFTER_MS,\n    by: 'person',\n    press: 'accept',\n    action: { type: 'verdict', id: SECOND_REGRESSION, verdict: 'accepted' },\n    isAnswered: hasVerdictOn(SECOND_REGRESSION),\n  },\n  {\n    after: DECIDE_AFTER_MS,\n    by: 'person',\n    press: 'ship',\n    action: { type: 'ship' },\n    isAnswered: hasPressedShip,\n  },\n  { after: 1300, action: { type: 'shipped' } },\n];\n\n/** Under reduced motion the run is over and the first regression is open, still to decide. */\nfunction restingOf() {\n  let state = reducer(INITIAL, RUN_STEP.action);\n  for (const step of LANDINGS) {\n    state = reducer(state, step.action);\n  }\n  return reducer(state, { type: 'opened', id: FIRST_REGRESSION });\n}\n\nexport const RESTING = restingOf();\n\nexport const LOOP_AFTER_MS = 3800;\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-02/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/agent-ops/agent-ops-02/data.ts",
      "content": "import type { BrandSlug } from '@/registry/ndeko/lib/brand-logos';\n\ntype Prompt = {\n  name: string;\n  team: string;\n  /** A family without a version number. */\n  model: string;\n  brand: BrandSlug;\n};\n\nexport const PROMPT: Prompt = {\n  name: 'Support reply',\n  team: 'Solway Books support',\n  model: 'Claude Sonnet',\n  brand: 'claude',\n};\n\nexport type TargetId = 'production' | 'candidate';\n\nexport type Target = {\n  id: TargetId;\n  label: string;\n  version: string;\n};\n\nexport const TARGETS: Record<TargetId, Target> = {\n  production: { id: 'production', label: 'Production', version: 'v12' },\n  candidate: { id: 'candidate', label: 'Candidate', version: 'v13' },\n};\n\nexport type Outcome = 'pass' | 'fail' | 'flaky';\n\nexport type Output = {\n  outcome: Outcome;\n  text: string;\n  /** The part of the text the grader points at. */\n  marked?: string;\n  /** What the grader said about a result that is not a plain pass. */\n  note?: string;\n  tokens: number;\n  costUsd: number;\n};\n\nexport type EvalCase = {\n  id: string;\n  name: string;\n  input: string;\n  expected: string;\n  production: Output;\n  candidate: Output;\n};\n\n/** Customer messages and replies written for this demo. Tokens and costs are illustrative. */\nexport const CASES: EvalCase[] = [\n  {\n    id: 'refund-in-window',\n    name: 'Refund inside 30 days',\n    input: 'I bought the atlas 12 days ago and I would like my money back.',\n    expected: 'Offers the refund and says it takes 5 to 7 business days.',\n    production: {\n      outcome: 'pass',\n      text: 'You are inside the 30 day window, so I have started the refund. It takes 5 to 7 business days to reach your card.',\n      tokens: 412,\n      costUsd: 0.004,\n    },\n    candidate: {\n      outcome: 'pass',\n      text: 'I have started your refund. Expect it on your card in 5 to 7 business days.',\n      tokens: 371,\n      costUsd: 0.004,\n    },\n  },\n  {\n    id: 'refund-late',\n    name: 'Refund after 30 days',\n    input: 'Can I return a cookbook I bought in March?',\n    expected: 'Explains the 30 day window and offers store credit.',\n    production: {\n      outcome: 'pass',\n      text: 'Returns close after 30 days, so a refund is not possible. I can offer store credit for the full price instead.',\n      tokens: 398,\n      costUsd: 0.004,\n    },\n    candidate: {\n      outcome: 'pass',\n      text: 'The 30 day window has passed. I can give you store credit for the full price if that helps.',\n      tokens: 362,\n      costUsd: 0.004,\n    },\n  },\n  {\n    id: 'damaged-order',\n    name: 'Order arrived damaged',\n    input: 'The cover of my book arrived torn. What now?',\n    expected: 'Apologises, asks for a photo and offers a replacement.',\n    production: {\n      outcome: 'pass',\n      text: 'I am sorry about the torn cover. Send me a photo and I will ship a replacement today.',\n      tokens: 344,\n      costUsd: 0.003,\n    },\n    candidate: {\n      outcome: 'flaky',\n      text: 'Sorry about that. I will ship a replacement today.',\n      note: 'Passed 2 of 3 runs. One run did not ask for a photo.',\n      tokens: 318,\n      costUsd: 0.003,\n    },\n  },\n  {\n    id: 'asks-human',\n    name: 'Asks for a person',\n    input: 'I want to talk to a real person please.',\n    expected: 'Hands over to the support team and gives the opening hours.',\n    production: {\n      outcome: 'fail',\n      text: 'I can help you with most questions right here. What is it about?',\n      marked: 'I can help you with most questions right here.',\n      note: 'The reply keeps the customer instead of handing over.',\n      tokens: 301,\n      costUsd: 0.003,\n    },\n    candidate: {\n      outcome: 'pass',\n      text: 'Of course. I have passed your conversation to the team. They answer on weekdays from 9 to 17.',\n      tokens: 356,\n      costUsd: 0.004,\n    },\n  },\n  {\n    id: 'change-address',\n    name: 'Change the delivery address',\n    input: 'I moved last week. Can you send order SB-20388 to my new place?',\n    expected: 'Changes the address if the order has not shipped.',\n    production: {\n      outcome: 'pass',\n      text: 'Order SB-20388 has not shipped yet, so I have updated the address. You will get a new confirmation.',\n      tokens: 420,\n      costUsd: 0.004,\n    },\n    candidate: {\n      outcome: 'pass',\n      text: 'Done. SB-20388 had not shipped, so it now goes to your new address.',\n      tokens: 377,\n      costUsd: 0.004,\n    },\n  },\n  {\n    id: 'double-charge',\n    name: 'Charged twice',\n    input: 'My card shows two payments for order SB-20418.',\n    expected:\n      'Refunds the second payment and says it takes 5 to 7 business days.',\n    production: {\n      outcome: 'pass',\n      text: 'I found the second payment and refunded it. It takes 5 to 7 business days to show on your card.',\n      tokens: 433,\n      costUsd: 0.004,\n    },\n    candidate: {\n      outcome: 'fail',\n      text: 'I found the second payment and refunded it. You will see it on your statement in a few days.',\n      marked: 'in a few days',\n      note: 'The reply leaves out the 5 to 7 business days of the policy.',\n      tokens: 391,\n      costUsd: 0.004,\n    },\n  },\n  {\n    id: 'gift-card',\n    name: 'Gift card balance',\n    input: 'How much is left on my gift card?',\n    expected: 'Asks for the last 4 digits of the card, then gives the balance.',\n    production: {\n      outcome: 'pass',\n      text: 'Happy to check. What are the last 4 digits of the card?',\n      tokens: 287,\n      costUsd: 0.003,\n    },\n    candidate: {\n      outcome: 'fail',\n      text: 'You can see the balance at any time on solwaybooks.example/gift-cards, signed in with the email the card was sent to.',\n      marked:\n        'You can see the balance at any time on solwaybooks.example/gift-cards',\n      note: 'The reply sends a link instead of asking for the card digits.',\n      tokens: 342,\n      costUsd: 0.003,\n    },\n  },\n  {\n    id: 'cancel-preorder',\n    name: 'Cancel a pre-order',\n    input: 'Please cancel my pre-order of the winter anthology.',\n    expected: 'Cancels the pre-order and confirms nothing was charged.',\n    production: {\n      outcome: 'pass',\n      text: 'Your pre-order is cancelled. Nothing was charged, so there is no refund to wait for.',\n      tokens: 352,\n      costUsd: 0.004,\n    },\n    candidate: {\n      outcome: 'pass',\n      text: 'Cancelled. Pre-orders are only charged on release, so you paid nothing.',\n      tokens: 329,\n      costUsd: 0.003,\n    },\n  },\n  {\n    id: 'late-parcel',\n    name: 'Angry about a late parcel',\n    input: 'Three weeks and still nothing. This is a joke.',\n    expected:\n      'Apologises first, then gives the tracking state and a next step.',\n    production: {\n      outcome: 'fail',\n      text: 'Your parcel left the warehouse on the 4th. Delivery times vary by courier.',\n      marked: 'Delivery times vary by courier.',\n      note: 'No apology and no next step.',\n      tokens: 338,\n      costUsd: 0.003,\n    },\n    candidate: {\n      outcome: 'pass',\n      text: 'I am sorry, three weeks is too long. The parcel is stuck at the depot, so I am sending a new one today by express.',\n      tokens: 402,\n      costUsd: 0.004,\n    },\n  },\n  {\n    id: 'vat-invoice',\n    name: 'Invoice with a VAT number',\n    input: 'I need an invoice with our VAT number for order SB-20455.',\n    expected: 'Asks for the VAT number and sends the corrected invoice.',\n    production: {\n      outcome: 'pass',\n      text: 'Send me the VAT number and I will issue a corrected invoice for SB-20455 right away.',\n      tokens: 366,\n      costUsd: 0.004,\n    },\n    candidate: {\n      outcome: 'pass',\n      text: 'Share the VAT number and I will send a corrected invoice for SB-20455.',\n      tokens: 331,\n      costUsd: 0.003,\n    },\n  },\n  {\n    id: 'spanish',\n    name: 'Writes in Spanish',\n    input: 'Hola, mi pedido no ha llegado todavía.',\n    expected: 'Answers in Spanish with the tracking state.',\n    production: {\n      outcome: 'pass',\n      text: 'Hola. Tu pedido salió ayer del almacén y llega el jueves.',\n      tokens: 359,\n      costUsd: 0.004,\n    },\n    candidate: {\n      outcome: 'pass',\n      text: 'Hola. Tu pedido salió ayer y llegará el jueves.',\n      tokens: 334,\n      costUsd: 0.003,\n    },\n  },\n  {\n    id: 'delete-account',\n    name: 'Delete my account',\n    input: 'Please delete my account and everything you hold about me.',\n    expected: 'Confirms the request and says deletion takes up to 30 days.',\n    production: {\n      outcome: 'pass',\n      text: 'I have filed your deletion request. Your account and data are removed within 30 days.',\n      tokens: 371,\n      costUsd: 0.004,\n    },\n    candidate: {\n      outcome: 'pass',\n      text: 'Your deletion request is filed. Everything is removed within 30 days.',\n      tokens: 340,\n      costUsd: 0.003,\n    },\n  },\n];\n\nexport const FIRST_REGRESSION = 'double-charge';\n\nexport const SECOND_REGRESSION = 'gift-card';\n\nexport function caseOf(id: string) {\n  const found = CASES.find((candidate) => candidate.id === id);\n  return found ?? CASES[0];\n}\n",
      "type": "registry:component",
      "target": "components/blocks/agent-ops-02/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "agent-ops"
  ],
  "type": "registry:block"
}