@distri/react 0.3.2 → 0.3.3

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
@@ -263,6 +263,7 @@ interface ChatStateStore extends ChatState {
263
263
  completeTool: (toolCall: ToolCall, result: ToolResult) => Promise<void>;
264
264
  executeTool: (toolCall: ToolCall, distriTool: DistriAnyTool) => void;
265
265
  hasPendingToolCalls: () => boolean;
266
+ failAllPendingToolCalls: (errorMessage: string) => void;
266
267
  clearToolResults: () => void;
267
268
  getExternalToolResponses: () => ToolResult[];
268
269
  getCurrentTask: () => TaskState | null;
@@ -391,6 +392,11 @@ interface ChatProps {
391
392
  className?: string;
392
393
  agentId?: string;
393
394
  enableHistory?: boolean;
395
+ /**
396
+ * Enable debug mode to show developer messages in the chat.
397
+ * Developer messages are hidden by default.
398
+ */
399
+ debug?: boolean;
394
400
  }
395
401
  declare const ChatInner: React__default.ForwardRefExoticComponent<ChatProps & React__default.RefAttributes<ChatInstance>>;
396
402
  interface ChatContainerProps extends ChatProps {
@@ -439,7 +445,6 @@ interface ChatInputProps {
439
445
  onSend: (content: string | DistriPart[]) => void;
440
446
  onStop?: () => void;
441
447
  browserEnabled?: boolean;
442
- /** Whether browser has an active session (used for highlighting) */
443
448
  browserHasSession?: boolean;
444
449
  onToggleBrowser?: (enabled: boolean) => void;
445
450
  placeholder?: string;
@@ -514,11 +519,42 @@ interface AuthLoadingProps {
514
519
  }
515
520
  declare const AuthLoading: React__default.FC<AuthLoadingProps>;
516
521
 
522
+ /**
523
+ * AskFollowUp - Interactive stepper component for agent follow-up questions
524
+ *
525
+ * This tool allows agents to ask a series of questions to the user.
526
+ * Questions are rendered as a stepper, one at a time.
527
+ * User answers are collected and sent back to the agent.
528
+ */
529
+
530
+ interface FollowUpQuestion {
531
+ id: string;
532
+ question: string;
533
+ type: 'text' | 'select' | 'multiselect' | 'boolean';
534
+ options?: string[];
535
+ placeholder?: string;
536
+ required?: boolean;
537
+ default?: string | string[] | boolean;
538
+ }
539
+ interface AskFollowUpInput {
540
+ title?: string;
541
+ description?: string;
542
+ questions: FollowUpQuestion[];
543
+ }
544
+ interface AskFollowUpOutput {
545
+ answers: Record<string, string | string[] | boolean>;
546
+ completed: boolean;
547
+ }
548
+ declare const ASK_FOLLOW_UP_TOOL_NAME = "ask_follow_up";
549
+ declare function createAskFollowUpTool(): DistriUiTool;
550
+
517
551
  interface DistriContextValue {
518
552
  client: DistriClient | null;
519
553
  error: Error | null;
520
554
  isLoading: boolean;
521
555
  token?: string | null;
556
+ workspaceId?: string | null;
557
+ setWorkspaceId?: (workspaceId: string | null) => void;
522
558
  }
523
559
  declare const DistriContext: React$1.Context<DistriContextValue>;
524
560
  interface DistriProviderProps {
@@ -555,6 +591,11 @@ declare function useDistriToken(): {
555
591
  token: string | null | undefined;
556
592
  isLoading: boolean;
557
593
  };
594
+ declare function useWorkspace(): {
595
+ workspaceId: string | null | undefined;
596
+ setWorkspaceId: ((workspaceId: string | null) => void) | undefined;
597
+ isLoading: boolean;
598
+ };
558
599
 
559
600
  type AuthStatus = 'idle' | 'loading' | 'authenticated' | 'error';
560
601
  interface DistriAuthContextValue {
@@ -867,8 +908,10 @@ interface MessageRendererProps {
867
908
  isExpanded?: boolean;
868
909
  onToggle?: () => void;
869
910
  toolRenderers?: ToolRendererMap;
911
+ /** Enable debug mode to show developer messages */
912
+ debug?: boolean;
870
913
  }
871
- declare function MessageRenderer({ message, index, toolRenderers, }: MessageRendererProps): React__default.ReactNode;
914
+ declare function MessageRenderer({ message, index, toolRenderers, debug, }: MessageRendererProps): React__default.ReactNode;
872
915
 
873
916
  interface StepBasedRendererProps {
874
917
  message: DistriMessage;
@@ -902,4 +945,4 @@ interface UserMessageRendererProps {
902
945
  }
903
946
  declare const UserMessageRenderer: React__default.FC<UserMessageRendererProps>;
904
947
 
905
- export { AgentSelect, AppSidebar, AssistantMessageRenderer, type AssistantMessageRendererProps, type AttachedImage, AuthLoading, type AuthStatus, Badge, BrowserPreviewPanel, BrowserViewport, type BrowserViewportProps, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Chat, type ChatContainerProps, type ChatCustomRenderers, type ChatEmptyStateCategory, type ChatEmptyStateController, type ChatEmptyStateOptions, type ChatEmptyStateStarter, ChatInner, ChatInput, type ChatInputProps, type ChatInstance, type ChatProps, type ChatState, type ChatStateStore, ConfigurationPanel, DialogRoot as Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, type DistriAnyTool, DistriAuthProvider, DistriContext, DistriProvider, type DistriUiTool, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ExtractedContent, ImageRenderer, type ImageRendererProps, Input, LoadingAnimation, type LoadingAnimationConfig, type LoadingAnimationPreset, type LoadingAnimationProps, LoadingShimmer, MessageRenderer, type MessageRendererProps, type ModelOption, type PlanState, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, StepBasedRenderer, type StepBasedRendererProps, type StepState, type StreamingIndicator, StreamingTextRenderer, type StreamingTtsOptions, type TaskState, Textarea, ThemeProvider, ThemeToggle, ThinkingRenderer, type ThinkingRendererProps, type ToolCallState, type ToolCallStatus, type ToolRendererMap, type ToolRendererProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TtsConfig, type TtsRequest, TypingIndicator, type UiToolProps, type UseAgentOptions, type UseAgentResult, type UseAgentsByUsageResult, type UseAgentsResult, type UseChatMessagesOptions, type UseChatMessagesReturn, type UseChatOptions, type UseChatReturn, type UseConfigurationResult, type UseThreadMessagesOptions, type UseThreadsOptions, type UseThreadsResult, UserMessageRenderer, type UserMessageRendererProps, VoiceInput, type VoiceInputProps, extractContent, useAgent, useAgentDefinitions, useAgentsByUsage, useChat, useChatMessages, useChatStateStore, useConfiguration, useDistri, useDistriAuth, useDistriToken, useSidebar, useSpeechToText, useTheme, useThreads, useTts, wrapFnToolAsUiTool, wrapTools };
948
+ export { ASK_FOLLOW_UP_TOOL_NAME, AgentSelect, AppSidebar, type AskFollowUpInput, type AskFollowUpOutput, AssistantMessageRenderer, type AssistantMessageRendererProps, type AttachedImage, AuthLoading, type AuthStatus, Badge, BrowserPreviewPanel, BrowserViewport, type BrowserViewportProps, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Chat, type ChatContainerProps, type ChatCustomRenderers, type ChatEmptyStateCategory, type ChatEmptyStateController, type ChatEmptyStateOptions, type ChatEmptyStateStarter, ChatInner, ChatInput, type ChatInputProps, type ChatInstance, type ChatProps, type ChatState, type ChatStateStore, ConfigurationPanel, DialogRoot as Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, type DistriAnyTool, DistriAuthProvider, DistriContext, DistriProvider, type DistriUiTool, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ExtractedContent, type FollowUpQuestion, ImageRenderer, type ImageRendererProps, Input, LoadingAnimation, type LoadingAnimationConfig, type LoadingAnimationPreset, type LoadingAnimationProps, LoadingShimmer, MessageRenderer, type MessageRendererProps, type ModelOption, type PlanState, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, StepBasedRenderer, type StepBasedRendererProps, type StepState, type StreamingIndicator, StreamingTextRenderer, type StreamingTtsOptions, type TaskState, Textarea, ThemeProvider, ThemeToggle, ThinkingRenderer, type ThinkingRendererProps, type ToolCallState, type ToolCallStatus, type ToolRendererMap, type ToolRendererProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TtsConfig, type TtsRequest, TypingIndicator, type UiToolProps, type UseAgentOptions, type UseAgentResult, type UseAgentsByUsageResult, type UseAgentsResult, type UseChatMessagesOptions, type UseChatMessagesReturn, type UseChatOptions, type UseChatReturn, type UseConfigurationResult, type UseThreadMessagesOptions, type UseThreadsOptions, type UseThreadsResult, UserMessageRenderer, type UserMessageRendererProps, VoiceInput, type VoiceInputProps, createAskFollowUpTool, extractContent, useAgent, useAgentDefinitions, useAgentsByUsage, useChat, useChatMessages, useChatStateStore, useConfiguration, useDistri, useDistriAuth, useDistriToken, useSidebar, useSpeechToText, useTheme, useThreads, useTts, useWorkspace, wrapFnToolAsUiTool, wrapTools };
package/dist/index.d.ts CHANGED
@@ -263,6 +263,7 @@ interface ChatStateStore extends ChatState {
263
263
  completeTool: (toolCall: ToolCall, result: ToolResult) => Promise<void>;
264
264
  executeTool: (toolCall: ToolCall, distriTool: DistriAnyTool) => void;
265
265
  hasPendingToolCalls: () => boolean;
266
+ failAllPendingToolCalls: (errorMessage: string) => void;
266
267
  clearToolResults: () => void;
267
268
  getExternalToolResponses: () => ToolResult[];
268
269
  getCurrentTask: () => TaskState | null;
@@ -391,6 +392,11 @@ interface ChatProps {
391
392
  className?: string;
392
393
  agentId?: string;
393
394
  enableHistory?: boolean;
395
+ /**
396
+ * Enable debug mode to show developer messages in the chat.
397
+ * Developer messages are hidden by default.
398
+ */
399
+ debug?: boolean;
394
400
  }
395
401
  declare const ChatInner: React__default.ForwardRefExoticComponent<ChatProps & React__default.RefAttributes<ChatInstance>>;
396
402
  interface ChatContainerProps extends ChatProps {
@@ -439,7 +445,6 @@ interface ChatInputProps {
439
445
  onSend: (content: string | DistriPart[]) => void;
440
446
  onStop?: () => void;
441
447
  browserEnabled?: boolean;
442
- /** Whether browser has an active session (used for highlighting) */
443
448
  browserHasSession?: boolean;
444
449
  onToggleBrowser?: (enabled: boolean) => void;
445
450
  placeholder?: string;
@@ -514,11 +519,42 @@ interface AuthLoadingProps {
514
519
  }
515
520
  declare const AuthLoading: React__default.FC<AuthLoadingProps>;
516
521
 
522
+ /**
523
+ * AskFollowUp - Interactive stepper component for agent follow-up questions
524
+ *
525
+ * This tool allows agents to ask a series of questions to the user.
526
+ * Questions are rendered as a stepper, one at a time.
527
+ * User answers are collected and sent back to the agent.
528
+ */
529
+
530
+ interface FollowUpQuestion {
531
+ id: string;
532
+ question: string;
533
+ type: 'text' | 'select' | 'multiselect' | 'boolean';
534
+ options?: string[];
535
+ placeholder?: string;
536
+ required?: boolean;
537
+ default?: string | string[] | boolean;
538
+ }
539
+ interface AskFollowUpInput {
540
+ title?: string;
541
+ description?: string;
542
+ questions: FollowUpQuestion[];
543
+ }
544
+ interface AskFollowUpOutput {
545
+ answers: Record<string, string | string[] | boolean>;
546
+ completed: boolean;
547
+ }
548
+ declare const ASK_FOLLOW_UP_TOOL_NAME = "ask_follow_up";
549
+ declare function createAskFollowUpTool(): DistriUiTool;
550
+
517
551
  interface DistriContextValue {
518
552
  client: DistriClient | null;
519
553
  error: Error | null;
520
554
  isLoading: boolean;
521
555
  token?: string | null;
556
+ workspaceId?: string | null;
557
+ setWorkspaceId?: (workspaceId: string | null) => void;
522
558
  }
523
559
  declare const DistriContext: React$1.Context<DistriContextValue>;
524
560
  interface DistriProviderProps {
@@ -555,6 +591,11 @@ declare function useDistriToken(): {
555
591
  token: string | null | undefined;
556
592
  isLoading: boolean;
557
593
  };
594
+ declare function useWorkspace(): {
595
+ workspaceId: string | null | undefined;
596
+ setWorkspaceId: ((workspaceId: string | null) => void) | undefined;
597
+ isLoading: boolean;
598
+ };
558
599
 
559
600
  type AuthStatus = 'idle' | 'loading' | 'authenticated' | 'error';
560
601
  interface DistriAuthContextValue {
@@ -867,8 +908,10 @@ interface MessageRendererProps {
867
908
  isExpanded?: boolean;
868
909
  onToggle?: () => void;
869
910
  toolRenderers?: ToolRendererMap;
911
+ /** Enable debug mode to show developer messages */
912
+ debug?: boolean;
870
913
  }
871
- declare function MessageRenderer({ message, index, toolRenderers, }: MessageRendererProps): React__default.ReactNode;
914
+ declare function MessageRenderer({ message, index, toolRenderers, debug, }: MessageRendererProps): React__default.ReactNode;
872
915
 
873
916
  interface StepBasedRendererProps {
874
917
  message: DistriMessage;
@@ -902,4 +945,4 @@ interface UserMessageRendererProps {
902
945
  }
903
946
  declare const UserMessageRenderer: React__default.FC<UserMessageRendererProps>;
904
947
 
905
- export { AgentSelect, AppSidebar, AssistantMessageRenderer, type AssistantMessageRendererProps, type AttachedImage, AuthLoading, type AuthStatus, Badge, BrowserPreviewPanel, BrowserViewport, type BrowserViewportProps, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Chat, type ChatContainerProps, type ChatCustomRenderers, type ChatEmptyStateCategory, type ChatEmptyStateController, type ChatEmptyStateOptions, type ChatEmptyStateStarter, ChatInner, ChatInput, type ChatInputProps, type ChatInstance, type ChatProps, type ChatState, type ChatStateStore, ConfigurationPanel, DialogRoot as Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, type DistriAnyTool, DistriAuthProvider, DistriContext, DistriProvider, type DistriUiTool, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ExtractedContent, ImageRenderer, type ImageRendererProps, Input, LoadingAnimation, type LoadingAnimationConfig, type LoadingAnimationPreset, type LoadingAnimationProps, LoadingShimmer, MessageRenderer, type MessageRendererProps, type ModelOption, type PlanState, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, StepBasedRenderer, type StepBasedRendererProps, type StepState, type StreamingIndicator, StreamingTextRenderer, type StreamingTtsOptions, type TaskState, Textarea, ThemeProvider, ThemeToggle, ThinkingRenderer, type ThinkingRendererProps, type ToolCallState, type ToolCallStatus, type ToolRendererMap, type ToolRendererProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TtsConfig, type TtsRequest, TypingIndicator, type UiToolProps, type UseAgentOptions, type UseAgentResult, type UseAgentsByUsageResult, type UseAgentsResult, type UseChatMessagesOptions, type UseChatMessagesReturn, type UseChatOptions, type UseChatReturn, type UseConfigurationResult, type UseThreadMessagesOptions, type UseThreadsOptions, type UseThreadsResult, UserMessageRenderer, type UserMessageRendererProps, VoiceInput, type VoiceInputProps, extractContent, useAgent, useAgentDefinitions, useAgentsByUsage, useChat, useChatMessages, useChatStateStore, useConfiguration, useDistri, useDistriAuth, useDistriToken, useSidebar, useSpeechToText, useTheme, useThreads, useTts, wrapFnToolAsUiTool, wrapTools };
948
+ export { ASK_FOLLOW_UP_TOOL_NAME, AgentSelect, AppSidebar, type AskFollowUpInput, type AskFollowUpOutput, AssistantMessageRenderer, type AssistantMessageRendererProps, type AttachedImage, AuthLoading, type AuthStatus, Badge, BrowserPreviewPanel, BrowserViewport, type BrowserViewportProps, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Chat, type ChatContainerProps, type ChatCustomRenderers, type ChatEmptyStateCategory, type ChatEmptyStateController, type ChatEmptyStateOptions, type ChatEmptyStateStarter, ChatInner, ChatInput, type ChatInputProps, type ChatInstance, type ChatProps, type ChatState, type ChatStateStore, ConfigurationPanel, DialogRoot as Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, type DistriAnyTool, DistriAuthProvider, DistriContext, DistriProvider, type DistriUiTool, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type ExtractedContent, type FollowUpQuestion, ImageRenderer, type ImageRendererProps, Input, LoadingAnimation, type LoadingAnimationConfig, type LoadingAnimationPreset, type LoadingAnimationProps, LoadingShimmer, MessageRenderer, type MessageRendererProps, type ModelOption, type PlanState, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, StepBasedRenderer, type StepBasedRendererProps, type StepState, type StreamingIndicator, StreamingTextRenderer, type StreamingTtsOptions, type TaskState, Textarea, ThemeProvider, ThemeToggle, ThinkingRenderer, type ThinkingRendererProps, type ToolCallState, type ToolCallStatus, type ToolRendererMap, type ToolRendererProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TtsConfig, type TtsRequest, TypingIndicator, type UiToolProps, type UseAgentOptions, type UseAgentResult, type UseAgentsByUsageResult, type UseAgentsResult, type UseChatMessagesOptions, type UseChatMessagesReturn, type UseChatOptions, type UseChatReturn, type UseConfigurationResult, type UseThreadMessagesOptions, type UseThreadsOptions, type UseThreadsResult, UserMessageRenderer, type UserMessageRendererProps, VoiceInput, type VoiceInputProps, createAskFollowUpTool, extractContent, useAgent, useAgentDefinitions, useAgentsByUsage, useChat, useChatMessages, useChatStateStore, useConfiguration, useDistri, useDistriAuth, useDistriToken, useSidebar, useSpeechToText, useTheme, useThreads, useTts, useWorkspace, wrapFnToolAsUiTool, wrapTools };