@aigentyc/chat-sdk 0.5.1 → 0.5.3

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.
@@ -1,6 +1,28 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Q as QuestionConfig } from './types-DRa1zFlN.cjs';
3
3
 
4
+ /**
5
+ * How wide the desktop chat panel is, and where the panels beside it go.
6
+ *
7
+ * The panel used to be a fixed `max-w-[780px]`, and the preview and live-chat
8
+ * panels that open next to it hardcoded the same number as `790px` / `800px`.
9
+ * A host that needed a wider or narrower chat had no way to ask for one, and
10
+ * changing the first number alone would have left the other two overlapping it
11
+ * or floating off in space. Everything that depends on the width now reads it
12
+ * from here.
13
+ */
14
+ /** Maximum width of the desktop chat panel when the host does not choose one. */
15
+ declare const DEFAULT_PANEL_WIDTH = 780;
16
+ /**
17
+ * Maximum width of the desktop chat panel.
18
+ *
19
+ * - a number is pixels (`960`)
20
+ * - a string is any CSS length (`"960px"`, `"60vw"`, `"min(960px, 60vw)"`)
21
+ *
22
+ * The panel is still never wider than the viewport.
23
+ */
24
+ type PanelWidth = number | string;
25
+
4
26
  interface ChatInterfaceProps {
5
27
  /** Allow per-instance overrides of any context value */
6
28
  isOpen?: boolean;
@@ -36,6 +58,14 @@ interface ChatInterfaceProps {
36
58
  * - `"stream-order"` — parts render in the order received from the API
37
59
  */
38
60
  messagePartOrder?: "text-first" | "tools-first" | "stream-order";
61
+ /**
62
+ * Where the view settles while an answer streams in.
63
+ * - `"latest-turn"` (default) — follows the answer down only until the
64
+ * visitor's question reaches the top, then holds there, so a long reply is
65
+ * read from its first line
66
+ * - `"bottom"` — always follows the end of the content
67
+ */
68
+ scrollAnchor?: "latest-turn" | "bottom";
39
69
  }
40
70
  interface AssistantMessageSlotProps {
41
71
  message: {
@@ -61,4 +91,4 @@ interface UserMessageSlotProps {
61
91
  }
62
92
  declare function ChatInterface(props: ChatInterfaceProps): react_jsx_runtime.JSX.Element;
63
93
 
64
- export { type AssistantMessageSlotProps as A, type ChatInterfaceProps as C, type UserMessageSlotProps as U, ChatInterface as a };
94
+ export { type AssistantMessageSlotProps as A, type ChatInterfaceProps as C, DEFAULT_PANEL_WIDTH as D, type PanelWidth as P, type UserMessageSlotProps as U, ChatInterface as a };
@@ -1,6 +1,28 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { Q as QuestionConfig } from './types-DRa1zFlN.js';
3
3
 
4
+ /**
5
+ * How wide the desktop chat panel is, and where the panels beside it go.
6
+ *
7
+ * The panel used to be a fixed `max-w-[780px]`, and the preview and live-chat
8
+ * panels that open next to it hardcoded the same number as `790px` / `800px`.
9
+ * A host that needed a wider or narrower chat had no way to ask for one, and
10
+ * changing the first number alone would have left the other two overlapping it
11
+ * or floating off in space. Everything that depends on the width now reads it
12
+ * from here.
13
+ */
14
+ /** Maximum width of the desktop chat panel when the host does not choose one. */
15
+ declare const DEFAULT_PANEL_WIDTH = 780;
16
+ /**
17
+ * Maximum width of the desktop chat panel.
18
+ *
19
+ * - a number is pixels (`960`)
20
+ * - a string is any CSS length (`"960px"`, `"60vw"`, `"min(960px, 60vw)"`)
21
+ *
22
+ * The panel is still never wider than the viewport.
23
+ */
24
+ type PanelWidth = number | string;
25
+
4
26
  interface ChatInterfaceProps {
5
27
  /** Allow per-instance overrides of any context value */
6
28
  isOpen?: boolean;
@@ -36,6 +58,14 @@ interface ChatInterfaceProps {
36
58
  * - `"stream-order"` — parts render in the order received from the API
37
59
  */
38
60
  messagePartOrder?: "text-first" | "tools-first" | "stream-order";
61
+ /**
62
+ * Where the view settles while an answer streams in.
63
+ * - `"latest-turn"` (default) — follows the answer down only until the
64
+ * visitor's question reaches the top, then holds there, so a long reply is
65
+ * read from its first line
66
+ * - `"bottom"` — always follows the end of the content
67
+ */
68
+ scrollAnchor?: "latest-turn" | "bottom";
39
69
  }
40
70
  interface AssistantMessageSlotProps {
41
71
  message: {
@@ -61,4 +91,4 @@ interface UserMessageSlotProps {
61
91
  }
62
92
  declare function ChatInterface(props: ChatInterfaceProps): react_jsx_runtime.JSX.Element;
63
93
 
64
- export { type AssistantMessageSlotProps as A, type ChatInterfaceProps as C, type UserMessageSlotProps as U, ChatInterface as a };
94
+ export { type AssistantMessageSlotProps as A, type ChatInterfaceProps as C, DEFAULT_PANEL_WIDTH as D, type PanelWidth as P, type UserMessageSlotProps as U, ChatInterface as a };
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkDDATCJ3O_cjs = require('./chunk-DDATCJ3O.cjs');
5
- var chunk6CVBJ4EI_cjs = require('./chunk-6CVBJ4EI.cjs');
5
+ var chunkB277MAUK_cjs = require('./chunk-B277MAUK.cjs');
6
6
  require('./chunk-X7R334SB.cjs');
7
7
  require('./chunk-72QJ2ORD.cjs');
8
8
  var chunkJOO6C3XT_cjs = require('./chunk-JOO6C3XT.cjs');
@@ -3600,103 +3600,115 @@ var Image = ({
3600
3600
 
3601
3601
  Object.defineProperty(exports, "Conversation", {
3602
3602
  enumerable: true,
3603
- get: function () { return chunk6CVBJ4EI_cjs.Conversation; }
3603
+ get: function () { return chunkB277MAUK_cjs.Conversation; }
3604
3604
  });
3605
3605
  Object.defineProperty(exports, "ConversationContent", {
3606
3606
  enumerable: true,
3607
- get: function () { return chunk6CVBJ4EI_cjs.ConversationContent; }
3607
+ get: function () { return chunkB277MAUK_cjs.ConversationContent; }
3608
3608
  });
3609
3609
  Object.defineProperty(exports, "ConversationEmptyState", {
3610
3610
  enumerable: true,
3611
- get: function () { return chunk6CVBJ4EI_cjs.ConversationEmptyState; }
3611
+ get: function () { return chunkB277MAUK_cjs.ConversationEmptyState; }
3612
3612
  });
3613
3613
  Object.defineProperty(exports, "ConversationScrollButton", {
3614
3614
  enumerable: true,
3615
- get: function () { return chunk6CVBJ4EI_cjs.ConversationScrollButton; }
3615
+ get: function () { return chunkB277MAUK_cjs.ConversationScrollButton; }
3616
+ });
3617
+ Object.defineProperty(exports, "FollowLatestTurn", {
3618
+ enumerable: true,
3619
+ get: function () { return chunkB277MAUK_cjs.FollowLatestTurn; }
3620
+ });
3621
+ Object.defineProperty(exports, "LATEST_TURN_ATTR", {
3622
+ enumerable: true,
3623
+ get: function () { return chunkB277MAUK_cjs.LATEST_TURN_ATTR; }
3616
3624
  });
3617
3625
  Object.defineProperty(exports, "Loader", {
3618
3626
  enumerable: true,
3619
- get: function () { return chunk6CVBJ4EI_cjs.Loader; }
3627
+ get: function () { return chunkB277MAUK_cjs.Loader; }
3620
3628
  });
3621
3629
  Object.defineProperty(exports, "Message", {
3622
3630
  enumerable: true,
3623
- get: function () { return chunk6CVBJ4EI_cjs.Message; }
3631
+ get: function () { return chunkB277MAUK_cjs.Message; }
3624
3632
  });
3625
3633
  Object.defineProperty(exports, "MessageAction", {
3626
3634
  enumerable: true,
3627
- get: function () { return chunk6CVBJ4EI_cjs.MessageAction; }
3635
+ get: function () { return chunkB277MAUK_cjs.MessageAction; }
3628
3636
  });
3629
3637
  Object.defineProperty(exports, "MessageActions", {
3630
3638
  enumerable: true,
3631
- get: function () { return chunk6CVBJ4EI_cjs.MessageActions; }
3639
+ get: function () { return chunkB277MAUK_cjs.MessageActions; }
3632
3640
  });
3633
3641
  Object.defineProperty(exports, "MessageAttachment", {
3634
3642
  enumerable: true,
3635
- get: function () { return chunk6CVBJ4EI_cjs.MessageAttachment; }
3643
+ get: function () { return chunkB277MAUK_cjs.MessageAttachment; }
3636
3644
  });
3637
3645
  Object.defineProperty(exports, "MessageAttachments", {
3638
3646
  enumerable: true,
3639
- get: function () { return chunk6CVBJ4EI_cjs.MessageAttachments; }
3647
+ get: function () { return chunkB277MAUK_cjs.MessageAttachments; }
3640
3648
  });
3641
3649
  Object.defineProperty(exports, "MessageBranch", {
3642
3650
  enumerable: true,
3643
- get: function () { return chunk6CVBJ4EI_cjs.MessageBranch; }
3651
+ get: function () { return chunkB277MAUK_cjs.MessageBranch; }
3644
3652
  });
3645
3653
  Object.defineProperty(exports, "MessageBranchContent", {
3646
3654
  enumerable: true,
3647
- get: function () { return chunk6CVBJ4EI_cjs.MessageBranchContent; }
3655
+ get: function () { return chunkB277MAUK_cjs.MessageBranchContent; }
3648
3656
  });
3649
3657
  Object.defineProperty(exports, "MessageBranchNext", {
3650
3658
  enumerable: true,
3651
- get: function () { return chunk6CVBJ4EI_cjs.MessageBranchNext; }
3659
+ get: function () { return chunkB277MAUK_cjs.MessageBranchNext; }
3652
3660
  });
3653
3661
  Object.defineProperty(exports, "MessageBranchPage", {
3654
3662
  enumerable: true,
3655
- get: function () { return chunk6CVBJ4EI_cjs.MessageBranchPage; }
3663
+ get: function () { return chunkB277MAUK_cjs.MessageBranchPage; }
3656
3664
  });
3657
3665
  Object.defineProperty(exports, "MessageBranchPrevious", {
3658
3666
  enumerable: true,
3659
- get: function () { return chunk6CVBJ4EI_cjs.MessageBranchPrevious; }
3667
+ get: function () { return chunkB277MAUK_cjs.MessageBranchPrevious; }
3660
3668
  });
3661
3669
  Object.defineProperty(exports, "MessageBranchSelector", {
3662
3670
  enumerable: true,
3663
- get: function () { return chunk6CVBJ4EI_cjs.MessageBranchSelector; }
3671
+ get: function () { return chunkB277MAUK_cjs.MessageBranchSelector; }
3664
3672
  });
3665
3673
  Object.defineProperty(exports, "MessageContent", {
3666
3674
  enumerable: true,
3667
- get: function () { return chunk6CVBJ4EI_cjs.MessageContent; }
3675
+ get: function () { return chunkB277MAUK_cjs.MessageContent; }
3668
3676
  });
3669
3677
  Object.defineProperty(exports, "MessageFeedback", {
3670
3678
  enumerable: true,
3671
- get: function () { return chunk6CVBJ4EI_cjs.MessageFeedback; }
3679
+ get: function () { return chunkB277MAUK_cjs.MessageFeedback; }
3672
3680
  });
3673
3681
  Object.defineProperty(exports, "MessageResponse", {
3674
3682
  enumerable: true,
3675
- get: function () { return chunk6CVBJ4EI_cjs.MessageResponse; }
3683
+ get: function () { return chunkB277MAUK_cjs.MessageResponse; }
3676
3684
  });
3677
3685
  Object.defineProperty(exports, "MessageToolbar", {
3678
3686
  enumerable: true,
3679
- get: function () { return chunk6CVBJ4EI_cjs.MessageToolbar; }
3687
+ get: function () { return chunkB277MAUK_cjs.MessageToolbar; }
3680
3688
  });
3681
3689
  Object.defineProperty(exports, "Source", {
3682
3690
  enumerable: true,
3683
- get: function () { return chunk6CVBJ4EI_cjs.Source; }
3691
+ get: function () { return chunkB277MAUK_cjs.Source; }
3684
3692
  });
3685
3693
  Object.defineProperty(exports, "Sources", {
3686
3694
  enumerable: true,
3687
- get: function () { return chunk6CVBJ4EI_cjs.Sources; }
3695
+ get: function () { return chunkB277MAUK_cjs.Sources; }
3688
3696
  });
3689
3697
  Object.defineProperty(exports, "SourcesContent", {
3690
3698
  enumerable: true,
3691
- get: function () { return chunk6CVBJ4EI_cjs.SourcesContent; }
3699
+ get: function () { return chunkB277MAUK_cjs.SourcesContent; }
3692
3700
  });
3693
3701
  Object.defineProperty(exports, "SourcesTrigger", {
3694
3702
  enumerable: true,
3695
- get: function () { return chunk6CVBJ4EI_cjs.SourcesTrigger; }
3703
+ get: function () { return chunkB277MAUK_cjs.SourcesTrigger; }
3696
3704
  });
3697
3705
  Object.defineProperty(exports, "SpinnerLoader", {
3698
3706
  enumerable: true,
3699
- get: function () { return chunk6CVBJ4EI_cjs.SpinnerLoader; }
3707
+ get: function () { return chunkB277MAUK_cjs.SpinnerLoader; }
3708
+ });
3709
+ Object.defineProperty(exports, "anchorToLatestTurn", {
3710
+ enumerable: true,
3711
+ get: function () { return chunkB277MAUK_cjs.anchorToLatestTurn; }
3700
3712
  });
3701
3713
  exports.AIImage = Image;
3702
3714
  exports.Artifact = Artifact;
@@ -67,7 +67,69 @@ type MessageToolbarProps = ComponentProps<"div">;
67
67
  declare const MessageToolbar: ({ className, children, ...props }: MessageToolbarProps) => react_jsx_runtime.JSX.Element;
68
68
 
69
69
  type ConversationProps = ComponentProps<typeof StickToBottom>;
70
+ /**
71
+ * Marks the turn the visitor sent last. {@link anchorToLatestTurn} stops the
72
+ * view there instead of at the bottom of whatever came back.
73
+ */
74
+ declare const LATEST_TURN_ATTR = "data-ac-latest-turn";
75
+ type TargetScrollTop = NonNullable<ConversationProps["targetScrollTop"]>;
76
+ /**
77
+ * Where "the bottom" is for a conversation: never further down than the point
78
+ * where the latest question reaches the top of the view.
79
+ *
80
+ * ## Why not simply stick to the bottom
81
+ *
82
+ * `StickToBottom` follows the end of the content, which is right while an
83
+ * answer is shorter than the view and wrong the moment it is taller. A reply
84
+ * that carries a product grid can run to thousands of pixels; following its
85
+ * end lands the visitor on the last row of cards with the written answer
86
+ * scrolled far out of sight above. Nothing on screen changes while the text
87
+ * streams in up there, so a turn that worked reads as a chat that stopped
88
+ * answering — which is how it was reported from the field.
89
+ *
90
+ * Capping the target instead gives the reading order people expect: the
91
+ * question pinned at the top, the answer growing downward from it.
92
+ *
93
+ * ## Why it is safe to hand to the library
94
+ *
95
+ * `use-stick-to-bottom` clamps the result to `min(this, bottom)`, so an answer
96
+ * that fits on screen behaves exactly as before. It also treats this capped
97
+ * position as "at the bottom" — so the lock holds while the answer grows, and a
98
+ * visitor who scrolls away still escapes it as usual.
99
+ *
100
+ * Measured from the live layout on every call rather than cached: the anchor
101
+ * moves whenever anything above it changes size (an image loading, an older
102
+ * result folding away), and the library already memoises per animation frame.
103
+ */
104
+ declare const anchorToLatestTurn: TargetScrollTop;
70
105
  declare const Conversation: ({ className, ...props }: ConversationProps) => react_jsx_runtime.JSX.Element;
106
+ /**
107
+ * Bring the view to a turn the visitor just sent. Render inside a
108
+ * {@link Conversation}; `turnKey` is the id of that turn.
109
+ *
110
+ * ## Why the anchor alone is not enough
111
+ *
112
+ * `use-stick-to-bottom` follows new content only while it believes the view is
113
+ * locked to the end, and it drops that lock on any upward scroll it did not
114
+ * make itself — a visitor reading back, but also the browser keeping content
115
+ * steady when something above the view shrinks, as an older result card does
116
+ * when it folds away. Once released it stays released: content growth is
117
+ * handled with the current position preserved, so every later answer streamed
118
+ * in below the fold while the view sat still, and the conversation read as one
119
+ * that had stopped answering.
120
+ *
121
+ * Sending a message is the one moment the visitor has plainly asked to follow
122
+ * along, so this re-engages the lock then. The scroll target is capped by
123
+ * {@link anchorToLatestTurn}, so "re-engage" lands on the new question rather
124
+ * than on the end of a long answer, and the library only ever scrolls
125
+ * downward, so it never drags the view back up over something being read.
126
+ *
127
+ * Deferred a frame so the new turn has been laid out when the target is
128
+ * measured.
129
+ */
130
+ declare const FollowLatestTurn: ({ turnKey }: {
131
+ turnKey?: string;
132
+ }) => null;
71
133
  type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
72
134
  declare const ConversationContent: ({ className, ...props }: ConversationContentProps) => react_jsx_runtime.JSX.Element;
73
135
  type ConversationEmptyStateProps = ComponentProps<"div"> & {
@@ -873,4 +935,4 @@ type ImageProps = Experimental_GeneratedImage & {
873
935
  };
874
936
  declare const Image: ({ base64, uint8Array, mediaType, ...props }: ImageProps) => react_jsx_runtime.JSX.Element;
875
937
 
876
- export { Image as AIImage, Artifact, ArtifactAction, type ArtifactActionProps, ArtifactActions, type ArtifactActionsProps, ArtifactClose, type ArtifactCloseProps, ArtifactContent, type ArtifactContentProps, ArtifactDescription, type ArtifactDescriptionProps, ArtifactHeader, type ArtifactHeaderProps, type ArtifactProps, ArtifactTitle, type ArtifactTitleProps, type AttachmentsContext, Canvas, ChainOfThought, ChainOfThoughtContent, type ChainOfThoughtContentProps, ChainOfThoughtHeader, type ChainOfThoughtHeaderProps, ChainOfThoughtImage, type ChainOfThoughtImageProps, type ChainOfThoughtProps, ChainOfThoughtSearchResult, type ChainOfThoughtSearchResultProps, ChainOfThoughtSearchResults, type ChainOfThoughtSearchResultsProps, ChainOfThoughtStep, type ChainOfThoughtStepProps, Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps, CodeBlock, CodeBlockCopyButton, type CodeBlockCopyButtonProps, ComponentRenderer, type ComponentRendererProps, Confirmation, ConfirmationAccepted, type ConfirmationAcceptedProps, ConfirmationAction, type ConfirmationActionProps, ConfirmationActions, type ConfirmationActionsProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, ConfirmationRequest, type ConfirmationRequestProps, ConfirmationTitle, type ConfirmationTitleProps, Connection, Context, ContextCacheUsage, type ContextCacheUsageProps, ContextContent, ContextContentBody, type ContextContentBodyProps, ContextContentFooter, type ContextContentFooterProps, ContextContentHeader, type ContextContentHeaderProps, type ContextContentProps, ContextInputUsage, type ContextInputUsageProps, ContextOutputUsage, type ContextOutputUsageProps, type ContextProps, ContextReasoningUsage, type ContextReasoningUsageProps, ContextTrigger, type ContextTriggerProps, Controls, type ControlsProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Edge, FollowupButtons, InlineCitation, InlineCitationCard, InlineCitationCardBody, type InlineCitationCardBodyProps, type InlineCitationCardProps, InlineCitationCardTrigger, type InlineCitationCardTriggerProps, InlineCitationCarousel, InlineCitationCarouselContent, type InlineCitationCarouselContentProps, InlineCitationCarouselHeader, type InlineCitationCarouselHeaderProps, InlineCitationCarouselIndex, type InlineCitationCarouselIndexProps, InlineCitationCarouselItem, type InlineCitationCarouselItemProps, InlineCitationCarouselNext, type InlineCitationCarouselNextProps, InlineCitationCarouselPrev, type InlineCitationCarouselPrevProps, type InlineCitationCarouselProps, type InlineCitationProps, InlineCitationQuote, type InlineCitationQuoteProps, InlineCitationSource, type InlineCitationSourceProps, InlineCitationText, type InlineCitationTextProps, Loader, type LoaderProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAttachment, type MessageAttachmentProps, MessageAttachments, type MessageAttachmentsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, Node, NodeAction, type NodeActionProps, NodeContent, type NodeContentProps, NodeDescription, type NodeDescriptionProps, NodeFooter, type NodeFooterProps, NodeHeader, type NodeHeaderProps, type NodeProps, NodeTitle, type NodeTitleProps, OpenIn, OpenInChatGPT, OpenInClaude, OpenInContent, type OpenInContentProps, OpenInCursor, OpenInItem, type OpenInItemProps, OpenInLabel, type OpenInLabelProps, type OpenInProps, OpenInScira, OpenInSeparator, type OpenInSeparatorProps, OpenInT3, OpenInTrigger, type OpenInTriggerProps, OpenInv0, Panel, Plan, PlanAction, type PlanActionProps, PlanContent, type PlanContentProps, PlanDescription, type PlanDescriptionProps, PlanFooter, type PlanFooterProps, PlanHeader, type PlanHeaderProps, type PlanProps, PlanTitle, type PlanTitleProps, PlanTrigger, type PlanTriggerProps, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputAttachment, type PromptInputAttachmentProps, PromptInputAttachments, type PromptInputAttachmentsProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSpeechButton, type PromptInputSpeechButtonProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Queue, QueueItem, QueueItemAction, type QueueItemActionProps, QueueItemActions, type QueueItemActionsProps, QueueItemAttachment, type QueueItemAttachmentProps, QueueItemContent, type QueueItemContentProps, QueueItemDescription, type QueueItemDescriptionProps, QueueItemFile, type QueueItemFileProps, QueueItemImage, type QueueItemImageProps, QueueItemIndicator, type QueueItemIndicatorProps, type QueueItemProps, QueueList, type QueueListProps, type QueueMessage, type QueueMessagePart, type QueueProps, QueueSection, QueueSectionContent, type QueueSectionContentProps, QueueSectionLabel, type QueueSectionLabelProps, type QueueSectionProps, QueueSectionTrigger, type QueueSectionTriggerProps, type QueueTodo, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, Shimmer, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpinnerLoader, type SpinnerLoaderProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Task, TaskContent, type TaskContentProps, TaskItem, TaskItemFile, type TaskItemFileProps, type TaskItemProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextInputContext, type TextShimmerProps, ThinkingSpinner, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolProps, Toolbar, WebPreview, WebPreviewBody, type WebPreviewBodyProps, WebPreviewConsole, type WebPreviewConsoleProps, type WebPreviewContextValue, WebPreviewNavigation, WebPreviewNavigationButton, type WebPreviewNavigationButtonProps, type WebPreviewNavigationProps, type WebPreviewProps, WebPreviewUrl, type WebPreviewUrlProps, highlightCode, usePromptInputAttachments, usePromptInputController, useProviderAttachments, useReasoning };
938
+ export { Image as AIImage, Artifact, ArtifactAction, type ArtifactActionProps, ArtifactActions, type ArtifactActionsProps, ArtifactClose, type ArtifactCloseProps, ArtifactContent, type ArtifactContentProps, ArtifactDescription, type ArtifactDescriptionProps, ArtifactHeader, type ArtifactHeaderProps, type ArtifactProps, ArtifactTitle, type ArtifactTitleProps, type AttachmentsContext, Canvas, ChainOfThought, ChainOfThoughtContent, type ChainOfThoughtContentProps, ChainOfThoughtHeader, type ChainOfThoughtHeaderProps, ChainOfThoughtImage, type ChainOfThoughtImageProps, type ChainOfThoughtProps, ChainOfThoughtSearchResult, type ChainOfThoughtSearchResultProps, ChainOfThoughtSearchResults, type ChainOfThoughtSearchResultsProps, ChainOfThoughtStep, type ChainOfThoughtStepProps, Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps, CodeBlock, CodeBlockCopyButton, type CodeBlockCopyButtonProps, ComponentRenderer, type ComponentRendererProps, Confirmation, ConfirmationAccepted, type ConfirmationAcceptedProps, ConfirmationAction, type ConfirmationActionProps, ConfirmationActions, type ConfirmationActionsProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, ConfirmationRequest, type ConfirmationRequestProps, ConfirmationTitle, type ConfirmationTitleProps, Connection, Context, ContextCacheUsage, type ContextCacheUsageProps, ContextContent, ContextContentBody, type ContextContentBodyProps, ContextContentFooter, type ContextContentFooterProps, ContextContentHeader, type ContextContentHeaderProps, type ContextContentProps, ContextInputUsage, type ContextInputUsageProps, ContextOutputUsage, type ContextOutputUsageProps, type ContextProps, ContextReasoningUsage, type ContextReasoningUsageProps, ContextTrigger, type ContextTriggerProps, Controls, type ControlsProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Edge, FollowLatestTurn, FollowupButtons, InlineCitation, InlineCitationCard, InlineCitationCardBody, type InlineCitationCardBodyProps, type InlineCitationCardProps, InlineCitationCardTrigger, type InlineCitationCardTriggerProps, InlineCitationCarousel, InlineCitationCarouselContent, type InlineCitationCarouselContentProps, InlineCitationCarouselHeader, type InlineCitationCarouselHeaderProps, InlineCitationCarouselIndex, type InlineCitationCarouselIndexProps, InlineCitationCarouselItem, type InlineCitationCarouselItemProps, InlineCitationCarouselNext, type InlineCitationCarouselNextProps, InlineCitationCarouselPrev, type InlineCitationCarouselPrevProps, type InlineCitationCarouselProps, type InlineCitationProps, InlineCitationQuote, type InlineCitationQuoteProps, InlineCitationSource, type InlineCitationSourceProps, InlineCitationText, type InlineCitationTextProps, LATEST_TURN_ATTR, Loader, type LoaderProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAttachment, type MessageAttachmentProps, MessageAttachments, type MessageAttachmentsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, Node, NodeAction, type NodeActionProps, NodeContent, type NodeContentProps, NodeDescription, type NodeDescriptionProps, NodeFooter, type NodeFooterProps, NodeHeader, type NodeHeaderProps, type NodeProps, NodeTitle, type NodeTitleProps, OpenIn, OpenInChatGPT, OpenInClaude, OpenInContent, type OpenInContentProps, OpenInCursor, OpenInItem, type OpenInItemProps, OpenInLabel, type OpenInLabelProps, type OpenInProps, OpenInScira, OpenInSeparator, type OpenInSeparatorProps, OpenInT3, OpenInTrigger, type OpenInTriggerProps, OpenInv0, Panel, Plan, PlanAction, type PlanActionProps, PlanContent, type PlanContentProps, PlanDescription, type PlanDescriptionProps, PlanFooter, type PlanFooterProps, PlanHeader, type PlanHeaderProps, type PlanProps, PlanTitle, type PlanTitleProps, PlanTrigger, type PlanTriggerProps, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputAttachment, type PromptInputAttachmentProps, PromptInputAttachments, type PromptInputAttachmentsProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSpeechButton, type PromptInputSpeechButtonProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Queue, QueueItem, QueueItemAction, type QueueItemActionProps, QueueItemActions, type QueueItemActionsProps, QueueItemAttachment, type QueueItemAttachmentProps, QueueItemContent, type QueueItemContentProps, QueueItemDescription, type QueueItemDescriptionProps, QueueItemFile, type QueueItemFileProps, QueueItemImage, type QueueItemImageProps, QueueItemIndicator, type QueueItemIndicatorProps, type QueueItemProps, QueueList, type QueueListProps, type QueueMessage, type QueueMessagePart, type QueueProps, QueueSection, QueueSectionContent, type QueueSectionContentProps, QueueSectionLabel, type QueueSectionLabelProps, type QueueSectionProps, QueueSectionTrigger, type QueueSectionTriggerProps, type QueueTodo, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, Shimmer, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpinnerLoader, type SpinnerLoaderProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Task, TaskContent, type TaskContentProps, TaskItem, TaskItemFile, type TaskItemFileProps, type TaskItemProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextInputContext, type TextShimmerProps, ThinkingSpinner, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolProps, Toolbar, WebPreview, WebPreviewBody, type WebPreviewBodyProps, WebPreviewConsole, type WebPreviewConsoleProps, type WebPreviewContextValue, WebPreviewNavigation, WebPreviewNavigationButton, type WebPreviewNavigationButtonProps, type WebPreviewNavigationProps, type WebPreviewProps, WebPreviewUrl, type WebPreviewUrlProps, anchorToLatestTurn, highlightCode, usePromptInputAttachments, usePromptInputController, useProviderAttachments, useReasoning };
@@ -67,7 +67,69 @@ type MessageToolbarProps = ComponentProps<"div">;
67
67
  declare const MessageToolbar: ({ className, children, ...props }: MessageToolbarProps) => react_jsx_runtime.JSX.Element;
68
68
 
69
69
  type ConversationProps = ComponentProps<typeof StickToBottom>;
70
+ /**
71
+ * Marks the turn the visitor sent last. {@link anchorToLatestTurn} stops the
72
+ * view there instead of at the bottom of whatever came back.
73
+ */
74
+ declare const LATEST_TURN_ATTR = "data-ac-latest-turn";
75
+ type TargetScrollTop = NonNullable<ConversationProps["targetScrollTop"]>;
76
+ /**
77
+ * Where "the bottom" is for a conversation: never further down than the point
78
+ * where the latest question reaches the top of the view.
79
+ *
80
+ * ## Why not simply stick to the bottom
81
+ *
82
+ * `StickToBottom` follows the end of the content, which is right while an
83
+ * answer is shorter than the view and wrong the moment it is taller. A reply
84
+ * that carries a product grid can run to thousands of pixels; following its
85
+ * end lands the visitor on the last row of cards with the written answer
86
+ * scrolled far out of sight above. Nothing on screen changes while the text
87
+ * streams in up there, so a turn that worked reads as a chat that stopped
88
+ * answering — which is how it was reported from the field.
89
+ *
90
+ * Capping the target instead gives the reading order people expect: the
91
+ * question pinned at the top, the answer growing downward from it.
92
+ *
93
+ * ## Why it is safe to hand to the library
94
+ *
95
+ * `use-stick-to-bottom` clamps the result to `min(this, bottom)`, so an answer
96
+ * that fits on screen behaves exactly as before. It also treats this capped
97
+ * position as "at the bottom" — so the lock holds while the answer grows, and a
98
+ * visitor who scrolls away still escapes it as usual.
99
+ *
100
+ * Measured from the live layout on every call rather than cached: the anchor
101
+ * moves whenever anything above it changes size (an image loading, an older
102
+ * result folding away), and the library already memoises per animation frame.
103
+ */
104
+ declare const anchorToLatestTurn: TargetScrollTop;
70
105
  declare const Conversation: ({ className, ...props }: ConversationProps) => react_jsx_runtime.JSX.Element;
106
+ /**
107
+ * Bring the view to a turn the visitor just sent. Render inside a
108
+ * {@link Conversation}; `turnKey` is the id of that turn.
109
+ *
110
+ * ## Why the anchor alone is not enough
111
+ *
112
+ * `use-stick-to-bottom` follows new content only while it believes the view is
113
+ * locked to the end, and it drops that lock on any upward scroll it did not
114
+ * make itself — a visitor reading back, but also the browser keeping content
115
+ * steady when something above the view shrinks, as an older result card does
116
+ * when it folds away. Once released it stays released: content growth is
117
+ * handled with the current position preserved, so every later answer streamed
118
+ * in below the fold while the view sat still, and the conversation read as one
119
+ * that had stopped answering.
120
+ *
121
+ * Sending a message is the one moment the visitor has plainly asked to follow
122
+ * along, so this re-engages the lock then. The scroll target is capped by
123
+ * {@link anchorToLatestTurn}, so "re-engage" lands on the new question rather
124
+ * than on the end of a long answer, and the library only ever scrolls
125
+ * downward, so it never drags the view back up over something being read.
126
+ *
127
+ * Deferred a frame so the new turn has been laid out when the target is
128
+ * measured.
129
+ */
130
+ declare const FollowLatestTurn: ({ turnKey }: {
131
+ turnKey?: string;
132
+ }) => null;
71
133
  type ConversationContentProps = ComponentProps<typeof StickToBottom.Content>;
72
134
  declare const ConversationContent: ({ className, ...props }: ConversationContentProps) => react_jsx_runtime.JSX.Element;
73
135
  type ConversationEmptyStateProps = ComponentProps<"div"> & {
@@ -873,4 +935,4 @@ type ImageProps = Experimental_GeneratedImage & {
873
935
  };
874
936
  declare const Image: ({ base64, uint8Array, mediaType, ...props }: ImageProps) => react_jsx_runtime.JSX.Element;
875
937
 
876
- export { Image as AIImage, Artifact, ArtifactAction, type ArtifactActionProps, ArtifactActions, type ArtifactActionsProps, ArtifactClose, type ArtifactCloseProps, ArtifactContent, type ArtifactContentProps, ArtifactDescription, type ArtifactDescriptionProps, ArtifactHeader, type ArtifactHeaderProps, type ArtifactProps, ArtifactTitle, type ArtifactTitleProps, type AttachmentsContext, Canvas, ChainOfThought, ChainOfThoughtContent, type ChainOfThoughtContentProps, ChainOfThoughtHeader, type ChainOfThoughtHeaderProps, ChainOfThoughtImage, type ChainOfThoughtImageProps, type ChainOfThoughtProps, ChainOfThoughtSearchResult, type ChainOfThoughtSearchResultProps, ChainOfThoughtSearchResults, type ChainOfThoughtSearchResultsProps, ChainOfThoughtStep, type ChainOfThoughtStepProps, Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps, CodeBlock, CodeBlockCopyButton, type CodeBlockCopyButtonProps, ComponentRenderer, type ComponentRendererProps, Confirmation, ConfirmationAccepted, type ConfirmationAcceptedProps, ConfirmationAction, type ConfirmationActionProps, ConfirmationActions, type ConfirmationActionsProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, ConfirmationRequest, type ConfirmationRequestProps, ConfirmationTitle, type ConfirmationTitleProps, Connection, Context, ContextCacheUsage, type ContextCacheUsageProps, ContextContent, ContextContentBody, type ContextContentBodyProps, ContextContentFooter, type ContextContentFooterProps, ContextContentHeader, type ContextContentHeaderProps, type ContextContentProps, ContextInputUsage, type ContextInputUsageProps, ContextOutputUsage, type ContextOutputUsageProps, type ContextProps, ContextReasoningUsage, type ContextReasoningUsageProps, ContextTrigger, type ContextTriggerProps, Controls, type ControlsProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Edge, FollowupButtons, InlineCitation, InlineCitationCard, InlineCitationCardBody, type InlineCitationCardBodyProps, type InlineCitationCardProps, InlineCitationCardTrigger, type InlineCitationCardTriggerProps, InlineCitationCarousel, InlineCitationCarouselContent, type InlineCitationCarouselContentProps, InlineCitationCarouselHeader, type InlineCitationCarouselHeaderProps, InlineCitationCarouselIndex, type InlineCitationCarouselIndexProps, InlineCitationCarouselItem, type InlineCitationCarouselItemProps, InlineCitationCarouselNext, type InlineCitationCarouselNextProps, InlineCitationCarouselPrev, type InlineCitationCarouselPrevProps, type InlineCitationCarouselProps, type InlineCitationProps, InlineCitationQuote, type InlineCitationQuoteProps, InlineCitationSource, type InlineCitationSourceProps, InlineCitationText, type InlineCitationTextProps, Loader, type LoaderProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAttachment, type MessageAttachmentProps, MessageAttachments, type MessageAttachmentsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, Node, NodeAction, type NodeActionProps, NodeContent, type NodeContentProps, NodeDescription, type NodeDescriptionProps, NodeFooter, type NodeFooterProps, NodeHeader, type NodeHeaderProps, type NodeProps, NodeTitle, type NodeTitleProps, OpenIn, OpenInChatGPT, OpenInClaude, OpenInContent, type OpenInContentProps, OpenInCursor, OpenInItem, type OpenInItemProps, OpenInLabel, type OpenInLabelProps, type OpenInProps, OpenInScira, OpenInSeparator, type OpenInSeparatorProps, OpenInT3, OpenInTrigger, type OpenInTriggerProps, OpenInv0, Panel, Plan, PlanAction, type PlanActionProps, PlanContent, type PlanContentProps, PlanDescription, type PlanDescriptionProps, PlanFooter, type PlanFooterProps, PlanHeader, type PlanHeaderProps, type PlanProps, PlanTitle, type PlanTitleProps, PlanTrigger, type PlanTriggerProps, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputAttachment, type PromptInputAttachmentProps, PromptInputAttachments, type PromptInputAttachmentsProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSpeechButton, type PromptInputSpeechButtonProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Queue, QueueItem, QueueItemAction, type QueueItemActionProps, QueueItemActions, type QueueItemActionsProps, QueueItemAttachment, type QueueItemAttachmentProps, QueueItemContent, type QueueItemContentProps, QueueItemDescription, type QueueItemDescriptionProps, QueueItemFile, type QueueItemFileProps, QueueItemImage, type QueueItemImageProps, QueueItemIndicator, type QueueItemIndicatorProps, type QueueItemProps, QueueList, type QueueListProps, type QueueMessage, type QueueMessagePart, type QueueProps, QueueSection, QueueSectionContent, type QueueSectionContentProps, QueueSectionLabel, type QueueSectionLabelProps, type QueueSectionProps, QueueSectionTrigger, type QueueSectionTriggerProps, type QueueTodo, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, Shimmer, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpinnerLoader, type SpinnerLoaderProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Task, TaskContent, type TaskContentProps, TaskItem, TaskItemFile, type TaskItemFileProps, type TaskItemProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextInputContext, type TextShimmerProps, ThinkingSpinner, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolProps, Toolbar, WebPreview, WebPreviewBody, type WebPreviewBodyProps, WebPreviewConsole, type WebPreviewConsoleProps, type WebPreviewContextValue, WebPreviewNavigation, WebPreviewNavigationButton, type WebPreviewNavigationButtonProps, type WebPreviewNavigationProps, type WebPreviewProps, WebPreviewUrl, type WebPreviewUrlProps, highlightCode, usePromptInputAttachments, usePromptInputController, useProviderAttachments, useReasoning };
938
+ export { Image as AIImage, Artifact, ArtifactAction, type ArtifactActionProps, ArtifactActions, type ArtifactActionsProps, ArtifactClose, type ArtifactCloseProps, ArtifactContent, type ArtifactContentProps, ArtifactDescription, type ArtifactDescriptionProps, ArtifactHeader, type ArtifactHeaderProps, type ArtifactProps, ArtifactTitle, type ArtifactTitleProps, type AttachmentsContext, Canvas, ChainOfThought, ChainOfThoughtContent, type ChainOfThoughtContentProps, ChainOfThoughtHeader, type ChainOfThoughtHeaderProps, ChainOfThoughtImage, type ChainOfThoughtImageProps, type ChainOfThoughtProps, ChainOfThoughtSearchResult, type ChainOfThoughtSearchResultProps, ChainOfThoughtSearchResults, type ChainOfThoughtSearchResultsProps, ChainOfThoughtStep, type ChainOfThoughtStepProps, Checkpoint, CheckpointIcon, type CheckpointIconProps, type CheckpointProps, CheckpointTrigger, type CheckpointTriggerProps, CodeBlock, CodeBlockCopyButton, type CodeBlockCopyButtonProps, ComponentRenderer, type ComponentRendererProps, Confirmation, ConfirmationAccepted, type ConfirmationAcceptedProps, ConfirmationAction, type ConfirmationActionProps, ConfirmationActions, type ConfirmationActionsProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, ConfirmationRequest, type ConfirmationRequestProps, ConfirmationTitle, type ConfirmationTitleProps, Connection, Context, ContextCacheUsage, type ContextCacheUsageProps, ContextContent, ContextContentBody, type ContextContentBodyProps, ContextContentFooter, type ContextContentFooterProps, ContextContentHeader, type ContextContentHeaderProps, type ContextContentProps, ContextInputUsage, type ContextInputUsageProps, ContextOutputUsage, type ContextOutputUsageProps, type ContextProps, ContextReasoningUsage, type ContextReasoningUsageProps, ContextTrigger, type ContextTriggerProps, Controls, type ControlsProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, Edge, FollowLatestTurn, FollowupButtons, InlineCitation, InlineCitationCard, InlineCitationCardBody, type InlineCitationCardBodyProps, type InlineCitationCardProps, InlineCitationCardTrigger, type InlineCitationCardTriggerProps, InlineCitationCarousel, InlineCitationCarouselContent, type InlineCitationCarouselContentProps, InlineCitationCarouselHeader, type InlineCitationCarouselHeaderProps, InlineCitationCarouselIndex, type InlineCitationCarouselIndexProps, InlineCitationCarouselItem, type InlineCitationCarouselItemProps, InlineCitationCarouselNext, type InlineCitationCarouselNextProps, InlineCitationCarouselPrev, type InlineCitationCarouselPrevProps, type InlineCitationCarouselProps, type InlineCitationProps, InlineCitationQuote, type InlineCitationQuoteProps, InlineCitationSource, type InlineCitationSourceProps, InlineCitationText, type InlineCitationTextProps, LATEST_TURN_ATTR, Loader, type LoaderProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAttachment, type MessageAttachmentProps, MessageAttachments, type MessageAttachmentsProps, MessageBranch, MessageBranchContent, type MessageBranchContentProps, MessageBranchNext, type MessageBranchNextProps, MessageBranchPage, type MessageBranchPageProps, MessageBranchPrevious, type MessageBranchPreviousProps, type MessageBranchProps, MessageBranchSelector, type MessageBranchSelectorProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageToolbar, type MessageToolbarProps, ModelSelector, ModelSelectorContent, type ModelSelectorContentProps, ModelSelectorDialog, type ModelSelectorDialogProps, ModelSelectorEmpty, type ModelSelectorEmptyProps, ModelSelectorGroup, type ModelSelectorGroupProps, ModelSelectorInput, type ModelSelectorInputProps, ModelSelectorItem, type ModelSelectorItemProps, ModelSelectorList, type ModelSelectorListProps, ModelSelectorLogo, ModelSelectorLogoGroup, type ModelSelectorLogoGroupProps, type ModelSelectorLogoProps, ModelSelectorName, type ModelSelectorNameProps, type ModelSelectorProps, ModelSelectorSeparator, type ModelSelectorSeparatorProps, ModelSelectorShortcut, type ModelSelectorShortcutProps, ModelSelectorTrigger, type ModelSelectorTriggerProps, Node, NodeAction, type NodeActionProps, NodeContent, type NodeContentProps, NodeDescription, type NodeDescriptionProps, NodeFooter, type NodeFooterProps, NodeHeader, type NodeHeaderProps, type NodeProps, NodeTitle, type NodeTitleProps, OpenIn, OpenInChatGPT, OpenInClaude, OpenInContent, type OpenInContentProps, OpenInCursor, OpenInItem, type OpenInItemProps, OpenInLabel, type OpenInLabelProps, type OpenInProps, OpenInScira, OpenInSeparator, type OpenInSeparatorProps, OpenInT3, OpenInTrigger, type OpenInTriggerProps, OpenInv0, Panel, Plan, PlanAction, type PlanActionProps, PlanContent, type PlanContentProps, PlanDescription, type PlanDescriptionProps, PlanFooter, type PlanFooterProps, PlanHeader, type PlanHeaderProps, type PlanProps, PlanTitle, type PlanTitleProps, PlanTrigger, type PlanTriggerProps, PromptInput, PromptInputActionAddAttachments, type PromptInputActionAddAttachmentsProps, PromptInputActionMenu, PromptInputActionMenuContent, type PromptInputActionMenuContentProps, PromptInputActionMenuItem, type PromptInputActionMenuItemProps, type PromptInputActionMenuProps, PromptInputActionMenuTrigger, type PromptInputActionMenuTriggerProps, PromptInputAttachment, type PromptInputAttachmentProps, PromptInputAttachments, type PromptInputAttachmentsProps, PromptInputBody, type PromptInputBodyProps, PromptInputButton, type PromptInputButtonProps, PromptInputCommand, PromptInputCommandEmpty, type PromptInputCommandEmptyProps, PromptInputCommandGroup, type PromptInputCommandGroupProps, PromptInputCommandInput, type PromptInputCommandInputProps, PromptInputCommandItem, type PromptInputCommandItemProps, PromptInputCommandList, type PromptInputCommandListProps, type PromptInputCommandProps, PromptInputCommandSeparator, type PromptInputCommandSeparatorProps, type PromptInputControllerProps, PromptInputFooter, type PromptInputFooterProps, PromptInputHeader, type PromptInputHeaderProps, PromptInputHoverCard, PromptInputHoverCardContent, type PromptInputHoverCardContentProps, type PromptInputHoverCardProps, PromptInputHoverCardTrigger, type PromptInputHoverCardTriggerProps, type PromptInputMessage, type PromptInputProps, PromptInputProvider, type PromptInputProviderProps, PromptInputSelect, PromptInputSelectContent, type PromptInputSelectContentProps, PromptInputSelectItem, type PromptInputSelectItemProps, type PromptInputSelectProps, PromptInputSelectTrigger, type PromptInputSelectTriggerProps, PromptInputSelectValue, type PromptInputSelectValueProps, PromptInputSpeechButton, type PromptInputSpeechButtonProps, PromptInputSubmit, type PromptInputSubmitProps, PromptInputTab, PromptInputTabBody, type PromptInputTabBodyProps, PromptInputTabItem, type PromptInputTabItemProps, PromptInputTabLabel, type PromptInputTabLabelProps, type PromptInputTabProps, PromptInputTabsList, type PromptInputTabsListProps, PromptInputTextarea, type PromptInputTextareaProps, PromptInputTools, type PromptInputToolsProps, Queue, QueueItem, QueueItemAction, type QueueItemActionProps, QueueItemActions, type QueueItemActionsProps, QueueItemAttachment, type QueueItemAttachmentProps, QueueItemContent, type QueueItemContentProps, QueueItemDescription, type QueueItemDescriptionProps, QueueItemFile, type QueueItemFileProps, QueueItemImage, type QueueItemImageProps, QueueItemIndicator, type QueueItemIndicatorProps, type QueueItemProps, QueueList, type QueueListProps, type QueueMessage, type QueueMessagePart, type QueueProps, QueueSection, QueueSectionContent, type QueueSectionContentProps, QueueSectionLabel, type QueueSectionLabelProps, type QueueSectionProps, QueueSectionTrigger, type QueueSectionTriggerProps, type QueueTodo, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, Shimmer, Source, type SourceProps, Sources, SourcesContent, type SourcesContentProps, type SourcesProps, SourcesTrigger, type SourcesTriggerProps, SpinnerLoader, type SpinnerLoaderProps, Suggestion, type SuggestionProps, Suggestions, type SuggestionsProps, Task, TaskContent, type TaskContentProps, TaskItem, TaskItemFile, type TaskItemFileProps, type TaskItemProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextInputContext, type TextShimmerProps, ThinkingSpinner, Tool, ToolContent, type ToolContentProps, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolOutput, type ToolOutputProps, type ToolProps, Toolbar, WebPreview, WebPreviewBody, type WebPreviewBodyProps, WebPreviewConsole, type WebPreviewConsoleProps, type WebPreviewContextValue, WebPreviewNavigation, WebPreviewNavigationButton, type WebPreviewNavigationButtonProps, type WebPreviewNavigationProps, type WebPreviewProps, WebPreviewUrl, type WebPreviewUrlProps, anchorToLatestTurn, highlightCode, usePromptInputAttachments, usePromptInputController, useProviderAttachments, useReasoning };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { detectLanguage, LATIN } from './chunk-BYTPAQ7F.js';
3
- export { Conversation, ConversationContent, ConversationEmptyState, ConversationScrollButton, Loader, Message, MessageAction, MessageActions, MessageAttachment, MessageAttachments, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageFeedback, MessageResponse, MessageToolbar, Source, Sources, SourcesContent, SourcesTrigger, SpinnerLoader } from './chunk-CNGIOCLR.js';
3
+ export { Conversation, ConversationContent, ConversationEmptyState, ConversationScrollButton, FollowLatestTurn, LATEST_TURN_ATTR, Loader, Message, MessageAction, MessageActions, MessageAttachment, MessageAttachments, MessageBranch, MessageBranchContent, MessageBranchNext, MessageBranchPage, MessageBranchPrevious, MessageBranchSelector, MessageContent, MessageFeedback, MessageResponse, MessageToolbar, Source, Sources, SourcesContent, SourcesTrigger, SpinnerLoader, anchorToLatestTurn } from './chunk-O5TPHZRP.js';
4
4
  import './chunk-MZQKGNWF.js';
5
5
  import './chunk-LDQVDUUJ.js';
6
6
  import { processImagesInHtml } from './chunk-PS3U7T37.js';
@@ -13,6 +13,29 @@ var classVarianceAuthority = require('class-variance-authority');
13
13
  var reactDom = require('react-dom');
14
14
  var streamdown = require('streamdown');
15
15
 
16
+ var LATEST_TURN_ATTR = "data-ac-latest-turn";
17
+ var LATEST_TURN_GAP_PX = 16;
18
+ var SCROLL_KEYS = /* @__PURE__ */ new Set([
19
+ "ArrowUp",
20
+ "ArrowDown",
21
+ "PageUp",
22
+ "PageDown",
23
+ "Home",
24
+ "End",
25
+ " "
26
+ ]);
27
+ var anchorToLatestTurn = (bottom, { scrollElement, contentElement }) => {
28
+ const anchorTop = latestTurnTop(scrollElement, contentElement);
29
+ if (anchorTop === null) return bottom;
30
+ return Math.min(bottom, Math.max(0, anchorTop - LATEST_TURN_GAP_PX));
31
+ };
32
+ function latestTurnTop(scrollElement, contentElement) {
33
+ const anchor = contentElement.querySelector(
34
+ `[${LATEST_TURN_ATTR}]`
35
+ );
36
+ if (!anchor) return null;
37
+ return anchor.getBoundingClientRect().top - scrollElement.getBoundingClientRect().top + scrollElement.scrollTop;
38
+ }
16
39
  var Conversation = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
17
40
  useStickToBottom.StickToBottom,
18
41
  {
@@ -23,6 +46,52 @@ var Conversation = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
23
46
  ...props
24
47
  }
25
48
  );
49
+ var FollowLatestTurn = ({ turnKey }) => {
50
+ const { scrollToBottom, scrollRef, contentRef, state } = useStickToBottom.useStickToBottomContext();
51
+ react.useEffect(() => {
52
+ if (!turnKey) return;
53
+ const frame = requestAnimationFrame(() => {
54
+ void scrollToBottom();
55
+ });
56
+ return () => cancelAnimationFrame(frame);
57
+ }, [turnKey, scrollToBottom]);
58
+ react.useEffect(() => {
59
+ const scroll = scrollRef.current;
60
+ const content = contentRef.current;
61
+ if (!turnKey || !scroll || !content) return;
62
+ let previous = latestTurnTop(scroll, content);
63
+ let steering = false;
64
+ const takeOver = () => {
65
+ steering = true;
66
+ };
67
+ const onKey = (event) => {
68
+ if (SCROLL_KEYS.has(event.key)) steering = true;
69
+ };
70
+ const observer = new ResizeObserver(() => {
71
+ const current = latestTurnTop(scroll, content);
72
+ if (!steering && previous !== null && current !== null) {
73
+ const shift = current - previous;
74
+ if (Math.abs(shift) > 1) {
75
+ state.scrollTop = Math.max(0, state.scrollTop + shift);
76
+ }
77
+ }
78
+ previous = current;
79
+ });
80
+ observer.observe(content);
81
+ scroll.addEventListener("wheel", takeOver, { passive: true });
82
+ scroll.addEventListener("touchmove", takeOver, { passive: true });
83
+ scroll.addEventListener("pointerdown", takeOver, { passive: true });
84
+ scroll.addEventListener("keydown", onKey);
85
+ return () => {
86
+ observer.disconnect();
87
+ scroll.removeEventListener("wheel", takeOver);
88
+ scroll.removeEventListener("touchmove", takeOver);
89
+ scroll.removeEventListener("pointerdown", takeOver);
90
+ scroll.removeEventListener("keydown", onKey);
91
+ };
92
+ }, [turnKey, scrollRef, contentRef, state]);
93
+ return null;
94
+ };
26
95
  var ConversationContent = ({
27
96
  className,
28
97
  ...props
@@ -1099,6 +1168,8 @@ exports.Conversation = Conversation;
1099
1168
  exports.ConversationContent = ConversationContent;
1100
1169
  exports.ConversationEmptyState = ConversationEmptyState;
1101
1170
  exports.ConversationScrollButton = ConversationScrollButton;
1171
+ exports.FollowLatestTurn = FollowLatestTurn;
1172
+ exports.LATEST_TURN_ATTR = LATEST_TURN_ATTR;
1102
1173
  exports.Loader = Loader;
1103
1174
  exports.Message = Message;
1104
1175
  exports.MessageAction = MessageAction;
@@ -1120,5 +1191,6 @@ exports.Sources = Sources;
1120
1191
  exports.SourcesContent = SourcesContent;
1121
1192
  exports.SourcesTrigger = SourcesTrigger;
1122
1193
  exports.SpinnerLoader = SpinnerLoader;
1123
- //# sourceMappingURL=chunk-6CVBJ4EI.cjs.map
1124
- //# sourceMappingURL=chunk-6CVBJ4EI.cjs.map
1194
+ exports.anchorToLatestTurn = anchorToLatestTurn;
1195
+ //# sourceMappingURL=chunk-B277MAUK.cjs.map
1196
+ //# sourceMappingURL=chunk-B277MAUK.cjs.map