@ash-cloud/ash-ui 0.2.5 → 0.2.6

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.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode, ComponentType, DragEvent, ChangeEvent, ClipboardEvent } from 'react';
3
- import { ToolInvocation, RichContent, MarkdownComponents, MentionProps, TodoStatus, TodoItem, FileAttachment as FileAttachment$2, LogEntry, ToolStatus, ActionType, NormalizedEntry, Message as Message$1 } from './types.cjs';
4
- export { MessageAttachment as AIMessageAttachment, AIMessageRole, AgentToolAction, AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_STYLE_CONFIG, ErrorEntry, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, MessageMetadata, MessageStyleConfig, MessageVariant, NormalizedEntryType, NormalizedToolCall, RenderMetadataFunction, RichContentSegment, RichMentionSegment, RichTextSegment, SearchAction, ThinkingEntry, TodoWriteAction, ToolCallEntry, ToolInvocationState, ToolResult, TypographyScale, UserMessageEntry, WebFetchAction, WebSearchAction, WidgetAction, WidgetEntry, WidgetRenderFunction, WidgetRenderProps, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, messageToNormalizedEntry, messagesToNormalizedEntries, normalizedEntriesToMessages, normalizedEntryToMessage } from './types.cjs';
3
+ import { ToolInvocation, RichContent, MarkdownComponents, MentionProps, ChatDisplayMode, ToolDescriptionMap, TodoStatus, TodoItem, FileAttachment as FileAttachment$2, LogEntry, ToolStatus, ActionType, NormalizedEntry, Message as Message$1 } from './types.cjs';
4
+ export { MessageAttachment as AIMessageAttachment, AIMessageRole, AgentToolAction, AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_STYLE_CONFIG, ErrorEntry, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, MessageMetadata, MessageStyleConfig, MessageVariant, NormalizedEntryType, NormalizedToolCall, RenderMetadataFunction, RichContentSegment, RichMentionSegment, RichTextSegment, SearchAction, SystemMessageEntry, ThinkingEntry, TodoWriteAction, ToolCallEntry, ToolInvocationState, ToolResult, TypographyScale, UserMessageEntry, WebFetchAction, WebSearchAction, WidgetAction, WidgetEntry, WidgetRenderFunction, WidgetRenderProps, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isSystemMessage, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, messageToNormalizedEntry, messagesToNormalizedEntries, normalizedEntriesToMessages, normalizedEntryToMessage } from './types.cjs';
5
5
  import { ParsedOption } from './utils.cjs';
6
6
  export { ParsedOptionsResult, ToolUseInput, cn, createToolCall, extractTextContent, formatElapsedTime, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, truncate, updateToolCallWithResult } from './utils.cjs';
7
7
  export { AlertCircleIcon, AlertTriangleIcon, ArrowUpIcon, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, ClockIcon, CodeIcon, CopyIcon, EditIcon, ErrorIcon, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, HomeIcon, IconProps, InfoIcon, ListChecksIcon, LoaderIcon, MessageSquareIcon, MicrophoneIcon, MoonIcon, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, SpinnerIcon, StopCircleIcon, SunIcon, TerminalIcon, ToolIcon, UserIcon, XCircleIcon, XIcon } from './icons.cjs';
@@ -232,6 +232,38 @@ interface ToolListProps {
232
232
  }
233
233
  declare function ToolList({ toolInvocations, className, defaultExpanded, variant, }: ToolListProps): react_jsx_runtime.JSX.Element | null;
234
234
 
