{"version":3,"file":"Timeline.mjs","names":["HOST_SLOTS"],"sources":["../../../../src/web/features/session/Timeline.tsx"],"sourcesContent":["import { useT, type UserMessageActionRunContext, type WebPluginSlotProps } from '@agimon-ai/po-core/web';\nimport {\n  AgentAvatar,\n  AlertIcon,\n  Avatar,\n  AvatarFallback,\n  AvatarImage,\n  Button,\n  ChevronDownIcon,\n  EmptyState,\n  cn,\n  ExternalLinkIcon,\n  FileIcon,\n  MessageIcon,\n  MessageItemGroup,\n  QuoteIcon,\n  RewindIcon,\n  Separator,\n  StreamCursor,\n  UserIcon,\n  ViewableImage,\n} from '@agimon-ai/po-web-components';\nimport { Link } from '@tanstack/react-router';\nimport { useStore } from '@tanstack/react-store';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport type { Store } from '@tanstack/store';\nimport {\n  Fragment,\n  memo,\n  type ComponentType,\n  type ReactNode,\n  useCallback,\n  useEffect,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n  useState,\n} from 'react';\n\nimport { useRenderTrace } from '../../lib/uiTrace';\n\n// Where each session's reader left off: a scrollTop, or null when at the live bottom.\nconst savedScroll = new WeakMap<object, number | null>();\n\nimport { FirstSessionWelcome } from '../../components/FirstSessionWelcome';\nimport { Region } from '../../components/Region';\nimport { type AttachedFileNote, userMessageParts } from '../../lib/attachmentNotes';\nimport { fileTabForPath, useFileLinks } from '../../lib/composition';\nimport { parseFileMentions } from '../../lib/fileMentions';\nimport { firstSessionWelcomeFor } from '../../lib/firstSessionWelcome';\nimport { qualifyHostId, splitHostId } from '../../lib/hostIdentity';\nimport {\n  HOST_SLOTS,\n  hostSlotFills,\n  pluginToolRenderer,\n  pluginUserMessageActions,\n  webPluginRegistryForHost,\n} from '../../lib/pluginRegistry';\nimport { focusPrompt } from '../../lib/promptFocus';\nimport { loadParticipantAvatar, type SessionAsset } from '../../lib/sessionAsset';\nimport {\n  isSupportedImageMimeType,\n  type InputSender,\n  type ProfileIdentity,\n  type SessionState,\n  type TimelineEntry,\n  type ToolEntry,\n  type UserImage,\n} from '../../lib/sessionModel';\nimport { personaInitials } from '../../lib/sessionSummary';\nimport { groupSummary, groupTone, timelineUnits } from '../../lib/timelineGroups';\nimport { responseTurns, transcriptTurns, type TranscriptTurnRow } from '../../lib/transcriptTurns';\nimport { appendComposerQuote } from '../../stores/composerStore';\nimport { ImageRefScope, useImageRefs } from '../../stores/imageRefStore';\nimport { sessionsStore } from '../../stores/sessionsStore';\nimport {\n  requestOlderHistory,\n  requestNewerHistory,\n  requestLatestHistory,\n  rewindToMessage,\n  sessionStoreFor,\n  submitMessageWithAck,\n  useActiveSession,\n} from '../../stores/sessionStore';\nimport { openTransientTab } from '../../stores/transientTabsStore';\nimport { useOpenTab } from '../../stores/useOpenTab';\nimport { usePluginSlotProps } from '../../stores/usePluginSlotProps';\nimport { useWebPluginRegistry } from '../../stores/useWebPluginRegistry';\nimport { workspacesStore } from '../../stores/workspacesStore';\nimport { MentionPreviews } from './MentionPreviews';\nimport { MessageMarkdown, type MessageFileLinkHandler } from './MessageMarkdown';\nimport { hasVisualOutput, ToolCard } from './ToolCard';\n\ntype Translate = ReturnType<typeof useT>;\n\nconst suggestions = (t: Translate): string[] => [\n  t('webDashboard.session.suggestionReviewTree', 'Review the working tree and summarise the diff'),\n  t('webDashboard.session.suggestionRunTargets', 'Run the affected nx targets and report failures'),\n  t('webDashboard.session.suggestionExplainSocket', 'Explain how the session socket handshake works'),\n];\n/** A session without a workspace has no code to point at, so its starters never mention one. */\nconst workspaceFreeSuggestions = (t: Translate): string[] => [\n  t('webDashboard.session.suggestionDraftReply', 'Draft a reply to a tricky email'),\n  t('webDashboard.session.suggestionMakePlan', 'Make a plan for something I want to get done'),\n  t('webDashboard.session.suggestionExplainTopic', 'Explain a topic in plain language'),\n];\n\n/** Closer than this to the end counts as reading the latest, so new frames keep the view pinned. */\nconst PINNED_THRESHOLD_PX = 200;\n/** Closer than this to the top asks for the window above, before the reader hits the edge. */\nconst PAGE_BACK_THRESHOLD_PX = 400;\n/**\n * Entries at the end that are never skipped.\n *\n * Containment makes a skipped entry report its placeholder height, so a\n * transcript whose tail is contained has a scroll height that is only an\n * estimate, and following the newest line lands short of it. The tail is also\n * the part a reader is nearly always looking at, so there is nothing to skip\n * there; everything above it is what makes a long session slow.\n */\n\nfunction noticeHref(line: string): string | null {\n  if (/\\s/u.test(line) || !/^https?:\\/\\//i.test(line)) return null;\n\n  try {\n    const url = new URL(line);\n    if ((url.protocol !== 'http:' && url.protocol !== 'https:') || !url.host || url.username || url.password) {\n      return null;\n    }\n    return url.href;\n  } catch {\n    return null;\n  }\n}\n\n/** Two letters from a persona name, so a profile without an icon is still distinct. */\nfunction SpeakerAvatar({\n  speaker,\n  identity,\n  sender,\n  sessionId,\n  unattributed = false,\n}: {\n  speaker: 'assistant' | 'user';\n  identity?: ProfileIdentity | null;\n  /** Who sent a user row, when the host recorded it. */\n  sender?: InputSender;\n  sessionId?: string | null;\n  /** A thread row whose sender nobody recorded: not the reader, and not guessed. */\n  unattributed?: boolean;\n}) {\n  const t = useT();\n  const profileId = sender?.kind === 'human' ? sender.id : undefined;\n  const [picture, setPicture] = useState<{ sessionId: string; profileId: string; url: string }>();\n  useEffect(() => {\n    if (!sessionId || !profileId) return;\n    let live = true;\n    let asset: SessionAsset | null = null;\n    void loadParticipantAvatar(sessionId, profileId).then(\n      (loaded) => {\n        if (!live) {\n          loaded?.dispose();\n          return;\n        }\n        asset = loaded;\n        if (loaded) setPicture({ sessionId, profileId, url: loaded.url });\n      },\n      () => {\n        /* Refused or unavailable pictures keep the recorded initials. */\n      },\n    );\n    return () => {\n      live = false;\n      asset?.dispose();\n    };\n  }, [sessionId, profileId]);\n  if (speaker === 'assistant') {\n    // The icon arrives as a bounded data URL on the journalled identity entry,\n    // so a persona without one, or with one that failed to load, still renders.\n    const label = identity?.name ?? identity?.profile ?? 'Po';\n    const fallback = identity ? personaInitials(label) : 'PO';\n    return (\n      <Avatar aria-label={label} className=\"size-9 shrink-0 border border-po-border-soft bg-po-deep\">\n        <AvatarImage\n          src={identity?.icon ?? '/favicon.svg'}\n          alt=\"\"\n          // Inset either way so a picture never runs into the ring: a persona's fills its own circle, Po's mark fits.\n          className={identity?.icon ? 'rounded-full p-0.5' : 'object-contain p-1'}\n        />\n        <AvatarFallback className=\"text-po-magenta\">{fallback}</AvatarFallback>\n      </Avatar>\n    );\n  }\n\n  if (sender && sender.kind !== 'human') {\n    // Another of Po's agents, or Po itself: drawn as Po's own work and named by the label beside it.\n    return (\n      <Avatar aria-label={sender.name} className=\"size-9 shrink-0 border border-po-border-soft bg-po-deep\">\n        <AvatarImage src=\"/favicon.svg\" alt=\"\" className=\"object-contain p-1\" />\n        <AvatarFallback className=\"text-po-magenta\">{personaInitials(sender.name)}</AvatarFallback>\n      </Avatar>\n    );\n  }\n\n  const unknown = unattributed && !sender;\n  return (\n    <Avatar\n      aria-label={\n        sender?.name ??\n        (unknown\n          ? t('webDashboard.session.senderNotRecorded', 'Sender not recorded')\n          : t('webDashboard.session.you', 'You'))\n      }\n      className=\"size-9 shrink-0 border border-po-border bg-po-panel\"\n    >\n      {picture && picture.sessionId === sessionId && picture.profileId === profileId ? (\n        <AvatarImage src={picture.url} alt=\"\" />\n      ) : null}\n      <AvatarFallback className=\"bg-po-panel text-po-dim\">\n        {sender ? personaInitials(sender.name) : unknown ? '?' : <UserIcon aria-hidden=\"true\" className=\"size-4\" />}\n      </AvatarFallback>\n    </Avatar>\n  );\n}\n\ntype UserMessageActions = ReturnType<typeof pluginUserMessageActions>;\n\nfunction MessageActions({\n  actions,\n  visible,\n  disabled,\n  actionsDisabled,\n  onQuote,\n  onRewind,\n  userMessage,\n}: {\n  actions: UserMessageActions;\n  visible: boolean;\n  disabled: boolean;\n  actionsDisabled: boolean;\n  onQuote: () => void;\n  onRewind: () => void;\n  userMessage?: UserMessageActionRunContext;\n}) {\n  const t = useT();\n  if (!visible) return null;\n  const rewindLabel = t('webDashboard.session.rewindToMessage', 'Rewind to message');\n  const quoteLabel = t('webDashboard.session.quoteMessage', 'Quote message');\n  return (\n    <div\n      data-testid=\"entry-actions\"\n      className=\"pointer-events-none absolute right-1 bottom-0 z-10 flex max-w-[calc(100%-0.5rem)] translate-y-1/2 flex-wrap justify-end gap-1 rounded-md border border-po-border-soft bg-po-panel p-0.5 opacity-0 shadow-sm transition-opacity group-hover/message:pointer-events-auto group-hover/message:opacity-100 group-focus-within/message:pointer-events-auto group-focus-within/message:opacity-100 [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100\"\n    >\n      {userMessage\n        ? actions.map((action) => {\n            const ActionIcon = action.icon;\n            const label = action.translateLabel?.(t) ?? action.label;\n            return (\n              <Button\n                key={`${action.pluginId}.${action.id}`}\n                variant=\"subtle\"\n                size={ActionIcon ? 'icon' : 'sm'}\n                data-testid=\"entry-plugin-action\"\n                aria-label={label}\n                title={label}\n                disabled={actionsDisabled}\n                onMouseDown={(event) => event.preventDefault()}\n                onClick={() => action.run(userMessage)}\n                className={ActionIcon ? 'border-0 shadow-none' : 'h-6 border-0 px-2 shadow-none'}\n              >\n                {ActionIcon ? <ActionIcon aria-hidden={true} className=\"h-3 w-3\" /> : label}\n              </Button>\n            );\n          })\n        : null}\n      <Button\n        variant=\"subtle\"\n        size=\"icon\"\n        data-testid=\"entry-rewind\"\n        aria-label={rewindLabel}\n        title={\n          disabled\n            ? t('webDashboard.session.rewindWait', 'Wait for the current response before rewinding')\n            : rewindLabel\n        }\n        disabled={disabled || actionsDisabled}\n        onMouseDown={(event) => event.preventDefault()}\n        onClick={onRewind}\n        className=\"border-0 shadow-none\"\n      >\n        <RewindIcon aria-hidden=\"true\" className=\"h-3 w-3\" />\n      </Button>\n      <Button\n        variant=\"subtle\"\n        size=\"icon\"\n        data-testid=\"entry-quote\"\n        aria-label={quoteLabel}\n        title={quoteLabel}\n        disabled={actionsDisabled}\n        onMouseDown={(event) => event.preventDefault()}\n        onClick={onQuote}\n        className=\"border-0 shadow-none\"\n      >\n        <QuoteIcon aria-hidden=\"true\" className=\"h-3 w-3\" />\n      </Button>\n    </div>\n  );\n}\n\nconst NO_IMAGES: readonly UserImage[] = [];\nconst sizeFormat = new Intl.NumberFormat(undefined, { style: 'unit', unit: 'kilobyte', maximumFractionDigits: 0 });\n\n/**\n * What the person attached: images as thumbnails that open full screen, files as chips. One image the\n * transcript sent by reference appears once its saved entry is read.\n */\nfunction UserAttachments({ images, files }: { images: readonly UserImage[]; files: readonly AttachedFileNote[] }) {\n  const t = useT();\n  const shown = useImageRefs(images).filter(\n    (image) => image.data !== undefined && isSupportedImageMimeType(image.mimeType),\n  );\n  if (shown.length === 0 && files.length === 0) return null;\n  return (\n    <div data-testid=\"user-attachments\" className=\"flex flex-wrap items-start gap-2\">\n      {shown.map((image, index) => (\n        <ViewableImage\n          key={`${image.mimeType}:${image.ref?.entryId ?? image.data?.slice(0, 24)}:${String(index)}`}\n          src={`data:${image.mimeType};base64,${image.data}`}\n          alt={t('webDashboard.session.attachmentAlt', 'Attachment {index}', { index: String(index + 1) })}\n          data-testid=\"user-attached-image\"\n          className=\"h-32 w-auto max-w-60 rounded-md border border-po-border-soft object-cover\"\n        />\n      ))}\n      {files.map((file) => (\n        <span\n          key={file.path}\n          data-testid=\"user-attached-file\"\n          title={file.path}\n          className=\"flex max-w-60 items-center gap-2 rounded-md border border-po-border-soft bg-po-panel px-2.5 py-1.5 text-sm\"\n        >\n          <FileIcon aria-hidden className=\"size-4 shrink-0 text-po-dim\" />\n          <span className=\"truncate text-po-text\">{file.name}</span>\n          <span className=\"shrink-0 text-po-dim\">{sizeFormat.format(Math.max(1, Math.round(file.size / 1024)))}</span>\n        </span>\n      ))}\n    </div>\n  );\n}\n\n/** The message's wall-clock time, quiet at the end of its first line; nothing when the entry carries none. */\nfunction MessageTime({ timestamp }: { timestamp: number | undefined }) {\n  if (timestamp === undefined) return null;\n  const at = new Date(timestamp);\n  return (\n    <time\n      data-testid=\"entry-time\"\n      dateTime={at.toISOString()}\n      className=\"shrink-0 pt-0.5 text-sm text-po-dim tabular-nums\"\n    >\n      {at.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' })}\n    </time>\n  );\n}\nfunction ToolEntryRow({\n  entry,\n  slotProps,\n  statuses,\n  suppressOutputs = false,\n}: {\n  entry: Extract<TimelineEntry, { kind: 'tool' }>;\n  slotProps: WebPluginSlotProps;\n  statuses: Readonly<Record<string, string>>;\n  suppressOutputs?: boolean;\n}) {\n  const presentation = pluginToolRenderer(entry.name, statuses)?.timelinePresentation ?? 'tool';\n  return (\n    <div\n      data-testid=\"entry-tool-row\"\n      data-tool-presentation={presentation}\n      className={presentation === 'tool' ? 'min-w-0 sm:pl-12' : 'min-w-0'}\n    >\n      <ToolCard entry={entry} slotProps={slotProps} statuses={statuses} suppressOutputs={suppressOutputs} />\n    </div>\n  );\n}\n\n/**\n * A run of calls to one tool, under one frame, indented to the message column. The rows\n * inside are the same cards the tool renders on its own; the group only takes\n * their border, so each call still opens and closes by itself. A run holding an image,\n * a video or an App opens, so merging never hides what a call showed.\n */\nfunction ToolGroupRow({\n  name,\n  entries,\n  slotProps,\n  statuses,\n}: {\n  name: string;\n  entries: readonly ToolEntry[];\n  slotProps: WebPluginSlotProps;\n  statuses: Readonly<Record<string, string>>;\n}) {\n  const visual = useMemo(() => entries.some(hasVisualOutput), [entries]);\n  return (\n    <div data-testid=\"entry-tool-row\" data-tool-presentation=\"tool\" className=\"min-w-0 sm:pl-12\">\n      <MessageItemGroup\n        // A visual arriving after the group mounted (a streamed call's result) opens it: the key remounts it expanded.\n        key={visual ? 'visual' : 'plain'}\n        data-testid=\"entry-tool-group\"\n        data-tool-name={name}\n        data-tool-count={entries.length}\n        tone={groupTone(entries)}\n        title={name}\n        summary={`· ${groupSummary(entries)}`}\n        defaultExpanded={visual}\n        className=\"min-w-0\"\n      >\n        {entries.map((entry) => (\n          <ToolCard key={entry.id} entry={entry} slotProps={slotProps} statuses={statuses} />\n        ))}\n      </MessageItemGroup>\n    </div>\n  );\n}\ninterface EntryProps {\n  entry: TimelineEntry;\n  onFileLink: MessageFileLinkHandler;\n  pluginActions: UserMessageActions;\n  sessionId: string | null;\n  sessionIdentity: ProfileIdentity | null;\n  profilePageId?: string;\n  sessionStreaming: boolean;\n  runtimeActionsDisabled: boolean;\n  canInteract: boolean;\n  slotProps: WebPluginSlotProps;\n  toolStatuses: Readonly<Record<string, string>>;\n  /** A grid card or thread fold: prose drops from the conversation's 15px to 13px. */\n  compact: boolean;\n  /** A child run's thread, whose inputs came from whoever drove the run rather than the reader. */\n  childThread: boolean;\n  showThinking: boolean;\n  suppressOutputs?: boolean;\n  /** A narrow column (the dock, the phone sheet): the person's bubble drops below their avatar and takes the full width. */\n  stacked?: boolean;\n}\n\nconst Entry = memo(function Entry({\n  entry,\n  onFileLink,\n  pluginActions,\n  sessionId,\n  sessionIdentity,\n  profilePageId,\n  sessionStreaming,\n  runtimeActionsDisabled,\n  canInteract,\n  slotProps,\n  toolStatuses,\n  compact,\n  childThread,\n  showThinking,\n  suppressOutputs,\n  stacked = false,\n}: EntryProps) {\n  const t = useT();\n  const quoteSource = useRef<HTMLDivElement>(null);\n  const quoteMessage = (text: string): void => {\n    const selection = window.getSelection();\n    const source = quoteSource.current;\n    const selected =\n      source !== null &&\n      selection !== null &&\n      !selection.isCollapsed &&\n      selection.anchorNode !== null &&\n      selection.focusNode !== null &&\n      source.contains(selection.anchorNode) &&\n      source.contains(selection.focusNode)\n        ? selection.toString()\n        : text;\n    const caret = appendComposerQuote(sessionId, selected);\n    if (caret !== null) requestAnimationFrame(() => focusPrompt(caret));\n  };\n\n  if (entry.kind === 'user') {\n    const senderLabel =\n      entry.sender?.name ??\n      (childThread ? t('webDashboard.session.senderNotRecorded', 'Sender not recorded') : undefined);\n    // The composer's notes tell the agent where attachments are saved; the reader sees the attachments instead.\n    const parts = userMessageParts(entry.text, (entry.images?.length ?? 0) > 0);\n    return (\n      <div\n        data-testid=\"entry-user\"\n        data-pending={entry.pending ? 'true' : undefined}\n        className={`group/message flex ${stacked ? 'flex-col items-end gap-1.5' : 'flex-row-reverse items-start gap-3'}`}\n      >\n        <SpeakerAvatar speaker=\"user\" sender={entry.sender} sessionId={sessionId} unattributed={childThread} />\n        {/* Mirrored and shrink-wrapped, so who spoke reads at a glance; stacked, the bubble gets the whole column. */}\n        <div className={stacked ? 'relative w-full min-w-0' : 'relative min-w-0 max-w-4/5'}>\n          {senderLabel ? (\n            <div data-testid=\"entry-user-sender\" className=\"mb-1 truncate text-right text-sm text-po-dim\">\n              {senderLabel}\n            </div>\n          ) : null}\n          <div\n            ref={quoteSource}\n            className={`flex flex-col gap-2 rounded-lg bg-po-rail px-4 py-3 leading-relaxed break-words text-po-hi ${compact ? 'text-base' : 'text-lg'}`}\n          >\n            <div className=\"flex items-start gap-4\">\n              <div className=\"min-w-0 flex-1\">\n                {parts.text ? (\n                  <MessageMarkdown\n                    sessionId={sessionId}\n                    slotProps={slotProps}\n                    onFileLink={onFileLink}\n                    text={parts.text}\n                  />\n                ) : null}\n              </div>\n              <MessageTime timestamp={entry.timestamp} />\n            </div>\n            <UserAttachments images={entry.images ?? NO_IMAGES} files={parts.files} />\n            {sessionId ? (\n              <MentionPreviews sessionId={sessionId} mentions={parseFileMentions(entry.text)} onFileLink={onFileLink} />\n            ) : null}\n          </div>\n          <MessageActions\n            actions={pluginActions}\n            visible={canInteract && !entry.pending}\n            disabled={sessionStreaming}\n            actionsDisabled={runtimeActionsDisabled}\n            onQuote={() => quoteMessage(parts.text)}\n            onRewind={() => rewindToMessage(entry.id, sessionId)}\n            userMessage={\n              sessionId !== null && entry.text.trim().length > 0\n                ? { sessionId, messageId: entry.id, text: entry.text }\n                : undefined\n            }\n          />\n        </div>\n      </div>\n    );\n  }\n\n  if (entry.kind === 'assistant') {\n    const time = entry.streaming ? null : <MessageTime timestamp={entry.timestamp} />;\n    const identity = entry.identity ?? sessionIdentity;\n    const face = <SpeakerAvatar speaker=\"assistant\" identity={identity} />;\n    const openProfileLabel = t('webDashboard.session.openProfile', 'Open profile for {name}', {\n      name: identity?.name ?? identity?.profile ?? '',\n    });\n    const avatar =\n      profilePageId && identity?.profile ? (\n        <Link\n          to=\"/page/$pageId\"\n          params={{ pageId: profilePageId }}\n          search={{ item: identity.profile, workspace: slotProps.sessionContext?.workspaceId }}\n          aria-label={openProfileLabel}\n          title={openProfileLabel}\n          className=\"shrink-0 rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-po-blue\"\n        >\n          {face}\n        </Link>\n      ) : (\n        face\n      );\n    return (\n      <div\n        data-testid=\"entry-assistant\"\n        data-streaming={entry.streaming}\n        className={`group/message flex ${stacked ? 'flex-col gap-1.5' : 'items-start gap-3'}`}\n      >\n        {/* Stacked, the avatar and time head the reply so the words get the whole column. */}\n        {stacked ? (\n          <div className=\"flex items-center justify-between gap-3\">\n            {avatar}\n            {time}\n          </div>\n        ) : (\n          avatar\n        )}\n        <div className=\"relative min-w-0 flex-1\">\n          <div className={`flex items-start gap-4 px-1 ${stacked ? '' : 'pt-1.5'}`}>\n            <div className=\"flex min-w-0 flex-1 flex-col gap-2\">\n              {showThinking && entry.thinking ? (\n                <div\n                  data-testid=\"entry-thinking\"\n                  // Thinking stays quiet and neutral, even when its Markdown source\n                  // uses strong emphasis for status updates.\n                  className={`font-normal text-po-dim [&_p]:whitespace-pre-wrap [&_strong]:font-normal [&_strong]:text-po-dim ${compact ? 'text-sm' : 'text-base'}`}\n                >\n                  <MessageMarkdown\n                    sessionId={sessionId}\n                    slotProps={slotProps}\n                    onFileLink={onFileLink}\n                    text={entry.thinking}\n                  />\n                </div>\n              ) : null}\n              <div\n                ref={quoteSource}\n                data-testid=\"entry-text\"\n                className={`leading-relaxed break-words text-po-text ${compact ? 'text-base' : 'text-lg'}`}\n              >\n                <MessageMarkdown\n                  sessionId={sessionId}\n                  slotProps={slotProps}\n                  onFileLink={onFileLink}\n                  text={entry.text}\n                />\n                {entry.streaming ? <StreamCursor /> : null}\n              </div>\n            </div>\n            {stacked ? null : time}\n          </div>\n          <MessageActions\n            actions={pluginActions}\n            visible={canInteract}\n            disabled={sessionStreaming}\n            actionsDisabled={runtimeActionsDisabled}\n            onQuote={() => quoteMessage(entry.text)}\n            onRewind={() => rewindToMessage(entry.id, sessionId)}\n          />\n        </div>\n      </div>\n    );\n  }\n\n  if (entry.kind === 'tool')\n    return (\n      <ToolEntryRow entry={entry} slotProps={slotProps} statuses={toolStatuses} suppressOutputs={suppressOutputs} />\n    );\n\n  if (entry.kind === 'intercom') {\n    const chip =\n      entry.intent === 'ask'\n        ? {\n            text: t('webDashboard.session.intercomAsked', 'Asked you'),\n            className: 'bg-po-tint-magenta text-po-magenta',\n          }\n        : entry.intent === 'reply'\n          ? { text: t('webDashboard.session.intercomReplied', 'Replied'), className: 'bg-po-tint-green text-po-green' }\n          : null;\n    if (entry.intent === 'no_reply') {\n      return (\n        <div data-testid=\"entry-intercom\" data-intent=\"no_reply\" className=\"flex items-center gap-3\">\n          <AgentAvatar name={entry.name} seed={entry.seed} />\n          <span className=\"flex min-w-0 flex-1 items-center gap-2 text-base text-po-dim\">\n            <span aria-hidden className=\"size-2 shrink-0 rounded-full bg-po-yellow\" />\n            {t('webDashboard.session.intercomNoReply', '{name} did not reply', { name: entry.name })}\n          </span>\n          <MessageTime timestamp={entry.timestamp} />\n        </div>\n      );\n    }\n    return (\n      <div data-testid=\"entry-intercom\" data-intent={entry.intent} className=\"flex items-start gap-3\">\n        <AgentAvatar name={entry.name} seed={entry.seed} />\n        <div className=\"min-w-0 max-w-4/5 rounded-lg bg-po-rail px-4 py-3\">\n          <div className=\"mb-1 flex flex-wrap items-center gap-x-2 gap-y-1\">\n            <span className=\"text-base font-semibold text-po-hi\">{entry.name}</span>\n            {entry.role ? <span className=\"text-sm text-po-dim\">{entry.role}</span> : null}\n            {chip ? <span className={`rounded-full px-2 py-0.5 text-sm ${chip.className}`}>{chip.text}</span> : null}\n          </div>\n          <div className=\"flex items-start gap-4\">\n            <div\n              className={`min-w-0 flex-1 leading-relaxed break-words text-po-hi ${compact ? 'text-base' : 'text-lg'}`}\n            >\n              <MessageMarkdown sessionId={sessionId} slotProps={slotProps} onFileLink={onFileLink} text={entry.text} />\n            </div>\n            <MessageTime timestamp={entry.timestamp} />\n          </div>\n        </div>\n      </div>\n    );\n  }\n\n  if (entry.kind === 'settled') {\n    return (\n      <div data-testid=\"entry-settled\" className=\"flex items-center gap-3 sm:pl-12\">\n        <Separator className=\"flex-1\" />\n        <span className=\"text-sm text-po-dim\">\n          {t('webDashboard.session.agentSettled', 'Agent settled')}\n          {entry.tools > 0\n            ? ` · ${\n                entry.tools === 1\n                  ? t('webDashboard.session.toolCountOne', '{count} tool', { count: entry.tools })\n                  : t('webDashboard.session.toolCountOther', '{count} tools', { count: entry.tools })\n              }`\n            : ''}\n        </span>\n        <Separator className=\"flex-1\" />\n      </div>\n    );\n  }\n\n  if (entry.kind === 'queued') return null;\n  // A notice: Po's own aside (a runner's exit, a mode switch, a refusal). It reads as a quiet meta line in the\n  // message column, below the conversation's weight; only an error turns red.\n  const isError = entry.tone === 'error';\n  return (\n    <div data-testid=\"entry-notice\" data-tone={entry.tone} className=\"sm:pl-12\">\n      <div className=\"flex items-start gap-4 px-1\">\n        <div className={`flex min-w-0 flex-1 items-start gap-2 text-sm ${isError ? 'text-po-red' : 'text-po-dim'}`}>\n          {isError ? (\n            <span aria-hidden className=\"flex h-5 shrink-0 items-center\">\n              <AlertIcon className=\"size-3.5\" />\n            </span>\n          ) : null}\n          <p className=\"min-w-0 flex-1 whitespace-pre-wrap break-words\">\n            {entry.text.split(/(\\s+)/u).map((part, index) => {\n              const href = noticeHref(part);\n              return (\n                <Fragment key={index}>\n                  {href === null ? (\n                    part\n                  ) : (\n                    <a href={href} target=\"_blank\" rel=\"noopener noreferrer\" className=\"underline underline-offset-2\">\n                      {part}\n                    </a>\n                  )}\n                </Fragment>\n              );\n            })}\n          </p>\n        </div>\n        <MessageTime timestamp={entry.timestamp} />\n      </div>\n    </div>\n  );\n}, entriesEqual);\n\nfunction entriesEqual(previous: EntryProps, next: EntryProps): boolean {\n  if (\n    previous.entry !== next.entry ||\n    previous.sessionId !== next.sessionId ||\n    previous.compact !== next.compact ||\n    previous.stacked !== next.stacked ||\n    previous.childThread !== next.childThread ||\n    previous.canInteract !== next.canInteract\n  )\n    return false;\n  if (next.entry.kind === 'tool') {\n    return previous.slotProps === next.slotProps && previous.toolStatuses === next.toolStatuses;\n  }\n  if (next.entry.kind === 'user') {\n    return (\n      previous.onFileLink === next.onFileLink &&\n      previous.pluginActions === next.pluginActions &&\n      previous.sessionStreaming === next.sessionStreaming &&\n      previous.runtimeActionsDisabled === next.runtimeActionsDisabled\n    );\n  }\n  if (next.entry.kind === 'assistant') {\n    return (\n      previous.onFileLink === next.onFileLink &&\n      previous.sessionIdentity === next.sessionIdentity &&\n      previous.profilePageId === next.profilePageId &&\n      previous.slotProps.sessionContext?.workspaceId === next.slotProps.sessionContext?.workspaceId &&\n      previous.sessionStreaming === next.sessionStreaming &&\n      previous.runtimeActionsDisabled === next.runtimeActionsDisabled\n    );\n  }\n  return true;\n}\n\nfunction BackgroundWorkNotice() {\n  const t = useT();\n  return (\n    <output data-testid=\"background-work-notice\" className=\"mt-auto flex shrink-0 justify-center px-3 pt-2 pb-3\">\n      <span className=\"max-w-lg rounded-md border border-po-yellow/40 bg-po-panel px-3 py-2 text-center text-sm leading-relaxed text-po-yellow\">\n        {t(\n          'webDashboard.session.backgroundWorkRunning',\n          'Background work is still running. The agent will resume when results are ready.',\n        )}\n      </span>\n    </output>\n  );\n}\n\n/**\n * One transcript, whichever fold it reads: the focused session's own, or a\n * thread of it. Owns the scroll pinning; the caller owns the empty state and\n * the session the entries' tool cards act on.\n *\n * `limit` and `compact` are for a fold that is not a whole surface, such as a\n * grid card: only the newest entries, drawn tighter, with no history paging\n * and no jump control, because a card is a glance and not a place to read.\n */\nexport interface TranscriptTurnRenderProps {\n  turn: Extract<TranscriptTurnRow, { kind: 'turn' }>;\n  sessionId: string | null;\n  slotProps: WebPluginSlotProps;\n  statuses: Readonly<Record<string, string>>;\n  renderEntry: (entry: TimelineEntry, options?: { suppressOutputs?: boolean }) => ReactNode;\n  /** A narrow column: entries stack under their avatar, so a turn layout should drop its avatar-column indent too. */\n  dense?: boolean;\n}\n\nexport function Transcript({\n  store,\n  sessionId,\n  historyKey = sessionId,\n  empty,\n  testId = 'timeline',\n  backgroundWorkActive = false,\n  runtimeActionsDisabled = false,\n  limit,\n  compact = false,\n  dense = false,\n  childThread = false,\n  showThinking = true,\n  renderTurn: Turn,\n  scrollerClassName,\n}: {\n  store: Store<SessionState>;\n  sessionId: string | null;\n  historyKey?: string | null;\n  empty: ReactNode;\n  testId?: string;\n  backgroundWorkActive?: boolean;\n  runtimeActionsDisabled?: boolean;\n  limit?: number;\n  compact?: boolean;\n  /**\n   * Compact type and spacing for a narrow column, such as the dock, while it\n   * stays a whole transcript: paging, the jump button and saved scroll still follow `compact`.\n   */\n  dense?: boolean;\n  /** A child run's thread: an input without a recorded sender is not the reader's, so it is not labelled \"You\". */\n  childThread?: boolean;\n  /** Presentation only: never changes the stored transcript or the model's input. */\n  showThinking?: boolean;\n  /** Opt-in turn layout. Unattributed/legacy entries keep the existing renderer. */\n  renderTurn?: ComponentType<TranscriptTurnRenderProps>;\n  /** Merged onto the scrolling element, so a layout can let it span the window and centre the column with padding. */\n  scrollerClassName?: string;\n}) {\n  'use no memo';\n  const t = useT();\n  const entries = useStore(store, (state) => state.entries);\n  const hasNewerHistory = useStore(store, (state) => state.hasNewerHistory);\n  const pendingSteers = useStore(store, (state) => state.pendingSteers);\n  // Pi's protocol transcript carries no persona, and a history window taken from\n  // the middle of a session carries no identity entry either, so an entry from\n  // those paths has no stamp of its own. The fold's current persona is the honest\n  // answer for one of them, and it corrects itself when the identity lands late,\n  // which a stamp written at merge time cannot do.\n  const sessionIdentity = useStore(store, (state) => state.profileIdentity);\n  // The transcript's own session, not the focused one: a background session window\n  // must not show the focused session's spinner or tool statuses.\n  const sessionStreaming = useStore(sessionStoreFor(sessionId), (state) => state.streaming);\n  const toolStatuses = useStore(sessionStoreFor(sessionId), (state) => state.statuses);\n  const resolveFileLink = useFileLinks(sessionId);\n  const openTab = useOpenTab();\n  const registryRevision = useWebPluginRegistry();\n  const slotProps = usePluginSlotProps(sessionId);\n  const hostId = sessionId === null ? undefined : splitHostId(sessionId)?.hostId;\n  const pages =\n    hostId === undefined\n      ? hostSlotFills(HOST_SLOTS.page)\n      : webPluginRegistryForHost(hostId).hostSlotFills(HOST_SLOTS.page);\n  const profilePageId =\n    sessionId !== null && pages.some((fill) => fill.id === 'profiles' && fill.component)\n      ? hostId === undefined\n        ? 'profiles'\n        : qualifyHostId(hostId, 'profiles')\n      : undefined;\n  const canInteract = useStore(\n    sessionsStore,\n    (state) => sessionId !== null && state.byId[sessionId]?.canInteract === true,\n  );\n  const pluginActions = useMemo(() => {\n    void registryRevision;\n    return pluginUserMessageActions();\n  }, [registryRevision]);\n  const onFileLink = useCallback<MessageFileLinkHandler>(\n    (label, explicit = false) => {\n      if (sessionId === null) return undefined;\n      const tab = explicit ? fileTabForPath(sessionId, label) : resolveFileLink(label);\n      if (tab === undefined) return undefined;\n      return () => {\n        openTransientTab(sessionId, tab);\n        openTab(tab.id);\n      };\n    },\n    [openTab, resolveFileLink, sessionId],\n  );\n  const visibleEntries = useMemo(() => {\n    const shown = entries.filter((entry) => entry.kind !== 'queued');\n    // In-flight steers sit at the live tail, so a window scrolled back into history leaves them out.\n    const withSteers = hasNewerHistory || pendingSteers.length === 0 ? shown : [...shown, ...pendingSteers];\n    return limit === undefined ? withSteers : withSteers.slice(-limit);\n  }, [entries, hasNewerHistory, limit, pendingSteers]);\n  // A tool that presents itself as a message has no frame to share, so only\n  // the card-shaped ones are gathered into runs.\n  const units = useMemo(() => {\n    void registryRevision;\n    if (Turn)\n      return responseTurns(transcriptTurns(visibleEntries), sessionStreaming).map((row) =>\n        row.kind === 'entry' ? { kind: 'single' as const, entry: row.entry, index: 0 } : row,\n      );\n    return timelineUnits(\n      visibleEntries,\n      (name) => (pluginToolRenderer(name, toolStatuses)?.timelinePresentation ?? 'tool') === 'tool',\n    );\n  }, [Turn, registryRevision, sessionStreaming, toolStatuses, visibleEntries]);\n  const scroller = useRef<HTMLDivElement>(null);\n  const unitKey = useCallback(\n    (index: number): string => {\n      const unit = units[index]!;\n      return unit.kind === 'turn'\n        ? unit.id\n        : unit.kind === 'group'\n          ? `group-${unit.entries[0]?.id ?? ''}`\n          : unit.entry.id;\n    },\n    [units],\n  );\n  // This component opts out of compiler memoization because the virtualizer is mutable.\n  // oxlint-disable-next-line react/incompatible-library\n  const virtualizer = useVirtualizer({\n    count: units.length,\n    getScrollElement: () => scroller.current,\n    estimateSize: () => 80,\n    overscan: 8,\n    getItemKey: unitKey,\n    initialRect: { width: 0, height: 800 },\n  });\n  // Rows start at the 80px estimate and grow once measured. The layout effect\n  // watches this so a measured row is followed like a new one.\n  const totalSize = virtualizer.getTotalSize();\n  // The transcript's height as of the last entry. Whether to follow the newest\n  // line is decided against this rather than against a scroll event, because\n  // an event fires after the fact and a fast run can grow the transcript\n  // before the browser has reported the reader's scroll.\n  const lastHeight = useRef(0);\n  const lastLayoutEntries = useRef(visibleEntries);\n  const following = useRef(true);\n  const [unread, setUnread] = useState(false);\n  // Where the bottom of the transcript sat before a window was prepended.\n  // Restoring against this is what keeps the reader's place: prepending grows\n  // the scroll height above them, and the browser would otherwise leave the\n  // viewport where it was and the content would appear to jump.\n  const anchor = useRef<{ key: string; offset: number } | null>(null);\n  // The first entry's key. A window prepended above the reader changes it, and\n  // nothing else does: an entry arriving at the bottom, or the streaming one\n  // growing, leaves the top of the transcript alone. That is the difference\n  // between holding the reader's place and refusing to follow a live run.\n  const firstId = useRef<string | null>(null);\n\n  const atBottom = (element: HTMLDivElement, height: number): boolean =>\n    element.scrollTop + element.clientHeight >= height - PINNED_THRESHOLD_PX;\n\n  const followLatest = (): void => {\n    const element = scroller.current;\n    if (!element || !following.current) return;\n    element.scrollTop = Math.max(0, element.scrollHeight - element.clientHeight);\n    setUnread(false);\n  };\n\n  const jumpToLatest = (): void => {\n    following.current = true;\n    setUnread(false);\n    if (!requestLatestHistory(historyKey)) followLatest();\n  };\n\n  /** Reaching the bottom by hand is the same as never having left it. */\n  const onScroll = (): void => {\n    const element = scroller.current;\n    if (!element) return;\n    const bottom = atBottom(element, element.scrollHeight);\n    following.current = bottom;\n    if (!compact) savedScroll.set(store, bottom ? null : element.scrollTop);\n    if (bottom) setUnread(false);\n    // A compact fold shows a fixed tail of a live thread; asking for the\n    // window above it would page history nobody can read there.\n    if (\n      !compact &&\n      ((element.scrollTop <= PAGE_BACK_THRESHOLD_PX && requestOlderHistory(historyKey)) ||\n        (bottom && requestNewerHistory(historyKey)))\n    ) {\n      following.current = false;\n      const item = virtualizer.getVirtualItems().find((candidate) => candidate.end > element.scrollTop);\n      if (item) anchor.current = { key: String(item.key), offset: element.scrollTop - item.start };\n    }\n  };\n\n  /** Wheel input is explicit intent to leave the live tail. */\n  const onWheel = (): void => {\n    following.current = false;\n  };\n\n  // A different fold starts at the bottom of its transcript. The unread badge\n  // is cleared during render so the new fold never paints the old fold's badge;\n  // the scroll bookkeeping stays in the layout effect, where refs belong.\n  const [shownStore, setShownStore] = useState(store);\n  if (shownStore !== store) {\n    setShownStore(store);\n    setUnread(false);\n  }\n  useLayoutEffect(() => {\n    lastHeight.current = 0;\n    firstId.current = null;\n    anchor.current = null;\n    following.current = true;\n  }, [store]);\n\n  useLayoutEffect(() => {\n    const element = scroller.current;\n    if (!element) return;\n    const entriesChanged = lastLayoutEntries.current !== visibleEntries;\n    lastLayoutEntries.current = visibleEntries;\n    // Registry/status regrouping can resize unchanged entries. A no-op regroup\n    // must not manufacture unread activity for someone reading older content.\n    if (!entriesChanged && element.scrollHeight === lastHeight.current) return;\n    // A prepended window grew the transcript upwards; hold the reader where\n    // they were by moving down by exactly what appeared above them.\n    const held = anchor.current;\n    const prepended =\n      visibleEntries.length > 0 && firstId.current !== null && visibleEntries[0]?.id !== firstId.current;\n    firstId.current = visibleEntries[0]?.id ?? null;\n    if (held !== null && prepended) {\n      anchor.current = null;\n      const index = units.findIndex((_unit, position) => unitKey(position) === held.key);\n      if (index >= 0) {\n        const offset = virtualizer.getOffsetForIndex(index, 'start')?.[0];\n        if (offset !== undefined) element.scrollTop = offset + held.offset;\n        lastHeight.current = element.scrollHeight;\n        return;\n      }\n    }\n    // The first layout and later streaming growth pin directly to the live tail.\n    // Repeated easing fights the changing target and makes token streaming jitter.\n    if (lastHeight.current === 0) {\n      const saved = compact ? null : savedScroll.get(store);\n      element.scrollTop = saved ?? element.scrollHeight;\n      lastHeight.current = element.scrollHeight;\n      following.current = saved === undefined || saved === null;\n      setUnread(false);\n      return;\n    }\n    // Measuring a row the estimate got wrong grows the transcript with nothing\n    // new in it. A reader sitting on the old bottom stays on the bottom, and\n    // nobody else is told there is new activity, because there is none.\n    if (!entriesChanged) {\n      const pinned = element.scrollTop + element.clientHeight >= lastHeight.current - 1;\n      lastHeight.current = element.scrollHeight;\n      if (pinned) {\n        following.current = true;\n        followLatest();\n      }\n      return;\n    }\n    const shouldFollow = following.current || atBottom(element, lastHeight.current);\n    lastHeight.current = element.scrollHeight;\n    if (shouldFollow) {\n      following.current = true;\n      setUnread(false);\n      followLatest();\n      return;\n    }\n    setUnread(true);\n  }, [units, visibleEntries, virtualizer, unitKey, totalSize]);\n\n  const renderEntry: TranscriptTurnRenderProps['renderEntry'] = (entry, options) => (\n    <Entry\n      key={entry.id}\n      entry={entry}\n      onFileLink={onFileLink}\n      pluginActions={pluginActions}\n      sessionId={sessionId}\n      sessionIdentity={sessionIdentity}\n      profilePageId={profilePageId}\n      sessionStreaming={sessionStreaming}\n      runtimeActionsDisabled={runtimeActionsDisabled}\n      canInteract={canInteract}\n      slotProps={slotProps}\n      toolStatuses={toolStatuses}\n      compact={compact || dense}\n      childThread={childThread}\n      showThinking={showThinking}\n      suppressOutputs={options?.suppressOutputs}\n      stacked={dense}\n    />\n  );\n  if (visibleEntries.length === 0) {\n    return (\n      <div className=\"relative flex min-h-0 flex-1 flex-col overflow-y-auto\">\n        {empty}\n        {backgroundWorkActive ? <BackgroundWorkNotice /> : null}\n      </div>\n    );\n  }\n\n  return (\n    <ImageRefScope value={historyKey ?? null}>\n      <div className=\"relative flex min-h-0 flex-1 flex-col\">\n        <div\n          ref={scroller}\n          onScroll={onScroll}\n          onWheel={onWheel}\n          data-testid={testId}\n          className={cn(\n            compact || dense ? 'flex-1 overflow-y-auto px-2.5 py-2' : 'flex-1 overflow-y-auto px-2 py-4 sm:py-5',\n            // A narrow column never scrolls sideways; wide blocks such as code scroll inside themselves.\n            dense && 'overflow-x-hidden',\n            scrollerClassName,\n          )}\n        >\n          <div style={{ height: totalSize, position: 'relative', width: '100%' }}>\n            {virtualizer.getVirtualItems().map((row) => {\n              const unit = units[row.index]!;\n              return (\n                <div\n                  key={row.key}\n                  data-index={row.index}\n                  ref={virtualizer.measureElement}\n                  style={{\n                    position: 'absolute',\n                    top: 0,\n                    left: 0,\n                    width: '100%',\n                    transform: `translateY(${row.start}px)`,\n                    paddingBottom: compact || dense ? 8 : 20,\n                  }}\n                >\n                  {unit.kind === 'turn' ? (\n                    Turn ? (\n                      <Turn\n                        turn={unit}\n                        sessionId={sessionId}\n                        slotProps={slotProps}\n                        statuses={toolStatuses}\n                        renderEntry={renderEntry}\n                        dense={dense}\n                      />\n                    ) : null\n                  ) : unit.kind === 'group' ? (\n                    <ToolGroupRow\n                      name={unit.name}\n                      entries={unit.entries}\n                      slotProps={slotProps}\n                      statuses={toolStatuses}\n                    />\n                  ) : (\n                    renderEntry(unit.entry)\n                  )}\n                </div>\n              );\n            })}\n          </div>\n          {backgroundWorkActive ? <BackgroundWorkNotice /> : null}\n        </div>\n        {(unread || hasNewerHistory) && !compact ? (\n          <Button\n            variant=\"subtle\"\n            size=\"sm\"\n            data-testid=\"timeline-jump\"\n            onClick={jumpToLatest}\n            className=\"absolute bottom-3 left-1/2 -translate-x-1/2 border border-po-border shadow-lg animate-po-rise\"\n          >\n            <ChevronDownIcon className=\"h-3 w-3\" />\n            {t('webDashboard.session.newActivityBelow', 'New activity below')}\n          </Button>\n        ) : null}\n      </div>\n    </ImageRefScope>\n  );\n}\n\n/** The focused session's conversation, with saved history readable before wake. */\nexport function Timeline({\n  renderTurn,\n  showThinking,\n  scrollerClassName,\n  dense,\n  empty,\n}: {\n  renderTurn?: ComponentType<TranscriptTurnRenderProps>;\n  showThinking?: boolean;\n  scrollerClassName?: string;\n  /** Compact type and spacing for a narrow column such as the dock; see `Transcript`. */\n  dense?: boolean;\n  /**\n   * A template's own empty conversation for an attached session. Dormant, read-only and\n   * first-session states keep the shared ones, and a person's emptyStateRegion fill still wraps it.\n   */\n  empty?: (context: { ask: (text: string) => void; workspaceFree: boolean }) => ReactNode;\n} = {}) {\n  useRenderTrace('Timeline');\n  const t = useT();\n  const activeId = useStore(sessionsStore, (state) => state.activeId);\n  const canInteract = useStore(\n    sessionsStore,\n    (state) => state.activeId !== null && state.byId[state.activeId]?.canInteract === true,\n  );\n  const dormant = useStore(\n    sessionsStore,\n    (state) => state.activeId !== null && state.byId[state.activeId]?.summary.dormant === true,\n  );\n  const idle = useStore(\n    sessionsStore,\n    (state) => state.activeId !== null && state.byId[state.activeId]?.summary.phase === 'idle',\n  );\n  const settled = useActiveSession((state) => state.settled);\n  // Only worth saying once the agent has stopped: while it is still running the\n  // transcript already shows the work, and the notice would just be noise. The\n  // server's flag counts only awaited work, never a dev server or watcher.\n  const awaitingWork = useStore(\n    sessionsStore,\n    (state) => state.activeId !== null && state.byId[state.activeId]?.summary.backgroundWorkActive === true,\n  );\n  const backgroundWorkActive = idle && settled && awaitingWork;\n  const workspaceId = useStore(sessionsStore, (state) =>\n    state.activeId === null ? undefined : state.byId[state.activeId]?.summary.workspaceId,\n  );\n  const workspaceFree = useStore(\n    workspacesStore,\n    (state) => workspaceId !== undefined && state.byId[workspaceId]?.kind === 'session',\n  );\n  const ask = (text: string): void => void submitMessageWithAck(text);\n  // The session onboarding opened greets the person by name with their Po's starters until the first\n  // message. Turning Help mode on leaves a notice, so notices alone do not end the welcome; its badge\n  // already says Help mode is on.\n  const welcome = dormant || !canInteract ? undefined : firstSessionWelcomeFor(activeId);\n  const conversing = useActiveSession((state) =>\n    state.entries.some((entry) => entry.kind === 'user' || entry.kind === 'assistant'),\n  );\n  if (welcome && !conversing)\n    return (\n      <Region slot={HOST_SLOTS.emptyStateRegion} sessionId={activeId}>\n        <FirstSessionWelcome po={welcome.po} name={welcome.name} interests={welcome.interests} onAsk={ask} />\n      </Region>\n    );\n  return (\n    <Transcript\n      store={sessionStoreFor(activeId)}\n      sessionId={activeId}\n      runtimeActionsDisabled={dormant}\n      backgroundWorkActive={backgroundWorkActive}\n      renderTurn={renderTurn}\n      scrollerClassName={scrollerClassName}\n      showThinking={showThinking}\n      dense={dense}\n      empty={\n        // A person's own package may wrap or replace the empty conversation in every template.\n        <Region slot={HOST_SLOTS.emptyStateRegion} sessionId={activeId}>\n          {empty && canInteract && !dormant ? (\n            empty({ ask, workspaceFree })\n          ) : (\n            <EmptyState\n              data-testid=\"timeline\"\n              size=\"page\"\n              icon={<MessageIcon />}\n              title={t('webDashboard.session.noMessagesYet', 'No messages yet')}\n              description={\n                !canInteract\n                  ? undefined\n                  : dormant\n                    ? // The composer's stopped-session panel already offers Wake session, the view's one primary.\n                      t(\n                        'webDashboard.session.emptyDormant',\n                        'There is no saved conversation to show yet. Wake the session below to start the agent again.',\n                      )\n                    : t(\n                        'webDashboard.session.emptyAttached',\n                        'This session is attached and waiting. Anything you send goes straight to the supervised agent.',\n                      )\n              }\n            >\n              {dormant || !canInteract ? null : (\n                <div data-testid=\"timeline-empty\" className=\"mt-2 flex w-full flex-col gap-1.5\">\n                  {(workspaceFree ? workspaceFreeSuggestions(t) : suggestions(t)).map((suggestion, index) => (\n                    <Button\n                      key={suggestion}\n                      variant=\"outline\"\n                      size=\"lg\"\n                      data-testid={`suggestion-${index}`}\n                      onClick={() => ask(suggestion)}\n                      className=\"h-auto justify-between bg-po-panel px-3 py-2 text-left font-normal text-po-text\"\n                    >\n                      <span className=\"flex-1 truncate\">{suggestion}</span>\n                      <ExternalLinkIcon className=\"h-3 w-3 shrink-0 text-po-faint\" />\n                    </Button>\n                  ))}\n                </div>\n              )}\n            </EmptyState>\n          )}\n        </Region>\n      }\n    />\n  );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,8BAAc,IAAI,QAA+B;AAqDvD,MAAM,eAAe,MAA2B;CAC9C,EAAE,6CAA6C,gDAAgD;CAC/F,EAAE,6CAA6C,iDAAiD;CAChG,EAAE,gDAAgD,gDAAgD;AACpG;;AAEA,MAAM,4BAA4B,MAA2B;CAC3D,EAAE,6CAA6C,iCAAiC;CAChF,EAAE,2CAA2C,8CAA8C;CAC3F,EAAE,+CAA+C,mCAAmC;AACtF;;AAGA,MAAM,sBAAsB;;AAE5B,MAAM,yBAAyB;;;;;;;;;;AAW/B,SAAS,WAAW,MAA6B;CAC/C,IAAI,MAAM,KAAK,IAAI,KAAK,CAAC,gBAAgB,KAAK,IAAI,GAAG,OAAO;CAE5D,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,IAAI;EACxB,IAAK,IAAI,aAAa,WAAW,IAAI,aAAa,YAAa,CAAC,IAAI,QAAQ,IAAI,YAAY,IAAI,UAC9F,OAAO;EAET,OAAO,IAAI;CACb,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,SAAS,cAAc,EACrB,SACA,UACA,QACA,WACA,eAAe,SASd;CACD,MAAM,IAAI,KAAK;CACf,MAAM,YAAY,QAAQ,SAAS,UAAU,OAAO,KAAK,KAAA;CACzD,MAAM,CAAC,SAAS,cAAc,SAAgE;CAC9F,gBAAgB;EACd,IAAI,CAAC,aAAa,CAAC,WAAW;EAC9B,IAAI,OAAO;EACX,IAAI,QAA6B;EACjC,sBAA2B,WAAW,SAAS,CAAC,CAAC,MAC9C,WAAW;GACV,IAAI,CAAC,M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