@ash-cloud/ash-ui 0.0.8 → 0.1.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/dist/index.cjs +99 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +67 -6
- package/dist/index.d.ts +67 -6
- package/dist/index.js +123 -32
- package/dist/index.js.map +1 -1
- package/dist/styles-full.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +90 -2
- package/dist/types.d.ts +90 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { NormalizedToolCall, NormalizedEntry, ToolDisplayConfig, WidgetRenderFunction, WidgetAction, LogEntry, ToolDisplayMode, TodoItem, ToolStatus, ActionType } from './types.cjs';
|
|
3
|
-
export { AgentToolAction, AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_DISPLAY_CONFIG, ErrorEntry, FileAttachment, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, NormalizedEntryType, SearchAction, ThinkingEntry, TodoStatus, TodoWriteAction, ToolCallEntry, ToolExecutionGroup as ToolExecutionGroupType, ToolResult, UserMessageEntry, WebFetchAction, WebSearchAction, WidgetEntry, WidgetRenderProps, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry } from './types.cjs';
|
|
2
|
+
import { NormalizedToolCall, NormalizedEntry, ToolDisplayConfig, WidgetRenderFunction, WidgetAction, RichContentRenderers, LogEntry, ToolDisplayMode, TodoItem, ToolStatus, ActionType, RichContent } from './types.cjs';
|
|
3
|
+
export { AgentToolAction, AssistantMessageEntry, CommandRunAction, CommandRunResult, ComponentRenderProps, DEFAULT_DISPLAY_CONFIG, ErrorEntry, FileAttachment, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, MentionRenderProps, NormalizedEntryType, RichComponentSegment, RichContentSegment, RichMentionSegment, RichTextSegment, SearchAction, ThinkingEntry, TodoStatus, TodoWriteAction, ToolCallEntry, ToolExecutionGroup as ToolExecutionGroupType, ToolResult, UserMessageEntry, WebFetchAction, WebSearchAction, WidgetEntry, WidgetRenderProps, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry } from './types.cjs';
|
|
4
4
|
import { ReactNode, DragEvent, ChangeEvent, ClipboardEvent } from 'react';
|
|
5
5
|
import { ParsedOption } from './utils.cjs';
|
|
6
6
|
export { GroupedEntry, ParsedOptionsResult, ToolUseInput, cn, createToolCall, extractTextContent, extractToolCallsFromGroup, formatElapsedTime, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, truncate, updateToolCallWithResult } from './utils.cjs';
|
|
@@ -102,6 +102,27 @@ interface MessageListProps {
|
|
|
102
102
|
* Default: true
|
|
103
103
|
*/
|
|
104
104
|
autoScroll?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Custom renderers for rich content segments.
|
|
107
|
+
* Used when entries have `richContent` defined.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```tsx
|
|
111
|
+
* <MessageList
|
|
112
|
+
* entries={entriesWithRichContent}
|
|
113
|
+
* richContentRenderers={{
|
|
114
|
+
* renderMention: ({ segment }) => (
|
|
115
|
+
* <MentionBadge
|
|
116
|
+
* name={segment.name}
|
|
117
|
+
* color={segment.color}
|
|
118
|
+
* onClick={() => scrollToEntity(segment.id)}
|
|
119
|
+
* />
|
|
120
|
+
* ),
|
|
121
|
+
* }}
|
|
122
|
+
* />
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
richContentRenderers?: RichContentRenderers;
|
|
105
126
|
/** Additional class names */
|
|
106
127
|
className?: string;
|
|
107
128
|
}
|
|
@@ -125,7 +146,7 @@ interface MessageListProps {
|
|
|
125
146
|
* <MessageList entries={entries} displayConfig={{ mode: 'compact' }} />
|
|
126
147
|
* ```
|
|
127
148
|
*/
|
|
128
|
-
declare function MessageList({ entries, loading, streamingContent, displayConfig: displayConfigProp, onOptionSelect, renderWidget, onWidgetAction, autoScroll, className, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
declare function MessageList({ entries, loading, streamingContent, displayConfig: displayConfigProp, onOptionSelect, renderWidget, onWidgetAction, autoScroll, richContentRenderers, className, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
129
150
|
|
|
130
151
|
interface UserMessageProps {
|
|
131
152
|
entry: NormalizedEntry;
|
|
@@ -141,6 +162,8 @@ interface AssistantMessageProps {
|
|
|
141
162
|
entry: NormalizedEntry;
|
|
142
163
|
/** Callback when user selects an option */
|
|
143
164
|
onOptionSelect?: (optionText: string) => void;
|
|
165
|
+
/** Custom renderers for rich content segments */
|
|
166
|
+
richContentRenderers?: RichContentRenderers;
|
|
144
167
|
className?: string;
|
|
145
168
|
}
|
|
146
169
|
/**
|
|
@@ -148,8 +171,9 @@ interface AssistantMessageProps {
|
|
|
148
171
|
*
|
|
149
172
|
* Uses glassmorphism styling with bot avatar and animated entry.
|
|
150
173
|
* Automatically detects and renders interactive options when present.
|
|
174
|
+
* Supports rich content segments for inline rendering of mentions and custom components.
|
|
151
175
|
*/
|
|
152
|
-
declare function AssistantMessage({ entry, onOptionSelect, className }: AssistantMessageProps): react_jsx_runtime.JSX.Element;
|
|
176
|
+
declare function AssistantMessage({ entry, onOptionSelect, richContentRenderers, className, }: AssistantMessageProps): react_jsx_runtime.JSX.Element;
|
|
153
177
|
interface ThinkingMessageProps {
|
|
154
178
|
entry: NormalizedEntry;
|
|
155
179
|
className?: string;
|
|
@@ -187,6 +211,8 @@ interface MessageEntryProps {
|
|
|
187
211
|
onOptionSelect?: (optionText: string) => void;
|
|
188
212
|
/** Whether tool calls should be expanded by default */
|
|
189
213
|
defaultExpanded?: boolean;
|
|
214
|
+
/** Custom renderers for rich content segments */
|
|
215
|
+
richContentRenderers?: RichContentRenderers;
|
|
190
216
|
className?: string;
|
|
191
217
|
}
|
|
192
218
|
/**
|
|
@@ -202,7 +228,7 @@ interface MessageEntryProps {
|
|
|
202
228
|
* ))}
|
|
203
229
|
* ```
|
|
204
230
|
*/
|
|
205
|
-
declare function MessageEntry({ entry, onOptionSelect, defaultExpanded, className }: MessageEntryProps): react_jsx_runtime.JSX.Element | null;
|
|
231
|
+
declare function MessageEntry({ entry, onOptionSelect, defaultExpanded, richContentRenderers, className, }: MessageEntryProps): react_jsx_runtime.JSX.Element | null;
|
|
206
232
|
|
|
207
233
|
interface LogsPanelProps {
|
|
208
234
|
logs: LogEntry[];
|
|
@@ -685,6 +711,41 @@ interface LazyMarkdownProps {
|
|
|
685
711
|
*/
|
|
686
712
|
declare function LazyMarkdown({ children, fallback, className }: LazyMarkdownProps): react_jsx_runtime.JSX.Element;
|
|
687
713
|
|
|
714
|
+
interface RichContentRendererProps {
|
|
715
|
+
/** Rich content segments to render */
|
|
716
|
+
content: RichContent;
|
|
717
|
+
/** Custom renderers for segments */
|
|
718
|
+
renderers?: RichContentRenderers;
|
|
719
|
+
/** Additional class name */
|
|
720
|
+
className?: string;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* RichContentRenderer - Renders structured rich content segments
|
|
724
|
+
*
|
|
725
|
+
* This is the preferred approach for rendering rich content within messages.
|
|
726
|
+
* Each segment type can have custom rendering via the `renderers` prop.
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* ```tsx
|
|
730
|
+
* <RichContentRenderer
|
|
731
|
+
* content={[
|
|
732
|
+
* { type: 'text', content: 'Looking at ' },
|
|
733
|
+
* { type: 'mention', name: 'Scene1', color: '#ff0' },
|
|
734
|
+
* { type: 'text', content: ' timeline.' },
|
|
735
|
+
* ]}
|
|
736
|
+
* renderers={{
|
|
737
|
+
* renderMention: ({ segment }) => (
|
|
738
|
+
* <MentionBadge
|
|
739
|
+
* name={segment.name}
|
|
740
|
+
* onClick={() => scrollTo(segment.id)}
|
|
741
|
+
* />
|
|
742
|
+
* ),
|
|
743
|
+
* }}
|
|
744
|
+
* />
|
|
745
|
+
* ```
|
|
746
|
+
*/
|
|
747
|
+
declare function RichContentRenderer({ content, renderers, className, }: RichContentRendererProps): react_jsx_runtime.JSX.Element;
|
|
748
|
+
|
|
688
749
|
interface TypewriterTextProps {
|
|
689
750
|
/** Words to cycle through */
|
|
690
751
|
words?: string[];
|
|
@@ -1267,4 +1328,4 @@ interface UseLongTextConversionReturn {
|
|
|
1267
1328
|
*/
|
|
1268
1329
|
declare function useLongTextConversion({ threshold, filenameTemplate, onConversion, }?: LongTextConversionOptions): UseLongTextConversionReturn;
|
|
1269
1330
|
|
|
1270
|
-
export { ActionIcon, type ActionIconProps, ActionType, type StreamEvent as AgentStreamEvent, AgentToolCard, type AgentToolCardProps, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolRow, type CompactToolRowProps, CompactToolStatusLine, type CompactToolStatusLineProps, type ConversionInfo, type CreateStreamFn, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, FileBadge, type FileBadgeProps, JsonDisplay, type JsonDisplayProps, LazyMarkdown, type LazyMarkdownProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, type LongTextConversionOptions, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, StatusIndicator, type StatusIndicatorProps, StepAccordion, type StepAccordionProps, type StepStatus, type StreamGenerator, StreamingText, type StreamingTextProps, type TextAttachment, type Theme, type ThemeContextType, ThemeProvider, type ThemeProviderProps, ThinkingMessage, type ThinkingMessageProps, TodoItem, TodoPanel, type TodoPanelProps, ToolCallCard, type ToolCallCardProps, ToolCallMessage, type ToolCallMessageProps, ToolDisplayConfig, ToolDisplayMode, ToolExecutionGroup, type ToolExecutionGroupProps, ToolStatus, TypewriterText, type TypewriterTextProps, type UseAgentChatOptions, type UseAgentChatReturn, type UseFileUploadOptions, type UseFileUploadReturn, type UseLongTextConversionReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, WidgetAction, WidgetRenderFunction, useAgentChat, useDisplayConfig, useDisplayMode, useFileUpload, useLongTextConversion, useMessageQueue, useStopExecution, useTheme };
|
|
1331
|
+
export { ActionIcon, type ActionIconProps, ActionType, type StreamEvent as AgentStreamEvent, AgentToolCard, type AgentToolCardProps, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolRow, type CompactToolRowProps, CompactToolStatusLine, type CompactToolStatusLineProps, type ConversionInfo, type CreateStreamFn, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, FileBadge, type FileBadgeProps, JsonDisplay, type JsonDisplayProps, LazyMarkdown, type LazyMarkdownProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, type LongTextConversionOptions, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, RichContent, RichContentRenderer, type RichContentRendererProps, RichContentRenderers, StatusIndicator, type StatusIndicatorProps, StepAccordion, type StepAccordionProps, type StepStatus, type StreamGenerator, StreamingText, type StreamingTextProps, type TextAttachment, type Theme, type ThemeContextType, ThemeProvider, type ThemeProviderProps, ThinkingMessage, type ThinkingMessageProps, TodoItem, TodoPanel, type TodoPanelProps, ToolCallCard, type ToolCallCardProps, ToolCallMessage, type ToolCallMessageProps, ToolDisplayConfig, ToolDisplayMode, ToolExecutionGroup, type ToolExecutionGroupProps, ToolStatus, TypewriterText, type TypewriterTextProps, type UseAgentChatOptions, type UseAgentChatReturn, type UseFileUploadOptions, type UseFileUploadReturn, type UseLongTextConversionReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, WidgetAction, WidgetRenderFunction, useAgentChat, useDisplayConfig, useDisplayMode, useFileUpload, useLongTextConversion, useMessageQueue, useStopExecution, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { NormalizedToolCall, NormalizedEntry, ToolDisplayConfig, WidgetRenderFunction, WidgetAction, LogEntry, ToolDisplayMode, TodoItem, ToolStatus, ActionType } from './types.js';
|
|
3
|
-
export { AgentToolAction, AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_DISPLAY_CONFIG, ErrorEntry, FileAttachment, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, NormalizedEntryType, SearchAction, ThinkingEntry, TodoStatus, TodoWriteAction, ToolCallEntry, ToolExecutionGroup as ToolExecutionGroupType, ToolResult, UserMessageEntry, WebFetchAction, WebSearchAction, WidgetEntry, WidgetRenderProps, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry } from './types.js';
|
|
2
|
+
import { NormalizedToolCall, NormalizedEntry, ToolDisplayConfig, WidgetRenderFunction, WidgetAction, RichContentRenderers, LogEntry, ToolDisplayMode, TodoItem, ToolStatus, ActionType, RichContent } from './types.js';
|
|
3
|
+
export { AgentToolAction, AssistantMessageEntry, CommandRunAction, CommandRunResult, ComponentRenderProps, DEFAULT_DISPLAY_CONFIG, ErrorEntry, FileAttachment, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, MentionRenderProps, NormalizedEntryType, RichComponentSegment, RichContentSegment, RichMentionSegment, RichTextSegment, SearchAction, ThinkingEntry, TodoStatus, TodoWriteAction, ToolCallEntry, ToolExecutionGroup as ToolExecutionGroupType, ToolResult, UserMessageEntry, WebFetchAction, WebSearchAction, WidgetEntry, WidgetRenderProps, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry } from './types.js';
|
|
4
4
|
import { ReactNode, DragEvent, ChangeEvent, ClipboardEvent } from 'react';
|
|
5
5
|
import { ParsedOption } from './utils.js';
|
|
6
6
|
export { GroupedEntry, ParsedOptionsResult, ToolUseInput, cn, createToolCall, extractTextContent, extractToolCallsFromGroup, formatElapsedTime, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, truncate, updateToolCallWithResult } from './utils.js';
|
|
@@ -102,6 +102,27 @@ interface MessageListProps {
|
|
|
102
102
|
* Default: true
|
|
103
103
|
*/
|
|
104
104
|
autoScroll?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Custom renderers for rich content segments.
|
|
107
|
+
* Used when entries have `richContent` defined.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```tsx
|
|
111
|
+
* <MessageList
|
|
112
|
+
* entries={entriesWithRichContent}
|
|
113
|
+
* richContentRenderers={{
|
|
114
|
+
* renderMention: ({ segment }) => (
|
|
115
|
+
* <MentionBadge
|
|
116
|
+
* name={segment.name}
|
|
117
|
+
* color={segment.color}
|
|
118
|
+
* onClick={() => scrollToEntity(segment.id)}
|
|
119
|
+
* />
|
|
120
|
+
* ),
|
|
121
|
+
* }}
|
|
122
|
+
* />
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
richContentRenderers?: RichContentRenderers;
|
|
105
126
|
/** Additional class names */
|
|
106
127
|
className?: string;
|
|
107
128
|
}
|
|
@@ -125,7 +146,7 @@ interface MessageListProps {
|
|
|
125
146
|
* <MessageList entries={entries} displayConfig={{ mode: 'compact' }} />
|
|
126
147
|
* ```
|
|
127
148
|
*/
|
|
128
|
-
declare function MessageList({ entries, loading, streamingContent, displayConfig: displayConfigProp, onOptionSelect, renderWidget, onWidgetAction, autoScroll, className, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
149
|
+
declare function MessageList({ entries, loading, streamingContent, displayConfig: displayConfigProp, onOptionSelect, renderWidget, onWidgetAction, autoScroll, richContentRenderers, className, }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
129
150
|
|
|
130
151
|
interface UserMessageProps {
|
|
131
152
|
entry: NormalizedEntry;
|
|
@@ -141,6 +162,8 @@ interface AssistantMessageProps {
|
|
|
141
162
|
entry: NormalizedEntry;
|
|
142
163
|
/** Callback when user selects an option */
|
|
143
164
|
onOptionSelect?: (optionText: string) => void;
|
|
165
|
+
/** Custom renderers for rich content segments */
|
|
166
|
+
richContentRenderers?: RichContentRenderers;
|
|
144
167
|
className?: string;
|
|
145
168
|
}
|
|
146
169
|
/**
|
|
@@ -148,8 +171,9 @@ interface AssistantMessageProps {
|
|
|
148
171
|
*
|
|
149
172
|
* Uses glassmorphism styling with bot avatar and animated entry.
|
|
150
173
|
* Automatically detects and renders interactive options when present.
|
|
174
|
+
* Supports rich content segments for inline rendering of mentions and custom components.
|
|
151
175
|
*/
|
|
152
|
-
declare function AssistantMessage({ entry, onOptionSelect, className }: AssistantMessageProps): react_jsx_runtime.JSX.Element;
|
|
176
|
+
declare function AssistantMessage({ entry, onOptionSelect, richContentRenderers, className, }: AssistantMessageProps): react_jsx_runtime.JSX.Element;
|
|
153
177
|
interface ThinkingMessageProps {
|
|
154
178
|
entry: NormalizedEntry;
|
|
155
179
|
className?: string;
|
|
@@ -187,6 +211,8 @@ interface MessageEntryProps {
|
|
|
187
211
|
onOptionSelect?: (optionText: string) => void;
|
|
188
212
|
/** Whether tool calls should be expanded by default */
|
|
189
213
|
defaultExpanded?: boolean;
|
|
214
|
+
/** Custom renderers for rich content segments */
|
|
215
|
+
richContentRenderers?: RichContentRenderers;
|
|
190
216
|
className?: string;
|
|
191
217
|
}
|
|
192
218
|
/**
|
|
@@ -202,7 +228,7 @@ interface MessageEntryProps {
|
|
|
202
228
|
* ))}
|
|
203
229
|
* ```
|
|
204
230
|
*/
|
|
205
|
-
declare function MessageEntry({ entry, onOptionSelect, defaultExpanded, className }: MessageEntryProps): react_jsx_runtime.JSX.Element | null;
|
|
231
|
+
declare function MessageEntry({ entry, onOptionSelect, defaultExpanded, richContentRenderers, className, }: MessageEntryProps): react_jsx_runtime.JSX.Element | null;
|
|
206
232
|
|
|
207
233
|
interface LogsPanelProps {
|
|
208
234
|
logs: LogEntry[];
|
|
@@ -685,6 +711,41 @@ interface LazyMarkdownProps {
|
|
|
685
711
|
*/
|
|
686
712
|
declare function LazyMarkdown({ children, fallback, className }: LazyMarkdownProps): react_jsx_runtime.JSX.Element;
|
|
687
713
|
|
|
714
|
+
interface RichContentRendererProps {
|
|
715
|
+
/** Rich content segments to render */
|
|
716
|
+
content: RichContent;
|
|
717
|
+
/** Custom renderers for segments */
|
|
718
|
+
renderers?: RichContentRenderers;
|
|
719
|
+
/** Additional class name */
|
|
720
|
+
className?: string;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* RichContentRenderer - Renders structured rich content segments
|
|
724
|
+
*
|
|
725
|
+
* This is the preferred approach for rendering rich content within messages.
|
|
726
|
+
* Each segment type can have custom rendering via the `renderers` prop.
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* ```tsx
|
|
730
|
+
* <RichContentRenderer
|
|
731
|
+
* content={[
|
|
732
|
+
* { type: 'text', content: 'Looking at ' },
|
|
733
|
+
* { type: 'mention', name: 'Scene1', color: '#ff0' },
|
|
734
|
+
* { type: 'text', content: ' timeline.' },
|
|
735
|
+
* ]}
|
|
736
|
+
* renderers={{
|
|
737
|
+
* renderMention: ({ segment }) => (
|
|
738
|
+
* <MentionBadge
|
|
739
|
+
* name={segment.name}
|
|
740
|
+
* onClick={() => scrollTo(segment.id)}
|
|
741
|
+
* />
|
|
742
|
+
* ),
|
|
743
|
+
* }}
|
|
744
|
+
* />
|
|
745
|
+
* ```
|
|
746
|
+
*/
|
|
747
|
+
declare function RichContentRenderer({ content, renderers, className, }: RichContentRendererProps): react_jsx_runtime.JSX.Element;
|
|
748
|
+
|
|
688
749
|
interface TypewriterTextProps {
|
|
689
750
|
/** Words to cycle through */
|
|
690
751
|
words?: string[];
|
|
@@ -1267,4 +1328,4 @@ interface UseLongTextConversionReturn {
|
|
|
1267
1328
|
*/
|
|
1268
1329
|
declare function useLongTextConversion({ threshold, filenameTemplate, onConversion, }?: LongTextConversionOptions): UseLongTextConversionReturn;
|
|
1269
1330
|
|
|
1270
|
-
export { ActionIcon, type ActionIconProps, ActionType, type StreamEvent as AgentStreamEvent, AgentToolCard, type AgentToolCardProps, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolRow, type CompactToolRowProps, CompactToolStatusLine, type CompactToolStatusLineProps, type ConversionInfo, type CreateStreamFn, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, FileBadge, type FileBadgeProps, JsonDisplay, type JsonDisplayProps, LazyMarkdown, type LazyMarkdownProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, type LongTextConversionOptions, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, StatusIndicator, type StatusIndicatorProps, StepAccordion, type StepAccordionProps, type StepStatus, type StreamGenerator, StreamingText, type StreamingTextProps, type TextAttachment, type Theme, type ThemeContextType, ThemeProvider, type ThemeProviderProps, ThinkingMessage, type ThinkingMessageProps, TodoItem, TodoPanel, type TodoPanelProps, ToolCallCard, type ToolCallCardProps, ToolCallMessage, type ToolCallMessageProps, ToolDisplayConfig, ToolDisplayMode, ToolExecutionGroup, type ToolExecutionGroupProps, ToolStatus, TypewriterText, type TypewriterTextProps, type UseAgentChatOptions, type UseAgentChatReturn, type UseFileUploadOptions, type UseFileUploadReturn, type UseLongTextConversionReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, WidgetAction, WidgetRenderFunction, useAgentChat, useDisplayConfig, useDisplayMode, useFileUpload, useLongTextConversion, useMessageQueue, useStopExecution, useTheme };
|
|
1331
|
+
export { ActionIcon, type ActionIconProps, ActionType, type StreamEvent as AgentStreamEvent, AgentToolCard, type AgentToolCardProps, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolRow, type CompactToolRowProps, CompactToolStatusLine, type CompactToolStatusLineProps, type ConversionInfo, type CreateStreamFn, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, FileBadge, type FileBadgeProps, JsonDisplay, type JsonDisplayProps, LazyMarkdown, type LazyMarkdownProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, type LongTextConversionOptions, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, RichContent, RichContentRenderer, type RichContentRendererProps, RichContentRenderers, StatusIndicator, type StatusIndicatorProps, StepAccordion, type StepAccordionProps, type StepStatus, type StreamGenerator, StreamingText, type StreamingTextProps, type TextAttachment, type Theme, type ThemeContextType, ThemeProvider, type ThemeProviderProps, ThinkingMessage, type ThinkingMessageProps, TodoItem, TodoPanel, type TodoPanelProps, ToolCallCard, type ToolCallCardProps, ToolCallMessage, type ToolCallMessageProps, ToolDisplayConfig, ToolDisplayMode, ToolExecutionGroup, type ToolExecutionGroupProps, ToolStatus, TypewriterText, type TypewriterTextProps, type UseAgentChatOptions, type UseAgentChatReturn, type UseFileUploadOptions, type UseFileUploadReturn, type UseLongTextConversionReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, WidgetAction, WidgetRenderFunction, useAgentChat, useDisplayConfig, useDisplayMode, useFileUpload, useLongTextConversion, useMessageQueue, useStopExecution, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { lazy, createContext, useState, useRef, useMemo, useEffect, Suspense, useCallback, useContext } from 'react';
|
|
2
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
1
|
+
import { lazy, createContext, useState, useRef, useMemo, useEffect, Suspense, Fragment, useCallback, useContext } from 'react';
|
|
2
|
+
import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
// src/components/ToolCallCard.tsx
|
|
5
5
|
|
|
@@ -946,12 +946,12 @@ function SectionContent({ children }) {
|
|
|
946
946
|
return /* @__PURE__ */ jsx("div", { className: "px-3 py-2", children });
|
|
947
947
|
}
|
|
948
948
|
function CommandRunDetails({ action }) {
|
|
949
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
950
|
-
action.command && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
949
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
950
|
+
action.command && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
951
951
|
/* @__PURE__ */ jsx(SectionHeader, { children: "COMMAND" }),
|
|
952
952
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsx(CodeBlock, { children: action.command }) })
|
|
953
953
|
] }),
|
|
954
|
-
action.result?.output && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
954
|
+
action.result?.output && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
955
955
|
/* @__PURE__ */ jsx(SectionHeader, { children: "OUTPUT" }),
|
|
956
956
|
/* @__PURE__ */ jsxs(SectionContent, { children: [
|
|
957
957
|
/* @__PURE__ */ jsx(CodeBlock, { maxHeight: 300, children: action.result.output }),
|
|
@@ -964,7 +964,7 @@ function CommandRunDetails({ action }) {
|
|
|
964
964
|
] });
|
|
965
965
|
}
|
|
966
966
|
function FileReadDetails({ action }) {
|
|
967
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
967
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
968
968
|
/* @__PURE__ */ jsx(SectionHeader, { children: "PATH" }),
|
|
969
969
|
/* @__PURE__ */ jsxs(SectionContent, { children: [
|
|
970
970
|
/* @__PURE__ */ jsx("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: action.path }),
|
|
@@ -983,31 +983,31 @@ function FileReadDetails({ action }) {
|
|
|
983
983
|
] });
|
|
984
984
|
}
|
|
985
985
|
function FileEditDetails({ action }) {
|
|
986
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
986
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
987
987
|
/* @__PURE__ */ jsx(SectionHeader, { children: "PATH" }),
|
|
988
988
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsx("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: action.path }) }),
|
|
989
|
-
action.oldString && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
989
|
+
action.oldString && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
990
990
|
/* @__PURE__ */ jsx(SectionHeader, { children: "OLD" }),
|
|
991
991
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsx(CodeBlock, { children: action.oldString }) })
|
|
992
992
|
] }),
|
|
993
|
-
action.newString && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
993
|
+
action.newString && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
994
994
|
/* @__PURE__ */ jsx(SectionHeader, { children: "NEW" }),
|
|
995
995
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsx(CodeBlock, { children: action.newString }) })
|
|
996
996
|
] })
|
|
997
997
|
] });
|
|
998
998
|
}
|
|
999
999
|
function FileWriteDetails({ action }) {
|
|
1000
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1000
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1001
1001
|
/* @__PURE__ */ jsx(SectionHeader, { children: "PATH" }),
|
|
1002
1002
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsx("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: action.path }) }),
|
|
1003
|
-
action.content && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1003
|
+
action.content && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1004
1004
|
/* @__PURE__ */ jsx(SectionHeader, { children: "CONTENT" }),
|
|
1005
1005
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsx(CodeBlock, { maxHeight: 300, children: action.content }) })
|
|
1006
1006
|
] })
|
|
1007
1007
|
] });
|
|
1008
1008
|
}
|
|
1009
1009
|
function SearchDetails({ action }) {
|
|
1010
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1010
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1011
1011
|
/* @__PURE__ */ jsx(SectionHeader, { children: "PATTERN" }),
|
|
1012
1012
|
/* @__PURE__ */ jsxs(SectionContent, { children: [
|
|
1013
1013
|
/* @__PURE__ */ jsx("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: action.pattern }),
|
|
@@ -1029,7 +1029,7 @@ function SearchDetails({ action }) {
|
|
|
1029
1029
|
] });
|
|
1030
1030
|
}
|
|
1031
1031
|
function GlobDetails({ action }) {
|
|
1032
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1032
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1033
1033
|
/* @__PURE__ */ jsx(SectionHeader, { children: "PATTERN" }),
|
|
1034
1034
|
/* @__PURE__ */ jsxs(SectionContent, { children: [
|
|
1035
1035
|
/* @__PURE__ */ jsx("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: action.pattern }),
|
|
@@ -1041,7 +1041,7 @@ function GlobDetails({ action }) {
|
|
|
1041
1041
|
] });
|
|
1042
1042
|
}
|
|
1043
1043
|
function WebFetchDetails({ action }) {
|
|
1044
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1044
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1045
1045
|
/* @__PURE__ */ jsx(SectionHeader, { children: "URL" }),
|
|
1046
1046
|
/* @__PURE__ */ jsxs(SectionContent, { children: [
|
|
1047
1047
|
/* @__PURE__ */ jsx(
|
|
@@ -1059,36 +1059,36 @@ function WebFetchDetails({ action }) {
|
|
|
1059
1059
|
] });
|
|
1060
1060
|
}
|
|
1061
1061
|
function WebSearchDetails({ action }) {
|
|
1062
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1062
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1063
1063
|
/* @__PURE__ */ jsx(SectionHeader, { children: "QUERY" }),
|
|
1064
1064
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsx("span", { className: "text-sm text-white/90", children: action.query }) })
|
|
1065
1065
|
] });
|
|
1066
1066
|
}
|
|
1067
1067
|
function McpToolDetails({ action }) {
|
|
1068
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1068
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1069
1069
|
/* @__PURE__ */ jsx(SectionHeader, { children: "TOOL" }),
|
|
1070
1070
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsxs("code", { className: "text-xs font-mono bg-white/10 text-white/90 px-1 py-0.5 rounded", children: [
|
|
1071
1071
|
action.serverName,
|
|
1072
1072
|
":",
|
|
1073
1073
|
action.toolName
|
|
1074
1074
|
] }) }),
|
|
1075
|
-
action.arguments && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1075
|
+
action.arguments && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1076
1076
|
/* @__PURE__ */ jsx(SectionHeader, { children: "ARGS" }),
|
|
1077
1077
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsx(JsonDisplay, { value: action.arguments }) })
|
|
1078
1078
|
] }),
|
|
1079
|
-
action.result && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1079
|
+
action.result && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1080
1080
|
/* @__PURE__ */ jsx(SectionHeader, { children: "RESULT" }),
|
|
1081
1081
|
/* @__PURE__ */ jsx(SectionContent, { children: action.result.type === "markdown" ? /* @__PURE__ */ jsx(CodeBlock, { children: String(action.result.value) }) : /* @__PURE__ */ jsx(JsonDisplay, { value: action.result.value }) })
|
|
1082
1082
|
] })
|
|
1083
1083
|
] });
|
|
1084
1084
|
}
|
|
1085
1085
|
function GenericToolDetails({ action }) {
|
|
1086
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1087
|
-
action.arguments && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1086
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1087
|
+
action.arguments && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1088
1088
|
/* @__PURE__ */ jsx(SectionHeader, { children: "ARGS" }),
|
|
1089
1089
|
/* @__PURE__ */ jsx(SectionContent, { children: /* @__PURE__ */ jsx(JsonDisplay, { value: action.arguments }) })
|
|
1090
1090
|
] }),
|
|
1091
|
-
action.result && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1091
|
+
action.result && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1092
1092
|
/* @__PURE__ */ jsx(SectionHeader, { children: "RESULT" }),
|
|
1093
1093
|
/* @__PURE__ */ jsx(SectionContent, { children: action.result.type === "markdown" ? /* @__PURE__ */ jsx(CodeBlock, { children: String(action.result.value) }) : /* @__PURE__ */ jsx(JsonDisplay, { value: action.result.value }) })
|
|
1094
1094
|
] })
|
|
@@ -1096,8 +1096,8 @@ function GenericToolDetails({ action }) {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
function TodoWriteDetails({ action }) {
|
|
1098
1098
|
const { todos, stats } = action;
|
|
1099
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1100
|
-
stats && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1099
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1100
|
+
stats && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1101
1101
|
/* @__PURE__ */ jsx(SectionHeader, { children: "PROGRESS" }),
|
|
1102
1102
|
/* @__PURE__ */ jsxs(SectionContent, { children: [
|
|
1103
1103
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
@@ -1313,6 +1313,56 @@ function LazyMarkdown({ children, fallback, className }) {
|
|
|
1313
1313
|
}
|
|
1314
1314
|
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("span", { className, children: fallback ?? children }), children: /* @__PURE__ */ jsx(ReactMarkdown, { children }) });
|
|
1315
1315
|
}
|
|
1316
|
+
function DefaultMentionBadge({ segment }) {
|
|
1317
|
+
const bgColor = segment.color ? `${segment.color}20` : "rgba(34, 197, 94, 0.2)";
|
|
1318
|
+
const textColor = segment.color || "#22c55e";
|
|
1319
|
+
const borderColor = segment.color ? `${segment.color}40` : "rgba(34, 197, 94, 0.4)";
|
|
1320
|
+
return /* @__PURE__ */ jsxs(
|
|
1321
|
+
"span",
|
|
1322
|
+
{
|
|
1323
|
+
className: "inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium mx-0.5",
|
|
1324
|
+
style: {
|
|
1325
|
+
backgroundColor: bgColor,
|
|
1326
|
+
color: textColor,
|
|
1327
|
+
border: `1px solid ${borderColor}`
|
|
1328
|
+
},
|
|
1329
|
+
title: segment.id ? `ID: ${segment.id}` : void 0,
|
|
1330
|
+
children: [
|
|
1331
|
+
"@",
|
|
1332
|
+
segment.name
|
|
1333
|
+
]
|
|
1334
|
+
}
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
function RichContentRenderer({
|
|
1338
|
+
content,
|
|
1339
|
+
renderers,
|
|
1340
|
+
className
|
|
1341
|
+
}) {
|
|
1342
|
+
return /* @__PURE__ */ jsx("div", { className: cn("rich-content", className), children: content.map((segment, index) => {
|
|
1343
|
+
const key = `segment-${index}`;
|
|
1344
|
+
switch (segment.type) {
|
|
1345
|
+
case "text":
|
|
1346
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(LazyMarkdown, { children: segment.content }) }, key);
|
|
1347
|
+
case "mention":
|
|
1348
|
+
if (renderers?.renderMention) {
|
|
1349
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderers.renderMention({ segment }) }, key);
|
|
1350
|
+
}
|
|
1351
|
+
return /* @__PURE__ */ jsx(DefaultMentionBadge, { segment }, key);
|
|
1352
|
+
case "component":
|
|
1353
|
+
if (renderers?.renderComponent) {
|
|
1354
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderers.renderComponent({ segment }) }, key);
|
|
1355
|
+
}
|
|
1356
|
+
return /* @__PURE__ */ jsxs("code", { className: "text-xs text-orange-400", children: [
|
|
1357
|
+
"[component: ",
|
|
1358
|
+
segment.componentType,
|
|
1359
|
+
"]"
|
|
1360
|
+
] }, key);
|
|
1361
|
+
default:
|
|
1362
|
+
return null;
|
|
1363
|
+
}
|
|
1364
|
+
}) });
|
|
1365
|
+
}
|
|
1316
1366
|
function OptionCards({ options, onSelect, className }) {
|
|
1317
1367
|
return /* @__PURE__ */ jsx("div", { className: cn("grid gap-2 mt-3", className), style: {
|
|
1318
1368
|
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))"
|
|
@@ -1397,18 +1447,35 @@ function UserMessage({ entry, className }) {
|
|
|
1397
1447
|
/* @__PURE__ */ jsx("div", { className: "w-7 h-7 rounded-full bg-white/10 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx(UserIcon, { className: "w-4 h-4 text-white/50" }) })
|
|
1398
1448
|
] });
|
|
1399
1449
|
}
|
|
1400
|
-
function AssistantMessage({
|
|
1401
|
-
|
|
1450
|
+
function AssistantMessage({
|
|
1451
|
+
entry,
|
|
1452
|
+
onOptionSelect,
|
|
1453
|
+
richContentRenderers,
|
|
1454
|
+
className
|
|
1455
|
+
}) {
|
|
1456
|
+
const parsedOptions = !entry.richContent ? parseOptionsFromContent(entry.content) : null;
|
|
1402
1457
|
const handleOptionSelect = (option) => {
|
|
1403
1458
|
if (onOptionSelect) {
|
|
1404
1459
|
onOptionSelect(`Option ${option.id}: ${option.label}`);
|
|
1405
1460
|
}
|
|
1406
1461
|
};
|
|
1462
|
+
const renderContent = (textContent) => {
|
|
1463
|
+
if (entry.richContent && entry.richContent.length > 0) {
|
|
1464
|
+
return /* @__PURE__ */ jsx(
|
|
1465
|
+
RichContentRenderer,
|
|
1466
|
+
{
|
|
1467
|
+
content: entry.richContent,
|
|
1468
|
+
renderers: richContentRenderers
|
|
1469
|
+
}
|
|
1470
|
+
);
|
|
1471
|
+
}
|
|
1472
|
+
return /* @__PURE__ */ jsx(LazyMarkdown, { children: textContent || entry.content });
|
|
1473
|
+
};
|
|
1407
1474
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex gap-3 ash-animate-fade-in", className), children: [
|
|
1408
1475
|
/* @__PURE__ */ jsx("div", { className: "w-7 h-7 rounded-full bg-[var(--ash-accent)]/20 flex items-center justify-center shrink-0", children: /* @__PURE__ */ jsx(BotIcon, { className: "w-4 h-4 text-[var(--ash-accent)]" }) }),
|
|
1409
1476
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 max-w-[85%]", children: [
|
|
1410
|
-
/* @__PURE__ */ jsx("div", { className: "ash-card-glass rounded-2xl p-4", children: /* @__PURE__ */ jsx("div", { className: "ash-message-content prose prose-sm prose-invert max-w-none text-sm leading-relaxed", children: parsedOptions ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1411
|
-
parsedOptions.preamble &&
|
|
1477
|
+
/* @__PURE__ */ jsx("div", { className: "ash-card-glass rounded-2xl p-4", children: /* @__PURE__ */ jsx("div", { className: "ash-message-content prose prose-sm prose-invert max-w-none text-sm leading-relaxed", children: parsedOptions ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1478
|
+
parsedOptions.preamble && renderContent(parsedOptions.preamble),
|
|
1412
1479
|
/* @__PURE__ */ jsx(
|
|
1413
1480
|
OptionCards,
|
|
1414
1481
|
{
|
|
@@ -1416,7 +1483,7 @@ function AssistantMessage({ entry, onOptionSelect, className }) {
|
|
|
1416
1483
|
onSelect: handleOptionSelect
|
|
1417
1484
|
}
|
|
1418
1485
|
)
|
|
1419
|
-
] }) :
|
|
1486
|
+
] }) : renderContent() }) }),
|
|
1420
1487
|
entry.timestamp && /* @__PURE__ */ jsx("div", { className: "text-xs text-white/40 mt-2", children: formatTimestamp(entry.timestamp) })
|
|
1421
1488
|
] })
|
|
1422
1489
|
] });
|
|
@@ -1451,12 +1518,26 @@ function ErrorMessage({ entry, className }) {
|
|
|
1451
1518
|
] }) })
|
|
1452
1519
|
] });
|
|
1453
1520
|
}
|
|
1454
|
-
function MessageEntry({
|
|
1521
|
+
function MessageEntry({
|
|
1522
|
+
entry,
|
|
1523
|
+
onOptionSelect,
|
|
1524
|
+
defaultExpanded,
|
|
1525
|
+
richContentRenderers,
|
|
1526
|
+
className
|
|
1527
|
+
}) {
|
|
1455
1528
|
switch (entry.entryType.type) {
|
|
1456
1529
|
case "user_message":
|
|
1457
1530
|
return /* @__PURE__ */ jsx(UserMessage, { entry, className });
|
|
1458
1531
|
case "assistant_message":
|
|
1459
|
-
return /* @__PURE__ */ jsx(
|
|
1532
|
+
return /* @__PURE__ */ jsx(
|
|
1533
|
+
AssistantMessage,
|
|
1534
|
+
{
|
|
1535
|
+
entry,
|
|
1536
|
+
onOptionSelect,
|
|
1537
|
+
richContentRenderers,
|
|
1538
|
+
className
|
|
1539
|
+
}
|
|
1540
|
+
);
|
|
1460
1541
|
case "thinking":
|
|
1461
1542
|
return /* @__PURE__ */ jsx(ThinkingMessage, { entry, className });
|
|
1462
1543
|
case "tool_call":
|
|
@@ -2133,6 +2214,7 @@ function MessageList({
|
|
|
2133
2214
|
renderWidget,
|
|
2134
2215
|
onWidgetAction,
|
|
2135
2216
|
autoScroll = true,
|
|
2217
|
+
richContentRenderers,
|
|
2136
2218
|
className
|
|
2137
2219
|
}) {
|
|
2138
2220
|
const contextConfig = useDisplayConfig();
|
|
@@ -2183,7 +2265,16 @@ function MessageList({
|
|
|
2183
2265
|
return /* @__PURE__ */ jsx("div", { className: "ash-animate-fade-in", children: widgetContent }, entry.id);
|
|
2184
2266
|
}
|
|
2185
2267
|
}
|
|
2186
|
-
return /* @__PURE__ */ jsx(
|
|
2268
|
+
return /* @__PURE__ */ jsx(
|
|
2269
|
+
MessageEntry,
|
|
2270
|
+
{
|
|
2271
|
+
entry,
|
|
2272
|
+
onOptionSelect,
|
|
2273
|
+
defaultExpanded: config.defaultExpanded,
|
|
2274
|
+
richContentRenderers
|
|
2275
|
+
},
|
|
2276
|
+
entry.id
|
|
2277
|
+
);
|
|
2187
2278
|
}
|
|
2188
2279
|
const toolCalls = extractToolCallsFromGroup(groupedEntry.entries);
|
|
2189
2280
|
return /* @__PURE__ */ jsxs("div", { className: "flex gap-3 ash-animate-fade-in", children: [
|
|
@@ -3697,6 +3788,6 @@ function useLongTextConversion({
|
|
|
3697
3788
|
};
|
|
3698
3789
|
}
|
|
3699
3790
|
|
|
3700
|
-
export { ActionIcon, AgentToolCard, AlertCircleIcon, AlertTriangleIcon, AssistantMessage, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, ClockIcon, CodeBlock, CodeIcon, CompactToolRow, CompactToolStatusLine, CopyIcon, DEFAULT_DISPLAY_CONFIG, DisplayModeProvider, DisplayModeToggle, EditIcon, EnvVarsPanel, ErrorIcon, ErrorMessage, FileBadge, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, InfoIcon, JsonDisplay, LazyMarkdown, ListChecksIcon, LoaderIcon, LoadingIndicator, LogsPanel, MessageEntry, MessageList, MessageSquareIcon, MoonIcon, OptionCards, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, SpinnerIcon, StatusIndicator, StepAccordion, StopCircleIcon, StreamingText, SunIcon, TerminalIcon, ThemeProvider, ThinkingMessage, TodoPanel, ToolCallCard, ToolCallMessage, ToolExecutionGroup, ToolIcon, TypewriterText, UserIcon, UserMessage, XCircleIcon, XIcon, allKeyframesCss, borderRadius, cn, colors, createToolCall, extractTextContent, extractToolCallsFromGroup, formatElapsedTime, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, inlineStyles, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, keyframes, keyframesCss, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, shadows, spacing, tokensToCssVariables, transitions, truncate, typography, updateToolCallWithResult, useAgentChat, useDisplayConfig, useDisplayMode, useFileUpload, useLongTextConversion, useMessageQueue, useStopExecution, useTheme, widget, zIndex };
|
|
3791
|
+
export { ActionIcon, AgentToolCard, AlertCircleIcon, AlertTriangleIcon, AssistantMessage, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, ClockIcon, CodeBlock, CodeIcon, CompactToolRow, CompactToolStatusLine, CopyIcon, DEFAULT_DISPLAY_CONFIG, DisplayModeProvider, DisplayModeToggle, EditIcon, EnvVarsPanel, ErrorIcon, ErrorMessage, FileBadge, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, InfoIcon, JsonDisplay, LazyMarkdown, ListChecksIcon, LoaderIcon, LoadingIndicator, LogsPanel, MessageEntry, MessageList, MessageSquareIcon, MoonIcon, OptionCards, PaperclipIcon, PlugIcon, RichContentRenderer, SearchIcon, SendIcon, SparklesIcon, SpinnerIcon, StatusIndicator, StepAccordion, StopCircleIcon, StreamingText, SunIcon, TerminalIcon, ThemeProvider, ThinkingMessage, TodoPanel, ToolCallCard, ToolCallMessage, ToolExecutionGroup, ToolIcon, TypewriterText, UserIcon, UserMessage, XCircleIcon, XIcon, allKeyframesCss, borderRadius, cn, colors, createToolCall, extractTextContent, extractToolCallsFromGroup, formatElapsedTime, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, inlineStyles, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, keyframes, keyframesCss, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, shadows, spacing, tokensToCssVariables, transitions, truncate, typography, updateToolCallWithResult, useAgentChat, useDisplayConfig, useDisplayMode, useFileUpload, useLongTextConversion, useMessageQueue, useStopExecution, useTheme, widget, zIndex };
|
|
3701
3792
|
//# sourceMappingURL=index.js.map
|
|
3702
3793
|
//# sourceMappingURL=index.js.map
|