235
+ interface ChatDisplayModeContextValue {
236
+ /** Current display mode */
237
+ mode: ChatDisplayMode;
238
+ /** Toggle between user and debug */
239
+ toggleMode: () => void;
240
+ /** Set mode directly */
241
+ setMode: (mode: ChatDisplayMode) => void;
242
+ /** Consumer-provided user-friendly tool descriptions */
243
+ toolDescriptions: ToolDescriptionMap;
244
+ /** Get user-friendly description for a tool call */
245
+ getUserDescription: (toolName: string, input?: unknown) => string | null;
246
+ }
247
+ /**
248
+ * Access the current chat display mode context.
249
+ * Returns a graceful fallback to 'debug' mode if no provider exists.
250
+ */
251
+ declare function useChatDisplayMode(): ChatDisplayModeContextValue;
252
+ interface ChatDisplayModeProviderProps {
253
+ children: ReactNode;
254
+ /** Initial mode (default: 'user') */
255
+ defaultMode?: ChatDisplayMode;
256
+ /** localStorage key for persisting preference (default: 'ash-display-mode') */
257
+ storageKey?: string;
258
+ /** Consumer-provided user-friendly tool descriptions */
259
+ toolDescriptions?: ToolDescriptionMap;
260
+ }
261
+ declare function ChatDisplayModeProvider({ children, defaultMode, storageKey, toolDescriptions, }: ChatDisplayModeProviderProps): react_jsx_runtime.JSX.Element;
262
+ interface DisplayModeToggleProps {
263
+ className?: string;
264
+ }
265
+ declare function DisplayModeToggle({ className }: DisplayModeToggleProps): react_jsx_runtime.JSX.Element;
266
+
235
267
  interface ReasoningContextValue {
236
268
  /** Whether the reasoning panel is open */
237
269
  isOpen: boolean;
@@ -1104,6 +1136,8 @@ interface CreateStreamOptions {
1104
1136
  metadata?: Record<string, unknown>;
1105
1137
  /** Session context from onBeforeSend/middleware */
1106
1138
  sessionContext?: string;
1139
+ /** Message role. When 'system', the message is stored as a system message. */
1140
+ role?: 'user' | 'system';
1107
1141
  }
1108
1142
  /**
1109
1143
  * Function that creates a stream of events
@@ -1314,9 +1348,15 @@ interface UseAgentChatReturn {
1314
1348
  */
1315
1349
  sessionId: string | null;
1316
1350
  /**
1317
- * Send a message to the agent
1351
+ * Send a message to the agent.
1352
+ * @param prompt - The message text
1353
+ * @param options - Optional send options
1354
+ * @param options.role - Message role. Defaults to 'user'. Use 'system' to send
1355
+ * without creating a user entry (for context injections, auto-notifications).
1318
1356
  */
1319
- send: (prompt: string) => Promise<void>;
1357
+ send: (prompt: string, options?: {
1358
+ role?: 'user' | 'system';
1359
+ }) => Promise<void>;
1320
1360
  /**
1321
1361
  * Stop the current streaming request
1322
1362
  */
@@ -1608,4 +1648,4 @@ interface UseLongTextConversionReturn {
1608
1648
  */
1609
1649
  declare function useLongTextConversion({ threshold, filenameTemplate, onConversion, }?: LongTextConversionOptions): UseLongTextConversionReturn;
1610
1650
 
1611
- export { Message$1 as AIMessage, ActionIcon, type ActionIconProps, ActionType, type StreamEvent as AgentStreamEvent, Attachment, type AttachmentFile, AttachmentInfo, type AttachmentInfoProps, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, Attachments, type AttachmentsProps, type BeforeSendContext, type BeforeSendResult, type FileAttachment as ChatFileAttachment, type ChatMiddleware, type ChatRequestOptions, CodeBlock, type CodeBlockProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, ConversationLoadMore, type ConversationLoadMoreProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, type ConversionInfo, type CreateMessage, type CreateStreamFn, type CreateStreamOptions, EnvVarsPanel, type EnvVarsPanelProps, FileAttachment$2 as FileAttachment, FileBadgeCompact, type FileBadgeProps, type FileAttachment as HookFileAttachment, JsonDisplay, type JsonDisplayProps, LazyMarkdown, type LazyMarkdownProps, LoadingDots, type LoadingDotsProps, LoadingSpinner, type LoadingSpinnerProps, LogEntry, LogsPanel, type LogsPanelProps, type LongTextConversionOptions, MarkdownComponents, Mention, MentionProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAvatar, type MessageAvatarProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageShimmer, type MessageShimmerProps, MessageTimestamp, type MessageTimestampProps, type MiddlewareRequest, type MiddlewareRequestResult, NormalizedEntry, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RichContent, type RichContentProps, RichContentRenderer, Shimmer, ShimmerBlock, type ShimmerBlockProps, ShimmerLine, type ShimmerLineProps, type ShimmerProps, ShimmerText, type ShimmerTextProps, StatusIndicator, type StatusIndicatorProps, type StreamGenerator, Task, TaskContent, type TaskContentProps, TaskItem, type TaskItemProps, TaskList, type TaskListProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextAttachment, ThinkingIndicator, type ThinkingIndicatorProps, TodoItem, TodoStatus, Tool, type ToolCallHandler, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolInvocation, ToolList, type ToolListProps, ToolOutput, type ToolOutputProps, type ToolProps, ToolStatus, type ToolVariant, type UseAgentChatOptions, type UseAgentChatReturn, type UseChatOptions, type UseChatReturn, type UseFileUploadOptions, type UseFileUploadReturn, type UseLongTextConversionReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, applyEventMiddleware, applyRequestMiddleware, callMiddlewareComplete, callMiddlewareError, formatFileSize as formatFileSizeHook, useAgentChat, useAttachment, useChat, useConversation, useFileUpload, useLongTextConversion, useMessage, useMessageQueue, useReasoning, useStopExecution, useTask, useTool };
1651
+ export { Message$1 as AIMessage, ActionIcon, type ActionIconProps, ActionType, type StreamEvent as AgentStreamEvent, Attachment, type AttachmentFile, AttachmentInfo, type AttachmentInfoProps, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, Attachments, type AttachmentsProps, type BeforeSendContext, type BeforeSendResult, ChatDisplayMode, ChatDisplayModeProvider, type ChatDisplayModeProviderProps, type FileAttachment as ChatFileAttachment, type ChatMiddleware, type ChatRequestOptions, CodeBlock, type CodeBlockProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, ConversationLoadMore, type ConversationLoadMoreProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, type ConversionInfo, type CreateMessage, type CreateStreamFn, type CreateStreamOptions, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, FileAttachment$2 as FileAttachment, FileBadgeCompact, type FileBadgeProps, type FileAttachment as HookFileAttachment, JsonDisplay, type JsonDisplayProps, LazyMarkdown, type LazyMarkdownProps, LoadingDots, type LoadingDotsProps, LoadingSpinner, type LoadingSpinnerProps, LogEntry, LogsPanel, type LogsPanelProps, type LongTextConversionOptions, MarkdownComponents, Mention, MentionProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAvatar, type MessageAvatarProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageShimmer, type MessageShimmerProps, MessageTimestamp, type MessageTimestampProps, type MiddlewareRequest, type MiddlewareRequestResult, NormalizedEntry, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RichContent, type RichContentProps, RichContentRenderer, Shimmer, ShimmerBlock, type ShimmerBlockProps, ShimmerLine, type ShimmerLineProps, type ShimmerProps, ShimmerText, type ShimmerTextProps, StatusIndicator, type StatusIndicatorProps, type StreamGenerator, Task, TaskContent, type TaskContentProps, TaskItem, type TaskItemProps, TaskList, type TaskListProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextAttachment, ThinkingIndicator, type ThinkingIndicatorProps, TodoItem, TodoStatus, Tool, type ToolCallHandler, ToolDescriptionMap, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolInvocation, ToolList, type ToolListProps, ToolOutput, type ToolOutputProps, type ToolProps, ToolStatus, type ToolVariant, type UseAgentChatOptions, type UseAgentChatReturn, type UseChatOptions, type UseChatReturn, type UseFileUploadOptions, type UseFileUploadReturn, type UseLongTextConversionReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, applyEventMiddleware, applyRequestMiddleware, callMiddlewareComplete, callMiddlewareError, formatFileSize as formatFileSizeHook, useAgentChat, useAttachment, useChat, useChatDisplayMode, useConversation, useFileUpload, useLongTextConversion, useMessage, useMessageQueue, useReasoning, useStopExecution, useTask, useTool };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode, ComponentType, DragEvent, ChangeEvent, ClipboardEvent } from 'react';
3
- import { ToolInvocation, RichContent, MarkdownComponents, MentionProps, TodoStatus, TodoItem, FileAttachment as FileAttachment$2, LogEntry, ToolStatus, ActionType, NormalizedEntry, Message as Message$1 } from './types.js';
4
- export { MessageAttachment as AIMessageAttachment, AIMessageRole, AgentToolAction, AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_STYLE_CONFIG, ErrorEntry, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, MessageMetadata, MessageStyleConfig, MessageVariant, NormalizedEntryType, NormalizedToolCall, RenderMetadataFunction, RichContentSegment, RichMentionSegment, RichTextSegment, SearchAction, ThinkingEntry, TodoWriteAction, ToolCallEntry, ToolInvocationState, ToolResult, TypographyScale, UserMessageEntry, WebFetchAction, WebSearchAction, WidgetAction, WidgetEntry, WidgetRenderFunction, WidgetRenderProps, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, messageToNormalizedEntry, messagesToNormalizedEntries, normalizedEntriesToMessages, normalizedEntryToMessage } from './types.js';
3
+ import { ToolInvocation, RichContent, MarkdownComponents, MentionProps, ChatDisplayMode, ToolDescriptionMap, TodoStatus, TodoItem, FileAttachment as FileAttachment$2, LogEntry, ToolStatus, ActionType, NormalizedEntry, Message as Message$1 } from './types.js';
4
+ export { MessageAttachment as AIMessageAttachment, AIMessageRole, AgentToolAction, AssistantMessageEntry, CommandRunAction, CommandRunResult, DEFAULT_STYLE_CONFIG, ErrorEntry, FileEditAction, FileReadAction, FileWriteAction, GenericToolAction, GlobAction, LogCategory, LogLevel, McpToolAction, MessageMetadata, MessageStyleConfig, MessageVariant, NormalizedEntryType, NormalizedToolCall, RenderMetadataFunction, RichContentSegment, RichMentionSegment, RichTextSegment, SearchAction, SystemMessageEntry, ThinkingEntry, TodoWriteAction, ToolCallEntry, ToolInvocationState, ToolResult, TypographyScale, UserMessageEntry, WebFetchAction, WebSearchAction, WidgetAction, WidgetEntry, WidgetRenderFunction, WidgetRenderProps, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isSystemMessage, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, messageToNormalizedEntry, messagesToNormalizedEntries, normalizedEntriesToMessages, normalizedEntryToMessage } from './types.js';
5
5
  import { ParsedOption } from './utils.js';
6
6
  export { ParsedOptionsResult, ToolUseInput, cn, createToolCall, extractTextContent, formatElapsedTime, formatFileSize, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, mapToolToActionType, normalizeToolResult, parseCommandResult, parseMcpToolName, parseOptionsFromContent, truncate, updateToolCallWithResult } from './utils.js';
7
7
  export { AlertCircleIcon, AlertTriangleIcon, ArrowUpIcon, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, ClockIcon, CodeIcon, CopyIcon, EditIcon, ErrorIcon, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, HomeIcon, IconProps, InfoIcon, ListChecksIcon, LoaderIcon, MessageSquareIcon, MicrophoneIcon, MoonIcon, PaperclipIcon, PlugIcon, SearchIcon, SendIcon, SparklesIcon, SpinnerIcon, StopCircleIcon, SunIcon, TerminalIcon, ToolIcon, UserIcon, XCircleIcon, XIcon } from './icons.js';
@@ -232,6 +232,38 @@ interface ToolListProps {
232
232
  }
233
233
  declare function ToolList({ toolInvocations, className, defaultExpanded, variant, }: ToolListProps): react_jsx_runtime.JSX.Element | null;
234
234
 
235
+ interface ChatDisplayModeContextValue {
236
+ /** Current display mode */
237
+ mode: ChatDisplayMode;
238
+ /** Toggle between user and debug */
239
+ toggleMode: () => void;
240
+ /** Set mode directly */
241
+ setMode: (mode: ChatDisplayMode) => void;
242
+ /** Consumer-provided user-friendly tool descriptions */
243
+ toolDescriptions: ToolDescriptionMap;
244
+ /** Get user-friendly description for a tool call */
245
+ getUserDescription: (toolName: string, input?: unknown) => string | null;
246
+ }
247
+ /**
248
+ * Access the current chat display mode context.
249
+ * Returns a graceful fallback to 'debug' mode if no provider exists.
250
+ */
251
+ declare function useChatDisplayMode(): ChatDisplayModeContextValue;
252
+ interface ChatDisplayModeProviderProps {
253
+ children: ReactNode;
254
+ /** Initial mode (default: 'user') */
255
+ defaultMode?: ChatDisplayMode;
256
+ /** localStorage key for persisting preference (default: 'ash-display-mode') */
257
+ storageKey?: string;
258
+ /** Consumer-provided user-friendly tool descriptions */
259
+ toolDescriptions?: ToolDescriptionMap;
260
+ }
261
+ declare function ChatDisplayModeProvider({ children, defaultMode, storageKey, toolDescriptions, }: ChatDisplayModeProviderProps): react_jsx_runtime.JSX.Element;
262
+ interface DisplayModeToggleProps {
263
+ className?: string;
264
+ }
265
+ declare function DisplayModeToggle({ className }: DisplayModeToggleProps): react_jsx_runtime.JSX.Element;
266
+
235
267
  interface ReasoningContextValue {
236
268
  /** Whether the reasoning panel is open */
237
269
  isOpen: boolean;
@@ -1104,6 +1136,8 @@ interface CreateStreamOptions {
1104
1136
  metadata?: Record<string, unknown>;
1105
1137
  /** Session context from onBeforeSend/middleware */
1106
1138
  sessionContext?: string;
1139
+ /** Message role. When 'system', the message is stored as a system message. */
1140
+ role?: 'user' | 'system';
1107
1141
  }
1108
1142
  /**
1109
1143
  * Function that creates a stream of events
@@ -1314,9 +1348,15 @@ interface UseAgentChatReturn {
1314
1348
  */
1315
1349
  sessionId: string | null;
1316
1350
  /**
1317
- * Send a message to the agent
1351
+ * Send a message to the agent.
1352
+ * @param prompt - The message text
1353
+ * @param options - Optional send options
1354
+ * @param options.role - Message role. Defaults to 'user'. Use 'system' to send
1355
+ * without creating a user entry (for context injections, auto-notifications).
1318
1356
  */
1319
- send: (prompt: string) => Promise<void>;
1357
+ send: (prompt: string, options?: {
1358
+ role?: 'user' | 'system';
1359
+ }) => Promise<void>;
1320
1360
  /**
1321
1361
  * Stop the current streaming request
1322
1362
  */
@@ -1608,4 +1648,4 @@ interface UseLongTextConversionReturn {
1608
1648
  */
1609
1649
  declare function useLongTextConversion({ threshold, filenameTemplate, onConversion, }?: LongTextConversionOptions): UseLongTextConversionReturn;
1610
1650
 
1611
- export { Message$1 as AIMessage, ActionIcon, type ActionIconProps, ActionType, type StreamEvent as AgentStreamEvent, Attachment, type AttachmentFile, AttachmentInfo, type AttachmentInfoProps, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, Attachments, type AttachmentsProps, type BeforeSendContext, type BeforeSendResult, type FileAttachment as ChatFileAttachment, type ChatMiddleware, type ChatRequestOptions, CodeBlock, type CodeBlockProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, ConversationLoadMore, type ConversationLoadMoreProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, type ConversionInfo, type CreateMessage, type CreateStreamFn, type CreateStreamOptions, EnvVarsPanel, type EnvVarsPanelProps, FileAttachment$2 as FileAttachment, FileBadgeCompact, type FileBadgeProps, type FileAttachment as HookFileAttachment, JsonDisplay, type JsonDisplayProps, LazyMarkdown, type LazyMarkdownProps, LoadingDots, type LoadingDotsProps, LoadingSpinner, type LoadingSpinnerProps, LogEntry, LogsPanel, type LogsPanelProps, type LongTextConversionOptions, MarkdownComponents, Mention, MentionProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAvatar, type MessageAvatarProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageShimmer, type MessageShimmerProps, MessageTimestamp, type MessageTimestampProps, type MiddlewareRequest, type MiddlewareRequestResult, NormalizedEntry, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RichContent, type RichContentProps, RichContentRenderer, Shimmer, ShimmerBlock, type ShimmerBlockProps, ShimmerLine, type ShimmerLineProps, type ShimmerProps, ShimmerText, type ShimmerTextProps, StatusIndicator, type StatusIndicatorProps, type StreamGenerator, Task, TaskContent, type TaskContentProps, TaskItem, type TaskItemProps, TaskList, type TaskListProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextAttachment, ThinkingIndicator, type ThinkingIndicatorProps, TodoItem, TodoStatus, Tool, type ToolCallHandler, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolInvocation, ToolList, type ToolListProps, ToolOutput, type ToolOutputProps, type ToolProps, ToolStatus, type ToolVariant, type UseAgentChatOptions, type UseAgentChatReturn, type UseChatOptions, type UseChatReturn, type UseFileUploadOptions, type UseFileUploadReturn, type UseLongTextConversionReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, applyEventMiddleware, applyRequestMiddleware, callMiddlewareComplete, callMiddlewareError, formatFileSize as formatFileSizeHook, useAgentChat, useAttachment, useChat, useConversation, useFileUpload, useLongTextConversion, useMessage, useMessageQueue, useReasoning, useStopExecution, useTask, useTool };
1651
+ export { Message$1 as AIMessage, ActionIcon, type ActionIconProps, ActionType, type StreamEvent as AgentStreamEvent, Attachment, type AttachmentFile, AttachmentInfo, type AttachmentInfoProps, AttachmentPreview, type AttachmentPreviewProps, type AttachmentProps, AttachmentRemove, type AttachmentRemoveProps, Attachments, type AttachmentsProps, type BeforeSendContext, type BeforeSendResult, ChatDisplayMode, ChatDisplayModeProvider, type ChatDisplayModeProviderProps, type FileAttachment as ChatFileAttachment, type ChatMiddleware, type ChatRequestOptions, CodeBlock, type CodeBlockProps, Conversation, ConversationContent, type ConversationContentProps, ConversationEmptyState, type ConversationEmptyStateProps, ConversationLoadMore, type ConversationLoadMoreProps, type ConversationProps, ConversationScrollButton, type ConversationScrollButtonProps, type ConversionInfo, type CreateMessage, type CreateStreamFn, type CreateStreamOptions, DisplayModeToggle, type DisplayModeToggleProps, EnvVarsPanel, type EnvVarsPanelProps, FileAttachment$2 as FileAttachment, FileBadgeCompact, type FileBadgeProps, type FileAttachment as HookFileAttachment, JsonDisplay, type JsonDisplayProps, LazyMarkdown, type LazyMarkdownProps, LoadingDots, type LoadingDotsProps, LoadingSpinner, type LoadingSpinnerProps, LogEntry, LogsPanel, type LogsPanelProps, type LongTextConversionOptions, MarkdownComponents, Mention, MentionProps, Message, MessageAction, type MessageActionProps, MessageActions, type MessageActionsProps, MessageAvatar, type MessageAvatarProps, MessageContent, type MessageContentProps, type MessageProps, MessageResponse, type MessageResponseProps, MessageShimmer, type MessageShimmerProps, MessageTimestamp, type MessageTimestampProps, type MiddlewareRequest, type MiddlewareRequestResult, NormalizedEntry, OptionCards, type OptionCardsProps, ParsedOption, type QueuedMessage, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RichContent, type RichContentProps, RichContentRenderer, Shimmer, ShimmerBlock, type ShimmerBlockProps, ShimmerLine, type ShimmerLineProps, type ShimmerProps, ShimmerText, type ShimmerTextProps, StatusIndicator, type StatusIndicatorProps, type StreamGenerator, Task, TaskContent, type TaskContentProps, TaskItem, type TaskItemProps, TaskList, type TaskListProps, type TaskProps, TaskTrigger, type TaskTriggerProps, type TextAttachment, ThinkingIndicator, type ThinkingIndicatorProps, TodoItem, TodoStatus, Tool, type ToolCallHandler, ToolDescriptionMap, ToolHeader, type ToolHeaderProps, ToolInput, type ToolInputProps, ToolInvocation, ToolList, type ToolListProps, ToolOutput, type ToolOutputProps, type ToolProps, ToolStatus, type ToolVariant, type UseAgentChatOptions, type UseAgentChatReturn, type UseChatOptions, type UseChatReturn, type UseFileUploadOptions, type UseFileUploadReturn, type UseLongTextConversionReturn, type UseMessageQueueOptions, type UseMessageQueueReturn, type UseStopExecutionOptions, type UseStopExecutionReturn, applyEventMiddleware, applyRequestMiddleware, callMiddlewareComplete, callMiddlewareError, formatFileSize as formatFileSizeHook, useAgentChat, useAttachment, useChat, useChatDisplayMode, useConversation, useFileUpload, useLongTextConversion, useMessage, useMessageQueue, useReasoning, useStopExecution, useTask, useTool };
package/dist/index.js CHANGED
@@ -1267,6 +1267,128 @@ function JsonDisplay({ value, maxHeight, className }) {
1267
1267
  const formatted = JSON.stringify(value, null, 2);
1268
1268
  return /* @__PURE__ */ jsx(CodeBlock, { maxHeight, className, children: formatted });
1269
1269
  }
1270
+ var ChatDisplayModeContext = createContext(null);
1271
+ function useChatDisplayMode() {
1272
+ const ctx = useContext(ChatDisplayModeContext);
1273
+ if (!ctx) {
1274
+ return {
1275
+ mode: "debug",
1276
+ toggleMode: () => {
1277
+ },
1278
+ setMode: () => {
1279
+ },
1280
+ toolDescriptions: {},
1281
+ getUserDescription: () => null
1282
+ };
1283
+ }
1284
+ return ctx;
1285
+ }
1286
+ function ChatDisplayModeProvider({
1287
+ children,
1288
+ defaultMode = "user",
1289
+ storageKey = "ash-display-mode",
1290
+ toolDescriptions = {}
1291
+ }) {
1292
+ const [mode, setModeState] = useState(() => {
1293
+ if (typeof window !== "undefined") {
1294
+ const stored = localStorage.getItem(storageKey);
1295
+ if (stored === "user" || stored === "debug") return stored;
1296
+ }
1297
+ return defaultMode;
1298
+ });
1299
+ useEffect(() => {
1300
+ if (typeof window !== "undefined") {
1301
+ localStorage.setItem(storageKey, mode);
1302
+ }
1303
+ }, [mode, storageKey]);
1304
+ const toggleMode = () => setModeState((m) => m === "user" ? "debug" : "user");
1305
+ const setMode = (m) => setModeState(m);
1306
+ const getUserDescription = (toolName, input) => {
1307
+ if (toolDescriptions[toolName]) {
1308
+ const desc = toolDescriptions[toolName];
1309
+ return typeof desc === "function" ? desc(input) : desc;
1310
+ }
1311
+ for (const [pattern, desc] of Object.entries(toolDescriptions)) {
1312
+ if (toolName.includes(pattern)) {
1313
+ return typeof desc === "function" ? desc(input) : desc;
1314
+ }
1315
+ }
1316
+ return null;
1317
+ };
1318
+ return /* @__PURE__ */ jsx(
1319
+ ChatDisplayModeContext.Provider,
1320
+ {
1321
+ value: {
1322
+ mode,
1323
+ toggleMode,
1324
+ setMode,
1325
+ toolDescriptions,
1326
+ getUserDescription
1327
+ },
1328
+ children
1329
+ }
1330
+ );
1331
+ }
1332
+ function DisplayModeToggle({ className }) {
1333
+ const { mode, toggleMode } = useChatDisplayMode();
1334
+ return /* @__PURE__ */ jsxs(
1335
+ "button",
1336
+ {
1337
+ onClick: toggleMode,
1338
+ className: cn("ash-display-mode-toggle", className),
1339
+ title: mode === "user" ? "Switch to debug mode" : "Switch to user mode",
1340
+ children: [
1341
+ /* @__PURE__ */ jsx("span", { className: "ash-display-mode-icon", children: mode === "user" ? /* @__PURE__ */ jsxs(
1342
+ "svg",
1343
+ {
1344
+ className: "w-4 h-4",
1345
+ fill: "none",
1346
+ stroke: "currentColor",
1347
+ viewBox: "0 0 24 24",
1348
+ children: [
1349
+ /* @__PURE__ */ jsx(
1350
+ "path",
1351
+ {
1352
+ strokeLinecap: "round",
1353
+ strokeLinejoin: "round",
1354
+ strokeWidth: 2,
1355
+ d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
1356
+ }
1357
+ ),
1358
+ /* @__PURE__ */ jsx(
1359
+ "path",
1360
+ {
1361
+ strokeLinecap: "round",
1362
+ strokeLinejoin: "round",
1363
+ strokeWidth: 2,
1364
+ d: "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
1365
+ }
1366
+ )
1367
+ ]
1368
+ }
1369
+ ) : /* @__PURE__ */ jsx(
1370
+ "svg",
1371
+ {
1372
+ className: "w-4 h-4",
1373
+ fill: "none",
1374
+ stroke: "currentColor",
1375
+ viewBox: "0 0 24 24",
1376
+ children: /* @__PURE__ */ jsx(
1377
+ "path",
1378
+ {
1379
+ strokeLinecap: "round",
1380
+ strokeLinejoin: "round",
1381
+ strokeWidth: 2,
1382
+ d: "M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"
1383
+ }
1384
+ )
1385
+ }
1386
+ ) }),
1387
+ /* @__PURE__ */ jsx("span", { className: "ash-display-mode-label", children: mode === "user" ? "User" : "Debug" })
1388
+ ]
1389
+ }
1390
+ );
1391
+ }
1270
1392
  var ToolContext = createContext(null);
1271
1393
  function useTool() {
1272
1394
  const context = useContext(ToolContext);
@@ -1283,6 +1405,7 @@ function Tool({
1283
1405
  variant = "default"
1284
1406
  }) {
1285
1407
  const [isExpanded, setIsExpanded] = useState(defaultExpanded);
1408
+ const { mode, getUserDescription } = useChatDisplayMode();
1286
1409
  const toggleExpanded = () => setIsExpanded((prev) => !prev);
1287
1410
  const contextValue = {
1288
1411
  toolInvocation,
@@ -1294,6 +1417,27 @@ function Tool({
1294
1417
  const isErrorResult = Boolean(
1295
1418
  toolInvocation.result && typeof toolInvocation.result === "object" && "error" in toolInvocation.result
1296
1419
  );
1420
+ if (mode === "user") {
1421
+ const userDesc = getUserDescription(toolInvocation.toolName, toolInvocation.args) || formatToolName(toolInvocation.toolName);
1422
+ return /* @__PURE__ */ jsxs(
1423
+ "div",
1424
+ {
1425
+ className: cn(
1426
+ "ash-tool ash-tool-user-mode",
1427
+ "flex items-center gap-2 px-3 py-1.5",
1428
+ "text-[var(--ash-font-size-xs,11px)]",
1429
+ "text-[var(--ash-text-muted,rgba(255,255,255,0.5))]",
1430
+ className
1431
+ ),
1432
+ "data-tool-name": toolInvocation.toolName,
1433
+ "data-tool-state": toolInvocation.state,
1434
+ children: [
1435
+ /* @__PURE__ */ jsx(StatusIndicator, { status, size: "xs" }),
1436
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: userDesc })
1437
+ ]
1438
+ }
1439
+ );
1440
+ }
1297
1441
  return /* @__PURE__ */ jsx(ToolContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
1298
1442
  "div",
1299
1443
  {
@@ -3128,6 +3272,9 @@ function isErrorEntry(entry) {
3128
3272
  function isWidgetEntry(entry) {
3129
3273
  return entry.type === "widget";
3130
3274
  }
3275
+ function isSystemMessage(entry) {
3276
+ return entry.type === "system_message";
3277
+ }
3131
3278
  var DEFAULT_STYLE_CONFIG = {
3132
3279
  userVariant: "bubble",
3133
3280
  assistantVariant: "bubble",
@@ -3261,7 +3408,7 @@ function messageToNormalizedEntry(message) {
3261
3408
  return {
3262
3409
  id,
3263
3410
  timestamp,
3264
- entryType: { type: "assistant_message" },
3411
+ entryType: { type: "system_message" },
3265
3412
  content
3266
3413
  };
3267
3414
  }
@@ -3909,8 +4056,9 @@ function useAgentChat(options) {
3909
4056
  return false;
3910
4057
  }
3911
4058
  }, [subscribeToSession, maxReconnectAttempts, reconnectBaseDelay, onReconnect, processEvent, emitStreamingEntries, handleToolPermission]);
3912
- const send = useCallback(async (prompt) => {
4059
+ const send = useCallback(async (prompt, sendOptions) => {
3913
4060
  if (isStreaming) return;
4061
+ const role = sendOptions?.role ?? "user";
3914
4062
  let finalPrompt = prompt;
3915
4063
  let additionalMetadata = {};
3916
4064
  let additionalContext;
@@ -3956,13 +4104,15 @@ function useAgentChat(options) {
3956
4104
  setError(null);
3957
4105
  reconnectAttemptsRef.current = 0;
3958
4106
  eventCountRef.current = 0;
3959
- const userEntry = {
3960
- id: `user-${Date.now()}-${Math.random().toString(36).slice(2)}`,
3961
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3962
- entryType: { type: "user_message" },
3963
- content: prompt
3964
- };
3965
- setHistoryEntries((prev) => [...prev, userEntry]);
4107
+ if (role !== "system") {
4108
+ const userEntry = {
4109
+ id: `user-${Date.now()}-${Math.random().toString(36).slice(2)}`,
4110
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
4111
+ entryType: { type: "user_message" },
4112
+ content: prompt
4113
+ };
4114
+ setHistoryEntries((prev) => [...prev, userEntry]);
4115
+ }
3966
4116
  resetStreamingState();
3967
4117
  const controller = new AbortController();
3968
4118
  abortControllerRef.current = controller;
@@ -3972,7 +4122,8 @@ function useAgentChat(options) {
3972
4122
  const stream = createStream(finalPrompt, sessionId || void 0, {
3973
4123
  signal: controller.signal,
3974
4124
  metadata: Object.keys(additionalMetadata).length > 0 ? additionalMetadata : void 0,
3975
- sessionContext: additionalContext
4125
+ sessionContext: additionalContext,
4126
+ role: role !== "user" ? role : void 0
3976
4127
  });
3977
4128
  for await (const event of stream) {
3978
4129
  if (controller.signal.aborted) break;
@@ -4419,6 +4570,6 @@ function useLongTextConversion({
4419
4570
  };
4420
4571
  }
4421
4572
 
4422
- export { ActionIcon, AlertCircleIcon, AlertTriangleIcon, ArrowUpIcon, Attachment, AttachmentInfo, AttachmentPreview, AttachmentRemove, Attachments, BotIcon, BrainIcon, BugIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, ClockIcon, CodeBlock, CodeIcon, Conversation, ConversationContent, ConversationEmptyState, ConversationLoadMore, ConversationScrollButton, CopyIcon, DEFAULT_STYLE_CONFIG, EditIcon, EnvVarsPanel, ErrorIcon, FileBadgeCompact, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, HomeIcon, InfoIcon, JsonDisplay, LazyMarkdown, ListChecksIcon, LoaderIcon, LoadingDots, LoadingSpinner, LogsPanel, Mention, Message, MessageAction, MessageActions, MessageAvatar, MessageContent, MessageResponse, MessageShimmer, MessageSquareIcon, MessageTimestamp, MicrophoneIcon, MoonIcon, OptionCards, PaperclipIcon, PlugIcon, Reasoning, ReasoningContent, ReasoningTrigger, RichContentRenderer, SearchIcon, SendIcon, Shimmer, ShimmerBlock, ShimmerLine, ShimmerText, SparklesIcon, SpinnerIcon, StatusIndicator, StopCircleIcon, SunIcon, Task, TaskContent, TaskItem, TaskList, TaskTrigger, TerminalIcon, ThinkingIndicator, Tool, ToolHeader, ToolIcon, ToolInput, ToolList, ToolOutput, UserIcon, XCircleIcon, XIcon, allKeyframesCss, applyEventMiddleware, applyRequestMiddleware, borderRadius, callMiddlewareComplete, callMiddlewareError, cn, colors, createToolCall, cssVars, extractTextContent, formatElapsedTime, formatFileSize, formatFileSize2 as formatFileSizeHook, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, inlineStyles, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, keyframes, keyframesCss, mapToolToActionType, messageToNormalizedEntry, messagesToNormalizedEntries, normalizeToolResult, normalizedEntriesToMessages, normalizedEntryToMessage, parseCommandResult, parseMcpToolName, parseOptionsFromContent, shadows, spacing, tokensToCssVariables, transitions, truncate, typography, updateToolCallWithResult, useAgentChat, useAttachment, useChat, useConversation, useFileUpload, useLongTextConversion, useMessage, useMessageQueue, useReasoning, useStopExecution, useTask, useTool, widget, zIndex };
4573
+ export { ActionIcon, AlertCircleIcon, AlertTriangleIcon, ArrowUpIcon, Attachment, AttachmentInfo, AttachmentPreview, AttachmentRemove, Attachments, BotIcon, BrainIcon, BugIcon, ChatDisplayModeProvider, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CircleIcon, ClipboardListIcon, ClockIcon, CodeBlock, CodeIcon, Conversation, ConversationContent, ConversationEmptyState, ConversationLoadMore, ConversationScrollButton, CopyIcon, DEFAULT_STYLE_CONFIG, DisplayModeToggle, EditIcon, EnvVarsPanel, ErrorIcon, FileBadgeCompact, FileIcon, FilePlusIcon, FolderSearchIcon, GlobeIcon, HomeIcon, InfoIcon, JsonDisplay, LazyMarkdown, ListChecksIcon, LoaderIcon, LoadingDots, LoadingSpinner, LogsPanel, Mention, Message, MessageAction, MessageActions, MessageAvatar, MessageContent, MessageResponse, MessageShimmer, MessageSquareIcon, MessageTimestamp, MicrophoneIcon, MoonIcon, OptionCards, PaperclipIcon, PlugIcon, Reasoning, ReasoningContent, ReasoningTrigger, RichContentRenderer, SearchIcon, SendIcon, Shimmer, ShimmerBlock, ShimmerLine, ShimmerText, SparklesIcon, SpinnerIcon, StatusIndicator, StopCircleIcon, SunIcon, Task, TaskContent, TaskItem, TaskList, TaskTrigger, TerminalIcon, ThinkingIndicator, Tool, ToolHeader, ToolIcon, ToolInput, ToolList, ToolOutput, UserIcon, XCircleIcon, XIcon, allKeyframesCss, applyEventMiddleware, applyRequestMiddleware, borderRadius, callMiddlewareComplete, callMiddlewareError, cn, colors, createToolCall, cssVars, extractTextContent, formatElapsedTime, formatFileSize, formatFileSize2 as formatFileSizeHook, formatTimestamp, formatToolName, generateToolSummary, getActionIcon, getActionLabel, inlineStyles, isAgentToolAction, isCommandRunAction, isErrorEntry, isFileEditAction, isFileReadAction, isFileWriteAction, isGenericToolAction, isGlobAction, isMcpToolAction, isSearchAction, isSystemMessage, isTodoWriteAction, isToolCallEntry, isWebFetchAction, isWebSearchAction, isWidgetEntry, keyframes, keyframesCss, mapToolToActionType, messageToNormalizedEntry, messagesToNormalizedEntries, normalizeToolResult, normalizedEntriesToMessages, normalizedEntryToMessage, parseCommandResult, parseMcpToolName, parseOptionsFromContent, shadows, spacing, tokensToCssVariables, transitions, truncate, typography, updateToolCallWithResult, useAgentChat, useAttachment, useChat, useChatDisplayMode, useConversation, useFileUpload, useLongTextConversion, useMessage, useMessageQueue, useReasoning, useStopExecution, useTask, useTool, widget, zIndex };
4423
4574
  //# sourceMappingURL=index.js.map
4424
4575
  //# sourceMappingURL=index.js.map