@galaxycore/ai-chat 0.5.0 → 0.6.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0
4
+
5
+ - 新增可选的页面指向:划选文字、双击段落、在图片上拖出区域,都可以变成聊天上下文引用。公开入口是 `useChatTargeting`、`ChatTargetingOverlay`、`toChatContextItem`,以及中英文文案;主入口和 `/targeting` 都会导出。
6
+ - 指向样式随主样式表引入,并单独输出 `dist/targeting.css`。
7
+ - 输入框按 Escape 会失焦,方便宿主关掉指向层。不挂载这套能力时,原有发送、附件和界面保持不变。
8
+
9
+ ## @galaxycore/ai-chat-gateway 0.2.0
10
+
11
+ - Upgraded `@earendil-works/pi-agent-core` and `@earendil-works/pi-ai` from 1.1.0 to 1.4.0. The gateway uses none of the APIs those releases changed; see the Pi changelogs for added providers, client identity and retry fixes.
12
+
3
13
  ## 0.5.0
4
14
 
5
15
  - Assistant text now renders Markdown by default, including headings, lists, tables and fenced code, using the existing streaming renderer. User input remains literal text.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  GalaxyCore 通用 React AI 聊天组件。默认界面借鉴 Chrome AI 侧栏和 Codex 的消息阅读、工具状态与输入区布局,使用 Lucide 图标;支持完整面板、组合组件和 headless Hook。不同业务系统可分别适配文档、表格、图表或编辑器上下文,也可以使用自己的主题与组件库。
4
4
 
5
- **当前版本:UI 包 0.5.0,网关包 0.1.0。** UI 提供平滑流式展示、历史会话菜单、语音输入、可部署示例和交互文档站。独立 Node 网关通过 pi core 实现流式文本、服务端工具调用、停止和持久化会话恢复。Codex 已预留运行时扩展接口,尚未实现其桥接。发布验收与真实模型联调状态见 [验证记录](docs/validation.md)。
5
+ **当前版本:UI 包 0.6.0,网关包 0.2.0。** UI 提供平滑流式展示、历史会话菜单、页面指向、语音输入、可部署示例和交互文档站。独立 Node 网关通过 pi core 实现流式文本、服务端工具调用、停止和持久化会话恢复。Codex 已预留运行时扩展接口,尚未实现其桥接。发布验收与真实模型联调状态见 [验证记录](docs/validation.md)。
6
6
 
7
7
  ## 本地运行
