@miiflow/assistant-ui 0.7.0 → 0.10.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.
Files changed (44) hide show
  1. package/dist/{WelcomeScreen-XVZqMpVW.d.ts → WelcomeScreen-Cbipi2rK.d.ts} +18 -8
  2. package/dist/{avatar-C13xc3tA.d.ts → avatar-CD685KQV.d.ts} +1 -1
  3. package/dist/branding-NieTEGQf.d.ts +32 -0
  4. package/dist/chunk-NG4HKXYB.js +2 -0
  5. package/dist/chunk-NG4HKXYB.js.map +1 -0
  6. package/dist/chunk-NKLA5PPB.js +2 -0
  7. package/dist/chunk-NKLA5PPB.js.map +1 -0
  8. package/dist/chunk-QECTWT2H.js +2 -0
  9. package/dist/chunk-QECTWT2H.js.map +1 -0
  10. package/dist/chunk-UZ2Z7C43.js +133 -0
  11. package/dist/chunk-UZ2Z7C43.js.map +1 -0
  12. package/dist/chunk-ZP4FGAAH.js +2 -0
  13. package/dist/chunk-ZP4FGAAH.js.map +1 -0
  14. package/dist/client/index.d.ts +41 -4
  15. package/dist/client/index.js +7 -5
  16. package/dist/client/index.js.map +1 -1
  17. package/dist/composer/index.d.ts +187 -0
  18. package/dist/composer/index.js +2 -0
  19. package/dist/composer/index.js.map +1 -0
  20. package/dist/context/index.d.ts +16 -4
  21. package/dist/context/index.js +1 -1
  22. package/dist/hooks/index.d.ts +2 -2
  23. package/dist/hooks/index.js +1 -1
  24. package/dist/index.d.ts +14 -6
  25. package/dist/index.js +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/{message-BrHFdwb2.d.ts → message-D0oMw3tR.d.ts} +1 -1
  28. package/dist/primitives/index.d.ts +3 -3
  29. package/dist/{streaming-DURrv9_E.d.ts → streaming-CmQo_OOA.d.ts} +81 -122
  30. package/dist/styled/index.d.ts +217 -91
  31. package/dist/styled/index.js +1 -1
  32. package/dist/styles-no-preflight.css +1 -1
  33. package/dist/styles.css +1 -1
  34. package/dist/types-Du00UBst.d.ts +48 -0
  35. package/package.json +18 -2
  36. package/dist/branding-SzYU4ncD.d.ts +0 -18
  37. package/dist/chunk-EI3GOLHT.js +0 -128
  38. package/dist/chunk-EI3GOLHT.js.map +0 -1
  39. package/dist/chunk-NSTK5EUQ.js +0 -2
  40. package/dist/chunk-NSTK5EUQ.js.map +0 -1
  41. package/dist/chunk-O2ILSWHS.js +0 -2
  42. package/dist/chunk-O2ILSWHS.js.map +0 -1
  43. package/dist/chunk-OCKHJ4WO.js +0 -2
  44. package/dist/chunk-OCKHJ4WO.js.map +0 -1
