@ash-cloud/ash-ui 0.0.3 → 0.0.4
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/icons.cjs +12 -0
- package/dist/icons.cjs.map +1 -1
- package/dist/icons.d.cts +3 -1
- package/dist/icons.d.ts +3 -1
- package/dist/icons.js +11 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.cjs +231 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -5
- package/dist/index.d.ts +40 -5
- package/dist/index.js +229 -21
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ export { AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_DISP
|
|
|
4
4
|
import { ReactNode, DragEvent, ChangeEvent } from 'react';
|
|
5
5
|
import { ParsedOption } from './utils.cjs';
|
|
6
6
|
export { GroupedEntry, ParsedOptionsResult, ToolUseInput, cn, createToolCall, extractTextContent, extractToolCallsFromGroup, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, truncate, updateToolCallWithResult } from './utils.cjs';
|
|
7
|
-
export { AlertCircleIcon, AlertTriangleIcon, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, CodeIcon, CopyIcon, EditIcon, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, IconProps, InfoIcon, ListChecksIcon, LoaderIcon, MessageSquareIcon, MoonIcon, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, StopCircleIcon, SunIcon, TerminalIcon, ToolIcon, UserIcon, XCircleIcon, XIcon } from './icons.cjs';
|
|
7
|
+
export { AlertCircleIcon, AlertTriangleIcon, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, CodeIcon, CopyIcon, EditIcon, ErrorIcon, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, IconProps, InfoIcon, ListChecksIcon, LoaderIcon, MessageSquareIcon, MoonIcon, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, SpinnerIcon, StopCircleIcon, SunIcon, TerminalIcon, ToolIcon, UserIcon, XCircleIcon, XIcon } from './icons.cjs';
|
|
8
8
|
export { BorderRadius, Colors, Keyframes, Shadows, Spacing, Transitions, Typography, Widget, ZIndex, allKeyframesCss, borderRadius, colors, inlineStyles, keyframes, keyframesCss, shadows, spacing, tokensToCssVariables, transitions, typography, widget, zIndex } from './design-tokens.cjs';
|
|
9
9
|
|
|
10
10
|
interface ToolCallCardProps {
|
|
@@ -382,12 +382,15 @@ interface DisplayModeToggleProps {
|
|
|
382
382
|
labels?: {
|
|
383
383
|
inline?: string;
|
|
384
384
|
compact?: string;
|
|
385
|
+
accordion?: string;
|
|
385
386
|
};
|
|
387
|
+
/** Which modes to cycle through (default: all three) */
|
|
388
|
+
modes?: ToolDisplayMode[];
|
|
386
389
|
}
|
|
387
390
|
/**
|
|
388
|
-
* DisplayModeToggle - Button to
|
|
391
|
+
* DisplayModeToggle - Button to cycle through display modes
|
|
389
392
|
*
|
|
390
|
-
* Uses the DisplayModeContext to
|
|
393
|
+
* Uses the DisplayModeContext to cycle through 'inline', 'compact', and 'accordion' modes.
|
|
391
394
|
* Must be used within a DisplayModeProvider.
|
|
392
395
|
*
|
|
393
396
|
* @example
|
|
@@ -411,7 +414,39 @@ interface DisplayModeToggleProps {
|
|
|
411
414
|
* }
|
|
412
415
|
* ```
|
|
413
416
|
*/
|
|
414
|
-
declare function DisplayModeToggle({ className, showLabel, labels, }: DisplayModeToggleProps): react_jsx_runtime.JSX.Element;
|
|
417
|
+
declare function DisplayModeToggle({ className, showLabel, labels, modes, }: DisplayModeToggleProps): react_jsx_runtime.JSX.Element;
|
|
418
|
+
|
|
419
|
+
type StepStatus = 'pending' | 'running' | 'success' | 'error';
|
|
420
|
+
interface StepAccordionProps {
|
|
421
|
+
/** Tool calls to display as steps */
|
|
422
|
+
toolCalls: NormalizedToolCall[];
|
|
423
|
+
/** Whether the accordion starts expanded */
|
|
424
|
+
defaultExpanded?: boolean;
|
|
425
|
+
/** Controlled expanded state */
|
|
426
|
+
isExpanded?: boolean;
|
|
427
|
+
/** Callback when expanded state changes */
|
|
428
|
+
onToggle?: () => void;
|
|
429
|
+
/** Additional class names */
|
|
430
|
+
className?: string;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* StepAccordion - Simpler accordion that shows tool calls as numbered steps
|
|
434
|
+
*
|
|
435
|
+
* Features:
|
|
436
|
+
* - Collapsed header shows current running step or completion status
|
|
437
|
+
* - Expanded view shows all steps as a numbered list
|
|
438
|
+
* - Shows step duration for completed steps
|
|
439
|
+
* - Compact design suitable for embedding in chat
|
|
440
|
+
*
|
|
441
|
+
* @example
|
|
442
|
+
* ```tsx
|
|
443
|
+
* <StepAccordion
|
|
444
|
+
* toolCalls={normalizedToolCalls}
|
|
445
|
+
* defaultExpanded={false}
|
|
446
|
+
* />
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
declare function StepAccordion({ toolCalls, defaultExpanded, isExpanded: controlledExpanded, onToggle, className, }: StepAccordionProps): react_jsx_runtime.JSX.Element | null;
|
|
415
450
|
|
|
416
451
|
interface StatusIndicatorProps {
|
|
417
452
|
status: ToolStatus;
|
|
@@ -840,4 +875,4 @@ interface UseFileUploadReturn {
|
|
|
840
875
|
declare function useFileUpload({ maxFileSize, // 100MB
|
|
841
876
|
maxFiles, onValidationError, }?: UseFileUploadOptions): UseFileUploadReturn;
|
|
842
877
|
|
|
843
|
-
export { ActionIcon, type ActionIconProps, ActionType, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolStatusLine, type CompactToolStatusLineProps, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, JsonDisplay, type JsonDisplayProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, StatusIndicator, type StatusIndicatorProps, StreamingText, type StreamingTextProps, 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 UseFileUploadOptions, type UseFileUploadReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, useDisplayConfig, useDisplayMode, useFileUpload, useMessageQueue, useStopExecution, useTheme };
|
|
878
|
+
export { ActionIcon, type ActionIconProps, ActionType, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolStatusLine, type CompactToolStatusLineProps, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, JsonDisplay, type JsonDisplayProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, StatusIndicator, type StatusIndicatorProps, StepAccordion, type StepAccordionProps, type StepStatus, StreamingText, type StreamingTextProps, 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 UseFileUploadOptions, type UseFileUploadReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, useDisplayConfig, useDisplayMode, useFileUpload, useMessageQueue, useStopExecution, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_DISP
|
|
|
4
4
|
import { ReactNode, DragEvent, ChangeEvent } from 'react';
|
|
5
5
|
import { ParsedOption } from './utils.js';
|
|
6
6
|
export { GroupedEntry, ParsedOptionsResult, ToolUseInput, cn, createToolCall, extractTextContent, extractToolCallsFromGroup, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, truncate, updateToolCallWithResult } from './utils.js';
|
|
7
|
-
export { AlertCircleIcon, AlertTriangleIcon, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, CodeIcon, CopyIcon, EditIcon, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, IconProps, InfoIcon, ListChecksIcon, LoaderIcon, MessageSquareIcon, MoonIcon, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, StopCircleIcon, SunIcon, TerminalIcon, ToolIcon, UserIcon, XCircleIcon, XIcon } from './icons.js';
|
|
7
|
+
export { AlertCircleIcon, AlertTriangleIcon, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, CodeIcon, CopyIcon, EditIcon, ErrorIcon, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, IconProps, InfoIcon, ListChecksIcon, LoaderIcon, MessageSquareIcon, MoonIcon, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, SpinnerIcon, StopCircleIcon, SunIcon, TerminalIcon, ToolIcon, UserIcon, XCircleIcon, XIcon } from './icons.js';
|
|
8
8
|
export { BorderRadius, Colors, Keyframes, Shadows, Spacing, Transitions, Typography, Widget, ZIndex, allKeyframesCss, borderRadius, colors, inlineStyles, keyframes, keyframesCss, shadows, spacing, tokensToCssVariables, transitions, typography, widget, zIndex } from './design-tokens.js';
|
|
9
9
|
|
|
10
10
|
interface ToolCallCardProps {
|
|
@@ -382,12 +382,15 @@ interface DisplayModeToggleProps {
|
|
|
382
382
|
labels?: {
|
|
383
383
|
inline?: string;
|
|
384
384
|
compact?: string;
|
|
385
|
+
accordion?: string;
|
|
385
386
|
};
|
|
387
|
+
/** Which modes to cycle through (default: all three) */
|
|
388
|
+
modes?: ToolDisplayMode[];
|
|
386
389
|
}
|
|
387
390
|
/**
|
|
388
|
-
* DisplayModeToggle - Button to
|
|
391
|
+
* DisplayModeToggle - Button to cycle through display modes
|
|
389
392
|
*
|
|
390
|
-
* Uses the DisplayModeContext to
|
|
393
|
+
* Uses the DisplayModeContext to cycle through 'inline', 'compact', and 'accordion' modes.
|
|
391
394
|
* Must be used within a DisplayModeProvider.
|
|
392
395
|
*
|
|
393
396
|
* @example
|
|
@@ -411,7 +414,39 @@ interface DisplayModeToggleProps {
|
|
|
411
414
|
* }
|
|
412
415
|
* ```
|
|
413
416
|
*/
|
|
414
|
-
declare function DisplayModeToggle({ className, showLabel, labels, }: DisplayModeToggleProps): react_jsx_runtime.JSX.Element;
|
|
417
|
+
declare function DisplayModeToggle({ className, showLabel, labels, modes, }: DisplayModeToggleProps): react_jsx_runtime.JSX.Element;
|
|
418
|
+
|
|
419
|
+
type StepStatus = 'pending' | 'running' | 'success' | 'error';
|
|
420
|
+
interface StepAccordionProps {
|
|
421
|
+
/** Tool calls to display as steps */
|
|
422
|
+
toolCalls: NormalizedToolCall[];
|
|
423
|
+
/** Whether the accordion starts expanded */
|
|
424
|
+
defaultExpanded?: boolean;
|
|
425
|
+
/** Controlled expanded state */
|
|
426
|
+
isExpanded?: boolean;
|
|
427
|
+
/** Callback when expanded state changes */
|
|
428
|
+
onToggle?: () => void;
|
|
429
|
+
/** Additional class names */
|
|
430
|
+
className?: string;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* StepAccordion - Simpler accordion that shows tool calls as numbered steps
|
|
434
|
+
*
|
|
435
|
+
* Features:
|
|
436
|
+
* - Collapsed header shows current running step or completion status
|
|
437
|
+
* - Expanded view shows all steps as a numbered list
|
|
438
|
+
* - Shows step duration for completed steps
|
|
439
|
+
* - Compact design suitable for embedding in chat
|
|
440
|
+
*
|
|
441
|
+
* @example
|
|
442
|
+
* ```tsx
|
|
443
|
+
* <StepAccordion
|
|
444
|
+
* toolCalls={normalizedToolCalls}
|
|
445
|
+
* defaultExpanded={false}
|
|
446
|
+
* />
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
declare function StepAccordion({ toolCalls, defaultExpanded, isExpanded: controlledExpanded, onToggle, className, }: StepAccordionProps): react_jsx_runtime.JSX.Element | null;
|
|
415
450
|
|
|
416
451
|
interface StatusIndicatorProps {
|
|
417
452
|
status: ToolStatus;
|
|
@@ -840,4 +875,4 @@ interface UseFileUploadReturn {
|
|
|
840
875
|
declare function useFileUpload({ maxFileSize, // 100MB
|
|
841
876
|
maxFiles, onValidationError, }?: UseFileUploadOptions): UseFileUploadReturn;
|
|
842
877
|
|
|
843
|
-
export { ActionIcon, type ActionIconProps, ActionType, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolStatusLine, type CompactToolStatusLineProps, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, JsonDisplay, type JsonDisplayProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, StatusIndicator, type StatusIndicatorProps, StreamingText, type StreamingTextProps, 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 UseFileUploadOptions, type UseFileUploadReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, useDisplayConfig, useDisplayMode, useFileUpload, useMessageQueue, useStopExecution, useTheme };
|
|
878
|
+
export { ActionIcon, type ActionIconProps, ActionType, AssistantMessage, type AssistantMessageProps, type FileAttachment as ChatFileAttachment, CodeBlock, type CodeBlockProps, CompactToolStatusLine, type CompactToolStatusLineProps, type DisplayModeContextType, DisplayModeProvider, type DisplayModeProviderProps, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, ErrorMessage, type ErrorMessageProps, JsonDisplay, type JsonDisplayProps, LoadingIndicator, type LoadingIndicatorProps, LogEntry, LogsPanel, type LogsPanelProps, MessageEntry, type MessageEntryProps, MessageList, type MessageListProps, NormalizedEntry, NormalizedToolCall, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, StatusIndicator, type StatusIndicatorProps, StepAccordion, type StepAccordionProps, type StepStatus, StreamingText, type StreamingTextProps, 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 UseFileUploadOptions, type UseFileUploadReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, UserMessage, type UserMessageProps, useDisplayConfig, useDisplayMode, useFileUpload, useMessageQueue, useStopExecution, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -630,6 +630,16 @@ function ClipboardListIcon({ className }) {
|
|
|
630
630
|
/* @__PURE__ */ jsx("path", { d: "M8 16h.01" })
|
|
631
631
|
] });
|
|
632
632
|
}
|
|
633
|
+
function SpinnerIcon({ className }) {
|
|
634
|
+
return /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
635
|
+
}
|
|
636
|
+
function ErrorIcon({ className }) {
|
|
637
|
+
return /* @__PURE__ */ jsxs("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
638
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
639
|
+
/* @__PURE__ */ jsx("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
|
|
640
|
+
/* @__PURE__ */ jsx("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
641
|
+
] });
|
|
642
|
+
}
|
|
633
643
|
function StatusIndicator({ status, size = "sm", className }) {
|
|
634
644
|
const sizeClasses = {
|
|
635
645
|
sm: "w-2 h-2",
|
|
@@ -1528,6 +1538,163 @@ function ToolExecutionGroup({
|
|
|
1528
1538
|
}
|
|
1529
1539
|
);
|
|
1530
1540
|
}
|
|
1541
|
+
function formatDuration(startMs, endMs) {
|
|
1542
|
+
const duration = endMs - startMs;
|
|
1543
|
+
if (duration < 1e3) return `${duration}ms`;
|
|
1544
|
+
return `${(duration / 1e3).toFixed(1)}s`;
|
|
1545
|
+
}
|
|
1546
|
+
function getToolLabel(toolName, summary) {
|
|
1547
|
+
if (summary && summary.length > 0 && summary.length < 50) {
|
|
1548
|
+
return summary;
|
|
1549
|
+
}
|
|
1550
|
+
const cleaned = toolName.replace(/^mcp__[^_]+__/, "").replace(/Tool$/, "").replace(/_/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
1551
|
+
return cleaned.charAt(0).toUpperCase() + cleaned.slice(1);
|
|
1552
|
+
}
|
|
1553
|
+
function toStepStatus(status) {
|
|
1554
|
+
switch (status) {
|
|
1555
|
+
case "pending":
|
|
1556
|
+
return "running";
|
|
1557
|
+
case "success":
|
|
1558
|
+
return "success";
|
|
1559
|
+
case "failed":
|
|
1560
|
+
return "error";
|
|
1561
|
+
default:
|
|
1562
|
+
return "pending";
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
function StepIcon({ status }) {
|
|
1566
|
+
const iconClass = "w-3.5 h-3.5";
|
|
1567
|
+
switch (status) {
|
|
1568
|
+
case "running":
|
|
1569
|
+
return /* @__PURE__ */ jsx(SpinnerIcon, { className: cn(iconClass, "animate-spin text-[var(--ash-accent)]") });
|
|
1570
|
+
case "success":
|
|
1571
|
+
return /* @__PURE__ */ jsx(CheckIcon, { className: cn(iconClass, "text-[var(--ash-accent)]") });
|
|
1572
|
+
case "error":
|
|
1573
|
+
return /* @__PURE__ */ jsx(ErrorIcon, { className: cn(iconClass, "text-red-500") });
|
|
1574
|
+
default:
|
|
1575
|
+
return /* @__PURE__ */ jsx(ToolIcon, { className: cn(iconClass, "text-white/40") });
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
function StepAccordion({
|
|
1579
|
+
toolCalls,
|
|
1580
|
+
defaultExpanded = false,
|
|
1581
|
+
isExpanded: controlledExpanded,
|
|
1582
|
+
onToggle,
|
|
1583
|
+
className
|
|
1584
|
+
}) {
|
|
1585
|
+
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
1586
|
+
const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
|
|
1587
|
+
const handleToggle = useCallback(() => {
|
|
1588
|
+
if (onToggle) {
|
|
1589
|
+
onToggle();
|
|
1590
|
+
} else {
|
|
1591
|
+
setInternalExpanded((prev) => !prev);
|
|
1592
|
+
}
|
|
1593
|
+
}, [onToggle]);
|
|
1594
|
+
if (toolCalls.length === 0) {
|
|
1595
|
+
return null;
|
|
1596
|
+
}
|
|
1597
|
+
const completedSteps = toolCalls.filter((tc) => tc.status === "success" || tc.status === "failed").length;
|
|
1598
|
+
const runningStep = toolCalls.find((tc) => tc.status === "pending");
|
|
1599
|
+
const hasError = toolCalls.some((tc) => tc.status === "failed");
|
|
1600
|
+
const allComplete = completedSteps === toolCalls.length;
|
|
1601
|
+
return /* @__PURE__ */ jsxs(
|
|
1602
|
+
"div",
|
|
1603
|
+
{
|
|
1604
|
+
className: cn(
|
|
1605
|
+
"rounded-xl border overflow-hidden",
|
|
1606
|
+
hasError ? "border-red-500/30" : allComplete ? "border-[var(--ash-accent)]/30" : "border-yellow-500/30",
|
|
1607
|
+
className
|
|
1608
|
+
),
|
|
1609
|
+
children: [
|
|
1610
|
+
/* @__PURE__ */ jsxs(
|
|
1611
|
+
"button",
|
|
1612
|
+
{
|
|
1613
|
+
type: "button",
|
|
1614
|
+
onClick: handleToggle,
|
|
1615
|
+
className: "w-full flex items-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 transition-colors text-left cursor-pointer",
|
|
1616
|
+
children: [
|
|
1617
|
+
/* @__PURE__ */ jsx(
|
|
1618
|
+
ChevronDownIcon,
|
|
1619
|
+
{
|
|
1620
|
+
className: cn(
|
|
1621
|
+
"w-4 h-4 text-white/40 transition-transform duration-200 flex-shrink-0",
|
|
1622
|
+
!isExpanded && "-rotate-90"
|
|
1623
|
+
)
|
|
1624
|
+
}
|
|
1625
|
+
),
|
|
1626
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-w-0 flex items-center gap-2", children: runningStep ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1627
|
+
/* @__PURE__ */ jsx(SpinnerIcon, { className: "w-3.5 h-3.5 animate-spin text-[var(--ash-accent)] flex-shrink-0" }),
|
|
1628
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-white/80 truncate", children: getToolLabel(runningStep.toolName, runningStep.summary) })
|
|
1629
|
+
] }) : hasError ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1630
|
+
/* @__PURE__ */ jsx(ErrorIcon, { className: "w-3.5 h-3.5 text-red-500 flex-shrink-0" }),
|
|
1631
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-red-400 truncate", children: "Completed with errors" })
|
|
1632
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1633
|
+
/* @__PURE__ */ jsx(CheckIcon, { className: "w-3.5 h-3.5 text-[var(--ash-accent)] flex-shrink-0" }),
|
|
1634
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm text-white/70 truncate", children: [
|
|
1635
|
+
completedSteps,
|
|
1636
|
+
" step",
|
|
1637
|
+
completedSteps !== 1 ? "s" : "",
|
|
1638
|
+
" completed"
|
|
1639
|
+
] })
|
|
1640
|
+
] }) }),
|
|
1641
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs px-1.5 py-0.5 rounded-full bg-white/10 text-white/50 flex-shrink-0", children: [
|
|
1642
|
+
completedSteps,
|
|
1643
|
+
"/",
|
|
1644
|
+
toolCalls.length
|
|
1645
|
+
] })
|
|
1646
|
+
]
|
|
1647
|
+
}
|
|
1648
|
+
),
|
|
1649
|
+
isExpanded && /* @__PURE__ */ jsx("div", { className: "border-t border-white/10 ash-accordion-content", children: /* @__PURE__ */ jsx("div", { className: "divide-y divide-white/5", children: toolCalls.map((toolCall, index) => {
|
|
1650
|
+
const stepStatus = toStepStatus(toolCall.status);
|
|
1651
|
+
const startTime = toolCall.startedAt ? new Date(toolCall.startedAt).getTime() : 0;
|
|
1652
|
+
const endTime = toolCall.completedAt ? new Date(toolCall.completedAt).getTime() : 0;
|
|
1653
|
+
const hasDuration = startTime > 0 && endTime > 0;
|
|
1654
|
+
return /* @__PURE__ */ jsxs(
|
|
1655
|
+
"div",
|
|
1656
|
+
{
|
|
1657
|
+
className: cn(
|
|
1658
|
+
"px-3 py-2 flex items-start gap-2",
|
|
1659
|
+
stepStatus === "running" && "bg-[var(--ash-accent)]/5",
|
|
1660
|
+
stepStatus === "error" && "bg-red-500/5"
|
|
1661
|
+
),
|
|
1662
|
+
children: [
|
|
1663
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 flex-shrink-0 pt-0.5", children: [
|
|
1664
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs text-white/40 w-4 text-right", children: [
|
|
1665
|
+
index + 1,
|
|
1666
|
+
"."
|
|
1667
|
+
] }),
|
|
1668
|
+
/* @__PURE__ */ jsx(StepIcon, { status: stepStatus })
|
|
1669
|
+
] }),
|
|
1670
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1671
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1672
|
+
/* @__PURE__ */ jsx(
|
|
1673
|
+
"span",
|
|
1674
|
+
{
|
|
1675
|
+
className: cn(
|
|
1676
|
+
"text-sm",
|
|
1677
|
+
stepStatus === "running" && "text-[var(--ash-accent)]",
|
|
1678
|
+
stepStatus === "success" && "text-white/70",
|
|
1679
|
+
stepStatus === "error" && "text-red-400",
|
|
1680
|
+
stepStatus === "pending" && "text-white/40"
|
|
1681
|
+
),
|
|
1682
|
+
children: getToolLabel(toolCall.toolName, toolCall.summary)
|
|
1683
|
+
}
|
|
1684
|
+
),
|
|
1685
|
+
hasDuration && (stepStatus === "success" || stepStatus === "error") && /* @__PURE__ */ jsx("span", { className: "text-xs text-white/40", children: formatDuration(startTime, endTime) })
|
|
1686
|
+
] }),
|
|
1687
|
+
toolCall.isError && toolCall.actionType && "result" in toolCall.actionType && /* @__PURE__ */ jsx("p", { className: "text-xs mt-1 text-red-400/80 truncate", children: String(toolCall.actionType.result?.value || "Error") })
|
|
1688
|
+
] })
|
|
1689
|
+
]
|
|
1690
|
+
},
|
|
1691
|
+
toolCall.id
|
|
1692
|
+
);
|
|
1693
|
+
}) }) })
|
|
1694
|
+
]
|
|
1695
|
+
}
|
|
1696
|
+
);
|
|
1697
|
+
}
|
|
1531
1698
|
|
|
1532
1699
|
// src/types.ts
|
|
1533
1700
|
function isCommandRunAction(action) {
|
|
@@ -1646,7 +1813,13 @@ function MessageList({
|
|
|
1646
1813
|
const toolCalls = extractToolCallsFromGroup(groupedEntry.entries);
|
|
1647
1814
|
return /* @__PURE__ */ jsxs("div", { className: "flex gap-3 ash-animate-fade-in", children: [
|
|
1648
1815
|
/* @__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)]" }) }),
|
|
1649
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
1816
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: config.mode === "accordion" ? /* @__PURE__ */ jsx(
|
|
1817
|
+
StepAccordion,
|
|
1818
|
+
{
|
|
1819
|
+
toolCalls,
|
|
1820
|
+
defaultExpanded: config.defaultExpanded
|
|
1821
|
+
}
|
|
1822
|
+
) : /* @__PURE__ */ jsx(
|
|
1650
1823
|
ToolExecutionGroup,
|
|
1651
1824
|
{
|
|
1652
1825
|
toolCalls,
|
|
@@ -2066,19 +2239,22 @@ function EnvVarsPanel({
|
|
|
2066
2239
|
function DisplayModeToggle({
|
|
2067
2240
|
className,
|
|
2068
2241
|
showLabel = true,
|
|
2069
|
-
labels = { inline: "Inline", compact: "Compact" }
|
|
2242
|
+
labels = { inline: "Inline", compact: "Compact", accordion: "Steps" },
|
|
2243
|
+
modes = ["inline", "compact", "accordion"]
|
|
2070
2244
|
}) {
|
|
2071
|
-
const { config,
|
|
2072
|
-
const
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2245
|
+
const { config, setMode } = useDisplayMode();
|
|
2246
|
+
const currentMode = config.mode;
|
|
2247
|
+
const currentIndex = modes.indexOf(currentMode);
|
|
2248
|
+
const effectiveIndex = currentIndex === -1 ? 0 : currentIndex;
|
|
2249
|
+
const nextIndex = (effectiveIndex + 1) % modes.length;
|
|
2250
|
+
const nextMode = modes[nextIndex];
|
|
2251
|
+
const handleClick = () => {
|
|
2252
|
+
setMode(nextMode);
|
|
2253
|
+
};
|
|
2254
|
+
const getIcon = (mode) => {
|
|
2255
|
+
switch (mode) {
|
|
2256
|
+
case "inline":
|
|
2257
|
+
return /* @__PURE__ */ jsx(
|
|
2082
2258
|
"svg",
|
|
2083
2259
|
{
|
|
2084
2260
|
className: "ash-display-mode-icon",
|
|
@@ -2095,10 +2271,9 @@ function DisplayModeToggle({
|
|
|
2095
2271
|
}
|
|
2096
2272
|
)
|
|
2097
2273
|
}
|
|
2098
|
-
)
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
/* @__PURE__ */ jsx(
|
|
2274
|
+
);
|
|
2275
|
+
case "compact":
|
|
2276
|
+
return /* @__PURE__ */ jsx(
|
|
2102
2277
|
"svg",
|
|
2103
2278
|
{
|
|
2104
2279
|
className: "ash-display-mode-icon",
|
|
@@ -2115,9 +2290,42 @@ function DisplayModeToggle({
|
|
|
2115
2290
|
}
|
|
2116
2291
|
)
|
|
2117
2292
|
}
|
|
2118
|
-
)
|
|
2119
|
-
|
|
2120
|
-
|
|
2293
|
+
);
|
|
2294
|
+
case "accordion":
|
|
2295
|
+
return /* @__PURE__ */ jsx(
|
|
2296
|
+
"svg",
|
|
2297
|
+
{
|
|
2298
|
+
className: "ash-display-mode-icon",
|
|
2299
|
+
viewBox: "0 0 24 24",
|
|
2300
|
+
fill: "none",
|
|
2301
|
+
stroke: "currentColor",
|
|
2302
|
+
strokeWidth: "1.5",
|
|
2303
|
+
children: /* @__PURE__ */ jsx(
|
|
2304
|
+
"path",
|
|
2305
|
+
{
|
|
2306
|
+
strokeLinecap: "round",
|
|
2307
|
+
strokeLinejoin: "round",
|
|
2308
|
+
d: "M8.25 6.75h12M8.25 12h12M8.25 17.25h12M3.75 6.75h.007v.008H3.75V6.75zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zM3.75 12h.007v.008H3.75V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm-.375 5.25h.007v.008H3.75v-.008zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"
|
|
2309
|
+
}
|
|
2310
|
+
)
|
|
2311
|
+
}
|
|
2312
|
+
);
|
|
2313
|
+
}
|
|
2314
|
+
};
|
|
2315
|
+
const getLabel = (mode) => {
|
|
2316
|
+
return labels[mode] || mode.charAt(0).toUpperCase() + mode.slice(1);
|
|
2317
|
+
};
|
|
2318
|
+
return /* @__PURE__ */ jsxs(
|
|
2319
|
+
"button",
|
|
2320
|
+
{
|
|
2321
|
+
type: "button",
|
|
2322
|
+
onClick: handleClick,
|
|
2323
|
+
className: cn("ash-display-mode-toggle", className),
|
|
2324
|
+
title: `Switch to ${nextMode} mode`,
|
|
2325
|
+
children: [
|
|
2326
|
+
getIcon(currentMode),
|
|
2327
|
+
showLabel && /* @__PURE__ */ jsx("span", { className: "ash-display-mode-label", children: getLabel(currentMode) })
|
|
2328
|
+
]
|
|
2121
2329
|
}
|
|
2122
2330
|
);
|
|
2123
2331
|
}
|
|
@@ -2729,6 +2937,6 @@ function useFileUpload({
|
|
|
2729
2937
|
};
|
|
2730
2938
|
}
|
|
2731
2939
|
|
|
2732
|
-
export { ActionIcon, AlertCircleIcon, AlertTriangleIcon, AssistantMessage, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, CodeBlock, CodeIcon, CompactToolStatusLine, CopyIcon, DEFAULT_DISPLAY_CONFIG, DisplayModeProvider, DisplayModeToggle, EditIcon, EnvVarsPanel, ErrorMessage, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, InfoIcon, JsonDisplay, ListChecksIcon, LoaderIcon, LoadingIndicator, LogsPanel, MessageEntry, MessageList, MessageSquareIcon, MoonIcon, OptionCards, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, StatusIndicator, StopCircleIcon, StreamingText, SunIcon, TerminalIcon, ThemeProvider, ThinkingMessage, TodoPanel, ToolCallCard, ToolCallMessage, ToolExecutionGroup, ToolIcon, TypewriterText, UserIcon, UserMessage, XCircleIcon, XIcon, allKeyframesCss, borderRadius, cn, colors, createToolCall, extractTextContent, extractToolCallsFromGroup, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, inlineStyles, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, keyframes, keyframesCss, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, shadows, spacing, tokensToCssVariables, transitions, truncate, typography, updateToolCallWithResult, useDisplayConfig, useDisplayMode, useFileUpload, useMessageQueue, useStopExecution, useTheme, widget, zIndex };
|
|
2940
|
+
export { ActionIcon, AlertCircleIcon, AlertTriangleIcon, AssistantMessage, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, CodeBlock, CodeIcon, CompactToolStatusLine, CopyIcon, DEFAULT_DISPLAY_CONFIG, DisplayModeProvider, DisplayModeToggle, EditIcon, EnvVarsPanel, ErrorIcon, ErrorMessage, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, InfoIcon, JsonDisplay, 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, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, groupEntriesForCompactMode, inlineStyles, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, keyframes, keyframesCss, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, shadows, spacing, tokensToCssVariables, transitions, truncate, typography, updateToolCallWithResult, useDisplayConfig, useDisplayMode, useFileUpload, useMessageQueue, useStopExecution, useTheme, widget, zIndex };
|
|
2733
2941
|
//# sourceMappingURL=index.js.map
|
|
2734
2942
|
//# sourceMappingURL=index.js.map
|