@miiflow/assistant-ui 0.13.0 → 0.15.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/README.md +209 -46
- package/dist/{WelcomeScreen-EGO8Qt2y.d.ts → WelcomeScreen-CSzlU0Yx.d.ts} +41 -9
- package/dist/{avatar-CD685KQV.d.ts → avatar-B_AvYfE8.d.ts} +4 -1
- package/dist/chunk-7QNDCHY7.js +2 -0
- package/dist/chunk-7QNDCHY7.js.map +1 -0
- package/dist/chunk-BINTGT2Q.js +5 -0
- package/dist/chunk-BINTGT2Q.js.map +1 -0
- package/dist/chunk-HNHLLH6W.js +2 -0
- package/dist/chunk-HNHLLH6W.js.map +1 -0
- package/dist/{chunk-WG77GQR3.js → chunk-ISMTV5BU.js} +2 -2
- package/dist/{chunk-WG77GQR3.js.map → chunk-ISMTV5BU.js.map} +1 -1
- package/dist/chunk-LDTAZ4GT.js +2 -0
- package/dist/chunk-LDTAZ4GT.js.map +1 -0
- package/dist/chunk-OU5ITGKX.js +2 -0
- package/dist/chunk-OU5ITGKX.js.map +1 -0
- package/dist/chunk-W7HQXA2Z.js +146 -0
- package/dist/chunk-W7HQXA2Z.js.map +1 -0
- package/dist/client/index.d.ts +66 -5
- package/dist/client/index.js +6 -6
- package/dist/client/index.js.map +1 -1
- package/dist/composer/index.d.ts +37 -3
- package/dist/composer/index.js +1 -1
- package/dist/context/index.d.ts +10 -3
- package/dist/context/index.js +1 -1
- package/dist/hooks/index.d.ts +11 -141
- package/dist/hooks/index.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{message-D0oMw3tR.d.ts → message-DTNTKSQr.d.ts} +1 -1
- package/dist/primitives/index.d.ts +3 -3
- package/dist/primitives/index.js +1 -1
- package/dist/{streaming-CmQo_OOA.d.ts → streaming-BfLEgW5u.d.ts} +81 -3
- package/dist/styled/index.d.ts +410 -11
- package/dist/styled/index.js +1 -1
- package/dist/styles-no-preflight.css +1 -1
- package/dist/styles.css +3 -1
- package/dist/use-branding-css-vars-CR2tjSV8.d.ts +155 -0
- package/package.json +2 -1
- package/dist/chunk-4WWJTYYA.js +0 -2
- package/dist/chunk-4WWJTYYA.js.map +0 -1
- package/dist/chunk-6RN7SUWT.js +0 -2
- package/dist/chunk-6RN7SUWT.js.map +0 -1
- package/dist/chunk-D2PFIJNZ.js +0 -2
- package/dist/chunk-D2PFIJNZ.js.map +0 -1
- package/dist/chunk-HYFMOOLH.js +0 -133
- package/dist/chunk-HYFMOOLH.js.map +0 -1
- package/dist/chunk-NKLA5PPB.js +0 -2
- package/dist/chunk-NKLA5PPB.js.map +0 -1
- package/dist/chunk-ZP4FGAAH.js +0 -2
- package/dist/chunk-ZP4FGAAH.js.map +0 -1
package/dist/composer/index.d.ts
CHANGED
|
@@ -138,6 +138,21 @@ interface CommandTokenViewProps {
|
|
|
138
138
|
}
|
|
139
139
|
declare function CommandTokenView({ id, kind, label, description, icon, tag, variant, selected, onMouseEnter, onMouseDown, htmlId, }: CommandTokenViewProps): react.JSX.Element;
|
|
140
140
|
|
|
141
|
+
type ResolveTokenLabel = (id: string, kind: string) => string | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Rebuild editor content from the plain-text projection the editor itself
|
|
144
|
+
* emits (`root.getTextContent()` / `ChatComposerSubmitPayload.text`).
|
|
145
|
+
*
|
|
146
|
+
* The exact inverse of Lexical's projection: paragraphs are joined with
|
|
147
|
+
* `"\n\n"` and a `LineBreakNode` is `"\n"`, so `"\n\n"` splits paragraphs and
|
|
148
|
+
* `"\n"` inside one becomes a line break. `<prefix><id>:<kind>` substrings
|
|
149
|
+
* become chips again; `resolveLabel` supplies a display label for ids that
|
|
150
|
+
* are opaque (ad accounts) — it falls back to the id.
|
|
151
|
+
*
|
|
152
|
+
* Must run inside `editor.update()` (or as `initialConfig.editorState`).
|
|
153
|
+
*/
|
|
154
|
+
declare function $hydrateFromEncodedText(text: string, resolveLabel?: ResolveTokenLabel): void;
|
|
155
|
+
|
|
141
156
|
interface LexicalChatInputHandle {
|
|
142
157
|
/** Clear the editor contents and reset history. */
|
|
143
158
|
clear: () => void;
|
|
@@ -151,6 +166,11 @@ interface LexicalChatInputHandle {
|
|
|
151
166
|
* like "/" or "@" so the matching typeahead opens.
|
|
152
167
|
*/
|
|
153
168
|
insertText: (text: string) => void;
|
|
169
|
+
/**
|
|
170
|
+
* Replace the editor contents with the plain-text projection of an earlier
|
|
171
|
+
* payload (`/id:kind` substrings become chips again) and reset history.
|
|
172
|
+
*/
|
|
173
|
+
setContent: (text: string) => void;
|
|
154
174
|
}
|
|
155
175
|
interface LexicalChatInputProps {
|
|
156
176
|
placeholder?: string;
|
|
@@ -167,8 +187,22 @@ interface LexicalChatInputProps {
|
|
|
167
187
|
* gate a parent-rendered submit button on `text.trim().length > 0`.
|
|
168
188
|
*/
|
|
169
189
|
onChange?: (payload: ChatComposerSubmitPayload) => void;
|
|
170
|
-
/** Called
|
|
171
|
-
onSubmit
|
|
190
|
+
/** Called on submit — Enter without Shift (when `submitOnEnter`) or `submit()`. */
|
|
191
|
+
onSubmit?: (payload: ChatComposerSubmitPayload) => void | Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* Whether Enter (without Shift) submits. Default true — the chat contract.
|
|
194
|
+
* Set false when the editor is a form FIELD (a schedule's message, a saved
|
|
195
|
+
* prompt): Enter then inserts a paragraph and Shift+Enter a line break, and
|
|
196
|
+
* the owner reads the value from `onChange`.
|
|
197
|
+
*/
|
|
198
|
+
submitOnEnter?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Content to hydrate on mount, in the same plain-text projection the editor
|
|
201
|
+
* emits (`payload.text`). Read ONCE — remount with a `key` to reset.
|
|
202
|
+
*/
|
|
203
|
+
initialContent?: string;
|
|
204
|
+
/** Display label for a rehydrated chip whose id is opaque; defaults to the id. */
|
|
205
|
+
resolveTokenLabel?: ResolveTokenLabel;
|
|
172
206
|
/**
|
|
173
207
|
* Optional slash-command typeahead. When omitted, the editor behaves like
|
|
174
208
|
* a plain rich-text input.
|
|
@@ -184,4 +218,4 @@ interface LexicalChatInputProps {
|
|
|
184
218
|
}
|
|
185
219
|
declare const LexicalChatInput: react.ForwardRefExoticComponent<LexicalChatInputProps & react.RefAttributes<LexicalChatInputHandle>>;
|
|
186
220
|
|
|
187
|
-
export { $createCommandTokenNode, $isCommandTokenNode, COMMAND_TOKEN_REGEX, ChatComposerCommand, ChatComposerSubmitPayload, CommandProvider, CommandTokenNode, CommandTokenPlugin, type CommandTokenPluginProps, CommandTokenView, type CommandTokenViewProps, type InlineCommandTokenMatch, LexicalChatInput, type LexicalChatInputHandle, type LexicalChatInputProps, type SerializedCommandTokenNode, findInlineCommandTokens };
|
|
221
|
+
export { $createCommandTokenNode, $hydrateFromEncodedText, $isCommandTokenNode, COMMAND_TOKEN_REGEX, ChatComposerCommand, ChatComposerSubmitPayload, CommandProvider, CommandTokenNode, CommandTokenPlugin, type CommandTokenPluginProps, CommandTokenView, type CommandTokenViewProps, type InlineCommandTokenMatch, LexicalChatInput, type LexicalChatInputHandle, type LexicalChatInputProps, type ResolveTokenLabel, type SerializedCommandTokenNode, findInlineCommandTokens };
|
package/dist/composer/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{d as $createCommandTokenNode,e as $isCommandTokenNode,f as COMMAND_TOKEN_REGEX,c as CommandTokenNode,h as CommandTokenPlugin,b as CommandTokenView,
|
|
1
|
+
export{d as $createCommandTokenNode,i as $hydrateFromEncodedText,e as $isCommandTokenNode,f as COMMAND_TOKEN_REGEX,c as CommandTokenNode,h as CommandTokenPlugin,b as CommandTokenView,j as LexicalChatInput,g as findInlineCommandTokens}from'../chunk-BINTGT2Q.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { C as ChatMessage, P as ParticipantRole } from '../message-
|
|
4
|
-
import {
|
|
3
|
+
import { C as ChatMessage, P as ParticipantRole } from '../message-DTNTKSQr.js';
|
|
4
|
+
import { g as VisualizationActionEvent } from '../streaming-BfLEgW5u.js';
|
|
5
5
|
|
|
6
6
|
interface ChatContextValue {
|
|
7
7
|
/** List of messages in the conversation */
|
|
@@ -31,6 +31,12 @@ interface ChatContextValue {
|
|
|
31
31
|
label?: string;
|
|
32
32
|
tag?: ReactNode;
|
|
33
33
|
} | undefined;
|
|
34
|
+
/** Whether the surface hosting the chat is dark. Drives choices that CSS
|
|
35
|
+
* variables can't express, such as which syntax-highlighting theme a code
|
|
36
|
+
* block uses. The host app must supply this: chat-ui is themed through
|
|
37
|
+
* `--chat-*` variables and the `.dark` class is NOT applied by every
|
|
38
|
+
* consumer, so neither is a reliable signal. Defaults to false (light). */
|
|
39
|
+
isDarkSurface: boolean;
|
|
34
40
|
}
|
|
35
41
|
declare const ChatContext: react.Context<ChatContextValue | null>;
|
|
36
42
|
interface ChatProviderProps {
|
|
@@ -48,8 +54,9 @@ interface ChatProviderProps {
|
|
|
48
54
|
label?: string;
|
|
49
55
|
tag?: ReactNode;
|
|
50
56
|
} | undefined;
|
|
57
|
+
isDarkSurface?: boolean;
|
|
51
58
|
}
|
|
52
|
-
declare function ChatProvider({ children, messages, isStreaming, streamingMessageId, viewerRole, onSendMessage, onStopStreaming, onRetryLastMessage, customData, onVisualizationAction, resolveCommandToken, }: ChatProviderProps): react.JSX.Element;
|
|
59
|
+
declare function ChatProvider({ children, messages, isStreaming, streamingMessageId, viewerRole, onSendMessage, onStopStreaming, onRetryLastMessage, customData, onVisualizationAction, resolveCommandToken, isDarkSurface, }: ChatProviderProps): react.JSX.Element;
|
|
53
60
|
declare function useChatContext(): ChatContextValue;
|
|
54
61
|
|
|
55
62
|
export { ChatContext, type ChatContextValue, ChatProvider, type ChatProviderProps, useChatContext };
|
package/dist/context/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as ChatContext,b as ChatProvider,c as useChatContext}from'../chunk-
|
|
1
|
+
export{a as ChatContext,b as ChatProvider,c as useChatContext}from'../chunk-HNHLLH6W.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,146 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
export { U as UseAutoScrollOptions, a as UseAutoScrollReturn, u as useAttachments, b as useAutoScroll, c as useBrandingCSSVars, d as useMessageComposer, e as useScrollLock, f as useStreaming } from '../use-branding-css-vars-CR2tjSV8.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../streaming-BfLEgW5u.js';
|
|
4
|
+
import '../branding-NieTEGQf.js';
|
|
5
5
|
|
|
6
|
-
interface UseAutoScrollOptions {
|
|
7
|
-
/** Whether auto-scroll is enabled */
|
|
8
|
-
enabled?: boolean;
|
|
9
|
-
/** Smooth scroll behavior */
|
|
10
|
-
smooth?: boolean;
|
|
11
|
-
/** Scroll to bottom when component mounts */
|
|
12
|
-
scrollToBottomOnMount?: boolean;
|
|
13
|
-
}
|
|
14
|
-
interface UseAutoScrollReturn<T extends HTMLElement> {
|
|
15
|
-
/** Ref to attach to the scrollable container */
|
|
16
|
-
containerRef: React.RefObject<T | null>;
|
|
17
|
-
/** Scroll to bottom programmatically (always forces scroll) */
|
|
18
|
-
scrollToBottom: (behavior?: ScrollBehavior) => void;
|
|
19
|
-
/** Whether the viewport is currently at the bottom */
|
|
20
|
-
isAtBottom: boolean;
|
|
21
|
-
}
|
|
22
6
|
/**
|
|
23
|
-
*
|
|
24
|
-
* when new content is added, unless the user has scrolled up.
|
|
7
|
+
* Whether the viewer has asked for reduced motion.
|
|
25
8
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* persists scroll behavior across content resize to prevent
|
|
31
|
-
* the "content outraces scroll" bug.
|
|
32
|
-
*/
|
|
33
|
-
declare function useAutoScroll<T extends HTMLElement>({ enabled, smooth, scrollToBottomOnMount, }?: UseAutoScrollOptions): UseAutoScrollReturn<T>;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Locks scroll position during collapsible/height animations.
|
|
37
|
-
*
|
|
38
|
-
* Prevents viewport jumps when content height changes during animations
|
|
39
|
-
* (e.g. ReasoningPanel expand/collapse). Finds the nearest scrollable
|
|
40
|
-
* ancestor and temporarily locks its scroll position for the animation duration.
|
|
41
|
-
*
|
|
42
|
-
* Adapted from assistant-ui's useScrollLock.
|
|
43
|
-
*
|
|
44
|
-
* @param animatedElementRef - Ref to the animated element
|
|
45
|
-
* @param animationDuration - Lock duration in milliseconds
|
|
46
|
-
* @returns Function to activate the scroll lock (call before toggling)
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```tsx
|
|
50
|
-
* const panelRef = useRef<HTMLDivElement>(null);
|
|
51
|
-
* const lockScroll = useScrollLock(panelRef, 200);
|
|
52
|
-
*
|
|
53
|
-
* const handleToggle = () => {
|
|
54
|
-
* lockScroll();
|
|
55
|
-
* setIsExpanded(!isExpanded);
|
|
56
|
-
* };
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
declare function useScrollLock<T extends HTMLElement = HTMLElement>(animatedElementRef: RefObject<T | null>, animationDuration: number): () => void;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Hook to manage streaming message state.
|
|
63
|
-
*/
|
|
64
|
-
declare function useStreaming(options?: StreamingOptions): {
|
|
65
|
-
startStreaming: (messageId: string) => void;
|
|
66
|
-
appendContent: (chunk: StreamChunk) => void;
|
|
67
|
-
stopStreaming: () => void;
|
|
68
|
-
handleError: (error: Error) => void;
|
|
69
|
-
abortSignal: AbortSignal | undefined;
|
|
70
|
-
isStreaming: boolean;
|
|
71
|
-
streamingMessageId: string | null;
|
|
72
|
-
streamedContent: string;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
interface UseMessageComposerOptions {
|
|
76
|
-
/** Callback when message is submitted */
|
|
77
|
-
onSubmit: (content: string, attachments?: File[]) => Promise<void>;
|
|
78
|
-
/** Whether submission is disabled */
|
|
79
|
-
disabled?: boolean;
|
|
80
|
-
/** Maximum file size in bytes */
|
|
81
|
-
maxFileSize?: number;
|
|
82
|
-
/** Allowed file types (MIME types) */
|
|
83
|
-
allowedFileTypes?: string[];
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Hook to manage message composer state and behavior.
|
|
87
|
-
*/
|
|
88
|
-
declare function useMessageComposer({ onSubmit, disabled, maxFileSize, // 10MB
|
|
89
|
-
allowedFileTypes, }: UseMessageComposerOptions): {
|
|
90
|
-
content: string;
|
|
91
|
-
attachments: File[];
|
|
92
|
-
isSubmitting: boolean;
|
|
93
|
-
error: string | null;
|
|
94
|
-
canSubmit: boolean | "";
|
|
95
|
-
inputRef: react.RefObject<HTMLTextAreaElement | null>;
|
|
96
|
-
handleContentChange: (value: string) => void;
|
|
97
|
-
handleAddAttachment: (files: FileList | File[]) => void;
|
|
98
|
-
handleRemoveAttachment: (index: number) => void;
|
|
99
|
-
handleSubmit: () => Promise<void>;
|
|
100
|
-
handleKeyDown: (e: KeyboardEvent<HTMLTextAreaElement>) => void;
|
|
101
|
-
clear: () => void;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
interface AttachmentState {
|
|
105
|
-
file: File;
|
|
106
|
-
id: string;
|
|
107
|
-
progress: number;
|
|
108
|
-
status: "pending" | "uploading" | "complete" | "error";
|
|
109
|
-
error?: string;
|
|
110
|
-
url?: string;
|
|
111
|
-
}
|
|
112
|
-
interface UseAttachmentsOptions {
|
|
113
|
-
/** Maximum number of attachments */
|
|
114
|
-
maxCount?: number;
|
|
115
|
-
/** Maximum file size in bytes */
|
|
116
|
-
maxFileSize?: number;
|
|
117
|
-
/** Allowed MIME types */
|
|
118
|
-
allowedTypes?: string[];
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Hook to manage file attachments with upload progress.
|
|
122
|
-
*/
|
|
123
|
-
declare function useAttachments({ maxCount, maxFileSize, allowedTypes, }?: UseAttachmentsOptions): {
|
|
124
|
-
attachments: AttachmentState[];
|
|
125
|
-
addAttachment: (file: File) => {
|
|
126
|
-
success: boolean;
|
|
127
|
-
error?: string;
|
|
128
|
-
};
|
|
129
|
-
removeAttachment: (id: string) => void;
|
|
130
|
-
updateProgress: (id: string, progress: number) => void;
|
|
131
|
-
setError: (id: string, error: string) => void;
|
|
132
|
-
setUrl: (id: string, url: string) => void;
|
|
133
|
-
clear: () => void;
|
|
134
|
-
getFiles: () => File[];
|
|
135
|
-
canAddMore: boolean;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Converts BrandingData into CSS custom properties for chat-ui theming.
|
|
140
|
-
* Returns a CSSProperties object that can be spread onto a container element.
|
|
9
|
+
* The reasoning stream drives shimmer, a live meter and a blinking caret from
|
|
10
|
+
* inline `animation` declarations, and a media query cannot override an inline
|
|
11
|
+
* style — so the decision has to be made in JS and the effect simply not
|
|
12
|
+
* applied. Starts `false` so server rendering and the first client paint agree.
|
|
141
13
|
*/
|
|
142
|
-
declare function
|
|
143
|
-
iconColor?: string;
|
|
144
|
-
}): React.CSSProperties;
|
|
14
|
+
declare function usePrefersReducedMotion(): boolean;
|
|
145
15
|
|
|
146
|
-
export {
|
|
16
|
+
export { usePrefersReducedMotion };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as useAttachments,a as useStreaming}from'../chunk-
|
|
1
|
+
export{b as useAttachments,a as useStreaming}from'../chunk-ISMTV5BU.js';export{b as usePrefersReducedMotion,a as useScrollLock}from'../chunk-OU5ITGKX.js';export{a as useAutoScroll,b as useMessageComposer}from'../chunk-LDTAZ4GT.js';export{b as useBrandingCSSVars}from'../chunk-QECTWT2H.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { A as Attachment, C as ChatMessage, M as MessageData, a as MessageError, b as Participant, P as ParticipantRole, R as ReasoningChunk, S as SourceReference, c as SourceTypeConfig, d as SuggestedAction, e as SuggestedActionType } from './message-
|
|
2
|
-
export { a as ClarificationAnswer, C as ClarificationData, b as ClarificationQuestion, c as StreamChunk, d as StreamingOptions, e as StreamingState } from './streaming-
|
|
1
|
+
export { A as Attachment, C as ChatMessage, M as MessageData, a as MessageError, b as Participant, P as ParticipantRole, R as ReasoningChunk, S as SourceReference, c as SourceTypeConfig, d as SuggestedAction, e as SuggestedActionType } from './message-DTNTKSQr.js';
|
|
2
|
+
export { a as ClarificationAnswer, C as ClarificationData, b as ClarificationQuestion, c as StreamChunk, d as StreamingOptions, e as StreamingState } from './streaming-BfLEgW5u.js';
|
|
3
3
|
export { B as BrandingData } from './branding-NieTEGQf.js';
|
|
4
4
|
export { ChatContext, ChatContextValue, ChatProvider, ChatProviderProps, useChatContext } from './context/index.js';
|
|
5
|
-
export { useAttachments, useAutoScroll, useBrandingCSSVars, useMessageComposer, useScrollLock, useStreaming } from './
|
|
6
|
-
export { A as AvatarPrimitive, C as ComposerContext, a as ComposerInput, b as ComposerSubmit, M as MessageComposerPrimitive, c as MessageContentPrimitive, d as MessageContext, e as MessagePrimitive, f as MessageTimestampPrimitive, u as useComposer, g as useMessage } from './avatar-
|
|
5
|
+
export { u as useAttachments, b as useAutoScroll, c as useBrandingCSSVars, d as useMessageComposer, e as useScrollLock, f as useStreaming } from './use-branding-css-vars-CR2tjSV8.js';
|
|
6
|
+
export { A as AvatarPrimitive, C as ComposerContext, a as ComposerInput, b as ComposerSubmit, M as MessageComposerPrimitive, c as MessageContentPrimitive, d as MessageContext, e as MessagePrimitive, f as MessageTimestampPrimitive, u as useComposer, g as useMessage } from './avatar-B_AvYfE8.js';
|
|
7
7
|
export { ActionButton, MessageList as MessageListPrimitive, StreamingText as StreamingTextPrimitive, SuggestedActionsContext, SuggestedActions as SuggestedActionsPrimitive, TypingIndicator as TypingIndicatorPrimitive, useSuggestedActions } from './primitives/index.js';
|
|
8
|
-
export { A as AttachmentPreview, a as Avatar, C as ChatContainer, b as ChatLayout, M as MarkdownContent, c as Message, d as MessageActionBar, e as MessageComposer, f as MessageList, S as ScrollToBottomButton, g as StreamingText, h as SuggestedActions, T as ToolStatusIndicator, i as TypingIndicator, W as WelcomeScreen } from './WelcomeScreen-
|
|
8
|
+
export { A as AttachmentPreview, a as Avatar, C as ChatContainer, b as ChatLayout, M as MarkdownContent, c as Message, d as MessageActionBar, e as MessageComposer, f as MessageList, S as ScrollToBottomButton, g as StreamingText, h as SuggestedActions, T as ToolStatusIndicator, i as TypingIndicator, W as WelcomeScreen } from './WelcomeScreen-CSzlU0Yx.js';
|
|
9
9
|
import { ClassValue } from 'clsx';
|
|
10
10
|
import 'react';
|
|
11
11
|
import './types-Du00UBst.js';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as AttachmentPreview,b as Avatar,c as ChatContainer,
|
|
1
|
+
export{a as AttachmentPreview,b as Avatar,c as ChatContainer,xa as ChatLayout,f as MarkdownContent,fa as Message,n as MessageActionBar,ga as MessageComposer,ia as MessageList,ha as ScrollToBottomButton,H as StreamingText,I as SuggestedActions,wa as ToolStatusIndicator,ka as TypingIndicator,ya as WelcomeScreen,ea as parseContentWithInlineMarkers}from'./chunk-W7HQXA2Z.js';export{q as ActionButton,l as AvatarPrimitive,g as ComposerContext,j as ComposerInput,k as ComposerSubmit,i as MessageComposerPrimitive,d as MessageContentPrimitive,a as MessageContext,f as MessageListPrimitive,c as MessagePrimitive,e as MessageTimestampPrimitive,m as StreamingTextPrimitive,n as SuggestedActionsContext,p as SuggestedActionsPrimitive,r as TypingIndicatorPrimitive,h as useComposer,b as useMessage,o as useSuggestedActions}from'./chunk-7QNDCHY7.js';export{b as useAttachments,a as useStreaming}from'./chunk-ISMTV5BU.js';export{a as useScrollLock}from'./chunk-OU5ITGKX.js';export{a as useAutoScroll,b as useMessageComposer}from'./chunk-LDTAZ4GT.js';export{a as ChatContext,b as ChatProvider,c as useChatContext}from'./chunk-HNHLLH6W.js';export{a as chatTokens}from'./chunk-NG4HKXYB.js';export{a as getContrastTextColor,b as useBrandingCSSVars}from'./chunk-QECTWT2H.js';export{a as cn}from'./chunk-BINTGT2Q.js';var i={hour:"numeric",minute:"2-digit",hour12:true},m={month:"short",day:"numeric"},se={...m,year:"numeric",...i};function c(t){let e=typeof t=="string"?new Date(t):t,o=new Date;return e.getDate()===o.getDate()&&e.getMonth()===o.getMonth()&&e.getFullYear()===o.getFullYear()?e.toLocaleTimeString("en-US",i):e.getFullYear()===o.getFullYear()?`${e.toLocaleDateString("en-US",m)}, ${e.toLocaleTimeString("en-US",i)}`:e.toLocaleDateString("en-US",se)}function re(t){let e=typeof t=="string"?new Date(t):t,g=new Date().getTime()-e.getTime(),n=Math.floor(g/1e3),s=Math.floor(n/60),r=Math.floor(s/60),a=Math.floor(r/24);return n<60?"just now":s<60?`${s} minute${s===1?"":"s"} ago`:r<24?`${r} hour${r===1?"":"s"} ago`:a<7?`${a} day${a===1?"":"s"} ago`:c(e)}export{c as formatMessageTime,re as formatRelativeTime};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/format-date.ts"],"names":["TIME_FORMAT","DATE_FORMAT","FULL_FORMAT","formatMessageTime","date","d","now","formatRelativeTime","diffMs","diffSeconds","diffMinutes","diffHours","diffDays"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/utils/format-date.ts"],"names":["TIME_FORMAT","DATE_FORMAT","FULL_FORMAT","formatMessageTime","date","d","now","formatRelativeTime","diffMs","diffSeconds","diffMinutes","diffHours","diffDays"],"mappings":"mxCAIA,IAAMA,EAA0C,CAC9C,IAAA,CAAM,UACN,MAAA,CAAQ,SAAA,CACR,OAAQ,IACV,CAAA,CAEMC,CAAAA,CAA0C,CAC9C,MAAO,OAAA,CACP,GAAA,CAAK,SACP,CAAA,CAEMC,EAAAA,CAA0C,CAC9C,GAAGD,CAAAA,CACH,IAAA,CAAM,SAAA,CACN,GAAGD,CACL,CAAA,CAQO,SAASG,CAAAA,CAAkBC,CAAAA,CAA6B,CAC7D,IAAMC,CAAAA,CAAI,OAAOD,CAAAA,EAAS,SAAW,IAAI,IAAA,CAAKA,CAAI,CAAA,CAAIA,CAAAA,CAChDE,EAAM,IAAI,IAAA,CAOhB,OAJED,CAAAA,CAAE,SAAQ,GAAMC,CAAAA,CAAI,SAAQ,EAC5BD,CAAAA,CAAE,UAAS,GAAMC,CAAAA,CAAI,QAAA,EAAS,EAC9BD,EAAE,WAAA,EAAY,GAAMC,EAAI,WAAA,EAAY,CAG7BD,EAAE,kBAAA,CAAmB,OAAA,CAASL,CAAW,CAAA,CAG/BK,EAAE,WAAA,EAAY,GAAMC,EAAI,WAAA,EAAY,CAG9C,GAAGD,CAAAA,CAAE,kBAAA,CAAmB,QAASJ,CAAW,CAAC,KAAKI,CAAAA,CAAE,kBAAA,CAAmB,QAASL,CAAW,CAAC,GAG9FK,CAAAA,CAAE,kBAAA,CAAmB,OAAA,CAASH,EAAW,CAClD,CAKO,SAASK,GAAmBH,CAAAA,CAA6B,CAC9D,IAAMC,CAAAA,CAAI,OAAOD,CAAAA,EAAS,QAAA,CAAW,IAAI,IAAA,CAAKA,CAAI,EAAIA,CAAAA,CAEhDI,CAAAA,CADM,IAAI,IAAA,EAAK,CACF,OAAA,EAAQ,CAAIH,EAAE,OAAA,EAAQ,CACnCI,EAAc,IAAA,CAAK,KAAA,CAAMD,EAAS,GAAI,CAAA,CACtCE,CAAAA,CAAc,IAAA,CAAK,MAAMD,CAAAA,CAAc,EAAE,EACzCE,CAAAA,CAAY,IAAA,CAAK,MAAMD,CAAAA,CAAc,EAAE,CAAA,CACvCE,CAAAA,CAAW,KAAK,KAAA,CAAMD,CAAAA,CAAY,EAAE,CAAA,CAE1C,OAAIF,EAAc,EAAA,CACT,UAAA,CAGLC,CAAAA,CAAc,EAAA,CACT,GAAGA,CAAW,CAAA,OAAA,EAAUA,IAAgB,CAAA,CAAI,EAAA,CAAK,GAAG,CAAA,IAAA,CAAA,CAGzDC,CAAAA,CAAY,EAAA,CACP,CAAA,EAAGA,CAAS,CAAA,KAAA,EAAQA,CAAAA,GAAc,EAAI,EAAA,CAAK,GAAG,OAGnDC,CAAAA,CAAW,CAAA,CACN,GAAGA,CAAQ,CAAA,IAAA,EAAOA,IAAa,CAAA,CAAI,EAAA,CAAK,GAAG,CAAA,IAAA,CAAA,CAG7CT,CAAAA,CAAkBE,CAAC,CAC5B","file":"index.js","sourcesContent":["/**\n * Format a date for display in chat messages.\n */\n\nconst TIME_FORMAT: Intl.DateTimeFormatOptions = {\n hour: \"numeric\",\n minute: \"2-digit\",\n hour12: true,\n};\n\nconst DATE_FORMAT: Intl.DateTimeFormatOptions = {\n month: \"short\",\n day: \"numeric\",\n};\n\nconst FULL_FORMAT: Intl.DateTimeFormatOptions = {\n ...DATE_FORMAT,\n year: \"numeric\",\n ...TIME_FORMAT,\n};\n\n/**\n * Format a timestamp for display.\n * - Today: \"2:30 PM\"\n * - This year: \"Dec 15, 2:30 PM\"\n * - Other years: \"Dec 15, 2024, 2:30 PM\"\n */\nexport function formatMessageTime(date: Date | string): string {\n const d = typeof date === \"string\" ? new Date(date) : date;\n const now = new Date();\n\n const isToday =\n d.getDate() === now.getDate() &&\n d.getMonth() === now.getMonth() &&\n d.getFullYear() === now.getFullYear();\n\n if (isToday) {\n return d.toLocaleTimeString(\"en-US\", TIME_FORMAT);\n }\n\n const isThisYear = d.getFullYear() === now.getFullYear();\n\n if (isThisYear) {\n return `${d.toLocaleDateString(\"en-US\", DATE_FORMAT)}, ${d.toLocaleTimeString(\"en-US\", TIME_FORMAT)}`;\n }\n\n return d.toLocaleDateString(\"en-US\", FULL_FORMAT);\n}\n\n/**\n * Format a relative time (e.g., \"2 minutes ago\").\n */\nexport function formatRelativeTime(date: Date | string): string {\n const d = typeof date === \"string\" ? new Date(date) : date;\n const now = new Date();\n const diffMs = now.getTime() - d.getTime();\n const diffSeconds = Math.floor(diffMs / 1000);\n const diffMinutes = Math.floor(diffSeconds / 60);\n const diffHours = Math.floor(diffMinutes / 60);\n const diffDays = Math.floor(diffHours / 24);\n\n if (diffSeconds < 60) {\n return \"just now\";\n }\n\n if (diffMinutes < 60) {\n return `${diffMinutes} minute${diffMinutes === 1 ? \"\" : \"s\"} ago`;\n }\n\n if (diffHours < 24) {\n return `${diffHours} hour${diffHours === 1 ? \"\" : \"s\"} ago`;\n }\n\n if (diffDays < 7) {\n return `${diffDays} day${diffDays === 1 ? \"\" : \"s\"} ago`;\n }\n\n return formatMessageTime(d);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as StreamingChunk, C as ClarificationData, T as ToolApprovalData, M as MediaChunkData, A as ArtifactChunkData } from './streaming-
|
|
1
|
+
import { S as StreamingChunk, C as ClarificationData, T as ToolApprovalData, M as MediaChunkData, A as ArtifactChunkData } from './streaming-BfLEgW5u.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Citation source types for AI-generated content.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { A as Avatar, h as AvatarProps, C as ComposerContext, a as ComposerInput, i as ComposerInputProps, b as ComposerSubmit, j as ComposerSubmitProps, e as Message, M as MessageComposer, k as MessageComposerProps, c as MessageContent, l as MessageContentProps, d as MessageContext, m as MessageProps, f as MessageTimestamp, n as MessageTimestampProps, u as useComposer, g as useMessage } from '../avatar-
|
|
1
|
+
export { A as Avatar, h as AvatarProps, C as ComposerContext, a as ComposerInput, i as ComposerInputProps, b as ComposerSubmit, j as ComposerSubmitProps, e as Message, M as MessageComposer, k as MessageComposerProps, c as MessageContent, l as MessageContentProps, d as MessageContext, m as MessageProps, f as MessageTimestamp, n as MessageTimestampProps, u as useComposer, g as useMessage } from '../avatar-B_AvYfE8.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { HTMLAttributes, ReactNode, ButtonHTMLAttributes } from 'react';
|
|
4
|
-
import { d as SuggestedAction } from '../message-
|
|
5
|
-
import '../streaming-
|
|
4
|
+
import { d as SuggestedAction } from '../message-DTNTKSQr.js';
|
|
5
|
+
import '../streaming-BfLEgW5u.js';
|
|
6
6
|
|
|
7
7
|
interface MessageListProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
8
|
/** Messages to render */
|
package/dist/primitives/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{q as ActionButton,l as Avatar,g as ComposerContext,j as ComposerInput,k as ComposerSubmit,c as Message,i as MessageComposer,d as MessageContent,a as MessageContext,f as MessageList,e as MessageTimestamp,m as StreamingText,p as SuggestedActions,n as SuggestedActionsContext,r as TypingIndicator,h as useComposer,b as useMessage,o as useSuggestedActions}from'../chunk-
|
|
1
|
+
export{q as ActionButton,l as Avatar,g as ComposerContext,j as ComposerInput,k as ComposerSubmit,c as Message,i as MessageComposer,d as MessageContent,a as MessageContext,f as MessageList,e as MessageTimestamp,m as StreamingText,p as SuggestedActions,n as SuggestedActionsContext,r as TypingIndicator,h as useComposer,b as useMessage,o as useSuggestedActions}from'../chunk-7QNDCHY7.js';import'../chunk-LDTAZ4GT.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -69,6 +69,24 @@ interface SubagentChunkData {
|
|
|
69
69
|
result?: string;
|
|
70
70
|
durationMs?: number;
|
|
71
71
|
nestedChunks: StreamingChunk[];
|
|
72
|
+
/**
|
|
73
|
+
* The parent ReAct step this dispatch was launched from.
|
|
74
|
+
*
|
|
75
|
+
* `dispatch_assistant` is parallelizable, so one step can gather several
|
|
76
|
+
* children. Specialists sharing this value genuinely ran concurrently and are
|
|
77
|
+
* rendered as one group; different values ran at different times and stay
|
|
78
|
+
* separate steps. Undefined on runs that predate the field — those never
|
|
79
|
+
* group, which is the safe direction: showing two sequential dispatches as
|
|
80
|
+
* concurrent would be a claim the data does not support.
|
|
81
|
+
*/
|
|
82
|
+
dispatchStep?: number;
|
|
83
|
+
/**
|
|
84
|
+
* The sub-agent was handed the turn and answered the user directly, so its
|
|
85
|
+
* reply is the message body rather than this panel's `result` (which stays
|
|
86
|
+
* empty). The panel still shows the sub-agent's tool work; consumers use
|
|
87
|
+
* this to attribute the answer instead of rendering a duplicate result.
|
|
88
|
+
*/
|
|
89
|
+
transferred?: boolean;
|
|
72
90
|
}
|
|
73
91
|
interface ClarificationQuestion {
|
|
74
92
|
question: string;
|
|
@@ -138,7 +156,7 @@ interface ToolApprovalData {
|
|
|
138
156
|
*/
|
|
139
157
|
preview?: unknown;
|
|
140
158
|
}
|
|
141
|
-
type VisualizationType = "chart" | "table" | "card" | "kpi" | "code_preview" | "form";
|
|
159
|
+
type VisualizationType = "chart" | "table" | "card" | "kpi" | "code_preview" | "form" | "auth_prompt";
|
|
142
160
|
type ChartDataType = "line" | "bar" | "pie" | "area" | "scatter" | "composed";
|
|
143
161
|
interface ChartSeries {
|
|
144
162
|
name: string;
|
|
@@ -239,6 +257,28 @@ interface FormVisualizationData {
|
|
|
239
257
|
fields: FormField[];
|
|
240
258
|
submitAction?: string;
|
|
241
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* An integration the assistant could not use because the viewer hasn't
|
|
262
|
+
* authorized it. Either a first-party provider (`serviceProviderId`) or an
|
|
263
|
+
* OAuth-protected MCP server (`mcpServerId`).
|
|
264
|
+
*
|
|
265
|
+
* The package renders this; it never performs the OAuth flow, which needs the
|
|
266
|
+
* host app's session and mutations. Hosts wire the button through `onAction`.
|
|
267
|
+
*/
|
|
268
|
+
interface AuthPromptVisualizationData {
|
|
269
|
+
providerName: string;
|
|
270
|
+
reason?: string;
|
|
271
|
+
provider?: string;
|
|
272
|
+
providerLogo?: string;
|
|
273
|
+
serviceProviderId?: string;
|
|
274
|
+
mcpServerId?: string;
|
|
275
|
+
mcpServerName?: string;
|
|
276
|
+
authMethods?: Array<{
|
|
277
|
+
id: string;
|
|
278
|
+
name: string;
|
|
279
|
+
authType: string;
|
|
280
|
+
}>;
|
|
281
|
+
}
|
|
242
282
|
interface VisualizationConfig {
|
|
243
283
|
height?: number;
|
|
244
284
|
width?: string;
|
|
@@ -264,7 +304,7 @@ interface VisualizationData {
|
|
|
264
304
|
type: VisualizationType | (string & {});
|
|
265
305
|
title?: string;
|
|
266
306
|
description?: string;
|
|
267
|
-
data: ChartVisualizationData | TableVisualizationData | CardVisualizationData | KpiVisualizationData | CodePreviewVisualizationData | FormVisualizationData | Record<string, unknown>;
|
|
307
|
+
data: ChartVisualizationData | TableVisualizationData | CardVisualizationData | KpiVisualizationData | CodePreviewVisualizationData | FormVisualizationData | AuthPromptVisualizationData | Record<string, unknown>;
|
|
268
308
|
config?: VisualizationConfig;
|
|
269
309
|
}
|
|
270
310
|
interface VisualizationChunkData extends VisualizationData {
|
|
@@ -323,10 +363,37 @@ interface StreamingChunk {
|
|
|
323
363
|
type: ChunkType;
|
|
324
364
|
content: string;
|
|
325
365
|
toolName?: string;
|
|
366
|
+
/** Provider tool-call id — correlates this row with its observation frame
|
|
367
|
+
* when a turn runs several calls of the same tool in parallel. */
|
|
368
|
+
toolCallId?: string;
|
|
326
369
|
toolDescription?: string;
|
|
327
370
|
toolArgs?: Record<string, unknown>;
|
|
328
371
|
success?: boolean;
|
|
329
372
|
status?: "planned" | "executing" | "completed";
|
|
373
|
+
/**
|
|
374
|
+
* Whether this tool changes the customer's account, as DECLARED server-side
|
|
375
|
+
* (`writes` on the tool's schema, required and audit-gated). `undefined`
|
|
376
|
+
* means the tool declared neither — render that as unknown, never as a read.
|
|
377
|
+
*
|
|
378
|
+
* The renderer must not re-derive this from the tool name: the name-shape
|
|
379
|
+
* guess lives in `audit/checker.py` as a deliberate fallback whose default is
|
|
380
|
+
* "assume write", and a second copy on the presentation side would drift and
|
|
381
|
+
* mislabel a mutation as harmless in the one place a human is watching.
|
|
382
|
+
*/
|
|
383
|
+
toolWrites?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* When this chunk's work began / ended, as epoch ms.
|
|
386
|
+
*
|
|
387
|
+
* Three producers fill these and they must agree on the unit: the live
|
|
388
|
+
* reducers derive them from the SSE frame's `ts` (float seconds, ×1000),
|
|
389
|
+
* falling back to arrival time on a server that predates that field; the
|
|
390
|
+
* canonical replay maps the run trace's `started_at` / `completed_at`.
|
|
391
|
+
*
|
|
392
|
+
* `endedAt` stays undefined while the chunk is still open, which is what
|
|
393
|
+
* makes a step render as running rather than as a zero-length one.
|
|
394
|
+
*/
|
|
395
|
+
startedAt?: number;
|
|
396
|
+
endedAt?: number;
|
|
330
397
|
subtaskId?: number;
|
|
331
398
|
sequence?: number;
|
|
332
399
|
subtaskData?: SubTaskData;
|
|
@@ -435,6 +502,17 @@ type VisualizationActionEvent = {
|
|
|
435
502
|
} | {
|
|
436
503
|
type: "card_action";
|
|
437
504
|
action: string;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* The viewer asked to connect an integration from an `auth_prompt`. The
|
|
508
|
+
* package cannot run OAuth, so it reports intent and the host drives the
|
|
509
|
+
* flow (`connectMcpServer` / `startOauthFlow`).
|
|
510
|
+
*/
|
|
511
|
+
| {
|
|
512
|
+
type: "auth_connect";
|
|
513
|
+
providerName: string;
|
|
514
|
+
mcpServerId?: string;
|
|
515
|
+
serviceProviderId?: string;
|
|
438
516
|
};
|
|
439
517
|
|
|
440
|
-
export type { ArtifactChunkData as A, ClarificationData as C, Event as E, FormVisualizationData as F, KpiVisualizationData as K, MediaChunkData as M, ObservationEvent as O, PlanData as P, StreamingChunk as S, ToolApprovalData as T, VisualizationChunkData as V, ClarificationAnswer as a, ClarificationQuestion as b, StreamChunk as c, StreamingOptions as d, StreamingState as e,
|
|
518
|
+
export type { ArtifactChunkData as A, ClarificationData as C, Event as E, FormVisualizationData as F, KpiVisualizationData as K, MediaChunkData as M, ObservationEvent as O, PlanData as P, StreamingChunk as S, ToolApprovalData as T, VisualizationChunkData as V, ClarificationAnswer as a, ClarificationQuestion as b, StreamChunk as c, StreamingOptions as d, StreamingState as e, SubagentChunkData as f, VisualizationActionEvent as g, ChartVisualizationData as h, VisualizationConfig as i, TableVisualizationData as j, CardVisualizationData as k, CodePreviewVisualizationData as l, AuthPromptVisualizationData as m, EventStatus as n, ArtifactStatus as o, ChunkType as p, EventType as q, FollowupAction as r, PlanningEvent as s, ProgressData as t, StreamingMessage as u, SubTaskData as v, SubtaskEvent as w, ThinkingEvent as x, ToolEvent as y, VisualizationType as z };
|