@@ -0,0 +1,187 @@
1
+ import { C as CommandProvider, a as ChatComposerCommand, b as ChatComposerSubmitPayload } from '../types-Du00UBst.js';
2
+ export { c as ChatComposerToken } from '../types-Du00UBst.js';
3
+ import { DecoratorNode, NodeKey, Spread, SerializedLexicalNode, DOMExportOutput, DOMConversionMap, LexicalNode } from 'lexical';
4
+ import * as react from 'react';
5
+ import { ReactNode } from 'react';
6
+
7
+ type SerializedCommandTokenNode = Spread<{
8
+ commandId: string;
9
+ commandKind: string;
10
+ commandLabel: string;
11
+ /** Trigger character that produced the chip (e.g. "/" or "@"). Optional in
12
+ * v1 payloads — defaulted to "/" on import for backwards compatibility. */
13
+ commandPrefix?: string;
14
+ type: "command-token";
15
+ version: 1 | 2;
16
+ }, SerializedLexicalNode>;
17
+ declare class CommandTokenNode extends DecoratorNode<ReactNode> {
18
+ __id: string;
19
+ __kind: string;
20
+ __label: string;
21
+ __prefix: string;
22
+ constructor(id: string, kind: string, label: string, prefix?: string, key?: NodeKey);
23
+ static getType(): string;
24
+ static clone(node: CommandTokenNode): CommandTokenNode;
25
+ static importJSON(serialized: SerializedCommandTokenNode): CommandTokenNode;
26
+ exportJSON(): SerializedCommandTokenNode;
27
+ getCommandId(): string;
28
+ getCommandKind(): string;
29
+ getCommandLabel(): string;
30
+ getCommandPrefix(): string;
31
+ /** Wire format. Backend parses `<prefix><id>:<kind>` from the message body. */
32
+ getEncodedText(): string;
33
+ createDOM(): HTMLElement;
34
+ updateDOM(): false;
35
+ exportDOM(): DOMExportOutput;
36
+ static importDOM(): DOMConversionMap | null;
37
+ decorate(): ReactNode;
38
+ isInline(): boolean;
39
+ isKeyboardSelectable(): boolean;
40
+ /** Plain-text projection (clipboard, root.getTextContent, etc.). */
41
+ getTextContent(): string;
42
+ }
43
+ declare function $createCommandTokenNode(id: string, kind: string, label: string, prefix?: string): CommandTokenNode;
44
+ declare function $isCommandTokenNode(node: LexicalNode | null | undefined): node is CommandTokenNode;
45
+ /**
46
+ * Matches `<prefix><id>:<kind>` substrings emitted by `CommandTokenNode.getEncodedText()`,
47
+ * where `<prefix>` is `/` (skill / mode chips) or `@` (ad-account chips).
48
+ *
49
+ * Bounded by start-of-string, whitespace, or an opening bracket on the left,
50
+ * and end-of-string, whitespace, or punctuation on the right — so it doesn't
51
+ * fire on URLs like `https://example.com/path:foo` or emails like
52
+ * `user@host.com:port`.
53
+ *
54
+ * The id capture allows spaces (skill names may have them); the kind capture
55
+ * allows word chars and hyphens (e.g. `ad-account`).
56
+ */
57
+ declare const COMMAND_TOKEN_REGEX: RegExp;
58
+ interface InlineCommandTokenMatch {
59
+ id: string;
60
+ kind: string;
61
+ /** Trigger character that introduced the chip (`/` or `@`). */
62
+ prefix: string;
63
+ /** The full matched substring including the leading prefix (no leading boundary). */
64
+ raw: string;
65
+ /** Index in the original string where the leading prefix sits. */
66
+ index: number;
67
+ /** End index (exclusive) of the matched token. */
68
+ endIndex: number;
69
+ }
70
+ /**
71
+ * Find all `<prefix><id>:<kind>` tokens in a plain-text string.
72
+ *
73
+ * Returns matches in document order. Use this when rendering message
74
+ * history to replace token substrings with a visual chip.
75
+ */
76
+ declare function findInlineCommandTokens(text: string): InlineCommandTokenMatch[];
77
+
78
+ interface CommandTokenPluginProps {
79
+ /** The data source for the typeahead. When null, the plugin is inert. */
80
+ commandProvider?: CommandProvider | null;
81
+ /**
82
+ * Optional override for the typeahead UI. When supplied, replaces the
83
+ * default Tailwind popover (use this to render an MUI/host-themed menu).
84
+ */
85
+ menuRenderer?: (params: {
86
+ anchorElement: HTMLElement | null;
87
+ options: ChatComposerCommand[];
88
+ selectedIndex: number;
89
+ setSelectedIndex: (index: number) => void;
90
+ selectOption: (option: ChatComposerCommand) => void;
91
+ closeMenu: () => void;
92
+ }) => React.ReactNode;
93
+ /**
94
+ * Notified whenever the typeahead menu opens or closes. Use this to gate
95
+ * keyboard handlers (e.g. don't submit on Enter while the menu is open).
96
+ */
97
+ onMenuStateChange?: (isOpen: boolean) => void;
98
+ }
99
+ declare function CommandTokenPlugin({ commandProvider, menuRenderer, onMenuStateChange, }: CommandTokenPluginProps): React.JSX.Element | null;
100
+
101
+ /**
102
+ * Single source of truth for slash-command token visuals.
103
+ *
104
+ * Used in three places:
105
+ * - Typeahead popover row (variant="row")
106
+ * - Inline chip in the editor (variant="chip", inside CommandTokenNode.decorate)
107
+ * - Inline chip in message history (variant="chip", inside MarkdownContent)
108
+ *
109
+ * Renders a kind tag + label so the user gets the same visual identity at
110
+ * every step: pick → type → send → re-read. Adapts to the surrounding text
111
+ * color via `currentColor` so it survives light bubbles, dark bubbles, and
112
+ * any branded chat surface without bespoke palettes.
113
+ */
114
+ interface CommandTokenViewProps {
115
+ /** Slug-style id (wire format `/<id>:<kind>`). */
116
+ id: string;
117
+ /** Token category, e.g. "skill", "mode". Rendered as the leading tag. */
118
+ kind: string;
119
+ /** Display name; falls back to `id` if not provided. */
120
+ label?: string;
121
+ /** Optional secondary line; only rendered for variant="row". */
122
+ description?: string;
123
+ /** Optional leading icon (slotted before the label, after the tag). */
124
+ icon?: ReactNode;
125
+ /** Optional override for the leading tag (where `kind` renders by default).
126
+ * When set, replaces the uppercase kind pill — e.g. swap "AD-ACCOUNT" for
127
+ * the platform logo. */
128
+ tag?: ReactNode;
129
+ /** Compact inline pill ("chip") vs. full popover row ("row"). */
130
+ variant?: "chip" | "row";
131
+ /** When true, applies the row's "selected" styling. */
132
+ selected?: boolean;
133
+ /** Optional click handler (popover row uses it; chip doesn't by default). */
134
+ onMouseEnter?: () => void;
135
+ onMouseDown?: (e: React.MouseEvent) => void;
136
+ /** Pass-through id for ARIA wiring (used by typeahead). */
137
+ htmlId?: string;
138
+ }
139
+ declare function CommandTokenView({ id, kind, label, description, icon, tag, variant, selected, onMouseEnter, onMouseDown, htmlId, }: CommandTokenViewProps): react.JSX.Element;
140
+
141
+ interface LexicalChatInputHandle {
142
+ /** Clear the editor contents and reset history. */
143
+ clear: () => void;
144
+ /** Programmatically submit the current editor contents. */
145
+ submit: () => void;
146
+ /** Focus the editor. */
147
+ focus: () => void;
148
+ /**
149
+ * Insert text at the caret (or at the end when there is no selection) and
150
+ * focus the editor. Used by toolbar buttons to type trigger characters
151
+ * like "/" or "@" so the matching typeahead opens.
152
+ */
153
+ insertText: (text: string) => void;
154
+ }
155
+ interface LexicalChatInputProps {
156
+ placeholder?: string;
157
+ disabled?: boolean;
158
+ className?: string;
159
+ /** Tailwind classes applied to the inner ContentEditable element. */
160
+ inputClassName?: string;
161
+ /** Tailwind classes applied to the placeholder overlay (e.g. font sizing). */
162
+ placeholderClassName?: string;
163
+ /** Slot for additional Lexical plugins (mounted inside LexicalComposer). */
164
+ children?: ReactNode;
165
+ /**
166
+ * Called whenever the editor's plain-text projection changes. Use this to
167
+ * gate a parent-rendered submit button on `text.trim().length > 0`.
168
+ */
169
+ onChange?: (payload: ChatComposerSubmitPayload) => void;
170
+ /** Called when the user presses Enter (without Shift). */
171
+ onSubmit: (payload: ChatComposerSubmitPayload) => void | Promise<void>;
172
+ /**
173
+ * Optional slash-command typeahead. When omitted, the editor behaves like
174
+ * a plain rich-text input.
175
+ */
176
+ commandProvider?: CommandProvider | null;
177
+ /**
178
+ * Multiple typeahead providers, one per trigger character (e.g. `/` for
179
+ * skills + modes, `@` for ad accounts). When supplied, this takes
180
+ * precedence over the singular `commandProvider`. Each provider mounts its
181
+ * own `CommandTokenPlugin` instance.
182
+ */
183
+ commandProviders?: CommandProvider[];
184
+ }
185
+ declare const LexicalChatInput: react.ForwardRefExoticComponent<LexicalChatInputProps & react.RefAttributes<LexicalChatInputHandle>>;
186
+
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 };
@@ -0,0 +1,2 @@
1
+ export{d as $createCommandTokenNode,e as $isCommandTokenNode,f as COMMAND_TOKEN_REGEX,c as CommandTokenNode,h as CommandTokenPlugin,b as CommandTokenView,i as LexicalChatInput,g as findInlineCommandTokens}from'../chunk-ZP4FGAAH.js';//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1,8 +1,7 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as react from 'react';
3
2
  import { ReactNode } from 'react';
