@galaxycore/ai-chat 0.6.0 → 0.7.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 +5 -0
- package/README.md +1 -1
- package/dist/headless.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +63 -19
- package/dist/index.js.map +1 -1
- package/dist/{labels-D8smv23O.d.ts → labels-a_-_yLBi.d.ts} +9 -3
- package/docs/api-reference.md +2 -1
- package/docs/publishing.md +6 -6
- package/docs/streaming.md +27 -1
- package/docs/validation.md +13 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
- Keep following streamed replies through consecutive layout changes. Deliberate upward scrolling still pauses following.
|
|
6
|
+
- Add an optional `scrollRef` to reveal an element or text range inside the message viewport.
|
|
7
|
+
|
|
3
8
|
## 0.6.0
|
|
4
9
|
|
|
5
10
|
- 新增可选的页面指向:划选文字、双击段落、在图片上拖出区域,都可以变成聊天上下文引用。公开入口是 `useChatTargeting`、`ChatTargetingOverlay`、`toChatContextItem`,以及中英文文案;主入口和 `/targeting` 都会导出。
|
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
|
+
**当前版本:UI 包 0.7.0,网关包 0.2.0。** UI 提供平滑流式展示、历史会话菜单、页面指向、语音输入、可部署示例和交互文档站。独立 Node 网关通过 pi core 实现流式文本、服务端工具调用、停止和持久化会话恢复。Codex 已预留运行时扩展接口,尚未实现其桥接。发布验收与真实模型联调状态见 [验证记录](docs/validation.md)。
|
|
6
6
|
|
|
7
7
|
## 本地运行
|
|
8
8
|
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
import { ChatContextAdapter, ChatContextController, ChatContextItem, ChatContextOptions, ChatContextValue, ChatRequestContext, SelectedChatContextItem, TextSelectionAdapterOptions, createTextSelectionAdapter, useChatContext } from "./context.js";
|
|
3
3
|
import { SpeechInputAdapter, SpeechInputController, SpeechInputError, SpeechInputOptions, SpeechInputResult, SpeechInputSession, SpeechInputStartOptions, createBrowserSpeechAdapter, defaultSpeechInputLabels, useSpeechInput } from "./voice.js";
|
|
4
|
-
import { C as
|
|
5
|
-
export { type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatLabels, type ChatMessageActionContext, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type ChatSuggestedAction, type PartRendererProps, type PartRenderers, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, acceptsFile, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, safeUrl, useAiChat, useChatContext, useSpeechInput, zhCN };
|
|
4
|
+
import { C as ToolPresentationResolver, S as ToolPresentation, _ as ChatSuggestedAction, a as safeUrl, b as TextRenderer, c as AiChatOptions, d as ChatComposerProps, f as ChatLabels, g as ChatScrollHandle, h as ChatPanelProps, i as getMessageText, l as AiChatProps, m as ChatMessagesProps, n as zhCN, o as useAiChat, p as ChatMessageActionContext, r as acceptsFile, s as AiChatController, t as enUS, u as AttachmentOptions, v as PartRendererProps, w as ToolRenderers, x as ToolPart, y as PartRenderers } from "./labels-a_-_yLBi.js";
|
|
5
|
+
export { type AiChatController, type AiChatOptions, type AiChatProps, type AttachmentOptions, type ChatComposerProps, type ChatContextAdapter, type ChatContextController, type ChatContextItem, type ChatContextOptions, type ChatContextValue, type ChatLabels, type ChatMessageActionContext, type ChatMessagesProps, type ChatPanelProps, type ChatRequestContext, type ChatScrollHandle, type ChatSuggestedAction, type PartRendererProps, type PartRenderers, type SelectedChatContextItem, type SpeechInputAdapter, type SpeechInputController, SpeechInputError, type SpeechInputOptions, type SpeechInputResult, type SpeechInputSession, type SpeechInputStartOptions, type TextRenderer, type TextSelectionAdapterOptions, type ToolPart, type ToolPresentation, type ToolPresentationResolver, type ToolRenderers, acceptsFile, createBrowserSpeechAdapter, createTextSelectionAdapter, defaultSpeechInputLabels, enUS, getMessageText, safeUrl, useAiChat, useChatContext, useSpeechInput, zhCN };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { a as ChatIconName, c as Icon, i as ChatAppearanceProviderProps, n as ChatIconButtonProps, o as ChatIconOverrides, r as ChatAppearanceProvider, s as ChatIconProps, t as ChatIconButton } from "./appearance-BUtKwRL5.js";
|
|
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
|
-
import { C as
|
|
5
|
+
import { C as ToolPresentationResolver, S as ToolPresentation, _ as ChatSuggestedAction, b as TextRenderer, c as AiChatOptions, d as ChatComposerProps, f as ChatLabels, g as ChatScrollHandle, 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 PartRendererProps, w as ToolRenderers, x as ToolPart, y as PartRenderers } from "./labels-a_-_yLBi.js";
|
|
6
6
|
import { ActiveMarquee, ChatTargetHit, ChatTargetKind, ChatTargetRect, ChatTargetingController, ChatTargetingLabels, ChatTargetingOverlay, ChatTargetingOverlayProps, PendingChatTarget, UseChatTargetingOptions, enUSTargetingLabels, toChatContextItem, useChatTargeting, zhCNTargetingLabels } from "./targeting.js";
|
|
7
7
|
import { HTMLAttributes, ReactNode } from "react";
|
|
8
8
|
import { UIMessage } from "ai";
|
|
@@ -60,5 +60,5 @@ export declare function ChatHistoryMenu({ conversations, currentId, onSelect, on
|
|
|
60
60
|
/** Drafts and upload requests are isolated by conversation id. */
|
|
61
61
|
export declare function ChatComposer<M extends UIMessage = UIMessage>(props: ChatComposerProps<M>): import("react").JSX.Element;
|
|
62
62
|
//#endregion
|
|
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
|
+
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 ChatScrollHandle, 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 };
|
|
64
64
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { MarkdownResponse } from "./markdown.js";
|
|
|
8
8
|
import { ContextTray, createTextSelectionAdapter, useChatContext } from "./context.js";
|
|
9
9
|
import "./appearance.js";
|
|
10
10
|
import { ChatTargetingOverlay, enUSTargetingLabels, toChatContextItem, useChatTargeting, zhCNTargetingLabels } from "./targeting.js";
|
|
11
|
-
import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
11
|
+
import { useCallback, useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { isToolUIPart } from "ai";
|
|
14
14
|
//#region src/chat-composer.tsx
|
|
@@ -556,8 +556,8 @@ function useMessageScroll(messages) {
|
|
|
556
556
|
const frame = useRef(void 0);
|
|
557
557
|
const previousTime = useRef(void 0);
|
|
558
558
|
const lastTop = useRef(0);
|
|
559
|
-
const lastMaximum = useRef(0);
|
|
560
559
|
const writtenTop = useRef(void 0);
|
|
560
|
+
const endScrollbarGesture = useRef(void 0);
|
|
561
561
|
const touchY = useRef(void 0);
|
|
562
562
|
const previousMessages = useRef(messages.map(({ id }) => id));
|
|
563
563
|
const [awayFromBottom, setAwayFromBottom] = useState(false);
|
|
@@ -571,7 +571,6 @@ function useMessageScroll(messages) {
|
|
|
571
571
|
if (!element) return;
|
|
572
572
|
if (Math.abs(element.scrollTop - top) > .5) element.scrollTop = top;
|
|
573
573
|
writtenTop.current = lastTop.current = element.scrollTop;
|
|
574
|
-
lastMaximum.current = Math.max(0, element.scrollHeight - element.clientHeight);
|
|
575
574
|
}, []);
|
|
576
575
|
const schedule = useCallback(() => {
|
|
577
576
|
if (!following.current || frame.current !== void 0) return;
|
|
@@ -607,15 +606,39 @@ function useMessageScroll(messages) {
|
|
|
607
606
|
cancel();
|
|
608
607
|
setAwayFromBottom(true);
|
|
609
608
|
}, [cancel]);
|
|
609
|
+
const reveal = useCallback((target) => {
|
|
610
|
+
const element = scroller.current;
|
|
611
|
+
const node = "commonAncestorContainer" in target ? target.commonAncestorContainer : target;
|
|
612
|
+
if (!element || !content.current?.contains(node) || !element.offsetHeight) return false;
|
|
613
|
+
const viewport = element.getBoundingClientRect();
|
|
614
|
+
const bounds = target.getBoundingClientRect();
|
|
615
|
+
const scale = viewport.height / element.offsetHeight;
|
|
616
|
+
if (!scale || bounds.height <= 0) return false;
|
|
617
|
+
const viewportTop = viewport.top + element.clientTop * scale;
|
|
618
|
+
const viewportHeight = element.clientHeight * scale;
|
|
619
|
+
if (bounds.top >= viewportTop && bounds.bottom <= viewportTop + viewportHeight) return false;
|
|
620
|
+
const centerOffset = Math.max(0, (viewportHeight - bounds.height) / 2);
|
|
621
|
+
const previousTop = element.scrollTop;
|
|
622
|
+
const desiredTop = previousTop + (bounds.top - viewportTop - centerOffset) / scale;
|
|
623
|
+
const top = Math.max(0, Math.min(desiredTop, element.scrollHeight - element.clientHeight));
|
|
624
|
+
if (Math.abs(top - previousTop) <= .5) return false;
|
|
625
|
+
write(top);
|
|
626
|
+
if (element.scrollTop === previousTop) return false;
|
|
627
|
+
pause();
|
|
628
|
+
return true;
|
|
629
|
+
}, [pause, write]);
|
|
610
630
|
useClientLayoutEffect(() => {
|
|
611
631
|
scrollToLatest();
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
632
|
+
let observer;
|
|
633
|
+
if (scroller.current && content.current && typeof ResizeObserver !== "undefined") {
|
|
634
|
+
observer = new ResizeObserver(schedule);
|
|
635
|
+
observer.observe(content.current);
|
|
636
|
+
observer.observe(scroller.current);
|
|
637
|
+
}
|
|
616
638
|
return () => {
|
|
617
|
-
observer
|
|
639
|
+
observer?.disconnect();
|
|
618
640
|
cancel();
|
|
641
|
+
endScrollbarGesture.current?.();
|
|
619
642
|
};
|
|
620
643
|
}, [
|
|
621
644
|
scrollToLatest,
|
|
@@ -644,15 +667,9 @@ function useMessageScroll(messages) {
|
|
|
644
667
|
lastTop.current = top;
|
|
645
668
|
if (writtenTop.current !== void 0 && Math.abs(top - writtenTop.current) < 1) return;
|
|
646
669
|
writtenTop.current = void 0;
|
|
647
|
-
const maximum = Math.max(0, element.scrollHeight - element.clientHeight);
|
|
648
|
-
if (following.current && maximum < lastMaximum.current && top >= maximum - 1) {
|
|
649
|
-
lastMaximum.current = maximum;
|
|
650
|
-
schedule();
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
lastMaximum.current = maximum;
|
|
654
670
|
if (top < previous - 1) {
|
|
655
|
-
pause();
|
|
671
|
+
if (endScrollbarGesture.current) pause();
|
|
672
|
+
else schedule();
|
|
656
673
|
return;
|
|
657
674
|
}
|
|
658
675
|
if (top > previous && element.scrollHeight - top - element.clientHeight <= 4) {
|
|
@@ -661,6 +678,29 @@ function useMessageScroll(messages) {
|
|
|
661
678
|
schedule();
|
|
662
679
|
}
|
|
663
680
|
}
|
|
681
|
+
function onPointerDown(event) {
|
|
682
|
+
if (event.target !== event.currentTarget || event.button !== 0 || event.pointerType === "touch") return;
|
|
683
|
+
endScrollbarGesture.current?.();
|
|
684
|
+
const document = event.currentTarget.ownerDocument;
|
|
685
|
+
const view = document.defaultView;
|
|
686
|
+
const pointerId = event.pointerId;
|
|
687
|
+
let releaseFrame;
|
|
688
|
+
const cleanup = () => {
|
|
689
|
+
document.removeEventListener("pointerup", release, true);
|
|
690
|
+
document.removeEventListener("pointercancel", release, true);
|
|
691
|
+
view?.removeEventListener("blur", cleanup);
|
|
692
|
+
if (releaseFrame !== void 0) cancelAnimationFrame(releaseFrame);
|
|
693
|
+
endScrollbarGesture.current = void 0;
|
|
694
|
+
};
|
|
695
|
+
const release = (event) => {
|
|
696
|
+
if (event.pointerId !== pointerId || releaseFrame !== void 0) return;
|
|
697
|
+
releaseFrame = requestAnimationFrame(cleanup);
|
|
698
|
+
};
|
|
699
|
+
endScrollbarGesture.current = cleanup;
|
|
700
|
+
document.addEventListener("pointerup", release, true);
|
|
701
|
+
document.addEventListener("pointercancel", release, true);
|
|
702
|
+
view?.addEventListener("blur", cleanup);
|
|
703
|
+
}
|
|
664
704
|
function consumedByNestedScroll(event) {
|
|
665
705
|
let target = event.target instanceof Element ? event.target : null;
|
|
666
706
|
while (target && target !== event.currentTarget) {
|
|
@@ -694,8 +734,10 @@ function useMessageScroll(messages) {
|
|
|
694
734
|
content,
|
|
695
735
|
awayFromBottom,
|
|
696
736
|
scrollToLatest,
|
|
737
|
+
reveal,
|
|
697
738
|
scrollEvents: {
|
|
698
739
|
onScroll,
|
|
740
|
+
onPointerDown,
|
|
699
741
|
onWheel,
|
|
700
742
|
onTouchStart,
|
|
701
743
|
onTouchMove,
|
|
@@ -797,9 +839,10 @@ function StreamingText({ text, isStreaming, enabled = true, renderText }) {
|
|
|
797
839
|
function ChatMessages(props) {
|
|
798
840
|
return /* @__PURE__ */ jsx(Messages, { ...props }, props.chat.id);
|
|
799
841
|
}
|
|
800
|
-
function Messages({ chat, labels: labelOverrides, renderText, smoothStreaming = true, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderMessageHeader, empty, className, requestOptions, onActionError, capabilities }) {
|
|
842
|
+
function Messages({ chat, labels: labelOverrides, renderText, smoothStreaming = true, scrollRef, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderMessageHeader, empty, className, requestOptions, onActionError, capabilities }) {
|
|
801
843
|
const labels = resolveLabels(labelOverrides);
|
|
802
|
-
const { scroller, content, awayFromBottom, scrollToLatest, scrollEvents } = useMessageScroll(chat.messages);
|
|
844
|
+
const { scroller, content, awayFromBottom, scrollToLatest, reveal, scrollEvents } = useMessageScroll(chat.messages);
|
|
845
|
+
useImperativeHandle(scrollRef, () => ({ reveal }), [reveal]);
|
|
803
846
|
const copyTimeout = useRef(void 0);
|
|
804
847
|
const actionInFlight = useRef(false);
|
|
805
848
|
const [copiedId, setCopiedId] = useState();
|
|
@@ -1135,7 +1178,7 @@ function Messages({ chat, labels: labelOverrides, renderText, smoothStreaming =
|
|
|
1135
1178
|
function ChatPanel(props) {
|
|
1136
1179
|
return /* @__PURE__ */ jsx(Panel, { ...props }, props.chat.id);
|
|
1137
1180
|
}
|
|
1138
|
-
function Panel({ 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 }) {
|
|
1181
|
+
function Panel({ chat, labels: labelOverrides, title, subtitle, headerIcon, header, headerActions, footer, composer, composerProps, theme = "auto", variant = "panel", density = "comfortable", capabilities, className, renderText, smoothStreaming, scrollRef, renderers, tools, toolPresentation, suggestedActions, suggestionsTitle, suggestionsDescription, renderMessageActions, renderMessageHeader, empty, requestOptions, onActionError, ...elementProps }) {
|
|
1139
1182
|
const labels = resolveLabels(labelOverrides);
|
|
1140
1183
|
const [retrying, setRetrying] = useState(false);
|
|
1141
1184
|
const [retryError, setRetryError] = useState();
|
|
@@ -1198,6 +1241,7 @@ function Panel({ chat, labels: labelOverrides, title, subtitle, headerIcon, head
|
|
|
1198
1241
|
labels: labelOverrides,
|
|
1199
1242
|
renderText,
|
|
1200
1243
|
smoothStreaming,
|
|
1244
|
+
scrollRef,
|
|
1201
1245
|
renderers,
|
|
1202
1246
|
tools,
|
|
1203
1247
|
toolPresentation,
|
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 === '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,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,CAAC;CACzD,MAAM,WAAW,OAAO,CAAC;CACzB,MAAM,UAAU,OAAO,KAAK;CAC5B,MAAM,QAAQ,OAAO,IAAI;CACzB,MAAM,UAAU;CAChB,MAAM,YAAY,OAAyB,IAAI;CAC/C,MAAM,WAAW,OAA4B,IAAI;CACjD,MAAM,UAAU,MAAM;CACtB,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,KAAK;CAC1D,MAAM,cAAc;EAAE,GAAG;EAA0B,GAAG,QAAQ;CAAO;CACrE,MAAM,QAAQ,eAAe;EAC3B,SAAS,QAAQ;EAAS,MAAM,QAAQ;EACxC,aAAY,eAAc;GAExB,SAAQ,YAAW;IACjB,MAAM,OAAO,UAAU,GAAG,UAAU,MAAM,KAAK,OAAO,IAAI,KAAK,OAAO,eAAe;IACrF,MAAM,UAAU;IAChB,OAAO;GACT,CAAC;EACH;EACA,UAAS,YAAW,gBAAgB,OAAO;CAC7C,CAAC;CACD,gBAAgB;EAAE,IAAI,YAAY,KAAK,QAAQ,MAAM,OA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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, PointerEvent as ReactPointerEvent, 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 writtenTop = useRef<number | undefined>(undefined);\n const endScrollbarGesture = useRef<(() => void) | 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 }, []);\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 const reveal = useCallback((target: Element | Range) => {\n const element = scroller.current;\n const node = 'commonAncestorContainer' in target ? target.commonAncestorContainer : target;\n if (!element || !content.current?.contains(node) || !element.offsetHeight) return false;\n\n const viewport = element.getBoundingClientRect();\n const bounds = target.getBoundingClientRect();\n const scale = viewport.height / element.offsetHeight;\n if (!scale || bounds.height <= 0) return false;\n const viewportTop = viewport.top + element.clientTop * scale;\n const viewportHeight = element.clientHeight * scale;\n if (bounds.top >= viewportTop && bounds.bottom <= viewportTop + viewportHeight) return false;\n\n const centerOffset = Math.max(0, (viewportHeight - bounds.height) / 2);\n const previousTop = element.scrollTop;\n const desiredTop = previousTop + (bounds.top - viewportTop - centerOffset) / scale;\n const top = Math.max(0, Math.min(desiredTop, element.scrollHeight - element.clientHeight));\n if (Math.abs(top - previousTop) <= .5) return false;\n write(top);\n if (element.scrollTop === previousTop) return false;\n pause();\n return true;\n }, [pause, write]);\n\n useClientLayoutEffect(() => {\n scrollToLatest();\n let observer: ResizeObserver | undefined;\n if (scroller.current && content.current && typeof ResizeObserver !== 'undefined') {\n observer = new ResizeObserver(schedule);\n observer.observe(content.current);\n observer.observe(scroller.current);\n }\n return () => {\n observer?.disconnect();\n cancel();\n endScrollbarGesture.current?.();\n };\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 if (top < previous - 1) {\n // A layout can clamp scrollTop and then restore the old range before this event.\n // Wheel, touch and keyboard handlers already capture deliberate upward gestures.\n if (endScrollbarGesture.current) pause();\n else schedule();\n return;\n }\n if (top > previous && element.scrollHeight - top - element.clientHeight <= 4) {\n following.current = true;\n setAwayFromBottom(false);\n schedule();\n }\n }\n\n function onPointerDown(event: ReactPointerEvent<HTMLDivElement>) {\n if (event.target !== event.currentTarget || event.button !== 0 || event.pointerType === 'touch') return;\n endScrollbarGesture.current?.();\n const document = event.currentTarget.ownerDocument;\n const view = document.defaultView;\n const pointerId = event.pointerId;\n let releaseFrame: number | undefined;\n const cleanup = () => {\n document.removeEventListener('pointerup', release, true);\n document.removeEventListener('pointercancel', release, true);\n view?.removeEventListener('blur', cleanup);\n if (releaseFrame !== undefined) cancelAnimationFrame(releaseFrame);\n endScrollbarGesture.current = undefined;\n };\n const release = (event: PointerEvent) => {\n if (event.pointerId !== pointerId || releaseFrame !== undefined) return;\n // A native scrollbar click can deliver its scroll event after pointerup.\n releaseFrame = requestAnimationFrame(cleanup);\n };\n endScrollbarGesture.current = cleanup;\n document.addEventListener('pointerup', release, true);\n document.addEventListener('pointercancel', release, true);\n view?.addEventListener('blur', cleanup);\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, reveal, scrollEvents: { onScroll, onPointerDown, 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, useImperativeHandle, 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, scrollRef, 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, reveal, scrollEvents } = useMessageScroll(chat.messages);\n useImperativeHandle(scrollRef, () => ({ reveal }), [reveal]);\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, scrollRef, 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} scrollRef={scrollRef} 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,CAAC;CACzD,MAAM,WAAW,OAAO,CAAC;CACzB,MAAM,UAAU,OAAO,KAAK;CAC5B,MAAM,QAAQ,OAAO,IAAI;CACzB,MAAM,UAAU;CAChB,MAAM,YAAY,OAAyB,IAAI;CAC/C,MAAM,WAAW,OAA4B,IA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MAAK,OAAQ,CAAA;MACnB,oBAAC,QAAD,EAAA,UAAO,aAAa,SAAS,OAAO,QAAc,CAAA;MACjD,aAAa,OAAO,aAAa,oBAAC,MAAD;OAAM,WAAU;OAA2B,MAAK;MAAS,CAAA;KACrF;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,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { SpeechInputOptions } from "./voice.js";
|
|
3
3
|
import { UseChatHelpers, UseChatOptions } from "@ai-sdk/react";
|
|
4
|
-
import { HTMLAttributes, ReactNode } from "react";
|
|
4
|
+
import { HTMLAttributes, ReactNode, Ref } from "react";
|
|
5
5
|
import { ChatRequestOptions, FileUIPart, UIMessage } from "ai";
|
|
6
6
|
//#region src/types.d.ts
|
|
7
7
|
type AiChatController<M extends UIMessage = UIMessage> = UseChatHelpers<M> & {
|
|
@@ -121,6 +121,10 @@ interface ChatComposerProps<M extends UIMessage = UIMessage> {
|
|
|
121
121
|
className?: string;
|
|
122
122
|
onActionError?: (error: Error) => void;
|
|
123
123
|
}
|
|
124
|
+
interface ChatScrollHandle {
|
|
125
|
+
/** Reveal a transcript target, pausing follow only when the message viewport moves. */
|
|
126
|
+
reveal(target: Element | Range): boolean;
|
|
127
|
+
}
|
|
124
128
|
interface ChatMessagesProps<M extends UIMessage = UIMessage> {
|
|
125
129
|
chat: AiChatController<M>;
|
|
126
130
|
labels?: Partial<ChatLabels>;
|
|
@@ -130,6 +134,8 @@ interface ChatMessagesProps<M extends UIMessage = UIMessage> {
|
|
|
130
134
|
* Does not change messages or tool events. Stop/completion and reduced motion flush immediately.
|
|
131
135
|
* Custom part renderers retain control of their own presentation. */
|
|
132
136
|
smoothStreaming?: boolean;
|
|
137
|
+
/** Optional access to programmatic navigation inside the message viewport. */
|
|
138
|
+
scrollRef?: Ref<ChatScrollHandle>;
|
|
133
139
|
renderers?: PartRenderers<M>;
|
|
134
140
|
tools?: ToolRenderers<M>;
|
|
135
141
|
toolPresentation?: ToolPresentationResolver<M>;
|
|
@@ -185,5 +191,5 @@ declare function acceptsFile(file: Pick<File, 'name' | 'type'>, accept?: string)
|
|
|
185
191
|
declare const zhCN: Required<ChatLabels>;
|
|
186
192
|
declare const enUS: Required<ChatLabels>;
|
|
187
193
|
//#endregion
|
|
188
|
-
export {
|
|
189
|
-
//# sourceMappingURL=labels-
|
|
194
|
+
export { ToolPresentationResolver as C, ToolPresentation as S, ChatSuggestedAction as _, safeUrl as a, TextRenderer as b, AiChatOptions as c, ChatComposerProps as d, ChatLabels as f, ChatScrollHandle as g, ChatPanelProps as h, getMessageText as i, AiChatProps as l, ChatMessagesProps as m, zhCN as n, useAiChat as o, ChatMessageActionContext as p, acceptsFile as r, AiChatController as s, enUS as t, AttachmentOptions as u, PartRendererProps as v, ToolRenderers as w, ToolPart as x, PartRenderers as y };
|
|
195
|
+
//# sourceMappingURL=labels-a_-_yLBi.d.ts.map
|
package/docs/api-reference.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 组件与 API
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
以下接口对应当前源码。类型声明随 npm 包发布,组件保留 SDK 的 `UIMessage` 泛型。
|
|
4
4
|
|
|
5
5
|
## 模块入口
|
|
6
6
|
|
|
@@ -47,6 +47,7 @@ options 沿用 `@ai-sdk/react` 的 `UseChatOptions<M>`。返回 SDK `UseChatHelp
|
|
|
47
47
|
| `composerProps` | Composer props 子集 | 上下文、toolbar、attachments、speech、disabled |
|
|
48
48
|
| `renderText` | `({text,isStreaming}) => ReactNode` | 覆盖默认助手 Markdown / 用户纯文本渲染 |
|
|
49
49
|
| `smoothStreaming` | `boolean`,默认 `true` | 活跃文本的短窗口平滑显示;停止立即展示全文,自定义 part renderer 自行控制。见 [流式体验](streaming.md) |
|
|
50
|
+
| `scrollRef` | `Ref<ChatScrollHandle>` | 定位消息区中的元素或文字范围。见 [定位消息内容](streaming.md#定位消息内容) |
|
|
50
51
|
| `renderers` | 按 part.type 映射 | 最高优先级的自定义消息片段 |
|
|
51
52
|
| `tools` | 按 toolName 映射 | 自定义业务工具结果卡片 |
|
|
52
53
|
| `toolPresentation` | `ToolPresentationResolver<M>` | 只定制默认工具动作行的标题、图标和摘要 |
|
package/docs/publishing.md
CHANGED
|
@@ -36,7 +36,7 @@ mkdir -p artifacts
|
|
|
36
36
|
npm pack --pack-destination artifacts
|
|
37
37
|
|
|
38
38
|
# 消费项目:替换为真实文件的绝对路径
|
|
39
|
-
npm install /absolute/path/to/galaxycore-ai-chat-0.
|
|
39
|
+
npm install /absolute/path/to/galaxycore-ai-chat-0.7.0.tgz
|
|
40
40
|
npm install ai@^7.0.137 @ai-sdk/react@^4.0.140
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -53,12 +53,12 @@ npm run check
|
|
|
53
53
|
npm pack --dry-run
|
|
54
54
|
mkdir -p artifacts
|
|
55
55
|
npm pack --pack-destination artifacts
|
|
56
|
-
tar -tzf artifacts/galaxycore-ai-chat-0.
|
|
56
|
+
tar -tzf artifacts/galaxycore-ai-chat-0.7.0.tgz
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
`check` 执行类型检查、组件与网关测试、库构建和可部署示例构建;示例构建包含文档站。`prepack` 构建库,`prepublishOnly` 执行完整检查。tarball 应包含公开 JS 入口、声明、CSS、README 和文档,不应包含模型凭据、认证配置或业务数据。
|
|
60
60
|
|
|
61
|
-
检查根入口及 `headless`、`markdown`、`ag-ui`、`context`、`gateway`、`appearance`、`voice`、`styles.css` 子入口。React 与 AI SDK 应保持 peer dependency,Markdown 默认启用并保留独立入口。
|
|
61
|
+
检查根入口及 `headless`、`markdown`、`ag-ui`、`context`、`gateway`、`appearance`、`voice`、`targeting`、`styles.css` 子入口。React 与 AI SDK 应保持 peer dependency,Markdown 默认启用并保留独立入口。
|
|
62
62
|
|
|
63
63
|
在独立 Vite React 消费项目中安装 tarball,验证类型、样式、流式消息与停止;需要 Next.js 时另外验证客户端边界及 SSR 构建。不要只依赖仓库开发 alias 的演示结果。每次发布记录实际使用的 Node、React 和 AI SDK 版本,以及通过的消费测试,见 [验证记录](validation.md)。
|
|
64
64
|
|
|
@@ -85,12 +85,12 @@ CI 构建和测试步骤无需发布凭据。发布 job 可使用 CI secret 注
|
|
|
85
85
|
|
|
86
86
|
## 版本与发布
|
|
87
87
|
|
|
88
|
-
当前组件版本为 `0.
|
|
88
|
+
当前组件版本为 `0.7.0`,网关版本为 `0.2.0`,两者独立升级。0.x 阶段,修复使用 patch,新增功能和未冻结接口调整使用 minor,并在 changelog 说明兼容性。稳定 API 后再发布 1.0。
|
|
89
89
|
|
|
90
90
|
下面以 npmjs.org 公开发布为例。命令会实际上传产物,应在完成验收后由发布负责人执行;发布私有 registry 时替换地址,并按该服务调整可见性参数:
|
|
91
91
|
|
|
92
92
|
```sh
|
|
93
|
-
npm publish ./artifacts/galaxycore-ai-chat-0.
|
|
93
|
+
npm publish ./artifacts/galaxycore-ai-chat-0.7.0.tgz \
|
|
94
94
|
--access public --tag latest \
|
|
95
95
|
--registry=https://registry.npmjs.org/
|
|
96
96
|
```
|
|
@@ -98,7 +98,7 @@ npm publish ./artifacts/galaxycore-ai-chat-0.6.0.tgz \
|
|
|
98
98
|
使用 tarball 发布时,先显式执行完整检查,不依赖源仓库的生命周期脚本一定被触发。`latest` 是不指定版本安装时使用的标签,不代表 API 已冻结。需要独立试用通道时,可以采用预发布版本及 `next` 标签。发布后检查远端版本和完整性:
|
|
99
99
|
|
|
100
100
|
```sh
|
|
101
|
-
npm view @galaxycore/ai-chat@0.
|
|
101
|
+
npm view @galaxycore/ai-chat@0.7.0 version dist.integrity \
|
|
102
102
|
--registry=https://registry.npmjs.org/
|
|
103
103
|
npm dist-tag ls @galaxycore/ai-chat \
|
|
104
104
|
--registry=https://registry.npmjs.org/
|
package/docs/streaming.md
CHANGED
|
@@ -25,7 +25,7 @@ const chat = useAiChat({ transport });
|
|
|
25
25
|
## 滚动与阅读
|
|
26
26
|
|
|
27
27
|
- 在底部阅读时,新内容继续进入可见区域。
|
|
28
|
-
-
|
|
28
|
+
- 滚轮、触摸、键盘或滚动条主动向上查看历史时,暂停自动跟随。Markdown 重排和消息区尺寸变化期间继续跟随。
|
|
29
29
|
- 主动发送新消息时,回到底部并恢复跟随;流式回答过程中仍可再次上滑阅读。
|
|
30
30
|
- 内容不足一屏时,向上滑动不会误暂停后续内容的跟随。
|
|
31
31
|
- 点击“回到底部”恢复跟随。
|
|
@@ -36,6 +36,32 @@ const chat = useAiChat({ transport });
|
|
|
36
36
|
|
|
37
37
|
操作系统的“减少动态效果”偏好优先于视觉平滑效果。平滑展示不是网络缓冲,也不会让模型更快响应;较长的服务端停顿仍然需要等待实际数据。
|
|
38
38
|
|
|
39
|
+
### 定位消息内容
|
|
40
|
+
|
|
41
|
+
`ChatPanel`、`ChatMessages` 和 `AiChat` 都可以接收 `scrollRef`。宿主可以传入消息区内的元素或文字 `Range`,用于定位搜索命中、引用或正在朗读的句子。
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { useRef } from 'react';
|
|
45
|
+
import { ChatPanel, type AiChatController, type ChatScrollHandle } from '@galaxycore/ai-chat';
|
|
46
|
+
|
|
47
|
+
function Conversation({ chat, match }: { chat: AiChatController; match: Element | Range | null }) {
|
|
48
|
+
const scrollRef = useRef<ChatScrollHandle>(null);
|
|
49
|
+
return (
|
|
50
|
+
<ChatPanel
|
|
51
|
+
chat={chat}
|
|
52
|
+
scrollRef={scrollRef}
|
|
53
|
+
headerActions={
|
|
54
|
+
<button type="button" disabled={!match} onClick={() => match && scrollRef.current?.reveal(match)}>
|
|
55
|
+
显示匹配内容
|
|
56
|
+
</button>
|
|
57
|
+
}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`reveal` 只滚动当前面板的消息区。目标已完整可见、已卸载或属于其他面板时返回 `false`。如果滚动位置发生变化,返回 `true` 并暂停跟随。普通目标尽量居中,超过视口高度的目标从顶部显示。发送新消息、滚动到底部或使用“回到最新”可以恢复跟随。调用方负责决定何时定位,以及如何高亮文字和读取历史。
|
|
64
|
+
|
|
39
65
|
## Markdown 与工具
|
|
40
66
|
|
|
41
67
|
通过 `renderText={MarkdownResponse}` 使用流式 Markdown。文字、工具活动和工具后的回答保持消息中的顺序。模型凭据、工具执行、服务端停止与会话恢复仍然由网关负责,具体见 [网关接入](./gateway.md)。
|
package/docs/validation.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# 0.4.0 发布验收 · 2026-10-13
|
|
2
2
|
|
|
3
|
+
## 0.7.0 — 消息滚动与定位 (2026-11-23)
|
|
4
|
+
|
|
5
|
+
- 流式回复在布局重排时继续跟随最新消息,用户主动向上滚动时暂停跟随。宿主可通过 `scrollRef` 定位消息区中的元素或文字范围。
|
|
6
|
+
- `npm run check` 在 Node 24.22.1 下通过。组件 204 项、网关 11 项、示例服务 9 项测试通过,类型、组件库、工作台、文档站和服务构建均通过。
|
|
7
|
+
- 发布包在独立的 React 19 / AI SDK 7 Vite 项目中验收。Chromium 验证了原生滚动条拖动和文字范围定位。公开版本、标签和完整性见 `artifacts/npm-publication-0.7.json`。
|
|
8
|
+
|
|
9
|
+
## 0.6.0 — 页面指向 (2026-11-23)
|
|
10
|
+
|
|
11
|
+
- 新增可选页面指向:划选文字、双击段落、拖选图片区域可以变成聊天上下文引用。公开入口是 `useChatTargeting`、`ChatTargetingOverlay`、`toChatContextItem` 和 `/targeting`。不挂载时,原有发送和界面保持不变。
|
|
12
|
+
- Node 24.22.1 下 `npm run check` 通过:组件 200 项、网关 11 项、示例服务 9 项;类型检查、组件库、文档站、工作台和示例服务构建通过。
|
|
13
|
+
- `0.6.0` tarball 含 61 个文件,没有环境文件或凭据。本地包与 registry 完整性一致。
|
|
14
|
+
- 已公开发布到 npmjs.org,`latest` 为 `0.6.0`。记录见 `artifacts/npm-publication-0.6.json`。网关仍是 `0.2.0`,本轮没有重发。
|
|
15
|
+
|
|
3
16
|
## 0.5.0 — Default Markdown (2026-10-20)
|
|
4
17
|
|
|
5
18
|
- Assistant text uses the existing safe Streamdown renderer by default; user input remains literal and host renderers retain precedence. Streamdown is installed as a runtime dependency.
|