@athenaintel/react 0.23.1 → 0.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/chat/AthenaChat.cjs +3 -10
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +5 -3
- package/dist/chat/AthenaChat.js +3 -10
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/packages/react/package.json.cjs +1 -1
- package/dist/packages/react/package.json.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -459,6 +459,10 @@ Both use the same bearer / API key as session creation. The full recipe
|
|
|
459
459
|
template skill `voice-session-guide.md`. `createAthenaVoiceSession` is also
|
|
460
460
|
exported if you hold the bridge state yourself.
|
|
461
461
|
|
|
462
|
+
## What's new in 0.23.2
|
|
463
|
+
|
|
464
|
+
- Assistant turns no longer draw the grey vertical rule down their left edge. `AthenaChat` renders the lead column only when the host passes an `AvatarComponent`; without one the reply sits flush with the thread column and is told apart from the right-aligned user bubbles by alignment alone.
|
|
465
|
+
|
|
462
466
|
## What's new in 0.23.1
|
|
463
467
|
|
|
464
468
|
- Hotfix: 0.23.0 crashed `AthenaChat` on mount in published apps ("The chat hit an error", `Cannot read properties of undefined (reading 'status')`). The message-window hook shipped in 0.23.0 reads `connection` from the statewire extras, which exists in `@assistant-ui/react-statewire` 0.29 / `statewire` 0.19 — the versions the monorepo resolves and tests against — but the package still pinned 0.28.1 / 0.18.2 for consumers. The pins now match the tested versions, and a test fails the build if they drift again.
|
|
@@ -1151,7 +1155,7 @@ Hosts that already run **Tailwind v4** (like the athena-app template) may instea
|
|
|
1151
1155
|
|
|
1152
1156
|
Importing `styles.css` alongside a host Tailwind build is harmless (utilities are identical and layered). One caveat for themed Tailwind hosts: token values set on the `.athena-sdk` element shadow values inherited from `:root`, so define your app's token overrides on `.athena-sdk` too (`:root, .athena-sdk { --primary: …; }`) — or use the `theme` prop below, which always wins.
|
|
1153
1157
|
|
|
1154
|
-
The thread's reading column defaults to a 46rem measure (set it with `<AthenaChat maxWidth>`; the chat passes that value to the thread, so the `threadMaxWidth` theme token does not reach it), 15px body text on a relaxed leading, and the `--font-sans` stack (`Inter, ui-sans-serif, system-ui, …` — a stack only, the SDK downloads no webfont). Override the face with `theme.fontFamily`, or `.athena-sdk { --font-sans: …; }`. Assistant turns
|
|
1158
|
+
The thread's reading column defaults to a 46rem measure (set it with `<AthenaChat maxWidth>`; the chat passes that value to the thread, so the `threadMaxWidth` theme token does not reach it), 15px body text on a relaxed leading, and the `--font-sans` stack (`Inter, ui-sans-serif, system-ui, …` — a stack only, the SDK downloads no webfont). Override the face with `theme.fontFamily`, or `.athena-sdk { --font-sans: …; }`. Assistant turns sit flush with the column and carry no leading rule (pass `components.AssistantAvatar` to add a lead column); every message shows its time on hover beside its action bar, and a day separator marks the first message of a new calendar day.
|
|
1155
1159
|
|
|
1156
1160
|
## Theming
|
|
1157
1161
|
|
package/dist/chat/AthenaChat.cjs
CHANGED
|
@@ -706,21 +706,14 @@ const AthenaAssistantMessage = ({
|
|
|
706
706
|
children: [
|
|
707
707
|
/* @__PURE__ */ jsxRuntime.jsx(MessageDaySeparator, {}),
|
|
708
708
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
709
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
709
|
+
AvatarComponent ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
710
710
|
"div",
|
|
711
711
|
{
|
|
712
712
|
"data-slot": "assistant-lead",
|
|
713
713
|
className: "aui-assistant-message-lead flex shrink-0 justify-center",
|
|
714
|
-
children:
|
|
715
|
-
"span",
|
|
716
|
-
{
|
|
717
|
-
"aria-hidden": "true",
|
|
718
|
-
"data-slot": "assistant-rule",
|
|
719
|
-
className: "aui-assistant-message-rule w-0.5 self-stretch rounded-full bg-border"
|
|
720
|
-
}
|
|
721
|
-
)
|
|
714
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(AvatarComponent, {})
|
|
722
715
|
}
|
|
723
|
-
),
|
|
716
|
+
) : null,
|
|
724
717
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
725
718
|
/* @__PURE__ */ jsxRuntime.jsx(AthenaReasoningTextComponentContext.Provider, { value: TextComponent, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed", children: [
|
|
726
719
|
/* @__PURE__ */ jsxRuntime.jsx(NestedPtcMessages.NestedPtcComponentsProvider, { components: nestedPtcComponents, children: groupToolCalls ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AthenaChat.cjs","sources":["../../src/chat/AthenaChat.tsx"],"sourcesContent":["import { isGithubWakeMessage } from '@athenaintel/agent-runtime';\nimport { TiptapText } from './tiptap-text';\nimport { AthenaChatErrorBoundary } from './AthenaChatErrorBoundary';\nimport { StatewireApprovalCard } from './StatewireApprovalCard';\nimport { StatewireQueuedMessages } from './StatewireQueuedMessages';\nimport { StatewireConnectionBanner, StatewireErrorBanner } from './statewire-banners';\nimport { WaitingOnYouBanner } from './WaitingOnYouBanner';\nimport { WakeMarkerMessage } from '../chat-ui/messages/wake-marker';\nimport { ToolFallback, ToolFallbackAppearanceProvider } from '../tools/tool-fallback';\nimport { AppendDocumentToolUI } from '../tools/append-document-tool-ui';\nimport { ReadAssetToolUI } from '../tools/read-asset-tool-ui';\nimport { TOOL_UI_REGISTRY } from '../tools/tool-uis';\nimport { SuperGroupingCard, SuperGroupingFinalText } from './super-grouping/SuperGroupingCard';\nimport {\n NestedPtcComponentsProvider,\n NestedPtcMessages,\n useNestedPtcComponents,\n} from '../tools/NestedPtcMessages';\nimport { TooltipIconButton } from './tooltip-icon-button';\nimport { Button } from '../ui/button';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';\nimport { ChatComposerDock } from '../chat-ui/thread/chat-composer-dock';\nimport { ChatThreadShell } from '../chat-ui/thread/chat-thread-shell';\nimport { StatewireHistoryEdge } from '../chat-ui/thread/statewire-history-edge';\nimport { ThreadLoadingOverlay } from '../chat-ui/thread/thread-loading-overlay';\nimport { ComposerSendOrStop } from '../chat-ui/thread/composer-send-or-stop';\nimport {\n TiptapComposer,\n type ComposerFileIntake,\n type TiptapComposerHandle,\n} from '../chat-ui/composer/tiptap-composer';\nimport {\n MentionAuthCtx,\n type MentionAuthContext,\n} from '../chat-ui/mentions/suggestions/data/api-client';\nimport type { MentionRootCategory } from '../chat-ui/mentions/suggestions/data/use-mention-suggestions';\nimport type { MentionTool } from '../chat-ui/mentions/suggestions/data/types';\nimport { ACTION_BAR_REVEAL_CLASS, BranchPicker } from '../chat-ui/messages/message-components';\nimport { useMessageActionsReadOnly } from '../chat-ui/messages/message-actions-config';\nimport { useAthenaRunLive } from './use-athena-run-live';\nimport {\n AthenaChatWelcome,\n AthenaChatWelcomeSuggestions,\n DEFAULT_WELCOME_SUGGESTIONS,\n welcomeComposerDelayMs,\n welcomeEntrance,\n type WelcomeSuggestion,\n} from './athena-chat-welcome';\nimport {\n ATHENA_COMPOSER_COMPONENTS,\n AthenaComposerMentionButton,\n} from './athena-composer-controls';\nimport { ComposerKeyboardHint, useComposerKeyboardHint } from './composer-keyboard-hint';\nimport { usePrefersReducedMotion } from '../lib/use-prefers-reduced-motion';\nimport {\n ActionBarMorePrimitive,\n ActionBarPrimitive,\n AuiIf,\n ErrorPrimitive,\n MessagePrimitive,\n ThreadPrimitive,\n useAui,\n useAuiState,\n} from '@assistant-ui/react';\nimport type {\n EmptyMessagePartComponent,\n PartState,\n ReasoningMessagePartProps,\n ReasoningMessagePartComponent,\n TextMessagePartProps,\n TextMessagePartComponent,\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from '@assistant-ui/react';\nimport {\n AlertCircleIcon,\n ArrowUpIcon,\n BrainIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CopyIcon,\n DownloadIcon,\n ExternalLinkIcon,\n LayersIcon,\n MoreHorizontalIcon,\n PencilIcon,\n RefreshCwIcon,\n} from 'lucide-react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FC,\n} from 'react';\nimport {\n AthenaStatewireThreadIdContext,\n useAthenaStatewireThreadId,\n useAthenaThreadId,\n} from '../threads/thread-id-context';\nimport { FileUploadButton } from '../composer/FileUploadButton';\nimport { ComposerQuotePreview } from '../composer/ComposerQuotePreview';\nimport { ComposerAttachmentPreview } from '../composer/ComposerAttachmentPreview';\nimport { ComposerDropZone } from '../composer/ComposerDropZone';\nimport { useQuote, QuoteProvider, useQuoteFromPostMessage } from '../composer/QuoteContext';\nimport { AttachmentProvider, useAttachments } from '../composer/AttachmentContext';\nimport { buildComposedMessage } from '../composer/build-composed-message';\nimport { useAttachFiles } from '../composer/useAttachFiles';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport { createAthenaSpacesUrl } from '../lib/athena-urls';\nimport { cn, isRecord } from '../lib/utils';\nimport { getToolkitDisplayInfo } from '../toolkits';\nimport {\n RUN_ACTIVITY_COUNTER_SECONDS,\n RUN_ACTIVITY_STALL_SECONDS,\n runActivityKey,\n runActivityLabel,\n runActivityVerb,\n} from './run-activity';\nimport {\n formatDayLabel,\n formatMessageDateTime,\n formatMessageTime,\n isSameCalendarDay,\n parseMessageTime,\n readMessageCreatedAt,\n} from './message-time';\nimport { ThreadScrollToBottom } from './thread-scroll-to-bottom';\n\nfunction QuotePostMessageBridge() {\n useQuoteFromPostMessage();\n return null;\n}\n\nexport type { WelcomeSuggestion } from './athena-chat-welcome';\n\nexport interface AthenaChatProps {\n /** CSS class name for the root element. */\n className?: string;\n /** Welcome heading text. Defaults to \"Hello there!\" */\n welcomeMessage?: string;\n /** Welcome subheading text. */\n welcomeSubtext?: string;\n /**\n * Maximum width of the reading column (messages, welcome, composer).\n * Defaults to \"46rem\" — about 760 px, a comfortable measure for 15 px text.\n */\n maxWidth?: string;\n /**\n * Scroll anchoring for new turns. \"bottom\" (default) keeps the viewport\n * pinned to the end while the assistant streams — classic chat follow.\n * \"top\" pins the just-sent user message to the top of the viewport and\n * intentionally does NOT follow the streaming response (assistant-ui\n * disables autoScroll in that mode), so readers scroll at their own pace.\n */\n turnAnchor?: \"top\" | \"bottom\";\n /**\n * Marks the transcript read-only: Edit and Regenerate hide while Copy stays\n * available. For threads whose server rejects dispatch (e.g. legacy\n * pre-cutover conversations) — the runtime's static capability flags cannot\n * express a per-thread fence, so the host that knows passes it here.\n */\n readOnly?: boolean;\n /** Additional tool UIs to register by name. */\n toolUIs?: Record<string, ToolCallMessagePartComponent>;\n /** Tools / Toolkits offered by the composer's `@` menu beside the asset\n * library. Defaults to the toolkits enabled on the provider. */\n mentionTools?: MentionTool[];\n /** Suggestion cards shown on the welcome screen. Pass `[]` to hide.\n * For workflow launchers outside AthenaChat, use `useSendMessage()`.\n */\n welcomeSuggestions?: WelcomeSuggestion[];\n /** Optional component overrides for message containers and key message parts. */\n components?: AthenaChatComponents;\n /**\n * Fold a turn's tool calls into one collapsible activity group with a\n * count, the answer rendered below it. Defaults to `true`; pass `false` to\n * list every tool card inline in the order it was called.\n */\n groupToolCalls?: boolean;\n}\n\nexport interface AthenaChatMessagePartComponents {\n Text?: TextMessagePartComponent;\n Reasoning?: ReasoningMessagePartComponent;\n Empty?: EmptyMessagePartComponent;\n}\n\nexport interface AthenaChatComponents {\n UserMessage?: FC;\n AssistantMessage?: FC;\n AssistantActionBar?: FC<AthenaAssistantActionBarProps>;\n /**\n * Rendered in the leading column of every assistant turn (a small avatar or\n * mark). Without it the column holds a quiet 2 px rule.\n */\n AssistantAvatar?: FC;\n messageParts?: AthenaChatMessagePartComponents;\n}\n\nexport interface AthenaUserMessageProps {\n TextComponent?: TextMessagePartComponent;\n}\n\nexport interface AthenaAssistantActionBarProps {\n className?: string;\n}\n\nexport interface AthenaAssistantMessageProps {\n toolUIs: Record<string, ToolCallMessagePartComponent>;\n /** Leading-column content for the turn; a quiet 2 px rule when unset. */\n AvatarComponent?: FC;\n TextComponent?: TextMessagePartComponent;\n ReasoningComponent?: ReasoningMessagePartComponent;\n EmptyComponent?: EmptyMessagePartComponent;\n ActionBarComponent?: FC<AthenaAssistantActionBarProps>;\n /** Fold the turn's tool calls into one collapsible activity group. Defaults to `true`. */\n groupToolCalls?: boolean;\n}\n\nexport interface AthenaReasoningPartProps extends ReasoningMessagePartProps {\n TextComponent?: TextMessagePartComponent;\n}\n\ninterface AthenaChatDefaultComponentsContextValue {\n toolUIs: Record<string, ToolCallMessagePartComponent>;\n TextComponent: TextMessagePartComponent;\n ReasoningComponent?: ReasoningMessagePartComponent;\n EmptyComponent: EmptyMessagePartComponent;\n ActionBarComponent: FC<AthenaAssistantActionBarProps>;\n AvatarComponent?: FC;\n groupToolCalls: boolean;\n}\n\nconst AthenaChatDefaultComponentsContext =\n createContext<AthenaChatDefaultComponentsContextValue | null>(null);\n\nconst AthenaReasoningTextComponentContext = createContext<TextMessagePartComponent | null>(null);\n\nconst useAthenaChatDefaultComponents = (): AthenaChatDefaultComponentsContextValue => {\n const value = useContext(AthenaChatDefaultComponentsContext);\n\n if (!value) {\n throw new Error('Athena default chat components must be used within AthenaChat.');\n }\n\n return value;\n};\n\nconst AthenaDefaultAssistantMessage: FC = () => {\n const {\n toolUIs,\n TextComponent,\n ReasoningComponent,\n EmptyComponent,\n ActionBarComponent,\n AvatarComponent,\n groupToolCalls,\n } = useAthenaChatDefaultComponents();\n\n return (\n <AthenaAssistantMessage\n toolUIs={toolUIs}\n AvatarComponent={AvatarComponent}\n TextComponent={TextComponent}\n ReasoningComponent={ReasoningComponent}\n EmptyComponent={EmptyComponent}\n ActionBarComponent={ActionBarComponent}\n groupToolCalls={groupToolCalls}\n />\n );\n};\n\nconst AthenaDefaultUserMessage: FC = () => {\n const { TextComponent } = useAthenaChatDefaultComponents();\n\n return <AthenaUserMessage TextComponent={TextComponent} />;\n};\n\nconst getReasoningTokensFromMetadata = (metadata: unknown): number | undefined => {\n if (!isRecord(metadata)) {\n return undefined;\n }\n\n const customMetadata = metadata.custom;\n if (!isRecord(customMetadata)) {\n return undefined;\n }\n\n const athenaMetadata = customMetadata._athena;\n if (!isRecord(athenaMetadata)) {\n return undefined;\n }\n\n const reasoningTokens = athenaMetadata.reasoningTokens;\n return typeof reasoningTokens === 'number' && Number.isFinite(reasoningTokens)\n ? reasoningTokens\n : undefined;\n};\n\nconst formatReasoningTokens = (reasoningTokens: number) =>\n `${reasoningTokens.toLocaleString('en-US')} ${reasoningTokens === 1 ? 'token' : 'tokens'}`;\n\nconst withNestedPtcMessages = (\n ToolUI: ToolCallMessagePartComponent\n): ToolCallMessagePartComponent => {\n const ToolUIWithNestedPtcMessages: ToolCallMessagePartComponent = (props) => {\n const nestedComponents = useNestedPtcComponents(ToolFallback);\n\n return (\n <>\n <ToolUI {...props} />\n <NestedPtcMessages components={nestedComponents} />\n </>\n );\n };\n\n return ToolUIWithNestedPtcMessages;\n};\n\nexport const AthenaChat: FC<AthenaChatProps> = ({\n className,\n welcomeMessage = \"Hello there!\",\n welcomeSubtext = \"What can I help you with?\",\n maxWidth = \"46rem\",\n turnAnchor = \"bottom\",\n readOnly = false,\n toolUIs,\n mentionTools,\n welcomeSuggestions = DEFAULT_WELCOME_SUGGESTIONS,\n components,\n groupToolCalls = true,\n}) => {\n const athenaConfig = useAthenaConfig();\n // The chat surface is per thread. `AthenaProvider` keeps the host's\n // children mounted across a thread switch and swaps only the client under\n // them, so what used to reset with the whole tree — the composer draft, the\n // viewport's scroll position, the approval card and banner state, a caught\n // render crash — is reset here instead, keyed on the attached thread (the\n // id the provider publishes together with that thread's client, so the\n // fresh surface never renders against the previous thread's runtime).\n const statewireThreadId = useContext(AthenaStatewireThreadIdContext);\n // The mention menu's GraphQL credentials: the backend and credential the\n // provider resolved. `athenaConfig` keeps its identity across token\n // rotations (its `token` is a getter over a ref — see useAthenaConfigValue),\n // so this object is stable too. The mention store lists `accessToken` among\n // its memo dependencies, so it rebuilds (and refetches its lists) on the\n // composer's next render after a rotation; the getter is what hands the\n // rotated token to any fetch before that render. With neither token nor\n // API key the fetch rides the same-origin session cookie, as the SDK's\n // upload and thread REST calls do.\n const mentionAuth = useMemo<MentionAuthContext>(\n () => ({\n backendUrl: athenaConfig.backendUrl,\n appUrl: athenaConfig.appUrl,\n apiKey: athenaConfig.apiKey,\n credentials: 'include',\n get accessToken() {\n return athenaConfig.token ?? undefined;\n },\n }),\n [athenaConfig],\n );\n const providerMentionTools = useMemo<MentionTool[]>(() => {\n const uniqueToolkitIds = Array.from(new Set(athenaConfig.enabledToolkits));\n\n return uniqueToolkitIds.map((id) => {\n const toolkit = getToolkitDisplayInfo(id);\n\n return {\n id: toolkit.id,\n name: toolkit.name,\n description: toolkit.description,\n icon: toolkit.icon,\n type: 'toolkit',\n };\n });\n }, [athenaConfig.enabledToolkits]);\n const tools = mentionTools ?? providerMentionTools;\n const mergedToolUIs = useMemo(\n () => ({\n append_markdown_to_athena_document: AppendDocumentToolUI,\n read_full_asset: ReadAssetToolUI,\n read_asset: ReadAssetToolUI,\n ...TOOL_UI_REGISTRY,\n ...toolUIs,\n }),\n [toolUIs],\n );\n\n const textComponent = components?.messageParts?.Text ?? TiptapText;\n const reasoningComponent = components?.messageParts?.Reasoning;\n const emptyComponent = components?.messageParts?.Empty ?? AthenaAssistantMessageEmpty;\n const actionBarComponent = components?.AssistantActionBar ?? AthenaAssistantActionBar;\n const avatarComponent = components?.AssistantAvatar;\n\n const defaultComponentsContextValue = useMemo<AthenaChatDefaultComponentsContextValue>(\n () => ({\n toolUIs: mergedToolUIs,\n TextComponent: textComponent,\n ReasoningComponent: reasoningComponent,\n EmptyComponent: emptyComponent,\n ActionBarComponent: actionBarComponent,\n AvatarComponent: avatarComponent,\n groupToolCalls,\n }),\n [\n actionBarComponent,\n avatarComponent,\n emptyComponent,\n groupToolCalls,\n mergedToolUIs,\n reasoningComponent,\n textComponent,\n ],\n );\n const AssistantMessageComponent = components?.AssistantMessage ?? AthenaDefaultAssistantMessage;\n const UserMessageComponent = components?.UserMessage ?? AthenaDefaultUserMessage;\n const messageComponents = useMemo(\n () => ({\n UserMessage: UserMessageComponent,\n AssistantMessage: AssistantMessageComponent,\n }),\n [AssistantMessageComponent, UserMessageComponent],\n );\n\n return (\n <AthenaChatDefaultComponentsContext.Provider value={defaultComponentsContextValue}>\n {/* Contain render crashes to the chat pane (telemetry + retry) instead of\n unmounting the integrator's subtree. */}\n <AthenaChatErrorBoundary key={statewireThreadId ?? undefined}>\n {/* Every tool call in the thread — generic fallback, dedicated tool\n UI, nested PTC sub-call — renders as the one-line thread row. */}\n <ToolFallbackAppearanceProvider appearance=\"thread\">\n <ChatThreadShell\n overlay={<ThreadLoadingOverlay />}\n panelClassName={cn(\n 'aui-root aui-thread-root @container relative flex h-full flex-col bg-background',\n className,\n )}\n maxWidth={maxWidth}\n turnAnchor={turnAnchor}\n readOnly={readOnly}\n // Persistent \"waiting on you\" strip above the viewport; the approval\n // card it points at stays in the sticky footer below.\n banners={<WaitingOnYouBanner className=\"px-4 pt-3\" />}\n viewportClassName=\"aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4\"\n contentClassName=\"flex w-full flex-1 flex-col\"\n viewportOverlay={<ThreadScrollToTop />}\n welcome={\n <AthenaChatWelcome welcomeMessage={welcomeMessage} welcomeSubtext={welcomeSubtext} />\n }\n beforeMessages={<StatewireHistoryEdge className=\"aui-thread-history-edge\" />}\n components={messageComponents}\n runningIndicator={null}\n // The scroll-to-bottom pill is docked on the composer (see\n // AthenaChatComposer) instead of floating over the messages; the\n // footer's top padding is the room it sits in.\n scrollToBottom={null}\n viewportFooterClassName=\"aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pt-4 pb-4 md:pb-6\"\n viewportFooter={\n <>\n {/* Empty state: the suggestion cards sit directly above the\n composer (the greeting stays centred in the viewport). */}\n {welcomeSuggestions.length > 0 && (\n <ThreadPrimitive.Empty>\n <AthenaChatWelcomeSuggestions suggestions={welcomeSuggestions} />\n </ThreadPrimitive.Empty>\n )}\n <StatewireConnectionBanner />\n <StatewireErrorBanner />\n <StatewireApprovalCard />\n <StatewireQueuedMessages />\n <AttachmentProvider>\n <QuoteProvider>\n <QuotePostMessageBridge />\n <MentionAuthCtx.Provider value={mentionAuth}>\n <AthenaChatComposer\n tools={tools}\n welcomeSuggestionCount={welcomeSuggestions.length}\n />\n </MentionAuthCtx.Provider>\n </QuoteProvider>\n </AttachmentProvider>\n </>\n }\n />\n </ToolFallbackAppearanceProvider>\n </AthenaChatErrorBoundary>\n </AthenaChatDefaultComponentsContext.Provider>\n );\n};\n\nconst THREAD_VIEWPORT_ATTR = 'data-aui-thread-viewport';\n\nconst useScrollToTop = () => {\n const [isAtTop, setIsAtTop] = useState(true);\n const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);\n\n const containerRef = useCallback((node: HTMLButtonElement | null) => {\n setButtonEl(node);\n }, []);\n\n const getViewport = useCallback((): HTMLElement | null => {\n if (!buttonEl) return null;\n return buttonEl.closest(`[${THREAD_VIEWPORT_ATTR}]`) as HTMLElement | null;\n }, [buttonEl]);\n\n useEffect(() => {\n const viewport: HTMLElement | null = getViewport();\n if (!viewport) return;\n\n const handleScroll = () => {\n setIsAtTop(viewport.scrollTop <= 50);\n };\n\n handleScroll();\n viewport.addEventListener('scroll', handleScroll, { passive: true });\n return () => viewport.removeEventListener('scroll', handleScroll);\n }, [getViewport]);\n\n const handleClick = useCallback(() => {\n const viewport: HTMLElement | null = getViewport();\n if (!viewport) return;\n viewport.scrollTo({ top: 0, behavior: 'smooth' });\n }, [getViewport]);\n\n return { isAtTop, containerRef, handleClick };\n};\n\nconst ThreadScrollToTop: FC = () => {\n const { isAtTop, containerRef, handleClick } = useScrollToTop();\n const isEmpty = useAuiState((s) => s.thread.isEmpty);\n\n if (isEmpty) return null;\n\n return (\n <div className=\"sticky top-0 z-10 mx-auto flex h-0 w-full max-w-(--thread-max-width) justify-center\">\n <TooltipIconButton\n ref={containerRef}\n tooltip=\"Scroll to top\"\n variant=\"outline\"\n className={cn('aui-thread-scroll-to-top absolute top-2 rounded-full p-4 dark:bg-background dark:hover:bg-accent', isAtTop && 'invisible')}\n onClick={handleClick}\n >\n <ArrowUpIcon />\n </TooltipIconButton>\n </div>\n );\n};\n\n/**\n * The asset-library categories of AthenaChat's `@` menu. Browse profiles,\n * team and drives are left out: they need browser-side scoping or a workspace\n * id that API-key auth does not carry. The Tools / Toolkits categories are\n * added when the host (or the provider's enabled toolkits) offers any.\n */\nconst ATHENA_CHAT_MENTION_CATEGORIES: readonly MentionRootCategory[] = [\n 'favorites',\n 'assets',\n 'projects',\n 'folders',\n];\n\n/**\n * AthenaChat's composer: the shared chat-ui Tiptap editor and `@` mention menu\n * with AthenaChat's quote and attachment pills composed into the send.\n *\n * A draft with a quote or attachment pills — text or not — is intercepted on\n * submit and dispatched as one composed message through the composer runtime,\n * the path the server-owned queue observes, so a mid-run submit queues like\n * any other send. Pasted images upload into the pills through the same intake\n * as the paperclip and the drop zone, and every submit path (Enter, the send\n * button) waits for an in-flight upload so a send never leaves without its\n * attachment. The send control resolves send / queue / stop through the\n * shared chat-ui logic.\n *\n * The chrome is the shared dock's paper appearance (`data-appearance=\"paper\"`\n * on `.aui-composer-root`): the drop zone reports drag-over into\n * `data-drag-active`, the first focus in a browser shows the Enter /\n * Shift+Enter hint until the first send, and a thread that mounts empty\n * brings the composer in last, after the greeting and the suggestion cards.\n */\nconst AthenaChatComposer: FC<{\n tools: MentionTool[];\n /** How many suggestion cards precede the composer's entrance in the empty state. */\n welcomeSuggestionCount: number;\n}> = ({ tools, welcomeSuggestionCount }) => {\n const aui = useAui();\n const threadId = useAthenaStatewireThreadId();\n const { appUrl } = useAthenaConfig();\n const { attachments, clearAttachments, isUploading } = useAttachments();\n const { quote, clearQuote } = useQuote();\n const { attachFiles } = useAttachFiles();\n const composerRef = useRef<TiptapComposerHandle>(null);\n const [hasText, setHasText] = useState(false);\n const [dragActive, setDragActive] = useState(false);\n const keyboardHint = useComposerKeyboardHint();\n const reducedMotion = usePrefersReducedMotion();\n // The staged entrance belongs to the empty state only: a composer that\n // mounts over an existing transcript is simply there.\n const isEmpty = useAuiState((state) => state.thread.isEmpty);\n const [mountedEmpty] = useState(() => isEmpty);\n const entrance = welcomeEntrance(\n welcomeComposerDelayMs(welcomeSuggestionCount),\n reducedMotion || !mountedEmpty,\n );\n\n const rootCategories = useMemo<readonly MentionRootCategory[]>(() => {\n const categories = [...ATHENA_CHAT_MENTION_CATEGORIES];\n if (tools.some((tool) => tool.type === 'toolkit')) categories.push('toolkits');\n if (tools.some((tool) => tool.type === 'tool')) categories.push('tools');\n return categories;\n }, [tools]);\n\n // The submit paths are captured once by the editor's keybinding, so they\n // read the current draft extras through refs.\n const attachmentsRef = useRef(attachments);\n attachmentsRef.current = attachments;\n const quoteRef = useRef(quote);\n quoteRef.current = quote;\n const hasExtras = attachments.length > 0 || quote !== null;\n\n // A submit during an upload parks until the pills have the asset; the\n // waiters resolve on the render that turns `isUploading` off, by which\n // point `attachmentsRef` holds the uploaded asset.\n const isUploadingRef = useRef(isUploading);\n isUploadingRef.current = isUploading;\n const uploadWaitersRef = useRef<Array<() => void>>([]);\n useEffect(() => {\n if (isUploading) return;\n const waiters = uploadWaitersRef.current;\n uploadWaitersRef.current = [];\n for (const resolve of waiters) resolve();\n }, [isUploading]);\n const waitForHostUploads = useCallback(() => {\n if (!isUploadingRef.current) return;\n return new Promise<void>((resolve) => {\n uploadWaitersRef.current.push(resolve);\n });\n }, []);\n\n const sendComposed = useCallback(\n (userText: string): boolean => {\n const message = buildComposedMessage({\n attachments: attachmentsRef.current,\n quote: quoteRef.current,\n userText,\n appUrl,\n });\n if (!message) return false;\n // steer: false — a mid-run send queues behind the active run instead of\n // interrupting it; idle sends dispatch immediately.\n aui.composer.setText(message);\n aui.composer.send({ steer: false });\n clearAttachments();\n clearQuote();\n return true;\n },\n [appUrl, aui, clearAttachments, clearQuote],\n );\n\n // Consumes the editor's draft (possibly empty) only when there are extras\n // to compose with it.\n const interceptSubmit = useCallback(\n (text: string) =>\n attachmentsRef.current.length > 0 || quoteRef.current !== null\n ? sendComposed(text)\n : false,\n [sendComposed],\n );\n\n // Pasted images go through the pills' intake; drops are left to the\n // enclosing ComposerDropZone.\n const fileIntake = useMemo<ComposerFileIntake>(\n () => ({\n onPaste: (files) => {\n void attachFiles(files, 'paste');\n },\n }),\n [attachFiles],\n );\n\n return (\n <ComposerDropZone onDragActiveChange={setDragActive}>\n {/* React delivers `onFocus` as focusin, so the editor's focus reaches\n this wrapper; the same element carries the staged entrance. */}\n <div\n className={cn('aui-composer-entrance', entrance.className)}\n style={entrance.style}\n onFocus={keyboardHint.onFocus}\n >\n <ChatComposerDock\n appearance=\"paper\"\n dragActive={dragActive}\n aboveSurface={<ThreadScrollToBottom />}\n beforeEditor={\n <>\n <ComposerQuotePreview />\n <ComposerAttachmentPreview />\n </>\n }\n editor={\n <TiptapComposer\n ref={composerRef}\n threadId={threadId}\n appearance=\"paper\"\n placeholder=\"Type @ to tag an asset\"\n tools={tools}\n rootCategories={rootCategories}\n onDraftStateChange={setHasText}\n waitForHostUploads={waitForHostUploads}\n interceptSubmit={interceptSubmit}\n fileIntake={fileIntake}\n onSubmitted={keyboardHint.onSubmitted}\n />\n }\n toolbarStart={\n <div className=\"flex items-center gap-1\">\n <FileUploadButton className=\"aui-composer-attach size-8 rounded-full p-0 disabled:opacity-30\" />\n <AthenaComposerMentionButton\n onClick={() => composerRef.current?.openMentionMenu?.()}\n />\n </div>\n }\n toolbarEnd={\n <div className=\"flex items-center gap-1\">\n <ComposerSendOrStop\n composerRef={composerRef}\n hasDraft={hasText || hasExtras}\n sendBlockedReason={isUploading ? 'Upload in progress...' : null}\n components={ATHENA_COMPOSER_COMPONENTS}\n />\n </div>\n }\n belowSurface={<ComposerKeyboardHint visible={keyboardHint.visible} />}\n />\n </div>\n </ComposerDropZone>\n );\n};\n\nconst MessageError: FC = () => (\n <MessagePrimitive.Error>\n <ErrorPrimitive.Root className=\"aui-message-error-root mt-2 flex items-start gap-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm dark:bg-destructive/5 dark:text-red-200\">\n <AlertCircleIcon className=\"mt-0.5 size-4 shrink-0\" />\n <ErrorPrimitive.Message className=\"aui-message-error-message grow\" />\n <ActionBarPrimitive.Reload asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-6 shrink-0 text-destructive hover:text-destructive dark:text-red-200 dark:hover:text-red-100\"\n >\n <RefreshCwIcon className=\"size-3.5\" />\n </Button>\n </ActionBarPrimitive.Reload>\n </ErrorPrimitive.Root>\n </MessagePrimitive.Error>\n);\n\n/**\n * The quiet status line under a running turn: one pulsing dot, the verb\n * (\"Thinking…\", or the running tool's activity such as \"Searching the web…\"),\n * the elapsed seconds once the counter is due, and a stall tone once nothing\n * has streamed for a while — so a busy run and a possibly-stuck one stop\n * looking identical. The timer restarts whenever `resetKey` changes.\n */\nconst RunStatusLine: FC<{\n verb: string;\n resetKey: string;\n /** Render nothing until the counter is due (a host header already names the verb). */\n counterOnly?: boolean;\n className?: string;\n}> = ({ verb, resetKey, counterOnly = false, className }) => {\n const [seconds, setSeconds] = useState(0);\n useEffect(() => {\n setSeconds(0);\n const startedAt = Date.now();\n const timer = setInterval(() => {\n setSeconds(Math.floor((Date.now() - startedAt) / 1000));\n }, 1000);\n return () => clearInterval(timer);\n }, [resetKey]);\n const stalled = seconds >= RUN_ACTIVITY_STALL_SECONDS;\n if (counterOnly && seconds < RUN_ACTIVITY_COUNTER_SECONDS) return null;\n return (\n <div\n data-slot=\"run-status-line\"\n data-stalled={stalled ? 'true' : undefined}\n className={cn(\n 'aui-run-activity mt-2 flex items-center gap-2 px-1 text-[12px] text-muted-foreground',\n className,\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'size-1.5 shrink-0 rounded-full bg-current opacity-60',\n !stalled && 'animate-pulse motion-reduce:animate-none',\n )}\n />\n <span\n aria-hidden=\"true\"\n className={cn('tabular-nums', stalled && 'text-amber-600 dark:text-amber-400')}\n >\n {runActivityLabel(seconds, verb)}\n </span>\n {/* The visible counter ticks every second; announcing each tick would\n drown a screen reader, so the live region only speaks the two\n meaningful transitions: what the run is doing, and that it looks\n stalled. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {stalled ? 'Assistant is still working; nothing new for over thirty seconds.' : `${verb}…`}\n </span>\n </div>\n );\n};\n\nconst AthenaAssistantMessageEmpty: EmptyMessagePartComponent = ({ status }) => {\n if (status?.type !== 'running') return null;\n return <RunStatusLine verb=\"Thinking\" resetKey=\"empty\" className=\"mt-0\" />;\n};\n\n/**\n * Renders the empty/loading indicator while a message is running but has no\n * parts yet. `MessagePrimitive.GroupedParts` only renders existing parts, so\n * the indicator can't live inside its switch — it goes here as a sibling.\n */\nconst AthenaMessageEmptyIndicator: FC<{ EmptyComponent: EmptyMessagePartComponent }> = ({\n EmptyComponent,\n}) => {\n const hasParts = useAuiState((s) => s.message.parts.length > 0);\n const isRunning = useAuiState((s) => s.message.status?.type === 'running');\n if (hasParts || !isRunning) return null;\n return <EmptyComponent status={{ type: 'running' }} />;\n};\n\n/**\n * Run-liveness line under a running message whose tail is a tool call: the\n * tool's own verb from the shared registry, an elapsed counter that resets\n * whenever the stream moves the tail part, and the stall tone. Text and\n * reasoning tails animate on their own and render no line.\n */\nconst AthenaMessageActivityIndicator: FC = () => {\n const isRunning = useAuiState((s) => s.message.status?.type === 'running');\n const activityKey = useAuiState((s) => runActivityKey(s.message.parts));\n const verb = useAuiState((s) => runActivityVerb(s.message.parts));\n if (!isRunning || activityKey === null) return null;\n return <RunStatusLine verb={verb ?? 'Working'} resetKey={activityKey} />;\n};\n\n/**\n * The grouped view's running meta: the activity card already names the verb,\n * so this adds only the elapsed counter (after three seconds) and the stall\n * tone, keyed to the stream's tail like the inline indicator.\n */\nconst AthenaGroupedRunMeta: FC = () => {\n const activityKey = useAuiState((s) => runActivityKey(s.message.parts));\n return (\n <RunStatusLine\n verb=\"Working\"\n resetKey={activityKey ?? 'thinking'}\n counterOnly\n className=\"mt-1 px-0\"\n />\n );\n};\nconst renderGroupedRunningMeta = () => <AthenaGroupedRunMeta />;\n\n/**\n * The centered hairline with the date, rendered above the first message of a\n * calendar day that differs from the previous message's. Both messages need\n * the runtime's `_created_at` stamp; without it there is nothing truthful to\n * separate on.\n */\nconst MessageDaySeparator: FC = () => {\n const stamp = useAuiState((s) => readMessageCreatedAt(s.message.metadata?.custom));\n const previousStamp = useAuiState((s) => {\n const index = s.message.index;\n const previous = index > 0 ? s.thread.messages[index - 1] : undefined;\n return readMessageCreatedAt(previous?.metadata?.custom);\n });\n const label = useMemo(() => {\n const date = stamp ? parseMessageTime(stamp) : null;\n const previous = previousStamp ? parseMessageTime(previousStamp) : null;\n if (!date || !previous || isSameCalendarDay(date, previous)) return null;\n return formatDayLabel(date);\n }, [stamp, previousStamp]);\n if (!label) return null;\n return (\n <div\n role=\"separator\"\n aria-label={label}\n data-slot=\"day-separator\"\n className=\"aui-day-separator mb-3 flex w-full items-center gap-3 text-[11px] font-medium text-muted-foreground\"\n >\n <span aria-hidden=\"true\" className=\"h-px flex-1 bg-border\" />\n <span>{label}</span>\n <span aria-hidden=\"true\" className=\"h-px flex-1 bg-border\" />\n </div>\n );\n};\n\n/**\n * The message's clock time, revealed on hover beside the action bar (the\n * full date in its `title`). Reads the runtime's `_created_at` stamp; a\n * message without one shows no time rather than a wrong one.\n */\nconst MessageTimestamp: FC<{ className?: string }> = ({ className }) => {\n const stamp = useAuiState((s) => readMessageCreatedAt(s.message.metadata?.custom));\n const date = useMemo(() => (stamp ? parseMessageTime(stamp) : null), [stamp]);\n if (!date) return null;\n return (\n <time\n dateTime={date.toISOString()}\n title={formatMessageDateTime(date)}\n data-slot=\"message-timestamp\"\n className={cn(\n 'aui-message-timestamp shrink-0 text-[11px] tabular-nums text-muted-foreground',\n ACTION_BAR_REVEAL_CLASS,\n className,\n )}\n >\n {formatMessageTime(date)}\n </time>\n );\n};\n\nexport const AthenaReasoningPart: FC<AthenaReasoningPartProps> = ({\n text,\n status,\n TextComponent,\n}) => {\n const inheritedTextComponent = useContext(AthenaReasoningTextComponentContext);\n const EffectiveTextComponent = TextComponent ?? inheritedTextComponent ?? TiptapText;\n const isMessageRunning = useAuiState((state) => state.message.status?.type === 'running');\n const reasoningTokens = useAuiState((state) =>\n getReasoningTokensFromMetadata(state.message.metadata)\n );\n const isRunning = isMessageRunning || status?.type === 'running';\n const [isCollapsed, setIsCollapsed] = useState(!isRunning);\n const userOverrodeOpenStateRef = useRef(false);\n const hasText = text.trim().length > 0;\n\n const reasoningTextProps: TextMessagePartProps = {\n type: 'text',\n text,\n status: isRunning\n ? ({ type: 'running' } as TextMessagePartProps['status'])\n : (status as TextMessagePartProps['status']),\n };\n\n useEffect(() => {\n if (userOverrodeOpenStateRef.current) {\n return;\n }\n\n setIsCollapsed(!isRunning);\n }, [isRunning]);\n\n if (!hasText && !isRunning) {\n return null;\n }\n\n return (\n <Collapsible\n open={!isCollapsed}\n onOpenChange={(open) => {\n userOverrodeOpenStateRef.current = true;\n setIsCollapsed(!open);\n }}\n className=\"aui-assistant-reasoning-root mb-3 rounded-2xl border border-border/60 bg-muted/30 px-3 py-2\"\n >\n <CollapsibleTrigger asChild>\n <button\n type=\"button\"\n className=\"flex w-full items-center justify-between gap-3 text-left\"\n aria-label={isRunning ? 'Toggle reasoning while streaming' : 'Toggle reasoning'}\n >\n <span className=\"flex min-w-0 items-center gap-2 text-[13px] font-medium text-muted-foreground\">\n <BrainIcon className=\"size-4 shrink-0\" />\n <span>{isRunning ? 'Reasoning...' : 'Reasoning'}</span>\n </span>\n <span className=\"flex shrink-0 items-center gap-2\">\n {reasoningTokens !== undefined && (\n <span className=\"rounded-full border border-border/60 bg-background px-2 py-0.5 text-[11px] font-medium text-muted-foreground\">\n {formatReasoningTokens(reasoningTokens)}\n </span>\n )}\n <span\n className={cn(\n 'flex size-5 items-center justify-center text-muted-foreground transition-transform',\n isCollapsed ? 'rotate-0' : 'rotate-90'\n )}\n aria-hidden=\"true\"\n >\n <ChevronRightIcon className=\"size-4\" />\n </span>\n </span>\n </button>\n </CollapsibleTrigger>\n\n <CollapsibleContent className=\"pt-3\">\n {isRunning && !hasText ? (\n <span className=\"shimmer text-[13px] text-muted-foreground\">Analyzing...</span>\n ) : (\n <div className=\"aui-assistant-reasoning-body text-[13px] leading-relaxed\">\n <EffectiveTextComponent {...reasoningTextProps} />\n </div>\n )}\n </CollapsibleContent>\n </Collapsible>\n );\n};\n\nconst groupAdjacentToolCalls = (part: PartState) =>\n part.type === 'tool-call' ? (['group-tool'] as const) : null;\nconst noToolGrouping = () => null;\n\nexport const AthenaAssistantMessage: FC<AthenaAssistantMessageProps> = ({\n toolUIs,\n AvatarComponent,\n TextComponent = TiptapText,\n ReasoningComponent,\n EmptyComponent = AthenaAssistantMessageEmpty,\n ActionBarComponent = AthenaAssistantActionBar,\n groupToolCalls = true,\n}) => {\n const effectiveReasoningComponent = ReasoningComponent ?? AthenaReasoningPart;\n const toolUIsWithNestedMessages = useMemo(() => {\n const wrappedToolUIs: Record<string, ToolCallMessagePartComponent> = {};\n\n for (const [toolName, ToolUI] of Object.entries(toolUIs)) {\n wrappedToolUIs[toolName] = withNestedPtcMessages(ToolUI);\n }\n\n return wrappedToolUIs;\n }, [toolUIs]);\n\n // NestedPtcComponentsProvider still consumes the legacy parts-config shape\n // (Text / Reasoning / tools.by_name / Empty) to render PTC sub-tool messages\n // inside a tool card. The outer rendering uses GroupedParts, but the inner\n // PTC tree continues to mirror the parent registry.\n const nestedPtcComponents = useMemo(\n () => ({\n Text: TextComponent,\n Reasoning: effectiveReasoningComponent,\n tools: {\n Fallback: ToolFallback,\n by_name: toolUIsWithNestedMessages,\n },\n Empty: EmptyComponent,\n }),\n [EmptyComponent, TextComponent, effectiveReasoningComponent, toolUIsWithNestedMessages],\n );\n\n return (\n <MessagePrimitive.Root\n className=\"aui-assistant-message-root group/aui-assistant-message fade-in slide-in-from-bottom-1 relative mx-auto w-full max-w-(--thread-max-width) animate-in py-3 duration-150\"\n data-role=\"assistant\"\n >\n <MessageDaySeparator />\n <div className=\"flex gap-3\">\n {/* The leading column that makes an assistant turn scannable against\n the right-aligned user bubbles: the host's avatar, else a rule. */}\n <div\n data-slot=\"assistant-lead\"\n className=\"aui-assistant-message-lead flex shrink-0 justify-center\"\n >\n {AvatarComponent ? (\n <AvatarComponent />\n ) : (\n <span\n aria-hidden=\"true\"\n data-slot=\"assistant-rule\"\n className=\"aui-assistant-message-rule w-0.5 self-stretch rounded-full bg-border\"\n />\n )}\n </div>\n <div className=\"min-w-0 flex-1\">\n <AthenaReasoningTextComponentContext.Provider value={TextComponent}>\n <div className=\"aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed\">\n <NestedPtcComponentsProvider components={nestedPtcComponents}>\n {groupToolCalls ? (\n <div className=\"flex flex-col space-y-2\">\n <SuperGroupingCard\n toolUIs={toolUIsWithNestedMessages}\n TextComponent={TextComponent}\n ReasoningComponent={effectiveReasoningComponent}\n renderRunningMeta={renderGroupedRunningMeta}\n />\n <SuperGroupingFinalText TextComponent={TextComponent} />\n </div>\n ) : (\n <>\n <AthenaMessageEmptyIndicator EmptyComponent={EmptyComponent} />\n <MessagePrimitive.GroupedParts groupBy={noToolGrouping}>\n {({ part }) => {\n switch (part.type) {\n case 'tool-call': {\n const ToolUI = toolUIsWithNestedMessages[part.toolName];\n const toolProps = part as unknown as ToolCallMessagePartProps;\n return ToolUI ? <ToolUI {...toolProps} /> : <ToolFallback {...toolProps} />;\n }\n case 'reasoning': {\n const ReasoningRenderer = effectiveReasoningComponent;\n return <ReasoningRenderer {...(part as ReasoningMessagePartProps)} />;\n }\n case 'text': {\n const textPart = part as TextMessagePartProps;\n if (textPart.text === '' && textPart.status?.type === 'running') {\n return <EmptyComponent status={textPart.status} />;\n }\n return <TextComponent {...textPart} />;\n }\n default:\n return null;\n }\n }}\n </MessagePrimitive.GroupedParts>\n <AthenaMessageActivityIndicator />\n </>\n )}\n </NestedPtcComponentsProvider>\n <MessageError />\n </div>\n </AthenaReasoningTextComponentContext.Provider>\n <div className=\"aui-assistant-message-footer mt-1 ml-2 flex items-center gap-1\">\n <BranchPicker />\n <ActionBarComponent />\n <MessageTimestamp className=\"ml-auto group-hover/aui-assistant-message:opacity-100\" />\n </div>\n </div>\n </div>\n </MessagePrimitive.Root>\n );\n};\n\nconst AthenaToolGroup: FC<{ children: React.ReactNode; count: number }> = ({ children, count }) => {\n const [expanded, setExpanded] = useState(false);\n\n return (\n <div className=\"my-3 w-full overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm\">\n <button\n type=\"button\"\n onClick={() => setExpanded((v) => !v)}\n className=\"flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-muted/20\"\n aria-expanded={expanded}\n >\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground\">\n <LayersIcon className=\"size-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <span className=\"text-[13px] font-medium text-foreground\">\n {count} tool {count === 1 ? 'call' : 'calls'}\n </span>\n </div>\n <ChevronDownIcon\n className={cn(\n 'size-4 shrink-0 text-muted-foreground transition-transform duration-200',\n !expanded && '-rotate-90',\n )}\n />\n </button>\n {expanded && (\n <div className=\"border-t border-border/40 bg-muted/5 px-3 pt-1 pb-2 [&>*]:my-2\">\n {children}\n </div>\n )}\n </div>\n );\n};\n\nconst CopyMessageButton: FC = () => (\n <ActionBarPrimitive.Copy asChild>\n <TooltipIconButton tooltip=\"Copy\">\n <AuiIf condition={(s) => s.message.isCopied}>\n <CheckIcon />\n </AuiIf>\n <AuiIf condition={(s) => !s.message.isCopied}>\n <CopyIcon />\n </AuiIf>\n </TooltipIconButton>\n </ActionBarPrimitive.Copy>\n);\n\n/** Regenerate dispatches `run/reload`, so it hides on read-only threads. */\nconst RegenerateMessageButton: FC = () => {\n const readOnly = useMessageActionsReadOnly();\n if (readOnly) return null;\n return (\n <ActionBarPrimitive.Reload asChild>\n <TooltipIconButton tooltip=\"Regenerate\">\n <RefreshCwIcon />\n </TooltipIconButton>\n </ActionBarPrimitive.Reload>\n );\n};\n\n/**\n * The edit primitive does not check the runtime's edit capability itself —\n * clicking it on a runtime without one throws inside onPress — so the button\n * gates on the capability and, to match the rewind semantics of `run/edit`,\n * stays hidden while a run is live or the transcript is read-only.\n */\nconst EditMessageButton: FC = () => {\n const allowEdit = useAuiState((s) => s.thread.capabilities.edit);\n const isRunning = useAthenaRunLive();\n const readOnly = useMessageActionsReadOnly();\n if (!allowEdit || isRunning || readOnly) return null;\n return (\n <ActionBarPrimitive.Edit asChild>\n <TooltipIconButton tooltip=\"Edit\">\n <PencilIcon />\n </TooltipIconButton>\n </ActionBarPrimitive.Edit>\n );\n};\n\n/** Hover-revealed copy / edit row under a user bubble; mirrors the assistant bar. */\nconst AthenaUserActionBar: FC = () => {\n const isThreadRunning = useAuiState((s) => s.thread.isRunning);\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n 'aui-user-action-bar-root flex min-h-6 gap-1 text-muted-foreground',\n isThreadRunning\n ? 'invisible'\n : [\n ACTION_BAR_REVEAL_CLASS,\n 'group-hover/aui-user-message:pointer-events-auto group-hover/aui-user-message:opacity-100',\n ],\n )}\n >\n <CopyMessageButton />\n <EditMessageButton />\n </ActionBarPrimitive.Root>\n );\n};\n\nexport const AthenaAssistantActionBar: FC<AthenaAssistantActionBarProps> = ({ className }) => {\n const threadId = useAthenaThreadId();\n const { appUrl } = useAthenaConfig();\n // The bar stays mounted so the footer keeps its height: assistant-ui's\n // `autohide` / `hideWhenRunning` unmount it, which shifts the whole message\n // up and down on every hover. Visibility is CSS instead — the latest reply\n // keeps its actions, older replies reveal on hover or keyboard focus, and\n // while the thread runs every bar is `invisible` (layout kept, controls\n // unfocusable — opacity alone would still let Tab reveal them).\n const isLast = useAuiState((s) => s.message.isLast);\n const isThreadRunning = useAuiState((s) => s.thread.isRunning);\n\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n 'aui-assistant-action-bar-root -ml-1 flex min-h-6 gap-1 text-muted-foreground',\n isThreadRunning && 'invisible',\n !isThreadRunning &&\n !isLast && [\n ACTION_BAR_REVEAL_CLASS,\n 'group-hover/aui-assistant-message:pointer-events-auto group-hover/aui-assistant-message:opacity-100',\n ],\n className,\n )}\n >\n <CopyMessageButton />\n <RegenerateMessageButton />\n <ActionBarMorePrimitive.Root>\n <ActionBarMorePrimitive.Trigger asChild>\n <TooltipIconButton tooltip=\"More\" className=\"data-[state=open]:bg-accent\">\n <MoreHorizontalIcon />\n </TooltipIconButton>\n </ActionBarMorePrimitive.Trigger>\n <ActionBarMorePrimitive.Content\n side=\"bottom\"\n align=\"start\"\n className=\"aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\"\n >\n <ActionBarPrimitive.ExportMarkdown asChild>\n <ActionBarMorePrimitive.Item className=\"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground\">\n <DownloadIcon className=\"size-4\" />\n Export as Markdown\n </ActionBarMorePrimitive.Item>\n </ActionBarPrimitive.ExportMarkdown>\n {threadId && (\n <ActionBarMorePrimitive.Item\n className=\"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground\"\n onClick={() => {\n window.open(createAthenaSpacesUrl({ appUrl, sessionId: threadId }), '_blank');\n }}\n >\n <ExternalLinkIcon className=\"size-4\" />\n Open in Athena\n </ActionBarMorePrimitive.Item>\n )}\n </ActionBarMorePrimitive.Content>\n </ActionBarMorePrimitive.Root>\n </ActionBarPrimitive.Root>\n );\n};\n\nexport const AthenaUserMessage: FC<AthenaUserMessageProps> = ({\n TextComponent = TiptapText,\n}) => {\n // A GitHub wake turn is an event, not words the user typed: it renders as\n // the compact wake marker instead of a bubble quoting the injected text.\n const isWake = useAuiState((s) => isGithubWakeMessage(s.message.metadata?.custom));\n if (isWake) {\n return (\n <MessagePrimitive.Root\n className=\"aui-user-message-root aui-wake-marker-root mx-auto w-full max-w-(--thread-max-width) px-2 py-1\"\n data-role=\"user\"\n >\n <MessageDaySeparator />\n <WakeMarkerMessage />\n </MessagePrimitive.Root>\n );\n }\n return (\n <MessagePrimitive.Root\n className=\"aui-user-message-root group/aui-user-message fade-in slide-in-from-bottom-1 mx-auto flex w-full max-w-(--thread-max-width) animate-in flex-col items-end px-2 py-3 duration-150\"\n data-role=\"user\"\n >\n <MessageDaySeparator />\n {/* A soft bubble on a 75% measure: the user's words stay a bubble, the\n assistant's reading column stays the page. */}\n <div className=\"flex min-w-0 max-w-[75%] flex-col items-end gap-1\">\n <div className=\"aui-user-message-content wrap-break-word rounded-2xl bg-muted/70 px-4 py-2.5 text-foreground\">\n <MessagePrimitive.Parts components={{ Text: TextComponent }} />\n </div>\n <div className=\"aui-user-message-footer -mr-1 flex items-center gap-1\">\n <MessageTimestamp className=\"mr-1 group-hover/aui-user-message:opacity-100\" />\n <BranchPicker />\n <AthenaUserActionBar />\n </div>\n </div>\n </MessagePrimitive.Root>\n );\n};\n"],"names":["useQuoteFromPostMessage","createContext","useContext","jsx","isRecord","useNestedPtcComponents","ToolFallback","jsxs","Fragment","NestedPtcMessages","DEFAULT_WELCOME_SUGGESTIONS","useAthenaConfig","AthenaStatewireThreadIdContext","useMemo","getToolkitDisplayInfo","AppendDocumentToolUI","ReadAssetToolUI","TOOL_UI_REGISTRY","TiptapText","messageComponents","AthenaChatErrorBoundary","ToolFallbackAppearanceProvider","ChatThreadShell","ThreadLoadingOverlay","cn","WaitingOnYouBanner","AthenaChatWelcome","StatewireHistoryEdge","ThreadPrimitive","AthenaChatWelcomeSuggestions","StatewireConnectionBanner","StatewireErrorBanner","StatewireApprovalCard","StatewireQueuedMessages","AttachmentProvider","QuoteProvider","MentionAuthCtx","useState","useCallback","useEffect","useAuiState","TooltipIconButton","ArrowUpIcon","useAui","useAthenaStatewireThreadId","useAttachments","useQuote","useAttachFiles","useRef","useComposerKeyboardHint","usePrefersReducedMotion","welcomeEntrance","welcomeComposerDelayMs","buildComposedMessage","ComposerDropZone","ChatComposerDock","ThreadScrollToBottom","ComposerQuotePreview","ComposerAttachmentPreview","TiptapComposer","FileUploadButton","AthenaComposerMentionButton","ComposerSendOrStop","ATHENA_COMPOSER_COMPONENTS","ComposerKeyboardHint","MessagePrimitive","ErrorPrimitive","AlertCircleIcon","ActionBarPrimitive","Button","RefreshCwIcon","RUN_ACTIVITY_STALL_SECONDS","RUN_ACTIVITY_COUNTER_SECONDS","runActivityLabel","runActivityKey","runActivityVerb","readMessageCreatedAt","index","parseMessageTime","isSameCalendarDay","formatDayLabel","formatMessageDateTime","ACTION_BAR_REVEAL_CLASS","Collapsible","CollapsibleTrigger","BrainIcon","ChevronRightIcon","CollapsibleContent","NestedPtcComponentsProvider","SuperGroupingCard","SuperGroupingFinalText","BranchPicker","AuiIf","CheckIcon","CopyIcon","useMessageActionsReadOnly","useAthenaRunLive","PencilIcon","useAthenaThreadId","ActionBarMorePrimitive","MoreHorizontalIcon","DownloadIcon","createAthenaSpacesUrl","ExternalLinkIcon","isGithubWakeMessage","WakeMarkerMessage"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqIA,SAAS,yBAAyB;AAChCA,uCAAA;AACA,SAAO;AACT;AAsGA,MAAM,qCACJC,QAAAA,cAA8D,IAAI;AAEpE,MAA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jF,MAAI,QAAQ;AACV,WACEjG,2BAAAA;AAAAA,MAAC0D,MAAAA,iBAAiB;AAAA,MAAjB;AAAA,QACC,WAAU;AAAA,QACV,aAAU;AAAA,QAEV,UAAA;AAAA,UAAA9D,2BAAAA,IAAC,qBAAA,EAAoB;AAAA,yCACpBsG,WAAAA,mBAAA,CAAA,CAAkB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGzB;AACA,SACElG,2BAAAA;AAAAA,IAAC0D,MAAAA,iBAAiB;AAAA,IAAjB;AAAA,MACC,WAAU;AAAA,MACV,aAAU;AAAA,MAEV,UAAA;AAAA,QAAA9D,2BAAAA,IAAC,qBAAA,EAAoB;AAAA,QAGrBI,2BAAAA,KAAC,OAAA,EAAI,WAAU,qDACb,UAAA;AAAA,UAAAJ,2BAAAA,IAAC,OAAA,EAAI,WAAU,gGACb,UAAAA,2BAAAA,IAAC8D,MAAAA,iBAAiB,OAAjB,EAAuB,YAAY,EAAE,MAAM,cAAA,EAAc,CAAG,EAAA,CAC/D;AAAA,UACA1D,2BAAAA,KAAC,OAAA,EAAI,WAAU,yDACb,UAAA;AAAA,YAAAJ,2BAAAA,IAAC,kBAAA,EAAiB,WAAU,gDAAA,CAAgD;AAAA,2CAC3EwF,kBAAAA,cAAA,EAAa;AAAA,2CACb,qBAAA,CAAA,CAAoB;AAAA,UAAA,EAAA,CACvB;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;;;;;;"}
|
|
1
|
+
{"version":3,"file":"AthenaChat.cjs","sources":["../../src/chat/AthenaChat.tsx"],"sourcesContent":["import { isGithubWakeMessage } from '@athenaintel/agent-runtime';\nimport { TiptapText } from './tiptap-text';\nimport { AthenaChatErrorBoundary } from './AthenaChatErrorBoundary';\nimport { StatewireApprovalCard } from './StatewireApprovalCard';\nimport { StatewireQueuedMessages } from './StatewireQueuedMessages';\nimport { StatewireConnectionBanner, StatewireErrorBanner } from './statewire-banners';\nimport { WaitingOnYouBanner } from './WaitingOnYouBanner';\nimport { WakeMarkerMessage } from '../chat-ui/messages/wake-marker';\nimport { ToolFallback, ToolFallbackAppearanceProvider } from '../tools/tool-fallback';\nimport { AppendDocumentToolUI } from '../tools/append-document-tool-ui';\nimport { ReadAssetToolUI } from '../tools/read-asset-tool-ui';\nimport { TOOL_UI_REGISTRY } from '../tools/tool-uis';\nimport { SuperGroupingCard, SuperGroupingFinalText } from './super-grouping/SuperGroupingCard';\nimport {\n NestedPtcComponentsProvider,\n NestedPtcMessages,\n useNestedPtcComponents,\n} from '../tools/NestedPtcMessages';\nimport { TooltipIconButton } from './tooltip-icon-button';\nimport { Button } from '../ui/button';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';\nimport { ChatComposerDock } from '../chat-ui/thread/chat-composer-dock';\nimport { ChatThreadShell } from '../chat-ui/thread/chat-thread-shell';\nimport { StatewireHistoryEdge } from '../chat-ui/thread/statewire-history-edge';\nimport { ThreadLoadingOverlay } from '../chat-ui/thread/thread-loading-overlay';\nimport { ComposerSendOrStop } from '../chat-ui/thread/composer-send-or-stop';\nimport {\n TiptapComposer,\n type ComposerFileIntake,\n type TiptapComposerHandle,\n} from '../chat-ui/composer/tiptap-composer';\nimport {\n MentionAuthCtx,\n type MentionAuthContext,\n} from '../chat-ui/mentions/suggestions/data/api-client';\nimport type { MentionRootCategory } from '../chat-ui/mentions/suggestions/data/use-mention-suggestions';\nimport type { MentionTool } from '../chat-ui/mentions/suggestions/data/types';\nimport { ACTION_BAR_REVEAL_CLASS, BranchPicker } from '../chat-ui/messages/message-components';\nimport { useMessageActionsReadOnly } from '../chat-ui/messages/message-actions-config';\nimport { useAthenaRunLive } from './use-athena-run-live';\nimport {\n AthenaChatWelcome,\n AthenaChatWelcomeSuggestions,\n DEFAULT_WELCOME_SUGGESTIONS,\n welcomeComposerDelayMs,\n welcomeEntrance,\n type WelcomeSuggestion,\n} from './athena-chat-welcome';\nimport {\n ATHENA_COMPOSER_COMPONENTS,\n AthenaComposerMentionButton,\n} from './athena-composer-controls';\nimport { ComposerKeyboardHint, useComposerKeyboardHint } from './composer-keyboard-hint';\nimport { usePrefersReducedMotion } from '../lib/use-prefers-reduced-motion';\nimport {\n ActionBarMorePrimitive,\n ActionBarPrimitive,\n AuiIf,\n ErrorPrimitive,\n MessagePrimitive,\n ThreadPrimitive,\n useAui,\n useAuiState,\n} from '@assistant-ui/react';\nimport type {\n EmptyMessagePartComponent,\n PartState,\n ReasoningMessagePartProps,\n ReasoningMessagePartComponent,\n TextMessagePartProps,\n TextMessagePartComponent,\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n} from '@assistant-ui/react';\nimport {\n AlertCircleIcon,\n ArrowUpIcon,\n BrainIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CopyIcon,\n DownloadIcon,\n ExternalLinkIcon,\n LayersIcon,\n MoreHorizontalIcon,\n PencilIcon,\n RefreshCwIcon,\n} from 'lucide-react';\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type FC,\n} from 'react';\nimport {\n AthenaStatewireThreadIdContext,\n useAthenaStatewireThreadId,\n useAthenaThreadId,\n} from '../threads/thread-id-context';\nimport { FileUploadButton } from '../composer/FileUploadButton';\nimport { ComposerQuotePreview } from '../composer/ComposerQuotePreview';\nimport { ComposerAttachmentPreview } from '../composer/ComposerAttachmentPreview';\nimport { ComposerDropZone } from '../composer/ComposerDropZone';\nimport { useQuote, QuoteProvider, useQuoteFromPostMessage } from '../composer/QuoteContext';\nimport { AttachmentProvider, useAttachments } from '../composer/AttachmentContext';\nimport { buildComposedMessage } from '../composer/build-composed-message';\nimport { useAttachFiles } from '../composer/useAttachFiles';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport { createAthenaSpacesUrl } from '../lib/athena-urls';\nimport { cn, isRecord } from '../lib/utils';\nimport { getToolkitDisplayInfo } from '../toolkits';\nimport {\n RUN_ACTIVITY_COUNTER_SECONDS,\n RUN_ACTIVITY_STALL_SECONDS,\n runActivityKey,\n runActivityLabel,\n runActivityVerb,\n} from './run-activity';\nimport {\n formatDayLabel,\n formatMessageDateTime,\n formatMessageTime,\n isSameCalendarDay,\n parseMessageTime,\n readMessageCreatedAt,\n} from './message-time';\nimport { ThreadScrollToBottom } from './thread-scroll-to-bottom';\n\nfunction QuotePostMessageBridge() {\n useQuoteFromPostMessage();\n return null;\n}\n\nexport type { WelcomeSuggestion } from './athena-chat-welcome';\n\nexport interface AthenaChatProps {\n /** CSS class name for the root element. */\n className?: string;\n /** Welcome heading text. Defaults to \"Hello there!\" */\n welcomeMessage?: string;\n /** Welcome subheading text. */\n welcomeSubtext?: string;\n /**\n * Maximum width of the reading column (messages, welcome, composer).\n * Defaults to \"46rem\" — about 760 px, a comfortable measure for 15 px text.\n */\n maxWidth?: string;\n /**\n * Scroll anchoring for new turns. \"bottom\" (default) keeps the viewport\n * pinned to the end while the assistant streams — classic chat follow.\n * \"top\" pins the just-sent user message to the top of the viewport and\n * intentionally does NOT follow the streaming response (assistant-ui\n * disables autoScroll in that mode), so readers scroll at their own pace.\n */\n turnAnchor?: \"top\" | \"bottom\";\n /**\n * Marks the transcript read-only: Edit and Regenerate hide while Copy stays\n * available. For threads whose server rejects dispatch (e.g. legacy\n * pre-cutover conversations) — the runtime's static capability flags cannot\n * express a per-thread fence, so the host that knows passes it here.\n */\n readOnly?: boolean;\n /** Additional tool UIs to register by name. */\n toolUIs?: Record<string, ToolCallMessagePartComponent>;\n /** Tools / Toolkits offered by the composer's `@` menu beside the asset\n * library. Defaults to the toolkits enabled on the provider. */\n mentionTools?: MentionTool[];\n /** Suggestion cards shown on the welcome screen. Pass `[]` to hide.\n * For workflow launchers outside AthenaChat, use `useSendMessage()`.\n */\n welcomeSuggestions?: WelcomeSuggestion[];\n /** Optional component overrides for message containers and key message parts. */\n components?: AthenaChatComponents;\n /**\n * Fold a turn's tool calls into one collapsible activity group with a\n * count, the answer rendered below it. Defaults to `true`; pass `false` to\n * list every tool card inline in the order it was called.\n */\n groupToolCalls?: boolean;\n}\n\nexport interface AthenaChatMessagePartComponents {\n Text?: TextMessagePartComponent;\n Reasoning?: ReasoningMessagePartComponent;\n Empty?: EmptyMessagePartComponent;\n}\n\nexport interface AthenaChatComponents {\n UserMessage?: FC;\n AssistantMessage?: FC;\n AssistantActionBar?: FC<AthenaAssistantActionBarProps>;\n /**\n * Rendered in a leading column on every assistant turn (a small avatar or\n * mark). Without it there is no leading column: the reply sits flush with\n * the thread column and is told apart from the right-aligned user bubbles by\n * alignment alone.\n */\n AssistantAvatar?: FC;\n messageParts?: AthenaChatMessagePartComponents;\n}\n\nexport interface AthenaUserMessageProps {\n TextComponent?: TextMessagePartComponent;\n}\n\nexport interface AthenaAssistantActionBarProps {\n className?: string;\n}\n\nexport interface AthenaAssistantMessageProps {\n toolUIs: Record<string, ToolCallMessagePartComponent>;\n /** Leading-column content for the turn; no leading column at all when unset. */\n AvatarComponent?: FC;\n TextComponent?: TextMessagePartComponent;\n ReasoningComponent?: ReasoningMessagePartComponent;\n EmptyComponent?: EmptyMessagePartComponent;\n ActionBarComponent?: FC<AthenaAssistantActionBarProps>;\n /** Fold the turn's tool calls into one collapsible activity group. Defaults to `true`. */\n groupToolCalls?: boolean;\n}\n\nexport interface AthenaReasoningPartProps extends ReasoningMessagePartProps {\n TextComponent?: TextMessagePartComponent;\n}\n\ninterface AthenaChatDefaultComponentsContextValue {\n toolUIs: Record<string, ToolCallMessagePartComponent>;\n TextComponent: TextMessagePartComponent;\n ReasoningComponent?: ReasoningMessagePartComponent;\n EmptyComponent: EmptyMessagePartComponent;\n ActionBarComponent: FC<AthenaAssistantActionBarProps>;\n AvatarComponent?: FC;\n groupToolCalls: boolean;\n}\n\nconst AthenaChatDefaultComponentsContext =\n createContext<AthenaChatDefaultComponentsContextValue | null>(null);\n\nconst AthenaReasoningTextComponentContext = createContext<TextMessagePartComponent | null>(null);\n\nconst useAthenaChatDefaultComponents = (): AthenaChatDefaultComponentsContextValue => {\n const value = useContext(AthenaChatDefaultComponentsContext);\n\n if (!value) {\n throw new Error('Athena default chat components must be used within AthenaChat.');\n }\n\n return value;\n};\n\nconst AthenaDefaultAssistantMessage: FC = () => {\n const {\n toolUIs,\n TextComponent,\n ReasoningComponent,\n EmptyComponent,\n ActionBarComponent,\n AvatarComponent,\n groupToolCalls,\n } = useAthenaChatDefaultComponents();\n\n return (\n <AthenaAssistantMessage\n toolUIs={toolUIs}\n AvatarComponent={AvatarComponent}\n TextComponent={TextComponent}\n ReasoningComponent={ReasoningComponent}\n EmptyComponent={EmptyComponent}\n ActionBarComponent={ActionBarComponent}\n groupToolCalls={groupToolCalls}\n />\n );\n};\n\nconst AthenaDefaultUserMessage: FC = () => {\n const { TextComponent } = useAthenaChatDefaultComponents();\n\n return <AthenaUserMessage TextComponent={TextComponent} />;\n};\n\nconst getReasoningTokensFromMetadata = (metadata: unknown): number | undefined => {\n if (!isRecord(metadata)) {\n return undefined;\n }\n\n const customMetadata = metadata.custom;\n if (!isRecord(customMetadata)) {\n return undefined;\n }\n\n const athenaMetadata = customMetadata._athena;\n if (!isRecord(athenaMetadata)) {\n return undefined;\n }\n\n const reasoningTokens = athenaMetadata.reasoningTokens;\n return typeof reasoningTokens === 'number' && Number.isFinite(reasoningTokens)\n ? reasoningTokens\n : undefined;\n};\n\nconst formatReasoningTokens = (reasoningTokens: number) =>\n `${reasoningTokens.toLocaleString('en-US')} ${reasoningTokens === 1 ? 'token' : 'tokens'}`;\n\nconst withNestedPtcMessages = (\n ToolUI: ToolCallMessagePartComponent\n): ToolCallMessagePartComponent => {\n const ToolUIWithNestedPtcMessages: ToolCallMessagePartComponent = (props) => {\n const nestedComponents = useNestedPtcComponents(ToolFallback);\n\n return (\n <>\n <ToolUI {...props} />\n <NestedPtcMessages components={nestedComponents} />\n </>\n );\n };\n\n return ToolUIWithNestedPtcMessages;\n};\n\nexport const AthenaChat: FC<AthenaChatProps> = ({\n className,\n welcomeMessage = \"Hello there!\",\n welcomeSubtext = \"What can I help you with?\",\n maxWidth = \"46rem\",\n turnAnchor = \"bottom\",\n readOnly = false,\n toolUIs,\n mentionTools,\n welcomeSuggestions = DEFAULT_WELCOME_SUGGESTIONS,\n components,\n groupToolCalls = true,\n}) => {\n const athenaConfig = useAthenaConfig();\n // The chat surface is per thread. `AthenaProvider` keeps the host's\n // children mounted across a thread switch and swaps only the client under\n // them, so what used to reset with the whole tree — the composer draft, the\n // viewport's scroll position, the approval card and banner state, a caught\n // render crash — is reset here instead, keyed on the attached thread (the\n // id the provider publishes together with that thread's client, so the\n // fresh surface never renders against the previous thread's runtime).\n const statewireThreadId = useContext(AthenaStatewireThreadIdContext);\n // The mention menu's GraphQL credentials: the backend and credential the\n // provider resolved. `athenaConfig` keeps its identity across token\n // rotations (its `token` is a getter over a ref — see useAthenaConfigValue),\n // so this object is stable too. The mention store lists `accessToken` among\n // its memo dependencies, so it rebuilds (and refetches its lists) on the\n // composer's next render after a rotation; the getter is what hands the\n // rotated token to any fetch before that render. With neither token nor\n // API key the fetch rides the same-origin session cookie, as the SDK's\n // upload and thread REST calls do.\n const mentionAuth = useMemo<MentionAuthContext>(\n () => ({\n backendUrl: athenaConfig.backendUrl,\n appUrl: athenaConfig.appUrl,\n apiKey: athenaConfig.apiKey,\n credentials: 'include',\n get accessToken() {\n return athenaConfig.token ?? undefined;\n },\n }),\n [athenaConfig],\n );\n const providerMentionTools = useMemo<MentionTool[]>(() => {\n const uniqueToolkitIds = Array.from(new Set(athenaConfig.enabledToolkits));\n\n return uniqueToolkitIds.map((id) => {\n const toolkit = getToolkitDisplayInfo(id);\n\n return {\n id: toolkit.id,\n name: toolkit.name,\n description: toolkit.description,\n icon: toolkit.icon,\n type: 'toolkit',\n };\n });\n }, [athenaConfig.enabledToolkits]);\n const tools = mentionTools ?? providerMentionTools;\n const mergedToolUIs = useMemo(\n () => ({\n append_markdown_to_athena_document: AppendDocumentToolUI,\n read_full_asset: ReadAssetToolUI,\n read_asset: ReadAssetToolUI,\n ...TOOL_UI_REGISTRY,\n ...toolUIs,\n }),\n [toolUIs],\n );\n\n const textComponent = components?.messageParts?.Text ?? TiptapText;\n const reasoningComponent = components?.messageParts?.Reasoning;\n const emptyComponent = components?.messageParts?.Empty ?? AthenaAssistantMessageEmpty;\n const actionBarComponent = components?.AssistantActionBar ?? AthenaAssistantActionBar;\n const avatarComponent = components?.AssistantAvatar;\n\n const defaultComponentsContextValue = useMemo<AthenaChatDefaultComponentsContextValue>(\n () => ({\n toolUIs: mergedToolUIs,\n TextComponent: textComponent,\n ReasoningComponent: reasoningComponent,\n EmptyComponent: emptyComponent,\n ActionBarComponent: actionBarComponent,\n AvatarComponent: avatarComponent,\n groupToolCalls,\n }),\n [\n actionBarComponent,\n avatarComponent,\n emptyComponent,\n groupToolCalls,\n mergedToolUIs,\n reasoningComponent,\n textComponent,\n ],\n );\n const AssistantMessageComponent = components?.AssistantMessage ?? AthenaDefaultAssistantMessage;\n const UserMessageComponent = components?.UserMessage ?? AthenaDefaultUserMessage;\n const messageComponents = useMemo(\n () => ({\n UserMessage: UserMessageComponent,\n AssistantMessage: AssistantMessageComponent,\n }),\n [AssistantMessageComponent, UserMessageComponent],\n );\n\n return (\n <AthenaChatDefaultComponentsContext.Provider value={defaultComponentsContextValue}>\n {/* Contain render crashes to the chat pane (telemetry + retry) instead of\n unmounting the integrator's subtree. */}\n <AthenaChatErrorBoundary key={statewireThreadId ?? undefined}>\n {/* Every tool call in the thread — generic fallback, dedicated tool\n UI, nested PTC sub-call — renders as the one-line thread row. */}\n <ToolFallbackAppearanceProvider appearance=\"thread\">\n <ChatThreadShell\n overlay={<ThreadLoadingOverlay />}\n panelClassName={cn(\n 'aui-root aui-thread-root @container relative flex h-full flex-col bg-background',\n className,\n )}\n maxWidth={maxWidth}\n turnAnchor={turnAnchor}\n readOnly={readOnly}\n // Persistent \"waiting on you\" strip above the viewport; the approval\n // card it points at stays in the sticky footer below.\n banners={<WaitingOnYouBanner className=\"px-4 pt-3\" />}\n viewportClassName=\"aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4\"\n contentClassName=\"flex w-full flex-1 flex-col\"\n viewportOverlay={<ThreadScrollToTop />}\n welcome={\n <AthenaChatWelcome welcomeMessage={welcomeMessage} welcomeSubtext={welcomeSubtext} />\n }\n beforeMessages={<StatewireHistoryEdge className=\"aui-thread-history-edge\" />}\n components={messageComponents}\n runningIndicator={null}\n // The scroll-to-bottom pill is docked on the composer (see\n // AthenaChatComposer) instead of floating over the messages; the\n // footer's top padding is the room it sits in.\n scrollToBottom={null}\n viewportFooterClassName=\"aui-thread-viewport-footer sticky bottom-0 mx-auto mt-auto flex w-full max-w-(--thread-max-width) flex-col gap-4 overflow-visible rounded-t-3xl bg-background pt-4 pb-4 md:pb-6\"\n viewportFooter={\n <>\n {/* Empty state: the suggestion cards sit directly above the\n composer (the greeting stays centred in the viewport). */}\n {welcomeSuggestions.length > 0 && (\n <ThreadPrimitive.Empty>\n <AthenaChatWelcomeSuggestions suggestions={welcomeSuggestions} />\n </ThreadPrimitive.Empty>\n )}\n <StatewireConnectionBanner />\n <StatewireErrorBanner />\n <StatewireApprovalCard />\n <StatewireQueuedMessages />\n <AttachmentProvider>\n <QuoteProvider>\n <QuotePostMessageBridge />\n <MentionAuthCtx.Provider value={mentionAuth}>\n <AthenaChatComposer\n tools={tools}\n welcomeSuggestionCount={welcomeSuggestions.length}\n />\n </MentionAuthCtx.Provider>\n </QuoteProvider>\n </AttachmentProvider>\n </>\n }\n />\n </ToolFallbackAppearanceProvider>\n </AthenaChatErrorBoundary>\n </AthenaChatDefaultComponentsContext.Provider>\n );\n};\n\nconst THREAD_VIEWPORT_ATTR = 'data-aui-thread-viewport';\n\nconst useScrollToTop = () => {\n const [isAtTop, setIsAtTop] = useState(true);\n const [buttonEl, setButtonEl] = useState<HTMLButtonElement | null>(null);\n\n const containerRef = useCallback((node: HTMLButtonElement | null) => {\n setButtonEl(node);\n }, []);\n\n const getViewport = useCallback((): HTMLElement | null => {\n if (!buttonEl) return null;\n return buttonEl.closest(`[${THREAD_VIEWPORT_ATTR}]`) as HTMLElement | null;\n }, [buttonEl]);\n\n useEffect(() => {\n const viewport: HTMLElement | null = getViewport();\n if (!viewport) return;\n\n const handleScroll = () => {\n setIsAtTop(viewport.scrollTop <= 50);\n };\n\n handleScroll();\n viewport.addEventListener('scroll', handleScroll, { passive: true });\n return () => viewport.removeEventListener('scroll', handleScroll);\n }, [getViewport]);\n\n const handleClick = useCallback(() => {\n const viewport: HTMLElement | null = getViewport();\n if (!viewport) return;\n viewport.scrollTo({ top: 0, behavior: 'smooth' });\n }, [getViewport]);\n\n return { isAtTop, containerRef, handleClick };\n};\n\nconst ThreadScrollToTop: FC = () => {\n const { isAtTop, containerRef, handleClick } = useScrollToTop();\n const isEmpty = useAuiState((s) => s.thread.isEmpty);\n\n if (isEmpty) return null;\n\n return (\n <div className=\"sticky top-0 z-10 mx-auto flex h-0 w-full max-w-(--thread-max-width) justify-center\">\n <TooltipIconButton\n ref={containerRef}\n tooltip=\"Scroll to top\"\n variant=\"outline\"\n className={cn('aui-thread-scroll-to-top absolute top-2 rounded-full p-4 dark:bg-background dark:hover:bg-accent', isAtTop && 'invisible')}\n onClick={handleClick}\n >\n <ArrowUpIcon />\n </TooltipIconButton>\n </div>\n );\n};\n\n/**\n * The asset-library categories of AthenaChat's `@` menu. Browse profiles,\n * team and drives are left out: they need browser-side scoping or a workspace\n * id that API-key auth does not carry. The Tools / Toolkits categories are\n * added when the host (or the provider's enabled toolkits) offers any.\n */\nconst ATHENA_CHAT_MENTION_CATEGORIES: readonly MentionRootCategory[] = [\n 'favorites',\n 'assets',\n 'projects',\n 'folders',\n];\n\n/**\n * AthenaChat's composer: the shared chat-ui Tiptap editor and `@` mention menu\n * with AthenaChat's quote and attachment pills composed into the send.\n *\n * A draft with a quote or attachment pills — text or not — is intercepted on\n * submit and dispatched as one composed message through the composer runtime,\n * the path the server-owned queue observes, so a mid-run submit queues like\n * any other send. Pasted images upload into the pills through the same intake\n * as the paperclip and the drop zone, and every submit path (Enter, the send\n * button) waits for an in-flight upload so a send never leaves without its\n * attachment. The send control resolves send / queue / stop through the\n * shared chat-ui logic.\n *\n * The chrome is the shared dock's paper appearance (`data-appearance=\"paper\"`\n * on `.aui-composer-root`): the drop zone reports drag-over into\n * `data-drag-active`, the first focus in a browser shows the Enter /\n * Shift+Enter hint until the first send, and a thread that mounts empty\n * brings the composer in last, after the greeting and the suggestion cards.\n */\nconst AthenaChatComposer: FC<{\n tools: MentionTool[];\n /** How many suggestion cards precede the composer's entrance in the empty state. */\n welcomeSuggestionCount: number;\n}> = ({ tools, welcomeSuggestionCount }) => {\n const aui = useAui();\n const threadId = useAthenaStatewireThreadId();\n const { appUrl } = useAthenaConfig();\n const { attachments, clearAttachments, isUploading } = useAttachments();\n const { quote, clearQuote } = useQuote();\n const { attachFiles } = useAttachFiles();\n const composerRef = useRef<TiptapComposerHandle>(null);\n const [hasText, setHasText] = useState(false);\n const [dragActive, setDragActive] = useState(false);\n const keyboardHint = useComposerKeyboardHint();\n const reducedMotion = usePrefersReducedMotion();\n // The staged entrance belongs to the empty state only: a composer that\n // mounts over an existing transcript is simply there.\n const isEmpty = useAuiState((state) => state.thread.isEmpty);\n const [mountedEmpty] = useState(() => isEmpty);\n const entrance = welcomeEntrance(\n welcomeComposerDelayMs(welcomeSuggestionCount),\n reducedMotion || !mountedEmpty,\n );\n\n const rootCategories = useMemo<readonly MentionRootCategory[]>(() => {\n const categories = [...ATHENA_CHAT_MENTION_CATEGORIES];\n if (tools.some((tool) => tool.type === 'toolkit')) categories.push('toolkits');\n if (tools.some((tool) => tool.type === 'tool')) categories.push('tools');\n return categories;\n }, [tools]);\n\n // The submit paths are captured once by the editor's keybinding, so they\n // read the current draft extras through refs.\n const attachmentsRef = useRef(attachments);\n attachmentsRef.current = attachments;\n const quoteRef = useRef(quote);\n quoteRef.current = quote;\n const hasExtras = attachments.length > 0 || quote !== null;\n\n // A submit during an upload parks until the pills have the asset; the\n // waiters resolve on the render that turns `isUploading` off, by which\n // point `attachmentsRef` holds the uploaded asset.\n const isUploadingRef = useRef(isUploading);\n isUploadingRef.current = isUploading;\n const uploadWaitersRef = useRef<Array<() => void>>([]);\n useEffect(() => {\n if (isUploading) return;\n const waiters = uploadWaitersRef.current;\n uploadWaitersRef.current = [];\n for (const resolve of waiters) resolve();\n }, [isUploading]);\n const waitForHostUploads = useCallback(() => {\n if (!isUploadingRef.current) return;\n return new Promise<void>((resolve) => {\n uploadWaitersRef.current.push(resolve);\n });\n }, []);\n\n const sendComposed = useCallback(\n (userText: string): boolean => {\n const message = buildComposedMessage({\n attachments: attachmentsRef.current,\n quote: quoteRef.current,\n userText,\n appUrl,\n });\n if (!message) return false;\n // steer: false — a mid-run send queues behind the active run instead of\n // interrupting it; idle sends dispatch immediately.\n aui.composer.setText(message);\n aui.composer.send({ steer: false });\n clearAttachments();\n clearQuote();\n return true;\n },\n [appUrl, aui, clearAttachments, clearQuote],\n );\n\n // Consumes the editor's draft (possibly empty) only when there are extras\n // to compose with it.\n const interceptSubmit = useCallback(\n (text: string) =>\n attachmentsRef.current.length > 0 || quoteRef.current !== null\n ? sendComposed(text)\n : false,\n [sendComposed],\n );\n\n // Pasted images go through the pills' intake; drops are left to the\n // enclosing ComposerDropZone.\n const fileIntake = useMemo<ComposerFileIntake>(\n () => ({\n onPaste: (files) => {\n void attachFiles(files, 'paste');\n },\n }),\n [attachFiles],\n );\n\n return (\n <ComposerDropZone onDragActiveChange={setDragActive}>\n {/* React delivers `onFocus` as focusin, so the editor's focus reaches\n this wrapper; the same element carries the staged entrance. */}\n <div\n className={cn('aui-composer-entrance', entrance.className)}\n style={entrance.style}\n onFocus={keyboardHint.onFocus}\n >\n <ChatComposerDock\n appearance=\"paper\"\n dragActive={dragActive}\n aboveSurface={<ThreadScrollToBottom />}\n beforeEditor={\n <>\n <ComposerQuotePreview />\n <ComposerAttachmentPreview />\n </>\n }\n editor={\n <TiptapComposer\n ref={composerRef}\n threadId={threadId}\n appearance=\"paper\"\n placeholder=\"Type @ to tag an asset\"\n tools={tools}\n rootCategories={rootCategories}\n onDraftStateChange={setHasText}\n waitForHostUploads={waitForHostUploads}\n interceptSubmit={interceptSubmit}\n fileIntake={fileIntake}\n onSubmitted={keyboardHint.onSubmitted}\n />\n }\n toolbarStart={\n <div className=\"flex items-center gap-1\">\n <FileUploadButton className=\"aui-composer-attach size-8 rounded-full p-0 disabled:opacity-30\" />\n <AthenaComposerMentionButton\n onClick={() => composerRef.current?.openMentionMenu?.()}\n />\n </div>\n }\n toolbarEnd={\n <div className=\"flex items-center gap-1\">\n <ComposerSendOrStop\n composerRef={composerRef}\n hasDraft={hasText || hasExtras}\n sendBlockedReason={isUploading ? 'Upload in progress...' : null}\n components={ATHENA_COMPOSER_COMPONENTS}\n />\n </div>\n }\n belowSurface={<ComposerKeyboardHint visible={keyboardHint.visible} />}\n />\n </div>\n </ComposerDropZone>\n );\n};\n\nconst MessageError: FC = () => (\n <MessagePrimitive.Error>\n <ErrorPrimitive.Root className=\"aui-message-error-root mt-2 flex items-start gap-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm dark:bg-destructive/5 dark:text-red-200\">\n <AlertCircleIcon className=\"mt-0.5 size-4 shrink-0\" />\n <ErrorPrimitive.Message className=\"aui-message-error-message grow\" />\n <ActionBarPrimitive.Reload asChild>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"size-6 shrink-0 text-destructive hover:text-destructive dark:text-red-200 dark:hover:text-red-100\"\n >\n <RefreshCwIcon className=\"size-3.5\" />\n </Button>\n </ActionBarPrimitive.Reload>\n </ErrorPrimitive.Root>\n </MessagePrimitive.Error>\n);\n\n/**\n * The quiet status line under a running turn: one pulsing dot, the verb\n * (\"Thinking…\", or the running tool's activity such as \"Searching the web…\"),\n * the elapsed seconds once the counter is due, and a stall tone once nothing\n * has streamed for a while — so a busy run and a possibly-stuck one stop\n * looking identical. The timer restarts whenever `resetKey` changes.\n */\nconst RunStatusLine: FC<{\n verb: string;\n resetKey: string;\n /** Render nothing until the counter is due (a host header already names the verb). */\n counterOnly?: boolean;\n className?: string;\n}> = ({ verb, resetKey, counterOnly = false, className }) => {\n const [seconds, setSeconds] = useState(0);\n useEffect(() => {\n setSeconds(0);\n const startedAt = Date.now();\n const timer = setInterval(() => {\n setSeconds(Math.floor((Date.now() - startedAt) / 1000));\n }, 1000);\n return () => clearInterval(timer);\n }, [resetKey]);\n const stalled = seconds >= RUN_ACTIVITY_STALL_SECONDS;\n if (counterOnly && seconds < RUN_ACTIVITY_COUNTER_SECONDS) return null;\n return (\n <div\n data-slot=\"run-status-line\"\n data-stalled={stalled ? 'true' : undefined}\n className={cn(\n 'aui-run-activity mt-2 flex items-center gap-2 px-1 text-[12px] text-muted-foreground',\n className,\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'size-1.5 shrink-0 rounded-full bg-current opacity-60',\n !stalled && 'animate-pulse motion-reduce:animate-none',\n )}\n />\n <span\n aria-hidden=\"true\"\n className={cn('tabular-nums', stalled && 'text-amber-600 dark:text-amber-400')}\n >\n {runActivityLabel(seconds, verb)}\n </span>\n {/* The visible counter ticks every second; announcing each tick would\n drown a screen reader, so the live region only speaks the two\n meaningful transitions: what the run is doing, and that it looks\n stalled. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {stalled ? 'Assistant is still working; nothing new for over thirty seconds.' : `${verb}…`}\n </span>\n </div>\n );\n};\n\nconst AthenaAssistantMessageEmpty: EmptyMessagePartComponent = ({ status }) => {\n if (status?.type !== 'running') return null;\n return <RunStatusLine verb=\"Thinking\" resetKey=\"empty\" className=\"mt-0\" />;\n};\n\n/**\n * Renders the empty/loading indicator while a message is running but has no\n * parts yet. `MessagePrimitive.GroupedParts` only renders existing parts, so\n * the indicator can't live inside its switch — it goes here as a sibling.\n */\nconst AthenaMessageEmptyIndicator: FC<{ EmptyComponent: EmptyMessagePartComponent }> = ({\n EmptyComponent,\n}) => {\n const hasParts = useAuiState((s) => s.message.parts.length > 0);\n const isRunning = useAuiState((s) => s.message.status?.type === 'running');\n if (hasParts || !isRunning) return null;\n return <EmptyComponent status={{ type: 'running' }} />;\n};\n\n/**\n * Run-liveness line under a running message whose tail is a tool call: the\n * tool's own verb from the shared registry, an elapsed counter that resets\n * whenever the stream moves the tail part, and the stall tone. Text and\n * reasoning tails animate on their own and render no line.\n */\nconst AthenaMessageActivityIndicator: FC = () => {\n const isRunning = useAuiState((s) => s.message.status?.type === 'running');\n const activityKey = useAuiState((s) => runActivityKey(s.message.parts));\n const verb = useAuiState((s) => runActivityVerb(s.message.parts));\n if (!isRunning || activityKey === null) return null;\n return <RunStatusLine verb={verb ?? 'Working'} resetKey={activityKey} />;\n};\n\n/**\n * The grouped view's running meta: the activity card already names the verb,\n * so this adds only the elapsed counter (after three seconds) and the stall\n * tone, keyed to the stream's tail like the inline indicator.\n */\nconst AthenaGroupedRunMeta: FC = () => {\n const activityKey = useAuiState((s) => runActivityKey(s.message.parts));\n return (\n <RunStatusLine\n verb=\"Working\"\n resetKey={activityKey ?? 'thinking'}\n counterOnly\n className=\"mt-1 px-0\"\n />\n );\n};\nconst renderGroupedRunningMeta = () => <AthenaGroupedRunMeta />;\n\n/**\n * The centered hairline with the date, rendered above the first message of a\n * calendar day that differs from the previous message's. Both messages need\n * the runtime's `_created_at` stamp; without it there is nothing truthful to\n * separate on.\n */\nconst MessageDaySeparator: FC = () => {\n const stamp = useAuiState((s) => readMessageCreatedAt(s.message.metadata?.custom));\n const previousStamp = useAuiState((s) => {\n const index = s.message.index;\n const previous = index > 0 ? s.thread.messages[index - 1] : undefined;\n return readMessageCreatedAt(previous?.metadata?.custom);\n });\n const label = useMemo(() => {\n const date = stamp ? parseMessageTime(stamp) : null;\n const previous = previousStamp ? parseMessageTime(previousStamp) : null;\n if (!date || !previous || isSameCalendarDay(date, previous)) return null;\n return formatDayLabel(date);\n }, [stamp, previousStamp]);\n if (!label) return null;\n return (\n <div\n role=\"separator\"\n aria-label={label}\n data-slot=\"day-separator\"\n className=\"aui-day-separator mb-3 flex w-full items-center gap-3 text-[11px] font-medium text-muted-foreground\"\n >\n <span aria-hidden=\"true\" className=\"h-px flex-1 bg-border\" />\n <span>{label}</span>\n <span aria-hidden=\"true\" className=\"h-px flex-1 bg-border\" />\n </div>\n );\n};\n\n/**\n * The message's clock time, revealed on hover beside the action bar (the\n * full date in its `title`). Reads the runtime's `_created_at` stamp; a\n * message without one shows no time rather than a wrong one.\n */\nconst MessageTimestamp: FC<{ className?: string }> = ({ className }) => {\n const stamp = useAuiState((s) => readMessageCreatedAt(s.message.metadata?.custom));\n const date = useMemo(() => (stamp ? parseMessageTime(stamp) : null), [stamp]);\n if (!date) return null;\n return (\n <time\n dateTime={date.toISOString()}\n title={formatMessageDateTime(date)}\n data-slot=\"message-timestamp\"\n className={cn(\n 'aui-message-timestamp shrink-0 text-[11px] tabular-nums text-muted-foreground',\n ACTION_BAR_REVEAL_CLASS,\n className,\n )}\n >\n {formatMessageTime(date)}\n </time>\n );\n};\n\nexport const AthenaReasoningPart: FC<AthenaReasoningPartProps> = ({\n text,\n status,\n TextComponent,\n}) => {\n const inheritedTextComponent = useContext(AthenaReasoningTextComponentContext);\n const EffectiveTextComponent = TextComponent ?? inheritedTextComponent ?? TiptapText;\n const isMessageRunning = useAuiState((state) => state.message.status?.type === 'running');\n const reasoningTokens = useAuiState((state) =>\n getReasoningTokensFromMetadata(state.message.metadata)\n );\n const isRunning = isMessageRunning || status?.type === 'running';\n const [isCollapsed, setIsCollapsed] = useState(!isRunning);\n const userOverrodeOpenStateRef = useRef(false);\n const hasText = text.trim().length > 0;\n\n const reasoningTextProps: TextMessagePartProps = {\n type: 'text',\n text,\n status: isRunning\n ? ({ type: 'running' } as TextMessagePartProps['status'])\n : (status as TextMessagePartProps['status']),\n };\n\n useEffect(() => {\n if (userOverrodeOpenStateRef.current) {\n return;\n }\n\n setIsCollapsed(!isRunning);\n }, [isRunning]);\n\n if (!hasText && !isRunning) {\n return null;\n }\n\n return (\n <Collapsible\n open={!isCollapsed}\n onOpenChange={(open) => {\n userOverrodeOpenStateRef.current = true;\n setIsCollapsed(!open);\n }}\n className=\"aui-assistant-reasoning-root mb-3 rounded-2xl border border-border/60 bg-muted/30 px-3 py-2\"\n >\n <CollapsibleTrigger asChild>\n <button\n type=\"button\"\n className=\"flex w-full items-center justify-between gap-3 text-left\"\n aria-label={isRunning ? 'Toggle reasoning while streaming' : 'Toggle reasoning'}\n >\n <span className=\"flex min-w-0 items-center gap-2 text-[13px] font-medium text-muted-foreground\">\n <BrainIcon className=\"size-4 shrink-0\" />\n <span>{isRunning ? 'Reasoning...' : 'Reasoning'}</span>\n </span>\n <span className=\"flex shrink-0 items-center gap-2\">\n {reasoningTokens !== undefined && (\n <span className=\"rounded-full border border-border/60 bg-background px-2 py-0.5 text-[11px] font-medium text-muted-foreground\">\n {formatReasoningTokens(reasoningTokens)}\n </span>\n )}\n <span\n className={cn(\n 'flex size-5 items-center justify-center text-muted-foreground transition-transform',\n isCollapsed ? 'rotate-0' : 'rotate-90'\n )}\n aria-hidden=\"true\"\n >\n <ChevronRightIcon className=\"size-4\" />\n </span>\n </span>\n </button>\n </CollapsibleTrigger>\n\n <CollapsibleContent className=\"pt-3\">\n {isRunning && !hasText ? (\n <span className=\"shimmer text-[13px] text-muted-foreground\">Analyzing...</span>\n ) : (\n <div className=\"aui-assistant-reasoning-body text-[13px] leading-relaxed\">\n <EffectiveTextComponent {...reasoningTextProps} />\n </div>\n )}\n </CollapsibleContent>\n </Collapsible>\n );\n};\n\nconst groupAdjacentToolCalls = (part: PartState) =>\n part.type === 'tool-call' ? (['group-tool'] as const) : null;\nconst noToolGrouping = () => null;\n\nexport const AthenaAssistantMessage: FC<AthenaAssistantMessageProps> = ({\n toolUIs,\n AvatarComponent,\n TextComponent = TiptapText,\n ReasoningComponent,\n EmptyComponent = AthenaAssistantMessageEmpty,\n ActionBarComponent = AthenaAssistantActionBar,\n groupToolCalls = true,\n}) => {\n const effectiveReasoningComponent = ReasoningComponent ?? AthenaReasoningPart;\n const toolUIsWithNestedMessages = useMemo(() => {\n const wrappedToolUIs: Record<string, ToolCallMessagePartComponent> = {};\n\n for (const [toolName, ToolUI] of Object.entries(toolUIs)) {\n wrappedToolUIs[toolName] = withNestedPtcMessages(ToolUI);\n }\n\n return wrappedToolUIs;\n }, [toolUIs]);\n\n // NestedPtcComponentsProvider still consumes the legacy parts-config shape\n // (Text / Reasoning / tools.by_name / Empty) to render PTC sub-tool messages\n // inside a tool card. The outer rendering uses GroupedParts, but the inner\n // PTC tree continues to mirror the parent registry.\n const nestedPtcComponents = useMemo(\n () => ({\n Text: TextComponent,\n Reasoning: effectiveReasoningComponent,\n tools: {\n Fallback: ToolFallback,\n by_name: toolUIsWithNestedMessages,\n },\n Empty: EmptyComponent,\n }),\n [EmptyComponent, TextComponent, effectiveReasoningComponent, toolUIsWithNestedMessages],\n );\n\n return (\n <MessagePrimitive.Root\n className=\"aui-assistant-message-root group/aui-assistant-message fade-in slide-in-from-bottom-1 relative mx-auto w-full max-w-(--thread-max-width) animate-in py-3 duration-150\"\n data-role=\"assistant\"\n >\n <MessageDaySeparator />\n <div className=\"flex gap-3\">\n {/* The leading column exists only when the host supplies an avatar;\n without one the turn is told apart from the right-aligned user\n bubbles by alignment alone, with no rule or gutter of its own. */}\n {AvatarComponent ? (\n <div\n data-slot=\"assistant-lead\"\n className=\"aui-assistant-message-lead flex shrink-0 justify-center\"\n >\n <AvatarComponent />\n </div>\n ) : null}\n <div className=\"min-w-0 flex-1\">\n <AthenaReasoningTextComponentContext.Provider value={TextComponent}>\n <div className=\"aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed\">\n <NestedPtcComponentsProvider components={nestedPtcComponents}>\n {groupToolCalls ? (\n <div className=\"flex flex-col space-y-2\">\n <SuperGroupingCard\n toolUIs={toolUIsWithNestedMessages}\n TextComponent={TextComponent}\n ReasoningComponent={effectiveReasoningComponent}\n renderRunningMeta={renderGroupedRunningMeta}\n />\n <SuperGroupingFinalText TextComponent={TextComponent} />\n </div>\n ) : (\n <>\n <AthenaMessageEmptyIndicator EmptyComponent={EmptyComponent} />\n <MessagePrimitive.GroupedParts groupBy={noToolGrouping}>\n {({ part }) => {\n switch (part.type) {\n case 'tool-call': {\n const ToolUI = toolUIsWithNestedMessages[part.toolName];\n const toolProps = part as unknown as ToolCallMessagePartProps;\n return ToolUI ? <ToolUI {...toolProps} /> : <ToolFallback {...toolProps} />;\n }\n case 'reasoning': {\n const ReasoningRenderer = effectiveReasoningComponent;\n return <ReasoningRenderer {...(part as ReasoningMessagePartProps)} />;\n }\n case 'text': {\n const textPart = part as TextMessagePartProps;\n if (textPart.text === '' && textPart.status?.type === 'running') {\n return <EmptyComponent status={textPart.status} />;\n }\n return <TextComponent {...textPart} />;\n }\n default:\n return null;\n }\n }}\n </MessagePrimitive.GroupedParts>\n <AthenaMessageActivityIndicator />\n </>\n )}\n </NestedPtcComponentsProvider>\n <MessageError />\n </div>\n </AthenaReasoningTextComponentContext.Provider>\n <div className=\"aui-assistant-message-footer mt-1 ml-2 flex items-center gap-1\">\n <BranchPicker />\n <ActionBarComponent />\n <MessageTimestamp className=\"ml-auto group-hover/aui-assistant-message:opacity-100\" />\n </div>\n </div>\n </div>\n </MessagePrimitive.Root>\n );\n};\n\nconst AthenaToolGroup: FC<{ children: React.ReactNode; count: number }> = ({ children, count }) => {\n const [expanded, setExpanded] = useState(false);\n\n return (\n <div className=\"my-3 w-full overflow-hidden rounded-xl border border-border/60 bg-background shadow-sm\">\n <button\n type=\"button\"\n onClick={() => setExpanded((v) => !v)}\n className=\"flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-muted/20\"\n aria-expanded={expanded}\n >\n <div className=\"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground\">\n <LayersIcon className=\"size-4\" />\n </div>\n <div className=\"min-w-0 flex-1\">\n <span className=\"text-[13px] font-medium text-foreground\">\n {count} tool {count === 1 ? 'call' : 'calls'}\n </span>\n </div>\n <ChevronDownIcon\n className={cn(\n 'size-4 shrink-0 text-muted-foreground transition-transform duration-200',\n !expanded && '-rotate-90',\n )}\n />\n </button>\n {expanded && (\n <div className=\"border-t border-border/40 bg-muted/5 px-3 pt-1 pb-2 [&>*]:my-2\">\n {children}\n </div>\n )}\n </div>\n );\n};\n\nconst CopyMessageButton: FC = () => (\n <ActionBarPrimitive.Copy asChild>\n <TooltipIconButton tooltip=\"Copy\">\n <AuiIf condition={(s) => s.message.isCopied}>\n <CheckIcon />\n </AuiIf>\n <AuiIf condition={(s) => !s.message.isCopied}>\n <CopyIcon />\n </AuiIf>\n </TooltipIconButton>\n </ActionBarPrimitive.Copy>\n);\n\n/** Regenerate dispatches `run/reload`, so it hides on read-only threads. */\nconst RegenerateMessageButton: FC = () => {\n const readOnly = useMessageActionsReadOnly();\n if (readOnly) return null;\n return (\n <ActionBarPrimitive.Reload asChild>\n <TooltipIconButton tooltip=\"Regenerate\">\n <RefreshCwIcon />\n </TooltipIconButton>\n </ActionBarPrimitive.Reload>\n );\n};\n\n/**\n * The edit primitive does not check the runtime's edit capability itself —\n * clicking it on a runtime without one throws inside onPress — so the button\n * gates on the capability and, to match the rewind semantics of `run/edit`,\n * stays hidden while a run is live or the transcript is read-only.\n */\nconst EditMessageButton: FC = () => {\n const allowEdit = useAuiState((s) => s.thread.capabilities.edit);\n const isRunning = useAthenaRunLive();\n const readOnly = useMessageActionsReadOnly();\n if (!allowEdit || isRunning || readOnly) return null;\n return (\n <ActionBarPrimitive.Edit asChild>\n <TooltipIconButton tooltip=\"Edit\">\n <PencilIcon />\n </TooltipIconButton>\n </ActionBarPrimitive.Edit>\n );\n};\n\n/** Hover-revealed copy / edit row under a user bubble; mirrors the assistant bar. */\nconst AthenaUserActionBar: FC = () => {\n const isThreadRunning = useAuiState((s) => s.thread.isRunning);\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n 'aui-user-action-bar-root flex min-h-6 gap-1 text-muted-foreground',\n isThreadRunning\n ? 'invisible'\n : [\n ACTION_BAR_REVEAL_CLASS,\n 'group-hover/aui-user-message:pointer-events-auto group-hover/aui-user-message:opacity-100',\n ],\n )}\n >\n <CopyMessageButton />\n <EditMessageButton />\n </ActionBarPrimitive.Root>\n );\n};\n\nexport const AthenaAssistantActionBar: FC<AthenaAssistantActionBarProps> = ({ className }) => {\n const threadId = useAthenaThreadId();\n const { appUrl } = useAthenaConfig();\n // The bar stays mounted so the footer keeps its height: assistant-ui's\n // `autohide` / `hideWhenRunning` unmount it, which shifts the whole message\n // up and down on every hover. Visibility is CSS instead — the latest reply\n // keeps its actions, older replies reveal on hover or keyboard focus, and\n // while the thread runs every bar is `invisible` (layout kept, controls\n // unfocusable — opacity alone would still let Tab reveal them).\n const isLast = useAuiState((s) => s.message.isLast);\n const isThreadRunning = useAuiState((s) => s.thread.isRunning);\n\n return (\n <ActionBarPrimitive.Root\n autohide=\"never\"\n className={cn(\n 'aui-assistant-action-bar-root -ml-1 flex min-h-6 gap-1 text-muted-foreground',\n isThreadRunning && 'invisible',\n !isThreadRunning &&\n !isLast && [\n ACTION_BAR_REVEAL_CLASS,\n 'group-hover/aui-assistant-message:pointer-events-auto group-hover/aui-assistant-message:opacity-100',\n ],\n className,\n )}\n >\n <CopyMessageButton />\n <RegenerateMessageButton />\n <ActionBarMorePrimitive.Root>\n <ActionBarMorePrimitive.Trigger asChild>\n <TooltipIconButton tooltip=\"More\" className=\"data-[state=open]:bg-accent\">\n <MoreHorizontalIcon />\n </TooltipIconButton>\n </ActionBarMorePrimitive.Trigger>\n <ActionBarMorePrimitive.Content\n side=\"bottom\"\n align=\"start\"\n className=\"aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\"\n >\n <ActionBarPrimitive.ExportMarkdown asChild>\n <ActionBarMorePrimitive.Item className=\"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground\">\n <DownloadIcon className=\"size-4\" />\n Export as Markdown\n </ActionBarMorePrimitive.Item>\n </ActionBarPrimitive.ExportMarkdown>\n {threadId && (\n <ActionBarMorePrimitive.Item\n className=\"aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground\"\n onClick={() => {\n window.open(createAthenaSpacesUrl({ appUrl, sessionId: threadId }), '_blank');\n }}\n >\n <ExternalLinkIcon className=\"size-4\" />\n Open in Athena\n </ActionBarMorePrimitive.Item>\n )}\n </ActionBarMorePrimitive.Content>\n </ActionBarMorePrimitive.Root>\n </ActionBarPrimitive.Root>\n );\n};\n\nexport const AthenaUserMessage: FC<AthenaUserMessageProps> = ({\n TextComponent = TiptapText,\n}) => {\n // A GitHub wake turn is an event, not words the user typed: it renders as\n // the compact wake marker instead of a bubble quoting the injected text.\n const isWake = useAuiState((s) => isGithubWakeMessage(s.message.metadata?.custom));\n if (isWake) {\n return (\n <MessagePrimitive.Root\n className=\"aui-user-message-root aui-wake-marker-root mx-auto w-full max-w-(--thread-max-width) px-2 py-1\"\n data-role=\"user\"\n >\n <MessageDaySeparator />\n <WakeMarkerMessage />\n </MessagePrimitive.Root>\n );\n }\n return (\n <MessagePrimitive.Root\n className=\"aui-user-message-root group/aui-user-message fade-in slide-in-from-bottom-1 mx-auto flex w-full max-w-(--thread-max-width) animate-in flex-col items-end px-2 py-3 duration-150\"\n data-role=\"user\"\n >\n <MessageDaySeparator />\n {/* A soft bubble on a 75% measure: the user's words stay a bubble, the\n assistant's reading column stays the page. */}\n <div className=\"flex min-w-0 max-w-[75%] flex-col items-end gap-1\">\n <div className=\"aui-user-message-content wrap-break-word rounded-2xl bg-muted/70 px-4 py-2.5 text-foreground\">\n <MessagePrimitive.Parts components={{ Text: TextComponent }} />\n </div>\n <div className=\"aui-user-message-footer -mr-1 flex items-center gap-1\">\n <MessageTimestamp className=\"mr-1 group-hover/aui-user-message:opacity-100\" />\n <BranchPicker />\n <AthenaUserActionBar />\n </div>\n </div>\n </MessagePrimitive.Root>\n );\n};\n"],"names":["useQuoteFromPostMessage","createContext","useContext","jsx","isRecord","useNestedPtcComponents","ToolFallback","jsxs","Fragment","NestedPtcMessages","DEFAULT_WELCOME_SUGGESTIONS","useAthenaConfig","AthenaStatewireThreadIdContext","useMemo","getToolkitDisplayInfo","AppendDocumentToolUI","ReadAssetToolUI","TOOL_UI_REGISTRY","TiptapText","messageComponents","AthenaChatErrorBoundary","ToolFallbackAppearanceProvider","ChatThreadShell","ThreadLoadingOverlay","cn","WaitingOnYouBanner","AthenaChatWelcome","StatewireHistoryEdge","ThreadPrimitive","AthenaChatWelcomeSuggestions","StatewireConnectionBanner","StatewireErrorBanner","StatewireApprovalCard","StatewireQueuedMessages","AttachmentProvider","QuoteProvider","MentionAuthCtx","useState","useCallback","useEffect","useAuiState","TooltipIconButton","ArrowUpIcon","useAui","useAthenaStatewireThreadId","useAttachments","useQuote","useAttachFiles","useRef","useComposerKeyboardHint","usePrefersReducedMotion","welcomeEntrance","welcomeComposerDelayMs","buildComposedMessage","ComposerDropZone","ChatComposerDock","ThreadScrollToBottom","ComposerQuotePreview","ComposerAttachmentPreview","TiptapComposer","FileUploadButton","AthenaComposerMentionButton","ComposerSendOrStop","ATHENA_COMPOSER_COMPONENTS","ComposerKeyboardHint","MessagePrimitive","ErrorPrimitive","AlertCircleIcon","ActionBarPrimitive","Button","RefreshCwIcon","RUN_ACTIVITY_STALL_SECONDS","RUN_ACTIVITY_COUNTER_SECONDS","runActivityLabel","runActivityKey","runActivityVerb","readMessageCreatedAt","index","parseMessageTime","isSameCalendarDay","formatDayLabel","formatMessageDateTime","ACTION_BAR_REVEAL_CLASS","Collapsible","CollapsibleTrigger","BrainIcon","ChevronRightIcon","CollapsibleContent","NestedPtcComponentsProvider","SuperGroupingCard","SuperGroupingFinalText","BranchPicker","AuiIf","CheckIcon","CopyIcon","useMessageActionsReadOnly","useAthenaRunLive","PencilIcon","useAthenaThreadId","ActionBarMorePrimitive","MoreHorizontalIcon","DownloadIcon","createAthenaSpacesUrl","ExternalLinkIcon","isGithubWakeMessage","WakeMarkerMessage"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqIA,SAAS,yBAAyB;AAChCA,uCAAA;AACA,SAAO;AACT;AAwGA,MAAM,qCACJC,QAAAA,cAA8D,IAAI;AAEpE,MAAM,sCAAsCA,QAAAA,cAA+C,IAAI;AAE/F,MAAM,iCAAiC,MAA+C;AACpF,QAAM,QAAQC,QAAAA,WAAW,kCAAkC;AAE3D,MAAI,CAAC,OAAO;AACV,UAAM,IAAI,MAAM,gEAAgE;AAAA,EAClF;AAEA,SAAO;AACT;AAEA,MAAM,gCAAoC,MAAM;AAC9C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE,+BAAA;AAEJ,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,MAAM,2BAA+B,MAAM;AACzC,QAAM,EAAE,cAAA,IAAkB,+BAAA;AAE1B,SAAOA,+BAAC,qBAAkB,eAA8B;AAC1D;AAEA,MAAM,iCAAiC,CAAC,aAA0C;AAChF,MAAI,CAACC,MAAAA,SAAS,QAAQ,GAAG;AACvB,WAAO;AAAA,EACT;AAEA,QAAM,iBAAiB,SAAS;AAChC,MAAI,CAACA,MAAAA,SAAS,cAAc,GAAG;AAC7B,WAAO;AAAA,EACT;AAEA,QAAM,iBAAiB,eAAe;AACtC,MAAI,CAACA,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AthenaChatComponents {
|
|
|
58
58
|
AssistantMessage?: FC;
|
|
59
59
|
AssistantActionBar?: FC<AthenaAssistantActionBarProps>;
|
|
60
60
|
/**
|
|
61
|
-
* Rendered in
|
|
62
|
-
* mark). Without it
|
|
61
|
+
* Rendered in a leading column on every assistant turn (a small avatar or
|
|
62
|
+
* mark). Without it there is no leading column: the reply sits flush with
|
|
63
|
+
* the thread column and is told apart from the right-aligned user bubbles by
|
|
64
|
+
* alignment alone.
|
|
63
65
|
*/
|
|
64
66
|
AssistantAvatar?: FC;
|
|
65
67
|
messageParts?: AthenaChatMessagePartComponents;
|
|
@@ -72,7 +74,7 @@ export interface AthenaAssistantActionBarProps {
|
|
|
72
74
|
}
|
|
73
75
|
export interface AthenaAssistantMessageProps {
|
|
74
76
|
toolUIs: Record<string, ToolCallMessagePartComponent>;
|
|
75
|
-
/** Leading-column content for the turn;
|
|
77
|
+
/** Leading-column content for the turn; no leading column at all when unset. */
|
|
76
78
|
AvatarComponent?: FC;
|
|
77
79
|
TextComponent?: TextMessagePartComponent;
|
|
78
80
|
ReasoningComponent?: ReasoningMessagePartComponent;
|
package/dist/chat/AthenaChat.js
CHANGED
|
@@ -704,21 +704,14 @@ const AthenaAssistantMessage = ({
|
|
|
704
704
|
children: [
|
|
705
705
|
/* @__PURE__ */ jsx(MessageDaySeparator, {}),
|
|
706
706
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
707
|
-
/* @__PURE__ */ jsx(
|
|
707
|
+
AvatarComponent ? /* @__PURE__ */ jsx(
|
|
708
708
|
"div",
|
|
709
709
|
{
|
|
710
710
|
"data-slot": "assistant-lead",
|
|
711
711
|
className: "aui-assistant-message-lead flex shrink-0 justify-center",
|
|
712
|
-
children:
|
|
713
|
-
"span",
|
|
714
|
-
{
|
|
715
|
-
"aria-hidden": "true",
|
|
716
|
-
"data-slot": "assistant-rule",
|
|
717
|
-
className: "aui-assistant-message-rule w-0.5 self-stretch rounded-full bg-border"
|
|
718
|
-
}
|
|
719
|
-
)
|
|
712
|
+
children: /* @__PURE__ */ jsx(AvatarComponent, {})
|
|
720
713
|
}
|
|
721
|
-
),
|
|
714
|
+
) : null,
|
|
722
715
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
723
716
|
/* @__PURE__ */ jsx(AthenaReasoningTextComponentContext.Provider, { value: TextComponent, children: /* @__PURE__ */ jsxs("div", { className: "aui-assistant-message-content wrap-break-word px-2 text-foreground leading-relaxed", children: [
|
|
724
717
|
/* @__PURE__ */ jsx(NestedPtcComponentsProvider, { components: nestedPtcComponents, children: groupToolCalls ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-2", children: [
|