4
- import { C as ChatMessage, P as ParticipantRole } from '../message-BrHFdwb2.js';
5
- import { d as VisualizationActionEvent } from '../streaming-DURrv9_E.js';
3
+ import { C as ChatMessage, P as ParticipantRole } from '../message-D0oMw3tR.js';
4
+ import { f as VisualizationActionEvent } from '../streaming-CmQo_OOA.js';
6
5
 
7
6
  interface ChatContextValue {
8
7
  /** List of messages in the conversation */
@@ -23,6 +22,15 @@ interface ChatContextValue {
23
22
  customData?: Record<string, unknown>;
24
23
  /** Callback when user interacts with a visualization (form submit, card action, etc.) */
25
24
  onVisualizationAction?: (event: VisualizationActionEvent) => void;
25
+ /** Resolve how to render an inline command-token chip (e.g. an
26
+ * `@<id>:ad-account` mention). Wire format only carries id + kind, so the
27
+ * host app supplies the display info. Returning `tag` replaces the default
28
+ * uppercase kind pill (e.g. a platform logo). Returning `label` overrides
29
+ * the id text. */
30
+ resolveCommandToken?: (id: string, kind: string) => {
31
+ label?: string;
32
+ tag?: ReactNode;
33
+ } | undefined;
26
34
  }
27
35
  declare const ChatContext: react.Context<ChatContextValue | null>;
28
36
  interface ChatProviderProps {
@@ -36,8 +44,12 @@ interface ChatProviderProps {
36
44
  onRetryLastMessage?: () => Promise<void>;
37
45
  customData?: Record<string, unknown>;
38
46
  onVisualizationAction?: (event: VisualizationActionEvent) => void;
47
+ resolveCommandToken?: (id: string, kind: string) => {
48
+ label?: string;
49
+ tag?: ReactNode;
50
+ } | undefined;
39
51
  }
40
- declare function ChatProvider({ children, messages, isStreaming, streamingMessageId, viewerRole, onSendMessage, onStopStreaming, onRetryLastMessage, customData, onVisualizationAction, }: ChatProviderProps): react_jsx_runtime.JSX.Element;
52
+ declare function ChatProvider({ children, messages, isStreaming, streamingMessageId, viewerRole, onSendMessage, onStopStreaming, onRetryLastMessage, customData, onVisualizationAction, resolveCommandToken, }: ChatProviderProps): react.JSX.Element;
41
53
  declare function useChatContext(): ChatContextValue;
42
54
 
43
55
  export { ChatContext, type ChatContextValue, ChatProvider, type ChatProviderProps, useChatContext };
@@ -1,2 +1,2 @@
1
- export{a as ChatContext,b as ChatProvider,c as useChatContext}from'../chunk-OCKHJ4WO.js';//# sourceMappingURL=index.js.map
1
+ export{a as ChatContext,b as ChatProvider,c as useChatContext}from'../chunk-NKLA5PPB.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { RefObject, KeyboardEvent } from 'react';
3
- import { b as StreamingOptions, a as StreamChunk } from '../streaming-DURrv9_E.js';
4
- import { B as BrandingData } from '../branding-SzYU4ncD.js';
3
+ import { d as StreamingOptions, c as StreamChunk } from '../streaming-CmQo_OOA.js';
4
+ import { B as BrandingData } from '../branding-NieTEGQf.js';
5
5
 
6
6
  interface UseAutoScrollOptions {
7
7
  /** Whether auto-scroll is enabled */
@@ -1,2 +1,2 @@
1
- export{b as useAttachments,a as useStreaming}from'../chunk-WG77GQR3.js';export{a as useScrollLock}from'../chunk-D2PFIJNZ.js';export{a as useAutoScroll,b as useMessageComposer}from'../chunk-4WWJTYYA.js';export{b as useBrandingCSSVars}from'../chunk-NSTK5EUQ.js';//# sourceMappingURL=index.js.map
1
+ export{b as useAttachments,a as useStreaming}from'../chunk-WG77GQR3.js';export{a as useScrollLock}from'../chunk-D2PFIJNZ.js';export{a as useAutoScroll,b as useMessageComposer}from'../chunk-4WWJTYYA.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,14 +1,14 @@
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-BrHFdwb2.js';
2
- export { a as StreamChunk, b as StreamingOptions, c as StreamingState } from './streaming-DURrv9_E.js';
3
- export { B as BrandingData } from './branding-SzYU4ncD.js';
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-D0oMw3tR.js';
2
+ export { a as ClarificationAnswer, C as ClarificationData, b as ClarificationQuestion, c as StreamChunk, d as StreamingOptions, e as StreamingState } from './streaming-CmQo_OOA.js';
3
+ export { B as BrandingData } from './branding-NieTEGQf.js';
4
4
  export { ChatContext, ChatContextValue, ChatProvider, ChatProviderProps, useChatContext } from './context/index.js';
5
5
  export { useAttachments, useAutoScroll, useBrandingCSSVars, useMessageComposer, useScrollLock, useStreaming } from './hooks/index.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-C13xc3tA.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-CD685KQV.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-XVZqMpVW.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-Cbipi2rK.js';
9
9
  import { ClassValue } from 'clsx';
10
- import 'react/jsx-runtime';
11
10
  import 'react';
11
+ import './types-Du00UBst.js';
12
12
 
13
13
  /**
14
14
  * Utility function to merge Tailwind CSS classes with proper precedence.
@@ -104,6 +104,14 @@ declare const chatTokens: {
104
104
  readonly secondary: "var(--chat-secondary, #56C18A)";
105
105
  readonly error: "var(--chat-error, #B1001B)";
106
106
  readonly warning: "var(--chat-warning, #DD9652)";
107
+ /**
108
+ * Accent for in-progress / live indicators in the reasoning panel:
109
+ * running halo, animated caret, header wave, rail-flow gradient, and
110
+ * active-row wash. Falls back to --chat-primary so existing usage is
111
+ * unchanged. Override independently when the brand primary is neutral
112
+ * and would otherwise blend into completed-state visuals.
113
+ */
114
+ readonly activity: "var(--chat-activity, var(--chat-primary, #106997))";
107
115
  readonly messageBg: "var(--chat-message-bg, rgba(0, 0, 0, 0.03))";
108
116
  readonly userMessageBg: "var(--chat-user-message-bg, var(--chat-primary, #106997))";
109
117
  readonly userMessageText: "var(--chat-user-message-text, #ffffff)";
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export{b as AttachmentPreview,c as Avatar,d as ChatContainer,ga as ChatLayout,f as MarkdownContent,_ as Message,l as MessageActionBar,$ as MessageComposer,ba as MessageList,aa as ScrollToBottomButton,C as StreamingText,D as SuggestedActions,fa as ToolStatusIndicator,da as TypingIndicator,ha as WelcomeScreen,a as cn,Z as parseContentWithInlineMarkers}from'./chunk-EI3GOLHT.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-6RN7SUWT.js';export{b as useAttachments,a as useStreaming}from'./chunk-WG77GQR3.js';export{a as useScrollLock}from'./chunk-D2PFIJNZ.js';export{a as useAutoScroll,b as useMessageComposer}from'./chunk-4WWJTYYA.js';export{a as ChatContext,b as ChatProvider,c as useChatContext}from'./chunk-OCKHJ4WO.js';export{a as chatTokens}from'./chunk-O2ILSWHS.js';export{a as getContrastTextColor,b as useBrandingCSSVars}from'./chunk-NSTK5EUQ.js';var i={hour:"numeric",minute:"2-digit",hour12:true},m={month:"short",day:"numeric"},se={...m,year:"numeric",...i};function u(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`:u(e)}export{u as formatMessageTime,re as formatRelativeTime};//# sourceMappingURL=index.js.map
1
+ export{a as AttachmentPreview,b as Avatar,c as ChatContainer,ba as ChatLayout,f as MarkdownContent,V as Message,l as MessageActionBar,W as MessageComposer,Y as MessageList,X as ScrollToBottomButton,x as StreamingText,y as SuggestedActions,aa as ToolStatusIndicator,_ as TypingIndicator,ca as WelcomeScreen,U as parseContentWithInlineMarkers}from'./chunk-UZ2Z7C43.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-6RN7SUWT.js';export{b as useAttachments,a as useStreaming}from'./chunk-WG77GQR3.js';export{a as useScrollLock}from'./chunk-D2PFIJNZ.js';export{a as useAutoScroll,b as useMessageComposer}from'./chunk-4WWJTYYA.js';export{a as ChatContext,b as ChatProvider,c as useChatContext}from'./chunk-NKLA5PPB.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-ZP4FGAAH.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":"+uCAIA,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
+ {"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":"6wCAIA,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-DURrv9_E.js';
1
+ import { S as StreamingChunk, C as ClarificationData, T as ToolApprovalData, M as MediaChunkData, A as ArtifactChunkData } from './streaming-CmQo_OOA.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-C13xc3tA.js';
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-CD685KQV.js';
2
2
  import * as react from 'react';
3
3
  import { HTMLAttributes, ReactNode, ButtonHTMLAttributes } from 'react';
4
- import { d as SuggestedAction } from '../message-BrHFdwb2.js';
5
- import '../streaming-DURrv9_E.js';
4
+ import { d as SuggestedAction } from '../message-D0oMw3tR.js';
5
+ import '../streaming-CmQo_OOA.js';
6
6
 
7
7
  interface MessageListProps extends HTMLAttributes<HTMLDivElement> {
8
8
  /** Messages to render */
@@ -18,9 +18,14 @@ interface StreamingOptions {
18
18
  onError?: (error: Error) => void;
19
19
  }
20
20
  /**
21
- * Extended chunk types for agentic streaming
21
+ * Extended chunk types for agentic streaming.
22
+ *
23
+ * `subtask` / `progress` / structured `planning` chunks are retained for
24
+ * historical messages persisted before the unified-ReAct migration. New
25
+ * streams emit `planning` only as plain text (enter_plan_mode / exit_plan_mode)
26
+ * and route sub-agent work through the `subagent` chunk type.
22
27
  */
23
- type ChunkType = "content" | "thinking" | "tool" | "observation" | "answer" | "planning" | "subtask" | "progress" | "wave_start" | "wave_complete" | "parallel_subtask_start" | "parallel_subtask_complete" | "multi_agent_planning" | "multi_agent_planning_complete" | "subagent_start" | "subagent_complete" | "subagent_failed" | "synthesis" | "clarification_needed" | "tool_approval_needed" | "visualization" | "media" | "artifact" | "subagent" | "file_operation" | "terminal" | "search_results" | "web_operation" | "claude_text" | "claude_thinking" | "suggested_action_created";
28
+ type ChunkType = "content" | "thinking" | "tool" | "observation" | "answer" | "planning" | "subtask" | "progress" | "clarification_needed" | "tool_approval_needed" | "visualization" | "media" | "artifact" | "subagent" | "suggested_action_created";
24
29
  /**
25
30
  * Subtask data structure for Plan & Execute mode
26
31
  */
@@ -56,115 +61,65 @@ interface ProgressData {
56
61
  percentage: number;
57
62
  waveNumber?: number;
58
63
  }
59
- interface WaveData {
60
- waveNumber: number;
61
- subtaskIds: number[];
62
- parallelCount: number;
63
- totalWaves: number;
64
- startTime?: number;
65
- executionTime?: number;
66
- success?: boolean;
67
- completedIds?: number[];
68
- }
69
- interface ParallelSubtaskData {
70
- subtaskId: number;
71
- waveNumber: number;
72
- description?: string;
73
- success?: boolean;
74
- result?: string;
75
- error?: string;
76
- executionTime?: number;
77
- }
78
- interface SubagentInfo {
79
- id?: string;
80
- name: string;
81
- role?: string;
82
- task?: string;
83
- status: "pending" | "running" | "completed" | "failed";
84
- result?: string;
85
- error?: string;
86
- executionTime?: number;
87
- }
88
- interface SearchResultItem {
89
- filePath: string;
90
- lineNumber?: number;
91
- snippet?: string;
92
- }
93
64
  interface SubagentChunkData {
94
65
  subagentId: string;
95
66
  subagentType: string;
96
- description: string;
97
67
  prompt?: string;
98
68
  status: "running" | "completed" | "failed";
99
69
  result?: string;
100
70
  durationMs?: number;
101
71
  nestedChunks: StreamingChunk[];
102
72
  }
103
- interface FileOperationChunkData {
104
- toolUseId: string;
105
- operation: "read" | "write" | "edit";
106
- filePath: string;
107
- status: "pending" | "completed" | "error";
108
- content?: string;
109
- totalLines?: number;
110
- language?: string;
111
- oldString?: string;
112
- newString?: string;
113
- error?: string;
114
- durationMs?: number;
115
- }
116
- interface TerminalChunkData {
117
- toolUseId: string;
118
- command: string;
119
- description?: string;
120
- status: "running" | "completed" | "failed";
121
- stdout?: string;
122
- stderr?: string;
123
- exitCode?: number;
124
- durationMs?: number;
125
- }
126
- interface SearchResultsChunkData {
127
- toolUseId: string;
128
- tool: "glob" | "grep";
129
- pattern: string;
130
- path?: string;
131
- status: "pending" | "completed" | "error";
132
- results: SearchResultItem[];
133
- totalCount: number;
134
- error?: string;
135
- durationMs?: number;
136
- }
137
- interface WebOperationChunkData {
138
- toolUseId: string;
139
- operation: "search" | "fetch";
140
- query?: string;
141
- url?: string;
142
- status: "pending" | "completed" | "error";
143
- results?: string;
144
- content?: string;
145
- error?: string;
146
- durationMs?: number;
73
+ interface ClarificationQuestion {
74
+ question: string;
75
+ options: string[];
76
+ /** When true the user may pick several options (checkboxes). */
77
+ multiSelect?: boolean;
78
+ /**
79
+ * Stable slug identifying the question's subject (e.g. "daily_budget"). Set by
80
+ * the agent; carried through so the answer is mapped back to it structurally —
81
+ * no parsing of formatted answer text.
82
+ */
83
+ key?: string;
84
+ /**
85
+ * When true the panel renders an inline "Other" choice with a text input so
86
+ * the user can type a custom value INSTEAD of picking an option. The typed
87
+ * value is submitted together with the other answers in one response — no
88
+ * extra "what would you like?" round trip.
89
+ */
90
+ allowFreeText?: boolean;
91
+ /** Wire-format aliases: the server emits snake_case question dicts verbatim.
92
+ * The panel resolves either casing — keep both for pass-through safety. */
93
+ multi_select?: boolean;
94
+ allow_free_text?: boolean;
147
95
  }
148
- interface ClaudeToolChunkData {
149
- toolUseId: string;
150
- toolName: string;
151
- toolDescription?: string;
152
- toolInput?: Record<string, unknown>;
153
- status: "pending" | "completed" | "error";
154
- content?: string;
155
- isError?: boolean;
156
- durationMs?: number;
96
+ /**
97
+ * A structured answer to one clarification question. Emitted by the panel and sent
98
+ * in the answer message metadata so the server records the established fact by
99
+ * (key, selected) deterministically instead of regex-parsing a "Q → A" string.
100
+ */
101
+ interface ClarificationAnswer {
102
+ key?: string;
103
+ question: string;
104
+ selected: string[];
157
105
  }
158
106
  interface ClarificationData {
159
- question: string;
160
- options?: string[];
107
+ /** Multiple-choice questions to put to the user (current shape). */
108
+ questions?: ClarificationQuestion[];
161
109
  context?: string;
110
+ /** @deprecated legacy single-question text, kept for rendering old history. */
111
+ question?: string;
112
+ /** @deprecated legacy single-question options. */
113
+ options?: string[];
114
+ /** @deprecated legacy free-text flag, no longer emitted. */
162
115
  allowFreeText?: boolean;
163
116
  subtaskId?: number;
164
117
  subtaskDescription?: string;
165
118
  subagentName?: string;
166
119
  subagentRole?: string;
167
120
  toolCallId?: string;
121
+ /** Durable checkpoint interrupt id — echo back as `interrupt_id` metadata on the answer so the server can reject a stale panel. */
122
+ interruptId?: string;
168
123
  }
169
124
  interface ToolApprovalData {
170
125
  toolName: string;
@@ -172,6 +127,16 @@ interface ToolApprovalData {
172
127
  toolInputs: Record<string, unknown>;
173
128
  toolSchema?: Record<string, unknown>;
174
129
  toolCallId?: string;
130
+ /** Durable checkpoint interrupt id — echo back as `interrupt_id` metadata on the answer so the server can reject a stale panel. */
131
+ interruptId?: string;
132
+ /** Human-readable tool identity surfaced in the approval eyebrow (e.g. "Yahoo Finance · Stock Basic Info"). Falls back to toolName when omitted. */
133
+ toolLabel?: string;
134
+ /**
135
+ * Opaque, host-app-interpreted preview payload. chat-ui only transports this —
136
+ * it never reads its shape. Used by host apps to render a specialized approval
137
+ * surface (e.g. an ad-mutation before/after diff) in place of the generic card.
138
+ */
139
+ preview?: unknown;
175
140
  }
176
141
  type VisualizationType = "chart" | "table" | "card" | "kpi" | "code_preview" | "form";
177
142
  type ChartDataType = "line" | "bar" | "pie" | "area" | "scatter" | "composed";
@@ -238,10 +203,11 @@ interface KpiMetric {
238
203
  changeLabel?: string;
239
204
  sparkline?: number[];
240
205
  color?: string;
206
+ prominence?: "primary" | "secondary";
241
207
  }
242
208
  interface KpiVisualizationData {
243
209
  metrics: KpiMetric[];
244
- layout?: "row" | "grid";
210
+ layout?: "row" | "grid" | "bento";
245
211
  }
246
212
  interface CodePreviewVisualizationData {
247
213
  code: string;
@@ -366,30 +332,9 @@ interface StreamingChunk {
366
332
  subtaskData?: SubTaskData;
367
333
  planData?: PlanData;
368
334
  progress?: ProgressData;
369
- isReplan?: boolean;
370
- waveData?: WaveData;
371
- parallelSubtaskData?: ParallelSubtaskData;
372
- waveNumber?: number;
373
- isParallel?: boolean;
374
- isMultiAgent?: boolean;
375
- subagentInfo?: SubagentInfo;
376
- subagentAllocations?: {
377
- name: string;
378
- focus: string;
379
- query?: string;
380
- }[];
381
- replanAttempt?: number;
382
- maxReplans?: number;
383
- failureReason?: string;
384
- isSynthesis?: boolean;
385
- orchestrator?: "react" | "plan_execute" | "claude_agent_sdk";
335
+ orchestrator?: "react" | "plan_execute";
386
336
  parentSubtaskId?: number;
387
337
  subagentData?: SubagentChunkData;
388
- fileOperationData?: FileOperationChunkData;
389
- terminalData?: TerminalChunkData;
390
- searchResultsData?: SearchResultsChunkData;
391
- webOperationData?: WebOperationChunkData;
392
- claudeToolData?: ClaudeToolChunkData;
393
338
  clarificationData?: ClarificationData;
394
339
  toolApprovalData?: ToolApprovalData;
395
340
  visualizationData?: VisualizationChunkData;
@@ -405,11 +350,8 @@ interface StreamingMessage {
405
350
  textContent: string;
406
351
  previousMessageId?: string;
407
352
  chunks?: StreamingChunk[];
408
- orchestratorType?: "react" | "plan_execute" | "claude_agent_sdk";
353
+ orchestratorType?: "react" | "plan_execute";
409
354
  executionPlan?: PlanData;
410
- isParallelExecution?: boolean;
411
- waveData?: Record<number, WaveData>;
412
- currentWaveNumber?: number;
413
355
  suggestedActions?: FollowupAction[];
414
356
  activeSubagents?: Map<string, SubagentChunkData>;
415
357
  pendingClarification?: ClarificationData;
@@ -428,12 +370,19 @@ interface FollowupAction {
428
370
  context: Record<string, unknown>;
429
371
  }
430
372
  type EventStatus = "pending" | "running" | "completed" | "failed";
431
- type EventType = "thinking" | "planning" | "tool" | "observation" | "subtask";
373
+ type EventType = "thinking" | "planning" | "tool" | "observation" | "subtask" | "subagent";
432
374
  interface BaseEvent {
433
375
  id: string;
434
376
  type: EventType;
435
377
  status: EventStatus;
436
378
  timestamp?: number;
379
+ /**
380
+ * Elapsed wall-clock duration for this event in seconds. Populated by
381
+ * `convertTimelineToEvents` from pairwise timeline timestamps; left
382
+ * undefined for live streaming chunks (no per-chunk arrival time is
383
+ * carried through the stream).
384
+ */
385
+ durationSeconds?: number;
437
386
  }
438
387
  interface ThinkingEvent extends BaseEvent {
439
388
  type: "thinking";
@@ -465,7 +414,17 @@ interface SubtaskEvent extends BaseEvent {
465
414
  error?: string;
466
415
  children?: Event[];
467
416
  }
468
- type Event = ThinkingEvent | PlanningEvent | ToolEvent | ObservationEvent | SubtaskEvent;
417
+ /**
418
+ * Sub-assistant dispatch event. Rendered inline in the parent's reasoning
419
+ * timeline at the position the dispatch was issued. Carries the full
420
+ * SubagentChunkData so the renderer can show name, status, and the
421
+ * streaming result without a separate lookup.
422
+ */
423
+ interface SubagentEvent extends BaseEvent {
424
+ type: "subagent";
425
+ subagentData: SubagentChunkData;
426
+ }
427
+ type Event = ThinkingEvent | PlanningEvent | ToolEvent | ObservationEvent | SubtaskEvent | SubagentEvent;
469
428
  type VisualizationActionEvent = {
470
429
  type: "form_submit";
471
430
  action: string;
@@ -478,4 +437,4 @@ type VisualizationActionEvent = {
478
437
  action: string;
479
438
  };
480
439
 
481
- export type { ArtifactChunkData as A, ThinkingEvent as B, ClarificationData as C, ToolEvent as D, Event as E, FormVisualizationData as F, VisualizationType as G, WebOperationChunkData as H, KpiVisualizationData as K, MediaChunkData as M, ObservationEvent as O, PlanData as P, StreamingChunk as S, ToolApprovalData as T, VisualizationChunkData as V, WaveData as W, StreamChunk as a, StreamingOptions as b, StreamingState as c, VisualizationActionEvent as d, ChartVisualizationData as e, VisualizationConfig as f, TableVisualizationData as g, CardVisualizationData as h, CodePreviewVisualizationData as i, EventStatus as j, ArtifactStatus as k, ChunkType as l, ClaudeToolChunkData as m, EventType as n, FileOperationChunkData as o, FollowupAction as p, ParallelSubtaskData as q, PlanningEvent as r, ProgressData as s, SearchResultsChunkData as t, StreamingMessage as u, SubTaskData as v, SubagentChunkData as w, SubagentInfo as x, SubtaskEvent as y, TerminalChunkData as z };
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, VisualizationActionEvent as f, ChartVisualizationData as g, VisualizationConfig as h, TableVisualizationData as i, CardVisualizationData as j, CodePreviewVisualizationData as k, EventStatus as l, ArtifactStatus as m, ChunkType as n, EventType as o, FollowupAction as p, PlanningEvent as q, ProgressData as r, StreamingMessage as s, SubTaskData as t, SubagentChunkData as u, SubtaskEvent as v, ThinkingEvent as w, ToolEvent as x, VisualizationType as y };