8
8
 
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { a as ChatIconName, c as Icon, i as ChatAppearanceProviderProps, n as Ch
3
3
  import { ChatContextAdapter, ChatContextController, ChatContextItem, ChatContextOptions, ChatContextValue, ChatRequestContext, ContextTray, ContextTrayLabels, ContextTrayProps, SelectedChatContextItem, TextSelectionAdapterOptions, createTextSelectionAdapter, useChatContext } from "./context.js";
4
4
  import { SpeechInputAdapter, SpeechInputController, SpeechInputError, SpeechInputErrorCode, SpeechInputLabels, SpeechInputOptions, SpeechInputResult, SpeechInputSession, SpeechInputStartOptions, SpeechInputState, SpeechInputSupport, UseSpeechInputOptions, createBrowserSpeechAdapter, defaultSpeechInputLabels, useSpeechInput } from "./voice.js";
5
5
  import { C as ToolRenderers, S as ToolPresentationResolver, _ as PartRendererProps, b as ToolPart, c as AiChatOptions, d as ChatComposerProps, f as ChatLabels, g as ChatSuggestedAction, h as ChatPanelProps, i as getMessageText, l as AiChatProps, m as ChatMessagesProps, n as zhCN, o as useAiChat, p as ChatMessageActionContext, s as AiChatController, t as enUS, u as AttachmentOptions, v as PartRenderers, x as ToolPresentation, y as TextRenderer } from "./labels-D8smv23O.js";
6
+ import { ActiveMarquee, ChatTargetHit, ChatTargetKind, ChatTargetRect, ChatTargetingController, ChatTargetingLabels, ChatTargetingOverlay, ChatTargetingOverlayProps, PendingChatTarget, UseChatTargetingOptions, enUSTargetingLabels, toChatContextItem, useChatTargeting, zhCNTargetingLabels } from "./targeting.js";
6
7
  import { HTMLAttributes, ReactNode } from "react";
7
8
  import { UIMessage } from "ai";
8
9
  //#region src/ai-chat.d.ts
@@ -59,5 +60,5 @@ export declare function ChatHistoryMenu({ conversations, currentId, onSelect, on
59
60
  /** Drafts and upload requests are isolated by conversation id. */
60
61
  export declare function ChatComposer<M extends UIMessage = UIMessage>(props: ChatComposerProps<M>): import("react").JSX.Element;
61
62
  //#endregion
62
- export { type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, ChatAppearanceProvider, type ChatAppearanceProviderProps, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatHistoryItem, type ChatHistoryLabels, type ChatHistoryMenuProps, Icon as ChatIcon, ChatIconButton, type ChatIconButtonProps, type ChatIconName, type ChatIconOverrides, type ChatIconProps, type ChatLabels, type ChatMessageActionContext, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type ChatSuggestedAction, ContextTray, type ContextTrayLabels, type ContextTrayProps, type PartRendererProps, type PartRenderers, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputErrorCode, type SpeechInputLabels, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type SpeechInputState, type SpeechInputSupport, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, type UseSpeechInputOptions, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, useAiChat, useChatContext, useSpeechInput, zhCN };
63
+ export { type ActiveMarquee, type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, ChatAppearanceProvider, type ChatAppearanceProviderProps, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatHistoryItem, type ChatHistoryLabels, type ChatHistoryMenuProps, Icon as ChatIcon, ChatIconButton, type ChatIconButtonProps, type ChatIconName, type ChatIconOverrides, type ChatIconProps, type ChatLabels, type ChatMessageActionContext, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type ChatSuggestedAction, type ChatTargetHit, type ChatTargetKind, type ChatTargetRect, type ChatTargetingController, type ChatTargetingLabels, ChatTargetingOverlay, type ChatTargetingOverlayProps, ContextTray, type ContextTrayLabels, type ContextTrayProps, type PartRendererProps, type PartRenderers, type PendingChatTarget, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputErrorCode, type SpeechInputLabels, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type SpeechInputState, type SpeechInputSupport, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, type UseChatTargetingOptions, type UseSpeechInputOptions, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, enUSTargetingLabels, getMessageText, toChatContextItem, useAiChat, useChatContext, useChatTargeting, useSpeechInput, zhCN, zhCNTargetingLabels };
63
64
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import { SpeechInputError, createBrowserSpeechAdapter, defaultSpeechInputLabels,
7
7
  import { MarkdownResponse } from "./markdown.js";
8
8
  import { ContextTray, createTextSelectionAdapter, useChatContext } from "./context.js";
9
9
  import "./appearance.js";
10
+ import { ChatTargetingOverlay, enUSTargetingLabels, toChatContextItem, useChatTargeting, zhCNTargetingLabels } from "./targeting.js";
10
11
  import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
11
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
13
  import { isToolUIPart } from "ai";
@@ -291,6 +292,10 @@ function Composer({ chat, labels: overrides, attachments, speech, toolbar, conte
291
292
  }
292
293
  },
293
294
  onKeyDown: (event) => {
295
+ if (event.key === "Escape" && !event.nativeEvent.isComposing && event.keyCode !== 229) {
296
+ event.currentTarget.blur();
297
+ return;
298
+ }
294
299
  if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing && event.keyCode !== 229) {
295
300
  event.preventDefault();
296
301
  send();
@@ -1428,6 +1433,6 @@ function ChatHistoryMenu({ conversations, currentId, onSelect, onNewChat, disabl
1428
1433
  });
1429
1434
  }
1430
1435
  //#endregion
1431
- export { AiChat, ChatAppearanceProvider, ChatComposer, ChatHistoryMenu, Icon as ChatIcon, ChatIconButton, ChatMessages, ChatPanel, ContextTray, SpeechInputError, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, useAiChat, useChatContext, useSpeechInput, zhCN };
1436
+ export { AiChat, ChatAppearanceProvider, ChatComposer, ChatHistoryMenu, Icon as ChatIcon, ChatIconButton, ChatMessages, ChatPanel, ChatTargetingOverlay, ContextTray, SpeechInputError, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, enUSTargetingLabels, getMessageText, toChatContextItem, useAiChat, useChatContext, useChatTargeting, useSpeechInput, zhCN, zhCNTargetingLabels };
1432
1437
 
1433
1438
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/chat-composer.tsx","../src/tool-activity.tsx","../src/use-message-scroll.ts","../src/streaming-text.tsx","../src/chat-messages.tsx","../src/chat-panel.tsx","../src/ai-chat.tsx","../src/chat-history-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useId, useRef, useState } from 'react';\nimport type { FileUIPart, UIMessage } from 'ai';\nimport { Icon } from './icons';\nimport { ChatIconButton } from './ui-primitives';\nimport { resolveLabels } from './labels';\nimport { acceptsFile, asError } from './utils';\nimport type { ChatComposerProps } from './types';\nimport { defaultSpeechInputLabels, useSpeechInput } from './voice';\n\ninterface PendingFile { id: string; name: string; part?: FileUIPart }\n\n/** Drafts and upload requests are isolated by conversation id. */\nexport function ChatComposer<M extends UIMessage = UIMessage>(props: ChatComposerProps<M>) {\n return <Composer key={props.chat.id} {...props} />;\n}\n\nfunction Composer<M extends UIMessage>({ chat, labels: overrides, attachments, speech, toolbar, context, requestOptions, disabled, className = '', onActionError }: ChatComposerProps<M>) {\n const labels = resolveLabels(overrides);\n const [text, setText] = useState('');\n const [files, setFiles] = useState<PendingFile[]>([]);\n const [error, setError] = useState<string>();\n const uploads = useRef(new Map<string, AbortController>());\n const sequence = useRef(0);\n const sending = useRef(false);\n const draft = useRef(text);\n draft.current = text;\n const fileInput = useRef<HTMLInputElement>(null);\n const textarea = useRef<HTMLTextAreaElement>(null);\n const inputId = useId();\n const [rememberSpeech, setRememberSpeech] = useState(false);\n const voiceLabels = { ...defaultSpeechInputLabels, ...speech?.labels };\n const voice = useSpeechInput({\n adapter: speech?.adapter, lang: speech?.lang,\n onComplete: recognized => {\n // Append to the latest draft, not a snapshot from recording start. Typing during capture is safe.\n setText(current => {\n const next = current ? `${current}${/\\s$/.test(current) ? '' : '\\n'}${recognized}` : recognized;\n draft.current = next;\n return next;\n });\n },\n onError: failure => onActionError?.(failure),\n });\n useEffect(() => { if (disabled || chat.isBusy) voice.cancel(); }, [disabled, chat.isBusy, voice.cancel]);\n\n\n useEffect(() => {\n const pending = uploads.current;\n return () => { pending.forEach(controller => controller.abort()); pending.clear(); };\n }, []);\n\n useEffect(() => {\n if (textarea.current) fitTextarea(textarea.current);\n }, [text]);\n\n useEffect(() => {\n const element = textarea.current;\n if (!element || typeof ResizeObserver === 'undefined') return;\n let width = element.getBoundingClientRect().width;\n const observer = new ResizeObserver(() => {\n const nextWidth = element.getBoundingClientRect().width;\n if (nextWidth === width) return;\n width = nextWidth;\n fitTextarea(element);\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, []);\n\n function report(value: unknown) {\n const actionError = asError(value);\n setError(actionError.message);\n onActionError?.(actionError);\n }\n\n function removeFile(id: string) {\n uploads.current.get(id)?.abort();\n uploads.current.delete(id);\n setFiles(current => current.filter(file => file.id !== id));\n }\n\n function addFiles(selected: File[]) {\n if (!attachments || disabled) return;\n setError(undefined);\n if (uploads.current.size + selected.length > (attachments.maxFiles ?? 5)) {\n report(new Error(labels.tooManyFiles)); return;\n }\n const valid: File[] = [];\n for (const file of selected) {\n if (file.size > (attachments.maxSize ?? 10 * 1024 * 1024)) report(new Error(`${labels.fileTooLarge}: ${file.name}`));\n else if (!acceptsFile(file, attachments.accept)) report(new Error(`${labels.fileNotAccepted}: ${file.name}`));\n else valid.push(file);\n }\n for (const file of valid) {\n const id = `${inputId}-${++sequence.current}`;\n const controller = new AbortController();\n uploads.current.set(id, controller);\n setFiles(current => [...current, { id, name: file.name }]);\n void Promise.resolve().then(() => attachments.upload(file, { signal: controller.signal })).then(part => {\n if (controller.signal.aborted || uploads.current.get(id) !== controller) return;\n if (part.type !== 'file' || !part.url || !part.mediaType) throw new Error(labels.uploadFailed);\n setFiles(current => current.map(entry => entry.id === id ? { ...entry, part } : entry));\n }).catch(value => {\n if (controller.signal.aborted || uploads.current.get(id) !== controller) return;\n removeFile(id);\n // Upload services may return signed URLs or infrastructure details in errors.\n setError(`${labels.uploadFailed}: ${file.name}`);\n onActionError?.(asError(value));\n });\n }\n }\n\n const uploading = files.some(file => !file.part);\n const canSend = !disabled && !chat.isBusy && !voice.isActive && !uploading && files.length <= (attachments?.maxFiles ?? 5) && (text.trim().length > 0 || files.length > 0);\n\n async function send() {\n if (!canSend || sending.current) return;\n sending.current = true;\n const previousText = text;\n const previousFiles = files;\n const outgoingFiles = files.flatMap(file => file.part ? [file.part] : []);\n setError(undefined);\n draft.current = '';\n setText('');\n setFiles([]);\n uploads.current.clear();\n try {\n await chat.sendMessage({ text: previousText.trim(), ...(outgoingFiles.length ? { files: outgoingFiles } : {}) }, requestOptions);\n } catch (value) {\n if (!draft.current) setText(previousText);\n // Preserve successfully uploaded files when submission fails before acceptance.\n // New draft uploads keep their own IDs/controllers and are never overwritten.\n previousFiles.forEach(file => uploads.current.set(file.id, new AbortController()));\n setFiles(current => [...previousFiles, ...current]);\n report(value);\n } finally { sending.current = false; }\n }\n\n return <div className=\"gc-chat__composer-wrap\">\n {context != null ? <div className=\"gc-chat__context\">{context}</div> : null}\n <form className={`gc-chat__composer ${className}`} onSubmit={event => { event.preventDefault(); void send(); }}\n onDragOver={event => { if (attachments && !disabled) event.preventDefault(); }}\n onDrop={event => { if (attachments && !disabled) { event.preventDefault(); addFiles(Array.from(event.dataTransfer.files)); } }}>\n {files.length ? <ul className=\"gc-chat__attachments\" aria-label={labels.attach}>\n {files.map(file => <li className=\"gc-chat__attachment\" key={file.id}>\n <Icon name=\"file\" /><span>{file.name}</span>\n {!file.part ? <span role=\"status\">{labels.uploading}</span> : null}\n <ChatIconButton label={`${labels.removeAttachment}: ${file.name}`} icon=\"close\" onClick={() => removeFile(file.id)} />\n </li>)}\n </ul> : null}\n {speech && voice.state === 'consent' && <div className=\"gc-chat__voice-consent\" role=\"group\" aria-label={voiceLabels.consentTitle}>\n <strong>{voiceLabels.consentTitle}</strong>\n <p className=\"gc-chat__voice-disclosure\">{voice.disclosure}</p>\n <label className=\"gc-chat__voice-remember\"><input type=\"checkbox\" checked={rememberSpeech} onChange={event => setRememberSpeech(event.target.checked)} />{voiceLabels.remember}</label>\n <div className=\"gc-chat__voice-actions\">\n <button type=\"button\" className=\"gc-chat__button\" disabled={disabled || chat.isBusy} onClick={() => voice.confirm(rememberSpeech)}>{voiceLabels.confirm}</button>\n <button type=\"button\" className=\"gc-chat__button\" onClick={voice.cancel}>{voiceLabels.cancel}</button>\n </div>\n </div>}\n {speech && voice.isActive && <div className=\"gc-chat__voice\" data-state={voice.state}>\n <span className=\"gc-chat__voice-wave\" aria-hidden=\"true\"><i/><i/><i/><i/><i/></span>\n <span className=\"gc-chat__voice-status\" role=\"status\">{voice.state === 'starting' ? voiceLabels.starting : voice.state === 'stopping' ? voiceLabels.stopping : voiceLabels.listening}</span>\n <div className=\"gc-chat__voice-actions\">\n <ChatIconButton disabled={voice.state === 'stopping'} label={voiceLabels.finish} icon=\"check\" onClick={voice.stop} />\n <ChatIconButton label={voiceLabels.cancel} icon=\"close\" onClick={voice.cancel} />\n </div>\n <p className=\"gc-chat__voice-transcript\">{voice.result.finalText}<span>{voice.result.interimText}</span>{!voice.result.finalText && !voice.result.interimText ? voiceLabels.empty : null}</p>\n </div>}\n {speech && !voice.support.supported && <p id={`${inputId}-voice-support`} className=\"gc-chat__voice-unsupported\">{voice.support.reason}</p>}\n {speech && voice.error && <p className=\"gc-chat__voice-error\" role=\"alert\">{voice.error.message}</p>}\n <textarea ref={textarea} className=\"gc-chat__input\" aria-label={labels.placeholder} placeholder={labels.placeholder}\n value={text} rows={2} disabled={disabled} onChange={event => setText(event.target.value)}\n onPaste={event => { if (attachments && event.clipboardData.files.length) { event.preventDefault(); addFiles(Array.from(event.clipboardData.files)); } }}\n onKeyDown={event => {\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing && event.keyCode !== 229) {\n event.preventDefault(); void send();\n }\n }} />\n <div className=\"gc-chat__composer-bottom\">\n <div className=\"gc-chat__toolbar\">\n {attachments ? <>\n <input ref={fileInput} id={inputId} type=\"file\" hidden multiple accept={attachments.accept} disabled={disabled}\n onChange={event => { addFiles(Array.from(event.target.files ?? [])); event.target.value = ''; }} />\n <ChatIconButton disabled={disabled} label={labels.attach} icon=\"plus\" onClick={() => fileInput.current?.click()} />\n </> : null}\n {toolbar}\n {!attachments && !speech && toolbar == null && <span className=\"gc-chat__input-hint\">{labels.composerHint}</span>}\n </div>\n <div className=\"gc-chat__composer-actions\">\n {speech && <ChatIconButton label={voiceLabels.start} icon=\"mic\" tooltip={voice.support.reason ?? voiceLabels.start}\n aria-describedby={!voice.support.supported ? `${inputId}-voice-support` : undefined}\n disabled={disabled || chat.isBusy || voice.isActive || voice.state === 'consent' || !voice.support.supported} onClick={voice.start} />}\n {chat.isBusy ? <ChatIconButton className=\"gc-chat__send\" label={labels.stop} icon=\"stop\" onClick={event => { event.preventDefault(); void chat.stop().catch(report); }} />\n : <ChatIconButton className=\"gc-chat__send\" type=\"submit\" disabled={!canSend} label={labels.send} icon=\"send\" />}\n </div>\n </div>\n {error ? <div className=\"gc-chat__error\" role=\"alert\">{error}<ChatIconButton label={labels.dismiss} icon=\"close\" onClick={() => setError(undefined)} /></div> : null}\n </form></div>;\n}\n\nfunction fitTextarea(element: HTMLTextAreaElement) {\n element.style.height = 'auto';\n // Preserve fractional two-row heights and refit when a narrow layout wraps the draft.\n element.style.height = `${Math.min(Math.max(element.getBoundingClientRect().height, element.scrollHeight), 180)}px`;\n}\n","\"use client\";\n\nimport { useId, useRef, useState } from 'react';\nimport type { UIMessage } from 'ai';\nimport { Icon, type IconName } from './icons';\nimport type { ChatLabels, ChatMessagesProps, ToolPart, ToolPresentation } from './types';\nimport { asError } from './utils';\n\nfunction readableValue(value: unknown): string {\n if (typeof value === 'string') return value;\n try { return JSON.stringify(value, null, 2) ?? '—'; }\n catch { return String(value); }\n}\n\ntype ActivityStatus = 'preparing' | 'running' | 'approval' | 'completed' | 'error' | 'denied' | 'waiting';\n\nfunction activityStatus<M extends UIMessage>(part: ToolPart<M>, active: boolean): ActivityStatus {\n if (part.state === 'output-error') return 'error';\n if (part.state === 'output-denied' || (part.state === 'approval-responded' && !part.approval.approved)) return 'denied';\n if (part.state === 'approval-requested' && !part.approval.isAutomatic) return 'approval';\n if (part.state === 'output-available' && !part.preliminary) return 'completed';\n // Idle does not imply cancellation: client-side tools may still be executing.\n // Only a live turn animates. Historical/incomplete calls retain neutral wording.\n if (!active) return 'waiting';\n return part.state === 'input-streaming' ? 'preparing' : 'running';\n}\n\n/** Default tool renderer: a quiet activity row with progressively disclosed payloads. */\nexport function ToolActivity<M extends UIMessage>({ part, chat, labels, active, presentation, requestOptions, onActionError }: {\n part: ToolPart<M>;\n chat: ChatMessagesProps<M>['chat'];\n labels: Required<ChatLabels>;\n active: boolean;\n presentation?: ToolPresentation;\n requestOptions: ChatMessagesProps<M>['requestOptions'];\n onActionError: ChatMessagesProps<M>['onActionError'];\n}) {\n const [expanded, setExpanded] = useState(false);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<Error>();\n const inFlight = useRef(false);\n const detailsId = useId();\n const name = part.type === 'dynamic-tool' ? part.toolName : part.type.slice(5);\n const title = presentation?.title || part.title || name || labels.tool;\n const approval = part.approval;\n const status = activityStatus(part, active);\n const stateLabels: Record<ActivityStatus, string> = {\n preparing: labels.toolPending, running: labels.toolRunning, approval: labels.toolApproval,\n completed: labels.toolComplete, error: labels.toolFailed, denied: labels.toolDenied, waiting: labels.toolWaiting,\n };\n const busy = status === 'preparing' || status === 'running';\n const statusIcon: IconName = busy ? 'loader' : status === 'error' ? 'warning' : status === 'denied' ? 'blocked'\n : status === 'completed' ? 'check' : status === 'waiting' ? 'more' : 'tool';\n\n async function respond(approved: boolean) {\n if (!approval || approval.isAutomatic || chat.isBusy || inFlight.current) return;\n inFlight.current = true;\n setPending(true);\n setError(undefined);\n try {\n await chat.addToolApprovalResponse({ id: approval.id, approved, options: requestOptions });\n } catch (cause) {\n const failure = asError(cause);\n setError(failure);\n inFlight.current = false;\n setPending(false);\n onActionError?.(failure);\n }\n }\n\n return <div className=\"gc-chat__tool\" data-layout=\"activity\" data-state={part.state} data-status={status}>\n <button type=\"button\" className=\"gc-chat__tool-heading\" aria-expanded={expanded} aria-controls={detailsId}\n aria-label={`${title} · ${stateLabels[status]} · ${expanded ? labels.toolHideDetails : labels.toolDetails}`}\n aria-describedby={presentation?.summary ? `${detailsId}-summary` : undefined}\n onClick={() => setExpanded(value => !value)}>\n <span className=\"gc-chat__tool-symbol\" aria-hidden=\"true\">{presentation?.icon ?? <Icon name={statusIcon} className={busy ? 'gc-chat__spinner' : undefined} />}</span>\n <span className=\"gc-chat__tool-name\" title={title}>{title}</span>\n <span className=\"gc-chat__tool-state\">{presentation?.icon != null && busy && <Icon name=\"loader\" className=\"gc-chat__spinner\" />}{stateLabels[status]}</span>\n {presentation?.summary && <span id={`${detailsId}-summary`} className=\"gc-chat__tool-summary\" title={presentation.summary}>{presentation.summary}</span>}\n <Icon name=\"chevron\" className=\"gc-chat__tool-chevron\" />\n </button>\n <span className=\"gc-chat__sr-only\" role=\"status\">{title} · {stateLabels[status]}</span>\n <div id={detailsId} className=\"gc-chat__tool-details\" hidden={!expanded}>\n {expanded && <>\n {title !== name && <div className=\"gc-chat__tool-identifier\">{name}</div>}\n {part.input !== undefined && <div className=\"gc-chat__tool-payload\"><span>{labels.toolInput}</span><pre>{readableValue(part.input)}</pre></div>}\n {part.state === 'output-available' && <div className=\"gc-chat__tool-payload\"><span>{labels.toolOutput}</span><pre>{readableValue(part.output)}</pre></div>}\n {part.input === undefined && part.state !== 'output-available' && <span>{stateLabels[status]}</span>}\n </>}\n </div>\n {approval?.requestReason && <p className=\"gc-chat__tool-reason\">{approval.requestReason}</p>}\n {approval?.reason && <p className=\"gc-chat__tool-reason\">{approval.reason}</p>}\n {part.state === 'output-error' && <p className=\"gc-chat__tool-error\">{part.errorText}</p>}\n {part.state === 'approval-requested' && !approval?.isAutomatic && <div className=\"gc-chat__approval-actions\">\n <button type=\"button\" className=\"gc-chat__button gc-chat__button--primary\" disabled={chat.isBusy || pending} onClick={() => void respond(true)}>{labels.approve}</button>\n <button type=\"button\" className=\"gc-chat__button\" disabled={chat.isBusy || pending} onClick={() => void respond(false)}>{labels.reject}</button>\n </div>}\n {error && <p className=\"gc-chat__tool-error\" role=\"alert\">{error.message}</p>}\n </div>;\n}\n","\"use client\";\n\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent, TouchEvent, WheelEvent } from 'react';\nimport type { UIMessage } from 'ai';\n\nconst useClientLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\n/** One scroll writer. Resize observations change the target, never the reader's intent. */\nexport function useMessageScroll(messages: readonly UIMessage[]) {\n const scroller = useRef<HTMLDivElement>(null);\n const content = useRef<HTMLDivElement>(null);\n const following = useRef(true);\n const frame = useRef<number | undefined>(undefined);\n const previousTime = useRef<number | undefined>(undefined);\n const lastTop = useRef(0);\n const lastMaximum = useRef(0);\n const writtenTop = useRef<number | undefined>(undefined);\n const touchY = useRef<number | undefined>(undefined);\n const previousMessages = useRef(messages.map(({ id }) => id));\n const [awayFromBottom, setAwayFromBottom] = useState(false);\n\n const cancel = useCallback(() => {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n frame.current = undefined;\n previousTime.current = undefined;\n }, []);\n\n const write = useCallback((top: number) => {\n const element = scroller.current;\n if (!element) return;\n if (Math.abs(element.scrollTop - top) > .5) element.scrollTop = top;\n writtenTop.current = lastTop.current = element.scrollTop;\n lastMaximum.current = Math.max(0, element.scrollHeight - element.clientHeight);\n }, []);\n\n const schedule = useCallback(() => {\n if (!following.current || frame.current !== undefined) return;\n const advance = (time: number) => {\n frame.current = undefined;\n const element = scroller.current;\n if (!element || !following.current) return;\n const target = Math.max(0, element.scrollHeight - element.clientHeight);\n const distance = target - element.scrollTop;\n const elapsed = previousTime.current === undefined ? 16 : Math.min(64, time - previousTime.current);\n previousTime.current = time;\n const instant = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;\n // Content may shrink (e.g. a Markdown delimiter closes). Let native clamping\n // settle it immediately; never ease backwards or restart CSS smooth-scroll.\n if (instant || distance <= 1 || distance > element.clientHeight) {\n write(target);\n previousTime.current = undefined;\n return;\n }\n write(Math.min(target, element.scrollTop + Math.max(1, distance * (1 - Math.exp(-elapsed / 48)))));\n frame.current = requestAnimationFrame(advance);\n };\n frame.current = requestAnimationFrame(advance);\n }, [write]);\n\n const scrollToLatest = useCallback(() => {\n cancel();\n following.current = true;\n setAwayFromBottom(false);\n const element = scroller.current;\n if (element) write(Math.max(0, element.scrollHeight - element.clientHeight));\n }, [cancel, write]);\n\n const pause = useCallback(() => {\n const element = scroller.current;\n // An upward gesture in an empty/short conversation cannot move the reader\n // away from the latest message. Do not leave future turns detached.\n if (!element || element.scrollHeight - element.clientHeight <= 1) return;\n following.current = false;\n cancel();\n setAwayFromBottom(true);\n }, [cancel]);\n\n useClientLayoutEffect(() => {\n scrollToLatest();\n if (!scroller.current || !content.current || typeof ResizeObserver === 'undefined') return cancel;\n const observer = new ResizeObserver(schedule);\n observer.observe(content.current);\n observer.observe(scroller.current);\n return () => { observer.disconnect(); cancel(); };\n }, [scrollToLatest, schedule, cancel]);\n\n // A new user turn expresses an intent to continue at the end of the conversation,\n // whether it comes from our composer, a suggestion, or a host's custom input.\n // Match the previous tail so prepending history does not look like a new turn.\n // Assistant deltas and tool continuations preserve the reader's scroll intent.\n useClientLayoutEffect(() => {\n const previous = previousMessages.current;\n const tail = previous.at(-1);\n const tailIndex = tail === undefined ? -1 : messages.findIndex(message => message.id === tail);\n const known = new Set(previous);\n const appendedUser = (tail === undefined || tailIndex !== -1)\n && messages.slice(tailIndex + 1).some(message => message.role === 'user' && !known.has(message.id));\n previousMessages.current = messages.map(({ id }) => id);\n if (appendedUser) scrollToLatest();\n // Also supports environments without ResizeObserver; duplicate signals share a frame.\n schedule();\n }, [messages, scrollToLatest, schedule]);\n\n function onScroll() {\n const element = scroller.current;\n if (!element) return;\n const top = element.scrollTop;\n const previous = lastTop.current;\n lastTop.current = top;\n if (writtenTop.current !== undefined && Math.abs(top - writtenTop.current) < 1) return;\n writtenTop.current = undefined;\n const maximum = Math.max(0, element.scrollHeight - element.clientHeight);\n if (following.current && maximum < lastMaximum.current && top >= maximum - 1) {\n // The browser clamps scrollTop when content shrinks or the viewport grows.\n // This is layout, not an instruction to stop following the conversation.\n lastMaximum.current = maximum;\n schedule();\n return;\n }\n lastMaximum.current = maximum;\n if (top < previous - 1) { pause(); return; }\n if (top > previous && element.scrollHeight - top - element.clientHeight <= 4) {\n following.current = true;\n setAwayFromBottom(false);\n schedule();\n }\n }\n\n function consumedByNestedScroll(event: { target: EventTarget; currentTarget: HTMLDivElement }) {\n let target = event.target instanceof Element ? event.target : null;\n while (target && target !== event.currentTarget) {\n if (target.scrollTop > 0 && target.scrollHeight > target.clientHeight) return true;\n target = target.parentElement;\n }\n return false;\n }\n function onWheel(event: WheelEvent<HTMLDivElement>) {\n if (event.deltaY >= 0 || event.ctrlKey || consumedByNestedScroll(event)) return;\n pause();\n }\n function onTouchStart(event: TouchEvent<HTMLDivElement>) { touchY.current = event.touches[0]?.clientY; }\n function onTouchMove(event: TouchEvent<HTMLDivElement>) {\n const y = event.touches[0]?.clientY;\n if (y !== undefined && touchY.current !== undefined && y > touchY.current + 2 && !consumedByNestedScroll(event)) pause();\n touchY.current = y;\n }\n function onKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n if (event.target !== event.currentTarget) return;\n if (['ArrowUp', 'PageUp', 'Home'].includes(event.key) || (event.key === ' ' && event.shiftKey)) pause();\n }\n\n return { scroller, content, awayFromBottom, scrollToLatest, scrollEvents: { onScroll, onWheel, onTouchStart, onTouchMove, onKeyDown } };\n}\n","\"use client\";\n\nimport { useEffect, useRef, useState } from 'react';\nimport type { TextRenderer } from './types';\n\nconst CATCH_UP_MS = 160;\nconst FRAME_INTERVAL_MS = 24;\nconst segmenter = typeof Intl.Segmenter === 'function'\n ? new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n : undefined;\n\nexport interface StreamingTextProps {\n text: string;\n isStreaming: boolean;\n enabled?: boolean;\n renderText?: TextRenderer;\n}\n\nfunction useReducedMotion() {\n const [reduced, setReduced] = useState(() => typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true);\n useEffect(() => {\n const query = window.matchMedia?.('(prefers-reduced-motion: reduce)');\n if (!query) return;\n const update = () => setReduced(query.matches);\n update();\n query.addEventListener('change', update);\n return () => query.removeEventListener('change', update);\n }, []);\n return reduced;\n}\n\n/** Presentation-only pacing: persisted messages and tool events stay untouched. */\nexport function StreamingText({ text, isStreaming, enabled = true, renderText }: StreamingTextProps) {\n const reducedMotion = useReducedMotion();\n const animate = enabled && isStreaming && !reducedMotion && segmenter !== undefined;\n // A newly mounted part already has its current text; never replay history.\n const [visible, setVisible] = useState(text);\n const shown = useRef(text);\n const target = useRef(text);\n const frame = useRef<number | undefined>(undefined);\n const queue = useRef({ boundaries: [] as number[], index: 0, deadline: 0, updatedAt: 0 });\n\n useEffect(() => {\n function cancel() {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n frame.current = undefined;\n }\n function reveal(value: string) {\n shown.current = value;\n setVisible(value);\n }\n const appending = text.startsWith(target.current);\n target.current = text;\n if (!animate || !appending || typeof requestAnimationFrame !== 'function') {\n cancel();\n reveal(text);\n return;\n }\n\n // The first character should respond immediately, even after an empty part.\n if (!shown.current && text) reveal(segmenter!.segment(text)[Symbol.iterator]().next().value!.segment);\n if (shown.current === text) {\n cancel();\n return;\n }\n\n const now = performance.now();\n const previous = queue.current;\n const offset = shown.current.length;\n queue.current = {\n // Segment the new target, since a delta can extend the previous final\n // grapheme (a combining mark or a joined emoji). Frames only slice it.\n boundaries: Array.from(segmenter!.segment(text), part => part.index + part.segment.length).filter(end => end > offset),\n index: 0,\n // New deltas share the existing deadline, so a busy stream cannot build\n // an ever-growing typewriter backlog. A background tab catches up too.\n deadline: frame.current === undefined ? now + CATCH_UP_MS : previous.deadline,\n updatedAt: frame.current === undefined ? now : previous.updatedAt,\n };\n\n function tick(time: number) {\n frame.current = undefined;\n const pending = queue.current;\n const elapsed = time - pending.updatedAt;\n if (elapsed >= FRAME_INTERVAL_MS || time >= pending.deadline) {\n const remaining = pending.boundaries.length - pending.index;\n const fraction = Math.min(1, elapsed / Math.max(1, pending.deadline - pending.updatedAt));\n pending.index += Math.min(remaining, Math.max(1, Math.ceil(remaining * fraction)));\n pending.updatedAt = time;\n reveal(target.current.slice(0, pending.boundaries[pending.index - 1]));\n }\n if (shown.current !== target.current) frame.current = requestAnimationFrame(tick);\n }\n if (frame.current === undefined) frame.current = requestAnimationFrame(tick);\n }, [text, animate]);\n\n useEffect(() => () => {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n frame.current = undefined;\n }, []);\n\n // Completion, stop and replacements must be visible in this very render,\n // before the effect synchronizes its queue. Nothing is lost on cancellation.\n const reset = !animate || !text.startsWith(target.current) || !text.startsWith(visible);\n const displayed = reset ? text : visible || segmenter?.segment(text)[Symbol.iterator]().next().value?.segment || '';\n return renderText ? renderText({ text: displayed, isStreaming }) : <div className=\"gc-chat__plain-text\">{displayed}</div>;\n}\n","\"use client\";\n\nimport { isToolUIPart, type UIMessage } from 'ai';\nimport { useEffect, useRef, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { Icon } from './icons';\nimport { ToolActivity } from './tool-activity';\nimport { ChatIconButton } from './ui-primitives';\nimport { resolveLabels } from './labels';\nimport type { ChatMessagesProps, ChatSuggestedAction, PartRendererProps, ToolPart } from './types';\nimport { asError, getMessageText, safeUrl } from './utils';\nimport { useMessageScroll } from './use-message-scroll';\nimport { StreamingText } from './streaming-text';\nimport { MarkdownResponse } from './markdown';\n\nexport function ChatMessages<M extends UIMessage = UIMessage>(props: ChatMessagesProps<M>) {\n return <Messages key={props.chat.id} {...props} />;\n}\n\nfunction Messages<M extends UIMessage>({ chat, labels: labelOverrides, renderText, smoothStreaming = true, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderMessageHeader, empty, className, requestOptions, onActionError, capabilities }: ChatMessagesProps<M>) {\n const labels = resolveLabels(labelOverrides);\n const { scroller, content, awayFromBottom, scrollToLatest, scrollEvents } = useMessageScroll(chat.messages);\n const copyTimeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const actionInFlight = useRef(false);\n const [copiedId, setCopiedId] = useState<string>();\n const [actionError, setActionError] = useState<Error>();\n const [actionPending, setActionPending] = useState(false);\n const [pendingSuggestion, setPendingSuggestion] = useState<string>();\n\n useEffect(() => () => clearTimeout(copyTimeout.current), []);\n\n function reportError(cause: unknown) {\n const error = asError(cause);\n setActionError(error);\n onActionError?.(error);\n }\n\n async function copy(message: M) {\n setActionError(undefined);\n try {\n await navigator.clipboard.writeText(getMessageText(message));\n setCopiedId(message.id);\n clearTimeout(copyTimeout.current);\n copyTimeout.current = setTimeout(() => setCopiedId(undefined), 1800);\n } catch (cause) { reportError(cause); }\n }\n\n async function regenerate(message: M) {\n if (chat.isBusy || actionInFlight.current || capabilities?.regenerate === false) return;\n actionInFlight.current = true;\n setActionPending(true);\n setActionError(undefined);\n try { await chat.regenerate({ ...requestOptions, messageId: message.id }); }\n catch (cause) { reportError(cause); }\n finally { actionInFlight.current = false; setActionPending(false); }\n }\n\n function focusComposer() {\n content.current?.closest('.gc-chat')?.querySelector<HTMLTextAreaElement>('.gc-chat__input')?.focus();\n }\n\n async function selectSuggestion(action: ChatSuggestedAction<M>, message: M) {\n if (chat.isBusy || actionInFlight.current || action.disabled || message !== chat.messages.at(-1)) return;\n actionInFlight.current = true;\n setActionPending(true);\n setPendingSuggestion(action.id);\n setActionError(undefined);\n try { await action.onSelect({ message, chat, focusComposer }); }\n catch (cause) { reportError(cause); }\n finally { actionInFlight.current = false; setActionPending(false); setPendingSuggestion(undefined); }\n }\n\n function renderPart(part: M['parts'][number], message: M, isStreaming: boolean): ReactNode {\n // The mapped renderer contract is checked at the consumer boundary. Runtime\n // lookup cannot preserve the correlation between this key and its union part.\n const renderer = renderers?.[part.type as keyof typeof renderers] as ((props: PartRendererProps<M>) => ReactNode) | undefined;\n if (renderer) return renderer({ part, message, isStreaming, chat });\n if (part.type === 'step-start') return null;\n if (isToolUIPart(part)) {\n const name = part.type === 'dynamic-tool' ? part.toolName : part.type.slice(5);\n const toolPart = part as ToolPart<M>;\n if (tools?.[name]) return tools[name]({ part: toolPart, message, isStreaming, chat });\n return <ToolActivity part={toolPart} chat={chat} labels={labels} active={chat.isBusy && message === last} presentation={toolPresentation?.({ part: toolPart, message, isStreaming, chat })} requestOptions={requestOptions} onActionError={onActionError} />;\n }\n switch (part.type) {\n case 'text': return part.text ? <div className=\"gc-chat__text\"><StreamingText text={part.text} isStreaming={message.role === 'assistant' && isStreaming && part.state !== 'done'} enabled={smoothStreaming} renderText={renderText ?? (message.role === 'assistant' ? MarkdownResponse : undefined)} /></div> : null;\n case 'reasoning': return <details className=\"gc-chat__reasoning\" data-streaming={isStreaming && part.state !== 'done' || undefined}><summary><Icon name=\"thinking\" /><span>{labels.reasoning}</span><Icon name=\"chevron\" /></summary><div className=\"gc-chat__plain-text\">{part.text}</div></details>;\n case 'source-url': {\n const url = safeUrl(part.url);\n return url ? <a className=\"gc-chat__source\" href={url} target=\"_blank\" rel=\"noopener noreferrer\"><Icon name=\"link\" /><span>{part.title || part.url}</span></a> : <span className=\"gc-chat__source\"><Icon name=\"link\" /><span>{part.title || labels.sources}</span></span>;\n }\n case 'source-document': return <span className=\"gc-chat__source\"><Icon name=\"file\" /><span>{part.title || part.filename || labels.sources}</span></span>;\n case 'file': {\n const url = safeUrl(part.url);\n const label = part.filename || part.mediaType;\n return url ? <a className=\"gc-chat__message-file\" href={url} target=\"_blank\" rel=\"noopener noreferrer\"><Icon name=\"file\" /><span>{label}</span></a> : <span className=\"gc-chat__message-file\"><Icon name=\"file\" /><span>{label}</span></span>;\n }\n default: return <div className=\"gc-chat__unsupported\"><Icon name=\"file\" /><span>{labels.unsupportedPart} <code>{part.type}</code></span></div>;\n }\n }\n\n const last = chat.messages.at(-1);\n const lastPart = last?.parts.filter(part => part.type !== 'step-start').at(-1);\n const toolFinished = lastPart && isToolUIPart(lastPart) && (\n (lastPart.state === 'output-available' && !lastPart.preliminary) || lastPart.state === 'output-error' || lastPart.state === 'output-denied'\n );\n // System instructions belong to the transport context, not the conversation UI.\n const visibleMessages = chat.messages.filter(message => message.role !== 'system');\n const actions = suggestedActions?.slice(0, 3) ?? [];\n const recommendedIndex = actions.findIndex(action => action.emphasis === 'recommended');\n const showThinking = chat.isBusy && (last?.role !== 'assistant' || !lastPart || (lastPart.type === 'text' && !lastPart.text) || toolFinished);\n const thinking = <div className=\"gc-chat__thinking\" role=\"status\"><Icon name=\"loader\" className=\"gc-chat__spinner\" /><span>{labels.thinking}</span><span className=\"gc-chat__thinking-dots\" aria-hidden=\"true\"><i /><i /><i /></span></div>;\n return <div className={['gc-chat__messages-wrap', className].filter(Boolean).join(' ')}>\n <div className=\"gc-chat__messages\" ref={scroller} role=\"log\" aria-label={labels.title} aria-live=\"polite\" aria-relevant=\"additions\" tabIndex={0} data-following={!awayFromBottom} {...scrollEvents}>\n <div className=\"gc-chat__messages-content\" ref={content}>\n {visibleMessages.length === 0 && !chat.isBusy && (empty ?? <div className=\"gc-chat__empty\"><span className=\"gc-chat__empty-symbol\"><Icon name=\"sparkle\" /></span><h2>{labels.emptyTitle}</h2><p>{labels.emptyDescription}</p></div>)}\n {visibleMessages.map(message => <article className={`gc-chat__message gc-chat__message--${message.role}`} key={message.id} aria-label={message.role === 'user' ? labels.user : labels.assistant}>\n {message.role === 'assistant' && (renderMessageHeader ? renderMessageHeader({ message, isStreaming: chat.status === 'streaming' && message === last, chat }) : <div className=\"gc-chat__message-heading\"><span className=\"gc-chat__assistant-mark\"><Icon name=\"sparkle\" /></span><strong className=\"gc-chat__assistant-name\">{labels.assistant}</strong></div>)}\n <div className=\"gc-chat__message-body\">{message.parts.map((part, partIndex) => <div className=\"gc-chat__part\" data-part={isToolUIPart(part) ? 'tool' : part.type} key={isToolUIPart(part) ? `tool-${part.toolCallId}` : `${part.type}-${partIndex}`}>{renderPart(part, message, chat.status === 'streaming' && message === last)}</div>)}</div>\n {message === last && message.role === 'assistant' && !chat.isBusy && <>\n {actions.length > 0 && <section className=\"gc-chat__suggestions\" aria-label={labels.suggestions ?? 'Suggested next steps'} aria-busy={pendingSuggestion !== undefined}>\n <div className=\"gc-chat__suggestions-heading\"><h3>{suggestionsTitle ?? labels.suggestions ?? 'Suggested next steps'}</h3>{suggestionsDescription != null && <span className=\"gc-chat__suggestions-reason\">{suggestionsDescription}</span>}</div>\n <div className=\"gc-chat__suggestions-actions\">{actions.map((action, index) => <button key={action.id} type=\"button\" className=\"gc-chat__suggestion\"\n data-emphasis={action.emphasis === 'recommended' && index !== recommendedIndex ? 'secondary' : action.emphasis ?? 'secondary'} data-pending={pendingSuggestion === action.id || undefined}\n disabled={actionPending || action.disabled} onClick={() => void selectSuggestion(action, message)}>\n {action.icon}{pendingSuggestion === action.id ? action.pendingLabel ?? action.label : action.label}{action.trailingIcon}\n </button>)}</div>\n </section>}\n {renderMessageActions?.({ message, chat, focusComposer })}\n </>}\n {message.role === 'assistant' && <div className=\"gc-chat__message-footer\">{showThinking && message === last ? thinking : <div className=\"gc-chat__message-actions\" role=\"group\" aria-label={labels.assistant}>\n {getMessageText(message) && <ChatIconButton size=\"sm\" label={copiedId === message.id ? labels.copied : labels.copy} icon={copiedId === message.id ? 'check' : 'copy'} data-copied={copiedId === message.id || undefined} disabled={chat.isBusy && message === last} onClick={() => void copy(message)} />}\n {message === last && capabilities?.regenerate !== false && <ChatIconButton size=\"sm\" label={labels.regenerate} icon=\"refresh\" disabled={chat.isBusy || actionPending} onClick={() => void regenerate(message)} />}\n </div>}</div>}\n </article>)}\n {showThinking && last?.role !== 'assistant' && <article className=\"gc-chat__message gc-chat__message--assistant\" aria-label={labels.assistant}><div className=\"gc-chat__message-footer\">{thinking}</div></article>}\n {actionError && <div className=\"gc-chat__error\" role=\"alert\">{actionError.message}<ChatIconButton label={labels.dismiss} icon=\"close\" size=\"sm\" onClick={() => setActionError(undefined)} /></div>}\n </div>\n </div>\n {awayFromBottom && <button type=\"button\" className=\"gc-chat__jump\" onClick={scrollToLatest}><Icon name=\"down\" /><span>{labels.jumpToLatest}</span></button>}\n <span className=\"gc-chat__sr-only\" role=\"status\">{copiedId ? labels.copied : ''}</span>\n </div>;\n}\n","\"use client\";\n\nimport type { UIMessage } from 'ai';\nimport { useRef, useState } from 'react';\nimport { ChatComposer } from './chat-composer';\nimport { ChatMessages } from './chat-messages';\nimport { Icon } from './icons';\nimport { ChatIconButton } from './ui-primitives';\nimport { resolveLabels } from './labels';\nimport type { ChatPanelProps } from './types';\nimport { asError } from './utils';\n\nexport function ChatPanel<M extends UIMessage = UIMessage>(props: ChatPanelProps<M>) {\n return <Panel key={props.chat.id} {...props} />;\n}\n\nfunction Panel<M extends UIMessage>({ chat, labels: labelOverrides, title, subtitle, headerIcon, header, headerActions, footer, composer, composerProps, theme = 'auto', variant = 'panel', density = 'comfortable', capabilities, className, renderText, smoothStreaming, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderMessageHeader, empty, requestOptions, onActionError, ...elementProps }: ChatPanelProps<M>) {\n const labels = resolveLabels(labelOverrides);\n const [retrying, setRetrying] = useState(false);\n const [retryError, setRetryError] = useState<Error>();\n const retryInFlight = useRef(false);\n\n async function retry() {\n if (chat.isBusy || retryInFlight.current || (capabilities?.regenerate === false && chat.messages.at(-1)?.role === 'assistant')) return;\n retryInFlight.current = true;\n setRetrying(true);\n setRetryError(undefined);\n try {\n const last = chat.messages.at(-1);\n // An unanswered user turn is retried without appending a duplicate turn.\n if (last?.role === 'user') await chat.sendMessage(undefined, requestOptions);\n else if (last?.role === 'assistant') await chat.regenerate({ ...requestOptions, messageId: last.id });\n else chat.clearError();\n } catch (cause) {\n const error = asError(cause);\n setRetryError(error);\n onActionError?.(error);\n } finally { retryInFlight.current = false; setRetrying(false); }\n }\n\n return <section {...elementProps} className={['gc-chat', className].filter(Boolean).join(' ')} data-theme={theme} data-variant={variant} data-density={density} aria-label={elementProps['aria-label'] ?? title ?? labels.title}>\n {header !== undefined ? header : <header className=\"gc-chat__header\"><div className=\"gc-chat__heading\"><span className=\"gc-chat__brand\">{headerIcon ?? <Icon name=\"sparkle\" />}</span><div className=\"gc-chat__header-copy\"><span className=\"gc-chat__title\">{title ?? labels.title}</span>{subtitle != null && <p className=\"gc-chat__subtitle\">{subtitle}</p>}</div></div>{headerActions && <div className=\"gc-chat__header-actions\">{headerActions}</div>}</header>}\n <ChatMessages chat={chat} capabilities={capabilities} labels={labelOverrides} renderText={renderText} smoothStreaming={smoothStreaming} renderers={renderers} tools={tools} toolPresentation={toolPresentation} suggestedActions={suggestedActions} suggestionsTitle={suggestionsTitle} suggestionsDescription={suggestionsDescription} renderMessageActions={renderMessageActions} renderMessageHeader={renderMessageHeader} empty={empty} requestOptions={requestOptions} onActionError={onActionError} />\n <div className=\"gc-chat__bottom\">\n {(chat.error || retryError) && <div className=\"gc-chat__error\" role=\"alert\"><span>{retryError?.message ?? labels.error}</span>{!(capabilities?.regenerate === false && chat.messages.at(-1)?.role === 'assistant') && <button type=\"button\" className=\"gc-chat__button\" disabled={chat.isBusy || retrying} onClick={() => void retry()}>{labels.retry}</button>}<ChatIconButton label={labels.dismiss} icon=\"close\" size=\"sm\" onClick={() => { chat.clearError(); setRetryError(undefined); }} /></div>}\n {composer !== undefined ? composer : <ChatComposer {...composerProps} chat={chat} labels={labelOverrides} requestOptions={requestOptions} onActionError={onActionError} />}\n {footer !== undefined ? footer : <p className=\"gc-chat__disclaimer\">{labels.disclaimer}</p>}\n </div>\n </section>;\n}\n","\"use client\";\n\nimport type { UIMessage } from 'ai';\nimport { useAiChat } from './use-ai-chat';\nimport { ChatPanel } from './chat-panel';\nimport type { AiChatProps } from './types';\n\nexport function AiChat<M extends UIMessage = UIMessage>({ options, ...props }: AiChatProps<M>) {\n const chat = useAiChat<M>(options);\n return <ChatPanel {...props} chat={chat} />;\n}\n","\"use client\";\n\nimport { useEffect, useRef, useState } from 'react';\nimport type { HTMLAttributes, KeyboardEvent, ReactNode } from 'react';\nimport { Icon } from './icons';\n\nexport interface ChatHistoryItem {\n id: string;\n title: string;\n}\n\nexport interface ChatHistoryLabels {\n title: string;\n newChat: string;\n more: string;\n back: string;\n allConversations: string;\n searchPlaceholder: string;\n searchLabel: string;\n empty: string;\n noResults: string;\n loading: string;\n retry: string;\n unnamed: string;\n}\n\nconst defaultLabels: ChatHistoryLabels = {\n title: '历史对话', newChat: '发起新对话', more: '更多对话', back: '返回最近对话',\n allConversations: '全部对话', searchPlaceholder: '搜索对话', searchLabel: '搜索对话',\n empty: '还没有历史对话', noResults: '没有找到相关对话', loading: '正在加载对话…',\n retry: '重试', unnamed: '未命名对话',\n};\n\nexport interface ChatHistoryMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n /** Most recent first. The host owns persistence, fetching and ordering. */\n conversations: readonly ChatHistoryItem[];\n currentId?: string;\n onSelect: (id: string) => void;\n onNewChat: () => void;\n /** Disables conversation mutations; browsing and searching remain available. */\n disabled?: boolean;\n /** Existing conversations remain visible and selectable unless disabled is also set. */\n loading?: boolean;\n error?: string;\n onRetry?: () => void;\n recentLimit?: number;\n /** Host actions such as settings or help. Direct buttons and links inherit row styling. */\n footer?: ReactNode;\n labels?: Partial<ChatHistoryLabels>;\n /** Focus the first available control when mounted. Defaults to false for inline demos. */\n autoFocus?: boolean;\n}\n\nfunction normalizeSearch(value: string) {\n return value.normalize('NFKC').toLocaleLowerCase();\n}\n\nfunction availableControls(element: HTMLDivElement) {\n return [...element.querySelectorAll<HTMLElement>('button:not(:disabled), a[href]')]\n .filter(control => !control.closest('[hidden], [inert], [aria-hidden=\"true\"]') && control.getAttribute('aria-disabled') !== 'true');\n}\n\n/** A standalone, non-modal surface. The host provides its trigger, positioning and dismissal. */\nexport function ChatHistoryMenu({\n conversations, currentId, onSelect, onNewChat, disabled = false, loading = false, error,\n onRetry, recentLimit = 5, footer, labels: overrides, autoFocus = false,\n className, onKeyDown, ...props\n}: ChatHistoryMenuProps) {\n const labels = { ...defaultLabels, ...overrides };\n const [showAll, setShowAll] = useState(false);\n const [query, setQuery] = useState('');\n const root = useRef<HTMLDivElement>(null);\n const search = useRef<HTMLInputElement>(null);\n const more = useRef<HTMLButtonElement>(null);\n const openedAll = useRef(false);\n const limit = Number.isFinite(recentLimit) ? Math.max(1, Math.floor(recentLimit)) : 5;\n const searchTerm = normalizeSearch(query.trim());\n const visibleConversations = showAll\n ? conversations.filter(conversation => normalizeSearch(conversation.title || labels.unnamed).includes(searchTerm))\n : conversations.slice(0, limit);\n\n useEffect(() => {\n if (autoFocus && root.current) (availableControls(root.current)[0] ?? root.current).focus();\n }, [autoFocus]);\n\n useEffect(() => {\n if (showAll) {\n openedAll.current = true;\n search.current?.focus();\n } else if (openedAll.current && root.current) {\n (more.current ?? availableControls(root.current)[0] ?? root.current).focus();\n }\n }, [showAll]);\n\n function navigate(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const target = event.target as HTMLElement;\n // Text editing, including Home/End and selection, belongs to the search field or host input.\n if (target.closest('input, textarea, select, [contenteditable=\"true\"]')) return;\n if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return;\n const controls = availableControls(event.currentTarget);\n if (!controls.length) return;\n const index = controls.findIndex(control => control === target || control.contains(target));\n if (index < 0 && target !== event.currentTarget) return;\n const next = event.key === 'Home' ? 0 : event.key === 'End' ? controls.length - 1\n : event.key === 'ArrowDown' ? (index + 1) % controls.length\n : index <= 0 ? controls.length - 1 : index - 1;\n event.preventDefault();\n controls[next]?.focus();\n }\n\n return <div {...props} ref={root} role=\"dialog\" aria-label={props['aria-label'] ?? labels.title}\n tabIndex={props.tabIndex ?? -1} className={['gc-chat-history', className].filter(Boolean).join(' ')}\n data-view={showAll ? 'all' : 'recent'} data-disabled={disabled || undefined} onKeyDown={navigate}>\n {showAll ? <>\n <div className=\"gc-chat-history__heading\">\n <button type=\"button\" className=\"gc-chat-history__back\" aria-label={labels.back}\n onClick={() => { setShowAll(false); setQuery(''); }}>\n <Icon name=\"chevron\" />\n </button>\n <span>{labels.allConversations}</span>\n </div>\n <div className=\"gc-chat-history__search\">\n <Icon name=\"search\" />\n <input ref={search} type=\"search\" value={query} aria-label={labels.searchLabel}\n placeholder={labels.searchPlaceholder} onChange={event => setQuery(event.target.value)} />\n </div>\n </> : <>\n <button type=\"button\" className=\"gc-chat-history__row gc-chat-history__new\" disabled={disabled} onClick={onNewChat}>\n <Icon name=\"edit\" /><span>{labels.newChat}</span>\n </button>\n <div className=\"gc-chat-history__separator\" />\n </>}\n\n {error && <div className=\"gc-chat-history__error\">\n <div role=\"alert\"><Icon name=\"warning\" /><span>{error}</span></div>\n {onRetry && <button type=\"button\" disabled={disabled || loading} onClick={onRetry}>{labels.retry}</button>}\n </div>}\n\n {loading && <div className=\"gc-chat-history__loading\" role=\"status\"><Icon name=\"loader\" /><span>{labels.loading}</span></div>}\n\n {visibleConversations.length > 0 ? <ul className=\"gc-chat-history__list\" aria-label={showAll ? labels.allConversations : labels.title}>\n {visibleConversations.map(conversation => <li key={conversation.id}>\n <button type=\"button\" className=\"gc-chat-history__row\" disabled={disabled}\n aria-current={conversation.id === currentId ? 'true' : undefined}\n title={conversation.title || labels.unnamed} onClick={() => onSelect(conversation.id)}>\n <Icon name=\"text\" />\n <span>{conversation.title || labels.unnamed}</span>\n {conversation.id === currentId && <Icon className=\"gc-chat-history__current\" name=\"check\" />}\n </button>\n </li>)}\n </ul> : loading && conversations.length === 0 ? <div className=\"gc-chat-history__skeleton\" aria-hidden=\"true\">\n {[0, 1, 2].map(index => <div key={index}><i /><span /></div>)}\n </div> : error && conversations.length === 0 ? null : <p className=\"gc-chat-history__empty\">{showAll && searchTerm ? labels.noResults : labels.empty}</p>}\n\n {!showAll && conversations.length > limit && <button ref={more} type=\"button\" className=\"gc-chat-history__row gc-chat-history__more\"\n onClick={() => setShowAll(true)}>\n <Icon name=\"more\" /><span>{labels.more}</span><Icon name=\"chevron\" />\n </button>}\n\n {footer && <><div className=\"gc-chat-history__separator\" /><div className=\"gc-chat-history__footer\">{footer}</div></>}\n </div>;\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,SAAgB,aAA8C,OAA6B;CACzF,OAAO,oBAAC,UAAD,EAA8B,GAAI,MAAQ,GAA3B,MAAM,KAAK,EAAgB;AACnD;AAEA,SAAS,SAA8B,EAAE,MAAM,QAAQ,WAAW,aAAa,QAAQ,SAAS,SAAS,gBAAgB,UAAU,YAAY,IAAI,iBAAuC;CACxL,MAAM,SAAS,cAAc,SAAS;CACtC,MAAM,CAAC,MAAM,WAAW,SAAS,EAAE;CACnC,MAAM,CAAC,OAAO,YAAY,SAAwB,CAAC,CAAC;CACpD,MAAM,CAAC,OAAO,YAAY,SAAiB;CAC3C,MAAM,UAAU,uBAAO,IAAI,IAA6B,C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;IACN,CAAA,EAAA,GAR+C,aAAa,EAQ5D,CAAC;GACH,CAAA,IAAI,WAAW,cAAc,WAAW,IAAI,oBAAC,OAAD;IAAK,WAAU;IAA4B,eAAY;IACpG,UAAA;KAAC;KAAG;KAAG;IAAC,CAAC,CAAC,KAAI,UAAS,qBAAC,OAAD,EAAA,UAAA,CAAiB,oBAAC,KAAD,CAAI,CAAA,GAAC,oBAAC,QAAD,CAAO,CAAA,CAAM,EAAA,GAAzB,KAAyB,CAAC;GACzD,CAAA,IAAI,SAAS,cAAc,WAAW,IAAI,OAAO,oBAAC,KAAD;IAAG,WAAU;IAA0B,UAAA,WAAW,aAAa,OAAO,YAAY,OAAO;GAAS,CAAA;GAEvJ,CAAC,WAAW,cAAc,SAAS,SAAS,qBAAC,UAAD;IAAQ,KAAK;IAAM,MAAK;IAAS,WAAU;IACtF,eAAe,WAAW,IAAI;IADa,UAAA;KAE3C,oBAAC,MAAD,EAAM,MAAK,OAAQ,CAAA;KAAC,oBAAC,QAAD,EAAA,UAAO,OAAO,KAAW,CAAA;KAAC,oBAAC,MAAD,EAAM,MAAK,UAAW,CAAA;IAC9D;;GAEP,UAAU,qBAAA,UAAA,EAAA,UAAA,CAAE,oBAAC,OAAD,EAAK,WAAU,6BAA8B,CAAA,GAAC,oBAAC,OAAD;IAAK,WAAU;IAA2B,UAAA;GAAY,CAAA,CAAG,EAAA,CAAA;EACjH;;AACP"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/chat-composer.tsx","../src/tool-activity.tsx","../src/use-message-scroll.ts","../src/streaming-text.tsx","../src/chat-messages.tsx","../src/chat-panel.tsx","../src/ai-chat.tsx","../src/chat-history-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useId, useRef, useState } from 'react';\nimport type { FileUIPart, UIMessage } from 'ai';\nimport { Icon } from './icons';\nimport { ChatIconButton } from './ui-primitives';\nimport { resolveLabels } from './labels';\nimport { acceptsFile, asError } from './utils';\nimport type { ChatComposerProps } from './types';\nimport { defaultSpeechInputLabels, useSpeechInput } from './voice';\n\ninterface PendingFile { id: string; name: string; part?: FileUIPart }\n\n/** Drafts and upload requests are isolated by conversation id. */\nexport function ChatComposer<M extends UIMessage = UIMessage>(props: ChatComposerProps<M>) {\n return <Composer key={props.chat.id} {...props} />;\n}\n\nfunction Composer<M extends UIMessage>({ chat, labels: overrides, attachments, speech, toolbar, context, requestOptions, disabled, className = '', onActionError }: ChatComposerProps<M>) {\n const labels = resolveLabels(overrides);\n const [text, setText] = useState('');\n const [files, setFiles] = useState<PendingFile[]>([]);\n const [error, setError] = useState<string>();\n const uploads = useRef(new Map<string, AbortController>());\n const sequence = useRef(0);\n const sending = useRef(false);\n const draft = useRef(text);\n draft.current = text;\n const fileInput = useRef<HTMLInputElement>(null);\n const textarea = useRef<HTMLTextAreaElement>(null);\n const inputId = useId();\n const [rememberSpeech, setRememberSpeech] = useState(false);\n const voiceLabels = { ...defaultSpeechInputLabels, ...speech?.labels };\n const voice = useSpeechInput({\n adapter: speech?.adapter, lang: speech?.lang,\n onComplete: recognized => {\n // Append to the latest draft, not a snapshot from recording start. Typing during capture is safe.\n setText(current => {\n const next = current ? `${current}${/\\s$/.test(current) ? '' : '\\n'}${recognized}` : recognized;\n draft.current = next;\n return next;\n });\n },\n onError: failure => onActionError?.(failure),\n });\n useEffect(() => { if (disabled || chat.isBusy) voice.cancel(); }, [disabled, chat.isBusy, voice.cancel]);\n\n\n useEffect(() => {\n const pending = uploads.current;\n return () => { pending.forEach(controller => controller.abort()); pending.clear(); };\n }, []);\n\n useEffect(() => {\n if (textarea.current) fitTextarea(textarea.current);\n }, [text]);\n\n useEffect(() => {\n const element = textarea.current;\n if (!element || typeof ResizeObserver === 'undefined') return;\n let width = element.getBoundingClientRect().width;\n const observer = new ResizeObserver(() => {\n const nextWidth = element.getBoundingClientRect().width;\n if (nextWidth === width) return;\n width = nextWidth;\n fitTextarea(element);\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, []);\n\n function report(value: unknown) {\n const actionError = asError(value);\n setError(actionError.message);\n onActionError?.(actionError);\n }\n\n function removeFile(id: string) {\n uploads.current.get(id)?.abort();\n uploads.current.delete(id);\n setFiles(current => current.filter(file => file.id !== id));\n }\n\n function addFiles(selected: File[]) {\n if (!attachments || disabled) return;\n setError(undefined);\n if (uploads.current.size + selected.length > (attachments.maxFiles ?? 5)) {\n report(new Error(labels.tooManyFiles)); return;\n }\n const valid: File[] = [];\n for (const file of selected) {\n if (file.size > (attachments.maxSize ?? 10 * 1024 * 1024)) report(new Error(`${labels.fileTooLarge}: ${file.name}`));\n else if (!acceptsFile(file, attachments.accept)) report(new Error(`${labels.fileNotAccepted}: ${file.name}`));\n else valid.push(file);\n }\n for (const file of valid) {\n const id = `${inputId}-${++sequence.current}`;\n const controller = new AbortController();\n uploads.current.set(id, controller);\n setFiles(current => [...current, { id, name: file.name }]);\n void Promise.resolve().then(() => attachments.upload(file, { signal: controller.signal })).then(part => {\n if (controller.signal.aborted || uploads.current.get(id) !== controller) return;\n if (part.type !== 'file' || !part.url || !part.mediaType) throw new Error(labels.uploadFailed);\n setFiles(current => current.map(entry => entry.id === id ? { ...entry, part } : entry));\n }).catch(value => {\n if (controller.signal.aborted || uploads.current.get(id) !== controller) return;\n removeFile(id);\n // Upload services may return signed URLs or infrastructure details in errors.\n setError(`${labels.uploadFailed}: ${file.name}`);\n onActionError?.(asError(value));\n });\n }\n }\n\n const uploading = files.some(file => !file.part);\n const canSend = !disabled && !chat.isBusy && !voice.isActive && !uploading && files.length <= (attachments?.maxFiles ?? 5) && (text.trim().length > 0 || files.length > 0);\n\n async function send() {\n if (!canSend || sending.current) return;\n sending.current = true;\n const previousText = text;\n const previousFiles = files;\n const outgoingFiles = files.flatMap(file => file.part ? [file.part] : []);\n setError(undefined);\n draft.current = '';\n setText('');\n setFiles([]);\n uploads.current.clear();\n try {\n await chat.sendMessage({ text: previousText.trim(), ...(outgoingFiles.length ? { files: outgoingFiles } : {}) }, requestOptions);\n } catch (value) {\n if (!draft.current) setText(previousText);\n // Preserve successfully uploaded files when submission fails before acceptance.\n // New draft uploads keep their own IDs/controllers and are never overwritten.\n previousFiles.forEach(file => uploads.current.set(file.id, new AbortController()));\n setFiles(current => [...previousFiles, ...current]);\n report(value);\n } finally { sending.current = false; }\n }\n\n return <div className=\"gc-chat__composer-wrap\">\n {context != null ? <div className=\"gc-chat__context\">{context}</div> : null}\n <form className={`gc-chat__composer ${className}`} onSubmit={event => { event.preventDefault(); void send(); }}\n onDragOver={event => { if (attachments && !disabled) event.preventDefault(); }}\n onDrop={event => { if (attachments && !disabled) { event.preventDefault(); addFiles(Array.from(event.dataTransfer.files)); } }}>\n {files.length ? <ul className=\"gc-chat__attachments\" aria-label={labels.attach}>\n {files.map(file => <li className=\"gc-chat__attachment\" key={file.id}>\n <Icon name=\"file\" /><span>{file.name}</span>\n {!file.part ? <span role=\"status\">{labels.uploading}</span> : null}\n <ChatIconButton label={`${labels.removeAttachment}: ${file.name}`} icon=\"close\" onClick={() => removeFile(file.id)} />\n </li>)}\n </ul> : null}\n {speech && voice.state === 'consent' && <div className=\"gc-chat__voice-consent\" role=\"group\" aria-label={voiceLabels.consentTitle}>\n <strong>{voiceLabels.consentTitle}</strong>\n <p className=\"gc-chat__voice-disclosure\">{voice.disclosure}</p>\n <label className=\"gc-chat__voice-remember\"><input type=\"checkbox\" checked={rememberSpeech} onChange={event => setRememberSpeech(event.target.checked)} />{voiceLabels.remember}</label>\n <div className=\"gc-chat__voice-actions\">\n <button type=\"button\" className=\"gc-chat__button\" disabled={disabled || chat.isBusy} onClick={() => voice.confirm(rememberSpeech)}>{voiceLabels.confirm}</button>\n <button type=\"button\" className=\"gc-chat__button\" onClick={voice.cancel}>{voiceLabels.cancel}</button>\n </div>\n </div>}\n {speech && voice.isActive && <div className=\"gc-chat__voice\" data-state={voice.state}>\n <span className=\"gc-chat__voice-wave\" aria-hidden=\"true\"><i/><i/><i/><i/><i/></span>\n <span className=\"gc-chat__voice-status\" role=\"status\">{voice.state === 'starting' ? voiceLabels.starting : voice.state === 'stopping' ? voiceLabels.stopping : voiceLabels.listening}</span>\n <div className=\"gc-chat__voice-actions\">\n <ChatIconButton disabled={voice.state === 'stopping'} label={voiceLabels.finish} icon=\"check\" onClick={voice.stop} />\n <ChatIconButton label={voiceLabels.cancel} icon=\"close\" onClick={voice.cancel} />\n </div>\n <p className=\"gc-chat__voice-transcript\">{voice.result.finalText}<span>{voice.result.interimText}</span>{!voice.result.finalText && !voice.result.interimText ? voiceLabels.empty : null}</p>\n </div>}\n {speech && !voice.support.supported && <p id={`${inputId}-voice-support`} className=\"gc-chat__voice-unsupported\">{voice.support.reason}</p>}\n {speech && voice.error && <p className=\"gc-chat__voice-error\" role=\"alert\">{voice.error.message}</p>}\n <textarea ref={textarea} className=\"gc-chat__input\" aria-label={labels.placeholder} placeholder={labels.placeholder}\n value={text} rows={2} disabled={disabled} onChange={event => setText(event.target.value)}\n onPaste={event => { if (attachments && event.clipboardData.files.length) { event.preventDefault(); addFiles(Array.from(event.clipboardData.files)); } }}\n onKeyDown={event => {\n if (event.key === 'Escape' && !event.nativeEvent.isComposing && event.keyCode !== 229) {\n event.currentTarget.blur();\n return;\n }\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing && event.keyCode !== 229) {\n event.preventDefault(); void send();\n }\n }} />\n <div className=\"gc-chat__composer-bottom\">\n <div className=\"gc-chat__toolbar\">\n {attachments ? <>\n <input ref={fileInput} id={inputId} type=\"file\" hidden multiple accept={attachments.accept} disabled={disabled}\n onChange={event => { addFiles(Array.from(event.target.files ?? [])); event.target.value = ''; }} />\n <ChatIconButton disabled={disabled} label={labels.attach} icon=\"plus\" onClick={() => fileInput.current?.click()} />\n </> : null}\n {toolbar}\n {!attachments && !speech && toolbar == null && <span className=\"gc-chat__input-hint\">{labels.composerHint}</span>}\n </div>\n <div className=\"gc-chat__composer-actions\">\n {speech && <ChatIconButton label={voiceLabels.start} icon=\"mic\" tooltip={voice.support.reason ?? voiceLabels.start}\n aria-describedby={!voice.support.supported ? `${inputId}-voice-support` : undefined}\n disabled={disabled || chat.isBusy || voice.isActive || voice.state === 'consent' || !voice.support.supported} onClick={voice.start} />}\n {chat.isBusy ? <ChatIconButton className=\"gc-chat__send\" label={labels.stop} icon=\"stop\" onClick={event => { event.preventDefault(); void chat.stop().catch(report); }} />\n : <ChatIconButton className=\"gc-chat__send\" type=\"submit\" disabled={!canSend} label={labels.send} icon=\"send\" />}\n </div>\n </div>\n {error ? <div className=\"gc-chat__error\" role=\"alert\">{error}<ChatIconButton label={labels.dismiss} icon=\"close\" onClick={() => setError(undefined)} /></div> : null}\n </form></div>;\n}\n\nfunction fitTextarea(element: HTMLTextAreaElement) {\n element.style.height = 'auto';\n // Preserve fractional two-row heights and refit when a narrow layout wraps the draft.\n element.style.height = `${Math.min(Math.max(element.getBoundingClientRect().height, element.scrollHeight), 180)}px`;\n}\n","\"use client\";\n\nimport { useId, useRef, useState } from 'react';\nimport type { UIMessage } from 'ai';\nimport { Icon, type IconName } from './icons';\nimport type { ChatLabels, ChatMessagesProps, ToolPart, ToolPresentation } from './types';\nimport { asError } from './utils';\n\nfunction readableValue(value: unknown): string {\n if (typeof value === 'string') return value;\n try { return JSON.stringify(value, null, 2) ?? '—'; }\n catch { return String(value); }\n}\n\ntype ActivityStatus = 'preparing' | 'running' | 'approval' | 'completed' | 'error' | 'denied' | 'waiting';\n\nfunction activityStatus<M extends UIMessage>(part: ToolPart<M>, active: boolean): ActivityStatus {\n if (part.state === 'output-error') return 'error';\n if (part.state === 'output-denied' || (part.state === 'approval-responded' && !part.approval.approved)) return 'denied';\n if (part.state === 'approval-requested' && !part.approval.isAutomatic) return 'approval';\n if (part.state === 'output-available' && !part.preliminary) return 'completed';\n // Idle does not imply cancellation: client-side tools may still be executing.\n // Only a live turn animates. Historical/incomplete calls retain neutral wording.\n if (!active) return 'waiting';\n return part.state === 'input-streaming' ? 'preparing' : 'running';\n}\n\n/** Default tool renderer: a quiet activity row with progressively disclosed payloads. */\nexport function ToolActivity<M extends UIMessage>({ part, chat, labels, active, presentation, requestOptions, onActionError }: {\n part: ToolPart<M>;\n chat: ChatMessagesProps<M>['chat'];\n labels: Required<ChatLabels>;\n active: boolean;\n presentation?: ToolPresentation;\n requestOptions: ChatMessagesProps<M>['requestOptions'];\n onActionError: ChatMessagesProps<M>['onActionError'];\n}) {\n const [expanded, setExpanded] = useState(false);\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<Error>();\n const inFlight = useRef(false);\n const detailsId = useId();\n const name = part.type === 'dynamic-tool' ? part.toolName : part.type.slice(5);\n const title = presentation?.title || part.title || name || labels.tool;\n const approval = part.approval;\n const status = activityStatus(part, active);\n const stateLabels: Record<ActivityStatus, string> = {\n preparing: labels.toolPending, running: labels.toolRunning, approval: labels.toolApproval,\n completed: labels.toolComplete, error: labels.toolFailed, denied: labels.toolDenied, waiting: labels.toolWaiting,\n };\n const busy = status === 'preparing' || status === 'running';\n const statusIcon: IconName = busy ? 'loader' : status === 'error' ? 'warning' : status === 'denied' ? 'blocked'\n : status === 'completed' ? 'check' : status === 'waiting' ? 'more' : 'tool';\n\n async function respond(approved: boolean) {\n if (!approval || approval.isAutomatic || chat.isBusy || inFlight.current) return;\n inFlight.current = true;\n setPending(true);\n setError(undefined);\n try {\n await chat.addToolApprovalResponse({ id: approval.id, approved, options: requestOptions });\n } catch (cause) {\n const failure = asError(cause);\n setError(failure);\n inFlight.current = false;\n setPending(false);\n onActionError?.(failure);\n }\n }\n\n return <div className=\"gc-chat__tool\" data-layout=\"activity\" data-state={part.state} data-status={status}>\n <button type=\"button\" className=\"gc-chat__tool-heading\" aria-expanded={expanded} aria-controls={detailsId}\n aria-label={`${title} · ${stateLabels[status]} · ${expanded ? labels.toolHideDetails : labels.toolDetails}`}\n aria-describedby={presentation?.summary ? `${detailsId}-summary` : undefined}\n onClick={() => setExpanded(value => !value)}>\n <span className=\"gc-chat__tool-symbol\" aria-hidden=\"true\">{presentation?.icon ?? <Icon name={statusIcon} className={busy ? 'gc-chat__spinner' : undefined} />}</span>\n <span className=\"gc-chat__tool-name\" title={title}>{title}</span>\n <span className=\"gc-chat__tool-state\">{presentation?.icon != null && busy && <Icon name=\"loader\" className=\"gc-chat__spinner\" />}{stateLabels[status]}</span>\n {presentation?.summary && <span id={`${detailsId}-summary`} className=\"gc-chat__tool-summary\" title={presentation.summary}>{presentation.summary}</span>}\n <Icon name=\"chevron\" className=\"gc-chat__tool-chevron\" />\n </button>\n <span className=\"gc-chat__sr-only\" role=\"status\">{title} · {stateLabels[status]}</span>\n <div id={detailsId} className=\"gc-chat__tool-details\" hidden={!expanded}>\n {expanded && <>\n {title !== name && <div className=\"gc-chat__tool-identifier\">{name}</div>}\n {part.input !== undefined && <div className=\"gc-chat__tool-payload\"><span>{labels.toolInput}</span><pre>{readableValue(part.input)}</pre></div>}\n {part.state === 'output-available' && <div className=\"gc-chat__tool-payload\"><span>{labels.toolOutput}</span><pre>{readableValue(part.output)}</pre></div>}\n {part.input === undefined && part.state !== 'output-available' && <span>{stateLabels[status]}</span>}\n </>}\n </div>\n {approval?.requestReason && <p className=\"gc-chat__tool-reason\">{approval.requestReason}</p>}\n {approval?.reason && <p className=\"gc-chat__tool-reason\">{approval.reason}</p>}\n {part.state === 'output-error' && <p className=\"gc-chat__tool-error\">{part.errorText}</p>}\n {part.state === 'approval-requested' && !approval?.isAutomatic && <div className=\"gc-chat__approval-actions\">\n <button type=\"button\" className=\"gc-chat__button gc-chat__button--primary\" disabled={chat.isBusy || pending} onClick={() => void respond(true)}>{labels.approve}</button>\n <button type=\"button\" className=\"gc-chat__button\" disabled={chat.isBusy || pending} onClick={() => void respond(false)}>{labels.reject}</button>\n </div>}\n {error && <p className=\"gc-chat__tool-error\" role=\"alert\">{error.message}</p>}\n </div>;\n}\n","\"use client\";\n\nimport { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent, TouchEvent, WheelEvent } from 'react';\nimport type { UIMessage } from 'ai';\n\nconst useClientLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\n/** One scroll writer. Resize observations change the target, never the reader's intent. */\nexport function useMessageScroll(messages: readonly UIMessage[]) {\n const scroller = useRef<HTMLDivElement>(null);\n const content = useRef<HTMLDivElement>(null);\n const following = useRef(true);\n const frame = useRef<number | undefined>(undefined);\n const previousTime = useRef<number | undefined>(undefined);\n const lastTop = useRef(0);\n const lastMaximum = useRef(0);\n const writtenTop = useRef<number | undefined>(undefined);\n const touchY = useRef<number | undefined>(undefined);\n const previousMessages = useRef(messages.map(({ id }) => id));\n const [awayFromBottom, setAwayFromBottom] = useState(false);\n\n const cancel = useCallback(() => {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n frame.current = undefined;\n previousTime.current = undefined;\n }, []);\n\n const write = useCallback((top: number) => {\n const element = scroller.current;\n if (!element) return;\n if (Math.abs(element.scrollTop - top) > .5) element.scrollTop = top;\n writtenTop.current = lastTop.current = element.scrollTop;\n lastMaximum.current = Math.max(0, element.scrollHeight - element.clientHeight);\n }, []);\n\n const schedule = useCallback(() => {\n if (!following.current || frame.current !== undefined) return;\n const advance = (time: number) => {\n frame.current = undefined;\n const element = scroller.current;\n if (!element || !following.current) return;\n const target = Math.max(0, element.scrollHeight - element.clientHeight);\n const distance = target - element.scrollTop;\n const elapsed = previousTime.current === undefined ? 16 : Math.min(64, time - previousTime.current);\n previousTime.current = time;\n const instant = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches;\n // Content may shrink (e.g. a Markdown delimiter closes). Let native clamping\n // settle it immediately; never ease backwards or restart CSS smooth-scroll.\n if (instant || distance <= 1 || distance > element.clientHeight) {\n write(target);\n previousTime.current = undefined;\n return;\n }\n write(Math.min(target, element.scrollTop + Math.max(1, distance * (1 - Math.exp(-elapsed / 48)))));\n frame.current = requestAnimationFrame(advance);\n };\n frame.current = requestAnimationFrame(advance);\n }, [write]);\n\n const scrollToLatest = useCallback(() => {\n cancel();\n following.current = true;\n setAwayFromBottom(false);\n const element = scroller.current;\n if (element) write(Math.max(0, element.scrollHeight - element.clientHeight));\n }, [cancel, write]);\n\n const pause = useCallback(() => {\n const element = scroller.current;\n // An upward gesture in an empty/short conversation cannot move the reader\n // away from the latest message. Do not leave future turns detached.\n if (!element || element.scrollHeight - element.clientHeight <= 1) return;\n following.current = false;\n cancel();\n setAwayFromBottom(true);\n }, [cancel]);\n\n useClientLayoutEffect(() => {\n scrollToLatest();\n if (!scroller.current || !content.current || typeof ResizeObserver === 'undefined') return cancel;\n const observer = new ResizeObserver(schedule);\n observer.observe(content.current);\n observer.observe(scroller.current);\n return () => { observer.disconnect(); cancel(); };\n }, [scrollToLatest, schedule, cancel]);\n\n // A new user turn expresses an intent to continue at the end of the conversation,\n // whether it comes from our composer, a suggestion, or a host's custom input.\n // Match the previous tail so prepending history does not look like a new turn.\n // Assistant deltas and tool continuations preserve the reader's scroll intent.\n useClientLayoutEffect(() => {\n const previous = previousMessages.current;\n const tail = previous.at(-1);\n const tailIndex = tail === undefined ? -1 : messages.findIndex(message => message.id === tail);\n const known = new Set(previous);\n const appendedUser = (tail === undefined || tailIndex !== -1)\n && messages.slice(tailIndex + 1).some(message => message.role === 'user' && !known.has(message.id));\n previousMessages.current = messages.map(({ id }) => id);\n if (appendedUser) scrollToLatest();\n // Also supports environments without ResizeObserver; duplicate signals share a frame.\n schedule();\n }, [messages, scrollToLatest, schedule]);\n\n function onScroll() {\n const element = scroller.current;\n if (!element) return;\n const top = element.scrollTop;\n const previous = lastTop.current;\n lastTop.current = top;\n if (writtenTop.current !== undefined && Math.abs(top - writtenTop.current) < 1) return;\n writtenTop.current = undefined;\n const maximum = Math.max(0, element.scrollHeight - element.clientHeight);\n if (following.current && maximum < lastMaximum.current && top >= maximum - 1) {\n // The browser clamps scrollTop when content shrinks or the viewport grows.\n // This is layout, not an instruction to stop following the conversation.\n lastMaximum.current = maximum;\n schedule();\n return;\n }\n lastMaximum.current = maximum;\n if (top < previous - 1) { pause(); return; }\n if (top > previous && element.scrollHeight - top - element.clientHeight <= 4) {\n following.current = true;\n setAwayFromBottom(false);\n schedule();\n }\n }\n\n function consumedByNestedScroll(event: { target: EventTarget; currentTarget: HTMLDivElement }) {\n let target = event.target instanceof Element ? event.target : null;\n while (target && target !== event.currentTarget) {\n if (target.scrollTop > 0 && target.scrollHeight > target.clientHeight) return true;\n target = target.parentElement;\n }\n return false;\n }\n function onWheel(event: WheelEvent<HTMLDivElement>) {\n if (event.deltaY >= 0 || event.ctrlKey || consumedByNestedScroll(event)) return;\n pause();\n }\n function onTouchStart(event: TouchEvent<HTMLDivElement>) { touchY.current = event.touches[0]?.clientY; }\n function onTouchMove(event: TouchEvent<HTMLDivElement>) {\n const y = event.touches[0]?.clientY;\n if (y !== undefined && touchY.current !== undefined && y > touchY.current + 2 && !consumedByNestedScroll(event)) pause();\n touchY.current = y;\n }\n function onKeyDown(event: KeyboardEvent<HTMLDivElement>) {\n if (event.target !== event.currentTarget) return;\n if (['ArrowUp', 'PageUp', 'Home'].includes(event.key) || (event.key === ' ' && event.shiftKey)) pause();\n }\n\n return { scroller, content, awayFromBottom, scrollToLatest, scrollEvents: { onScroll, onWheel, onTouchStart, onTouchMove, onKeyDown } };\n}\n","\"use client\";\n\nimport { useEffect, useRef, useState } from 'react';\nimport type { TextRenderer } from './types';\n\nconst CATCH_UP_MS = 160;\nconst FRAME_INTERVAL_MS = 24;\nconst segmenter = typeof Intl.Segmenter === 'function'\n ? new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n : undefined;\n\nexport interface StreamingTextProps {\n text: string;\n isStreaming: boolean;\n enabled?: boolean;\n renderText?: TextRenderer;\n}\n\nfunction useReducedMotion() {\n const [reduced, setReduced] = useState(() => typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true);\n useEffect(() => {\n const query = window.matchMedia?.('(prefers-reduced-motion: reduce)');\n if (!query) return;\n const update = () => setReduced(query.matches);\n update();\n query.addEventListener('change', update);\n return () => query.removeEventListener('change', update);\n }, []);\n return reduced;\n}\n\n/** Presentation-only pacing: persisted messages and tool events stay untouched. */\nexport function StreamingText({ text, isStreaming, enabled = true, renderText }: StreamingTextProps) {\n const reducedMotion = useReducedMotion();\n const animate = enabled && isStreaming && !reducedMotion && segmenter !== undefined;\n // A newly mounted part already has its current text; never replay history.\n const [visible, setVisible] = useState(text);\n const shown = useRef(text);\n const target = useRef(text);\n const frame = useRef<number | undefined>(undefined);\n const queue = useRef({ boundaries: [] as number[], index: 0, deadline: 0, updatedAt: 0 });\n\n useEffect(() => {\n function cancel() {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n frame.current = undefined;\n }\n function reveal(value: string) {\n shown.current = value;\n setVisible(value);\n }\n const appending = text.startsWith(target.current);\n target.current = text;\n if (!animate || !appending || typeof requestAnimationFrame !== 'function') {\n cancel();\n reveal(text);\n return;\n }\n\n // The first character should respond immediately, even after an empty part.\n if (!shown.current && text) reveal(segmenter!.segment(text)[Symbol.iterator]().next().value!.segment);\n if (shown.current === text) {\n cancel();\n return;\n }\n\n const now = performance.now();\n const previous = queue.current;\n const offset = shown.current.length;\n queue.current = {\n // Segment the new target, since a delta can extend the previous final\n // grapheme (a combining mark or a joined emoji). Frames only slice it.\n boundaries: Array.from(segmenter!.segment(text), part => part.index + part.segment.length).filter(end => end > offset),\n index: 0,\n // New deltas share the existing deadline, so a busy stream cannot build\n // an ever-growing typewriter backlog. A background tab catches up too.\n deadline: frame.current === undefined ? now + CATCH_UP_MS : previous.deadline,\n updatedAt: frame.current === undefined ? now : previous.updatedAt,\n };\n\n function tick(time: number) {\n frame.current = undefined;\n const pending = queue.current;\n const elapsed = time - pending.updatedAt;\n if (elapsed >= FRAME_INTERVAL_MS || time >= pending.deadline) {\n const remaining = pending.boundaries.length - pending.index;\n const fraction = Math.min(1, elapsed / Math.max(1, pending.deadline - pending.updatedAt));\n pending.index += Math.min(remaining, Math.max(1, Math.ceil(remaining * fraction)));\n pending.updatedAt = time;\n reveal(target.current.slice(0, pending.boundaries[pending.index - 1]));\n }\n if (shown.current !== target.current) frame.current = requestAnimationFrame(tick);\n }\n if (frame.current === undefined) frame.current = requestAnimationFrame(tick);\n }, [text, animate]);\n\n useEffect(() => () => {\n if (frame.current !== undefined) cancelAnimationFrame(frame.current);\n frame.current = undefined;\n }, []);\n\n // Completion, stop and replacements must be visible in this very render,\n // before the effect synchronizes its queue. Nothing is lost on cancellation.\n const reset = !animate || !text.startsWith(target.current) || !text.startsWith(visible);\n const displayed = reset ? text : visible || segmenter?.segment(text)[Symbol.iterator]().next().value?.segment || '';\n return renderText ? renderText({ text: displayed, isStreaming }) : <div className=\"gc-chat__plain-text\">{displayed}</div>;\n}\n","\"use client\";\n\nimport { isToolUIPart, type UIMessage } from 'ai';\nimport { useEffect, useRef, useState } from 'react';\nimport type { ReactNode } from 'react';\nimport { Icon } from './icons';\nimport { ToolActivity } from './tool-activity';\nimport { ChatIconButton } from './ui-primitives';\nimport { resolveLabels } from './labels';\nimport type { ChatMessagesProps, ChatSuggestedAction, PartRendererProps, ToolPart } from './types';\nimport { asError, getMessageText, safeUrl } from './utils';\nimport { useMessageScroll } from './use-message-scroll';\nimport { StreamingText } from './streaming-text';\nimport { MarkdownResponse } from './markdown';\n\nexport function ChatMessages<M extends UIMessage = UIMessage>(props: ChatMessagesProps<M>) {\n return <Messages key={props.chat.id} {...props} />;\n}\n\nfunction Messages<M extends UIMessage>({ chat, labels: labelOverrides, renderText, smoothStreaming = true, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderMessageHeader, empty, className, requestOptions, onActionError, capabilities }: ChatMessagesProps<M>) {\n const labels = resolveLabels(labelOverrides);\n const { scroller, content, awayFromBottom, scrollToLatest, scrollEvents } = useMessageScroll(chat.messages);\n const copyTimeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const actionInFlight = useRef(false);\n const [copiedId, setCopiedId] = useState<string>();\n const [actionError, setActionError] = useState<Error>();\n const [actionPending, setActionPending] = useState(false);\n const [pendingSuggestion, setPendingSuggestion] = useState<string>();\n\n useEffect(() => () => clearTimeout(copyTimeout.current), []);\n\n function reportError(cause: unknown) {\n const error = asError(cause);\n setActionError(error);\n onActionError?.(error);\n }\n\n async function copy(message: M) {\n setActionError(undefined);\n try {\n await navigator.clipboard.writeText(getMessageText(message));\n setCopiedId(message.id);\n clearTimeout(copyTimeout.current);\n copyTimeout.current = setTimeout(() => setCopiedId(undefined), 1800);\n } catch (cause) { reportError(cause); }\n }\n\n async function regenerate(message: M) {\n if (chat.isBusy || actionInFlight.current || capabilities?.regenerate === false) return;\n actionInFlight.current = true;\n setActionPending(true);\n setActionError(undefined);\n try { await chat.regenerate({ ...requestOptions, messageId: message.id }); }\n catch (cause) { reportError(cause); }\n finally { actionInFlight.current = false; setActionPending(false); }\n }\n\n function focusComposer() {\n content.current?.closest('.gc-chat')?.querySelector<HTMLTextAreaElement>('.gc-chat__input')?.focus();\n }\n\n async function selectSuggestion(action: ChatSuggestedAction<M>, message: M) {\n if (chat.isBusy || actionInFlight.current || action.disabled || message !== chat.messages.at(-1)) return;\n actionInFlight.current = true;\n setActionPending(true);\n setPendingSuggestion(action.id);\n setActionError(undefined);\n try { await action.onSelect({ message, chat, focusComposer }); }\n catch (cause) { reportError(cause); }\n finally { actionInFlight.current = false; setActionPending(false); setPendingSuggestion(undefined); }\n }\n\n function renderPart(part: M['parts'][number], message: M, isStreaming: boolean): ReactNode {\n // The mapped renderer contract is checked at the consumer boundary. Runtime\n // lookup cannot preserve the correlation between this key and its union part.\n const renderer = renderers?.[part.type as keyof typeof renderers] as ((props: PartRendererProps<M>) => ReactNode) | undefined;\n if (renderer) return renderer({ part, message, isStreaming, chat });\n if (part.type === 'step-start') return null;\n if (isToolUIPart(part)) {\n const name = part.type === 'dynamic-tool' ? part.toolName : part.type.slice(5);\n const toolPart = part as ToolPart<M>;\n if (tools?.[name]) return tools[name]({ part: toolPart, message, isStreaming, chat });\n return <ToolActivity part={toolPart} chat={chat} labels={labels} active={chat.isBusy && message === last} presentation={toolPresentation?.({ part: toolPart, message, isStreaming, chat })} requestOptions={requestOptions} onActionError={onActionError} />;\n }\n switch (part.type) {\n case 'text': return part.text ? <div className=\"gc-chat__text\"><StreamingText text={part.text} isStreaming={message.role === 'assistant' && isStreaming && part.state !== 'done'} enabled={smoothStreaming} renderText={renderText ?? (message.role === 'assistant' ? MarkdownResponse : undefined)} /></div> : null;\n case 'reasoning': return <details className=\"gc-chat__reasoning\" data-streaming={isStreaming && part.state !== 'done' || undefined}><summary><Icon name=\"thinking\" /><span>{labels.reasoning}</span><Icon name=\"chevron\" /></summary><div className=\"gc-chat__plain-text\">{part.text}</div></details>;\n case 'source-url': {\n const url = safeUrl(part.url);\n return url ? <a className=\"gc-chat__source\" href={url} target=\"_blank\" rel=\"noopener noreferrer\"><Icon name=\"link\" /><span>{part.title || part.url}</span></a> : <span className=\"gc-chat__source\"><Icon name=\"link\" /><span>{part.title || labels.sources}</span></span>;\n }\n case 'source-document': return <span className=\"gc-chat__source\"><Icon name=\"file\" /><span>{part.title || part.filename || labels.sources}</span></span>;\n case 'file': {\n const url = safeUrl(part.url);\n const label = part.filename || part.mediaType;\n return url ? <a className=\"gc-chat__message-file\" href={url} target=\"_blank\" rel=\"noopener noreferrer\"><Icon name=\"file\" /><span>{label}</span></a> : <span className=\"gc-chat__message-file\"><Icon name=\"file\" /><span>{label}</span></span>;\n }\n default: return <div className=\"gc-chat__unsupported\"><Icon name=\"file\" /><span>{labels.unsupportedPart} <code>{part.type}</code></span></div>;\n }\n }\n\n const last = chat.messages.at(-1);\n const lastPart = last?.parts.filter(part => part.type !== 'step-start').at(-1);\n const toolFinished = lastPart && isToolUIPart(lastPart) && (\n (lastPart.state === 'output-available' && !lastPart.preliminary) || lastPart.state === 'output-error' || lastPart.state === 'output-denied'\n );\n // System instructions belong to the transport context, not the conversation UI.\n const visibleMessages = chat.messages.filter(message => message.role !== 'system');\n const actions = suggestedActions?.slice(0, 3) ?? [];\n const recommendedIndex = actions.findIndex(action => action.emphasis === 'recommended');\n const showThinking = chat.isBusy && (last?.role !== 'assistant' || !lastPart || (lastPart.type === 'text' && !lastPart.text) || toolFinished);\n const thinking = <div className=\"gc-chat__thinking\" role=\"status\"><Icon name=\"loader\" className=\"gc-chat__spinner\" /><span>{labels.thinking}</span><span className=\"gc-chat__thinking-dots\" aria-hidden=\"true\"><i /><i /><i /></span></div>;\n return <div className={['gc-chat__messages-wrap', className].filter(Boolean).join(' ')}>\n <div className=\"gc-chat__messages\" ref={scroller} role=\"log\" aria-label={labels.title} aria-live=\"polite\" aria-relevant=\"additions\" tabIndex={0} data-following={!awayFromBottom} {...scrollEvents}>\n <div className=\"gc-chat__messages-content\" ref={content}>\n {visibleMessages.length === 0 && !chat.isBusy && (empty ?? <div className=\"gc-chat__empty\"><span className=\"gc-chat__empty-symbol\"><Icon name=\"sparkle\" /></span><h2>{labels.emptyTitle}</h2><p>{labels.emptyDescription}</p></div>)}\n {visibleMessages.map(message => <article className={`gc-chat__message gc-chat__message--${message.role}`} key={message.id} aria-label={message.role === 'user' ? labels.user : labels.assistant}>\n {message.role === 'assistant' && (renderMessageHeader ? renderMessageHeader({ message, isStreaming: chat.status === 'streaming' && message === last, chat }) : <div className=\"gc-chat__message-heading\"><span className=\"gc-chat__assistant-mark\"><Icon name=\"sparkle\" /></span><strong className=\"gc-chat__assistant-name\">{labels.assistant}</strong></div>)}\n <div className=\"gc-chat__message-body\">{message.parts.map((part, partIndex) => <div className=\"gc-chat__part\" data-part={isToolUIPart(part) ? 'tool' : part.type} key={isToolUIPart(part) ? `tool-${part.toolCallId}` : `${part.type}-${partIndex}`}>{renderPart(part, message, chat.status === 'streaming' && message === last)}</div>)}</div>\n {message === last && message.role === 'assistant' && !chat.isBusy && <>\n {actions.length > 0 && <section className=\"gc-chat__suggestions\" aria-label={labels.suggestions ?? 'Suggested next steps'} aria-busy={pendingSuggestion !== undefined}>\n <div className=\"gc-chat__suggestions-heading\"><h3>{suggestionsTitle ?? labels.suggestions ?? 'Suggested next steps'}</h3>{suggestionsDescription != null && <span className=\"gc-chat__suggestions-reason\">{suggestionsDescription}</span>}</div>\n <div className=\"gc-chat__suggestions-actions\">{actions.map((action, index) => <button key={action.id} type=\"button\" className=\"gc-chat__suggestion\"\n data-emphasis={action.emphasis === 'recommended' && index !== recommendedIndex ? 'secondary' : action.emphasis ?? 'secondary'} data-pending={pendingSuggestion === action.id || undefined}\n disabled={actionPending || action.disabled} onClick={() => void selectSuggestion(action, message)}>\n {action.icon}{pendingSuggestion === action.id ? action.pendingLabel ?? action.label : action.label}{action.trailingIcon}\n </button>)}</div>\n </section>}\n {renderMessageActions?.({ message, chat, focusComposer })}\n </>}\n {message.role === 'assistant' && <div className=\"gc-chat__message-footer\">{showThinking && message === last ? thinking : <div className=\"gc-chat__message-actions\" role=\"group\" aria-label={labels.assistant}>\n {getMessageText(message) && <ChatIconButton size=\"sm\" label={copiedId === message.id ? labels.copied : labels.copy} icon={copiedId === message.id ? 'check' : 'copy'} data-copied={copiedId === message.id || undefined} disabled={chat.isBusy && message === last} onClick={() => void copy(message)} />}\n {message === last && capabilities?.regenerate !== false && <ChatIconButton size=\"sm\" label={labels.regenerate} icon=\"refresh\" disabled={chat.isBusy || actionPending} onClick={() => void regenerate(message)} />}\n </div>}</div>}\n </article>)}\n {showThinking && last?.role !== 'assistant' && <article className=\"gc-chat__message gc-chat__message--assistant\" aria-label={labels.assistant}><div className=\"gc-chat__message-footer\">{thinking}</div></article>}\n {actionError && <div className=\"gc-chat__error\" role=\"alert\">{actionError.message}<ChatIconButton label={labels.dismiss} icon=\"close\" size=\"sm\" onClick={() => setActionError(undefined)} /></div>}\n </div>\n </div>\n {awayFromBottom && <button type=\"button\" className=\"gc-chat__jump\" onClick={scrollToLatest}><Icon name=\"down\" /><span>{labels.jumpToLatest}</span></button>}\n <span className=\"gc-chat__sr-only\" role=\"status\">{copiedId ? labels.copied : ''}</span>\n </div>;\n}\n","\"use client\";\n\nimport type { UIMessage } from 'ai';\nimport { useRef, useState } from 'react';\nimport { ChatComposer } from './chat-composer';\nimport { ChatMessages } from './chat-messages';\nimport { Icon } from './icons';\nimport { ChatIconButton } from './ui-primitives';\nimport { resolveLabels } from './labels';\nimport type { ChatPanelProps } from './types';\nimport { asError } from './utils';\n\nexport function ChatPanel<M extends UIMessage = UIMessage>(props: ChatPanelProps<M>) {\n return <Panel key={props.chat.id} {...props} />;\n}\n\nfunction Panel<M extends UIMessage>({ chat, labels: labelOverrides, title, subtitle, headerIcon, header, headerActions, footer, composer, composerProps, theme = 'auto', variant = 'panel', density = 'comfortable', capabilities, className, renderText, smoothStreaming, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderMessageHeader, empty, requestOptions, onActionError, ...elementProps }: ChatPanelProps<M>) {\n const labels = resolveLabels(labelOverrides);\n const [retrying, setRetrying] = useState(false);\n const [retryError, setRetryError] = useState<Error>();\n const retryInFlight = useRef(false);\n\n async function retry() {\n if (chat.isBusy || retryInFlight.current || (capabilities?.regenerate === false && chat.messages.at(-1)?.role === 'assistant')) return;\n retryInFlight.current = true;\n setRetrying(true);\n setRetryError(undefined);\n try {\n const last = chat.messages.at(-1);\n // An unanswered user turn is retried without appending a duplicate turn.\n if (last?.role === 'user') await chat.sendMessage(undefined, requestOptions);\n else if (last?.role === 'assistant') await chat.regenerate({ ...requestOptions, messageId: last.id });\n else chat.clearError();\n } catch (cause) {\n const error = asError(cause);\n setRetryError(error);\n onActionError?.(error);\n } finally { retryInFlight.current = false; setRetrying(false); }\n }\n\n return <section {...elementProps} className={['gc-chat', className].filter(Boolean).join(' ')} data-theme={theme} data-variant={variant} data-density={density} aria-label={elementProps['aria-label'] ?? title ?? labels.title}>\n {header !== undefined ? header : <header className=\"gc-chat__header\"><div className=\"gc-chat__heading\"><span className=\"gc-chat__brand\">{headerIcon ?? <Icon name=\"sparkle\" />}</span><div className=\"gc-chat__header-copy\"><span className=\"gc-chat__title\">{title ?? labels.title}</span>{subtitle != null && <p className=\"gc-chat__subtitle\">{subtitle}</p>}</div></div>{headerActions && <div className=\"gc-chat__header-actions\">{headerActions}</div>}</header>}\n <ChatMessages chat={chat} capabilities={capabilities} labels={labelOverrides} renderText={renderText} smoothStreaming={smoothStreaming} renderers={renderers} tools={tools} toolPresentation={toolPresentation} suggestedActions={suggestedActions} suggestionsTitle={suggestionsTitle} suggestionsDescription={suggestionsDescription} renderMessageActions={renderMessageActions} renderMessageHeader={renderMessageHeader} empty={empty} requestOptions={requestOptions} onActionError={onActionError} />\n <div className=\"gc-chat__bottom\">\n {(chat.error || retryError) && <div className=\"gc-chat__error\" role=\"alert\"><span>{retryError?.message ?? labels.error}</span>{!(capabilities?.regenerate === false && chat.messages.at(-1)?.role === 'assistant') && <button type=\"button\" className=\"gc-chat__button\" disabled={chat.isBusy || retrying} onClick={() => void retry()}>{labels.retry}</button>}<ChatIconButton label={labels.dismiss} icon=\"close\" size=\"sm\" onClick={() => { chat.clearError(); setRetryError(undefined); }} /></div>}\n {composer !== undefined ? composer : <ChatComposer {...composerProps} chat={chat} labels={labelOverrides} requestOptions={requestOptions} onActionError={onActionError} />}\n {footer !== undefined ? footer : <p className=\"gc-chat__disclaimer\">{labels.disclaimer}</p>}\n </div>\n </section>;\n}\n","\"use client\";\n\nimport type { UIMessage } from 'ai';\nimport { useAiChat } from './use-ai-chat';\nimport { ChatPanel } from './chat-panel';\nimport type { AiChatProps } from './types';\n\nexport function AiChat<M extends UIMessage = UIMessage>({ options, ...props }: AiChatProps<M>) {\n const chat = useAiChat<M>(options);\n return <ChatPanel {...props} chat={chat} />;\n}\n","\"use client\";\n\nimport { useEffect, useRef, useState } from 'react';\nimport type { HTMLAttributes, KeyboardEvent, ReactNode } from 'react';\nimport { Icon } from './icons';\n\nexport interface ChatHistoryItem {\n id: string;\n title: string;\n}\n\nexport interface ChatHistoryLabels {\n title: string;\n newChat: string;\n more: string;\n back: string;\n allConversations: string;\n searchPlaceholder: string;\n searchLabel: string;\n empty: string;\n noResults: string;\n loading: string;\n retry: string;\n unnamed: string;\n}\n\nconst defaultLabels: ChatHistoryLabels = {\n title: '历史对话', newChat: '发起新对话', more: '更多对话', back: '返回最近对话',\n allConversations: '全部对话', searchPlaceholder: '搜索对话', searchLabel: '搜索对话',\n empty: '还没有历史对话', noResults: '没有找到相关对话', loading: '正在加载对话…',\n retry: '重试', unnamed: '未命名对话',\n};\n\nexport interface ChatHistoryMenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {\n /** Most recent first. The host owns persistence, fetching and ordering. */\n conversations: readonly ChatHistoryItem[];\n currentId?: string;\n onSelect: (id: string) => void;\n onNewChat: () => void;\n /** Disables conversation mutations; browsing and searching remain available. */\n disabled?: boolean;\n /** Existing conversations remain visible and selectable unless disabled is also set. */\n loading?: boolean;\n error?: string;\n onRetry?: () => void;\n recentLimit?: number;\n /** Host actions such as settings or help. Direct buttons and links inherit row styling. */\n footer?: ReactNode;\n labels?: Partial<ChatHistoryLabels>;\n /** Focus the first available control when mounted. Defaults to false for inline demos. */\n autoFocus?: boolean;\n}\n\nfunction normalizeSearch(value: string) {\n return value.normalize('NFKC').toLocaleLowerCase();\n}\n\nfunction availableControls(element: HTMLDivElement) {\n return [...element.querySelectorAll<HTMLElement>('button:not(:disabled), a[href]')]\n .filter(control => !control.closest('[hidden], [inert], [aria-hidden=\"true\"]') && control.getAttribute('aria-disabled') !== 'true');\n}\n\n/** A standalone, non-modal surface. The host provides its trigger, positioning and dismissal. */\nexport function ChatHistoryMenu({\n conversations, currentId, onSelect, onNewChat, disabled = false, loading = false, error,\n onRetry, recentLimit = 5, footer, labels: overrides, autoFocus = false,\n className, onKeyDown, ...props\n}: ChatHistoryMenuProps) {\n const labels = { ...defaultLabels, ...overrides };\n const [showAll, setShowAll] = useState(false);\n const [query, setQuery] = useState('');\n const root = useRef<HTMLDivElement>(null);\n const search = useRef<HTMLInputElement>(null);\n const more = useRef<HTMLButtonElement>(null);\n const openedAll = useRef(false);\n const limit = Number.isFinite(recentLimit) ? Math.max(1, Math.floor(recentLimit)) : 5;\n const searchTerm = normalizeSearch(query.trim());\n const visibleConversations = showAll\n ? conversations.filter(conversation => normalizeSearch(conversation.title || labels.unnamed).includes(searchTerm))\n : conversations.slice(0, limit);\n\n useEffect(() => {\n if (autoFocus && root.current) (availableControls(root.current)[0] ?? root.current).focus();\n }, [autoFocus]);\n\n useEffect(() => {\n if (showAll) {\n openedAll.current = true;\n search.current?.focus();\n } else if (openedAll.current && root.current) {\n (more.current ?? availableControls(root.current)[0] ?? root.current).focus();\n }\n }, [showAll]);\n\n function navigate(event: KeyboardEvent<HTMLDivElement>) {\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n const target = event.target as HTMLElement;\n // Text editing, including Home/End and selection, belongs to the search field or host input.\n if (target.closest('input, textarea, select, [contenteditable=\"true\"]')) return;\n if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return;\n const controls = availableControls(event.currentTarget);\n if (!controls.length) return;\n const index = controls.findIndex(control => control === target || control.contains(target));\n if (index < 0 && target !== event.currentTarget) return;\n const next = event.key === 'Home' ? 0 : event.key === 'End' ? controls.length - 1\n : event.key === 'ArrowDown' ? (index + 1) % controls.length\n : index <= 0 ? controls.length - 1 : index - 1;\n event.preventDefault();\n controls[next]?.focus();\n }\n\n return <div {...props} ref={root} role=\"dialog\" aria-label={props['aria-label'] ?? labels.title}\n tabIndex={props.tabIndex ?? -1} className={['gc-chat-history', className].filter(Boolean).join(' ')}\n data-view={showAll ? 'all' : 'recent'} data-disabled={disabled || undefined} onKeyDown={navigate}>\n {showAll ? <>\n <div className=\"gc-chat-history__heading\">\n <button type=\"button\" className=\"gc-chat-history__back\" aria-label={labels.back}\n onClick={() => { setShowAll(false); setQuery(''); }}>\n <Icon name=\"chevron\" />\n </button>\n <span>{labels.allConversations}</span>\n </div>\n <div className=\"gc-chat-history__search\">\n <Icon name=\"search\" />\n <input ref={search} type=\"search\" value={query} aria-label={labels.searchLabel}\n placeholder={labels.searchPlaceholder} onChange={event => setQuery(event.target.value)} />\n </div>\n </> : <>\n <button type=\"button\" className=\"gc-chat-history__row gc-chat-history__new\" disabled={disabled} onClick={onNewChat}>\n <Icon name=\"edit\" /><span>{labels.newChat}</span>\n </button>\n <div className=\"gc-chat-history__separator\" />\n </>}\n\n {error && <div className=\"gc-chat-history__error\">\n <div role=\"alert\"><Icon name=\"warning\" /><span>{error}</span></div>\n {onRetry && <button type=\"button\" disabled={disabled || loading} onClick={onRetry}>{labels.retry}</button>}\n </div>}\n\n {loading && <div className=\"gc-chat-history__loading\" role=\"status\"><Icon name=\"loader\" /><span>{labels.loading}</span></div>}\n\n {visibleConversations.length > 0 ? <ul className=\"gc-chat-history__list\" aria-label={showAll ? labels.allConversations : labels.title}>\n {visibleConversations.map(conversation => <li key={conversation.id}>\n <button type=\"button\" className=\"gc-chat-history__row\" disabled={disabled}\n aria-current={conversation.id === currentId ? 'true' : undefined}\n title={conversation.title || labels.unnamed} onClick={() => onSelect(conversation.id)}>\n <Icon name=\"text\" />\n <span>{conversation.title || labels.unnamed}</span>\n {conversation.id === currentId && <Icon className=\"gc-chat-history__current\" name=\"check\" />}\n </button>\n </li>)}\n </ul> : loading && conversations.length === 0 ? <div className=\"gc-chat-history__skeleton\" aria-hidden=\"true\">\n {[0, 1, 2].map(index => <div key={index}><i /><span /></div>)}\n </div> : error && conversations.length === 0 ? null : <p className=\"gc-chat-history__empty\">{showAll && searchTerm ? labels.noResults : labels.empty}</p>}\n\n {!showAll && conversations.length > limit && <button ref={more} type=\"button\" className=\"gc-chat-history__row gc-chat-history__more\"\n onClick={() => setShowAll(true)}>\n <Icon name=\"more\" /><span>{labels.more}</span><Icon name=\"chevron\" />\n </button>}\n\n {footer && <><div className=\"gc-chat-history__separator\" /><div className=\"gc-chat-history__footer\">{footer}</div></>}\n </div>;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB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AAA,EAAA,UAAA,CAAE,oBAAC,OAAD,EAAK,WAAU,6BAA8B,CAAA,GAAC,oBAAC,OAAD;IAAK,WAAU;IAA2B,UAAA;GAAY,CAAA,CAAG,EAAA,CAAA;EACjH;;AACP"}
package/dist/styles.css CHANGED
@@ -1,4 +1,5 @@
1
1
  @import './history-menu.css';
2
+ @import './targeting.css';
2
3
 
3
4
  /* All selectors are scoped. Override these tokens on .gc-chat. */
4
5
  .gc-chat {