@foris/ai-agent 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/ai-agent.es.js +14895 -11685
  2. package/dist/ai-agent.umd.js +106 -62
  3. package/dist/components/ai-elements/artifact.d.ts +1 -1
  4. package/dist/components/ai-elements/chain-of-thought.d.ts +2 -2
  5. package/dist/components/ai-elements/checkpoint.d.ts +2 -2
  6. package/dist/components/ai-elements/code-block.d.ts +6 -1
  7. package/dist/components/ai-elements/confirmation.d.ts +2 -2
  8. package/dist/components/ai-elements/context.d.ts +6 -6
  9. package/dist/components/ai-elements/conversation.d.ts +1 -1
  10. package/dist/components/ai-elements/inline-citation.d.ts +3 -3
  11. package/dist/components/ai-elements/message-code-block.d.ts +2 -2
  12. package/dist/components/ai-elements/message.d.ts +1 -1
  13. package/dist/components/ai-elements/model-selector.d.ts +2 -2
  14. package/dist/components/ai-elements/node.d.ts +1 -1
  15. package/dist/components/ai-elements/open-in-chat.d.ts +1 -1
  16. package/dist/components/ai-elements/plan.d.ts +2 -2
  17. package/dist/components/ai-elements/prompt-input.d.ts +5 -5
  18. package/dist/components/ai-elements/queue.d.ts +3 -3
  19. package/dist/components/ai-elements/reasoning.d.ts +1 -1
  20. package/dist/components/ai-elements/sources.d.ts +1 -1
  21. package/dist/components/ai-elements/suggestion.d.ts +2 -2
  22. package/dist/components/ai-elements/task.d.ts +1 -1
  23. package/dist/components/ai-elements/tool.d.ts +1 -1
  24. package/dist/components/ai-elements/web-preview.d.ts +2 -2
  25. package/dist/components/chat-panel/ChatPanel.d.ts +22 -0
  26. package/dist/components/chat-panel/ChatPanelClearDialog.d.ts +13 -0
  27. package/dist/components/chat-panel/ChatPanelHeader.d.ts +5 -0
  28. package/dist/components/chat-panel/ChatPanelWelcome.d.ts +2 -0
  29. package/dist/components/chat-panel/index.d.ts +1 -0
  30. package/dist/components/chat-panel/locale/en.json.d.ts +8 -1
  31. package/dist/components/chat-panel/locale/es.json.d.ts +8 -1
  32. package/dist/components/ui/button-group.d.ts +1 -1
  33. package/dist/components/ui/button.d.ts +1 -1
  34. package/dist/components/ui/carousel.d.ts +1 -1
  35. package/dist/components/ui/command.d.ts +1 -1
  36. package/dist/components/ui/dialog.d.ts +2 -1
  37. package/dist/components/ui/input-group.d.ts +1 -1
  38. package/dist/context/AiAgentThemeContext.d.ts +23 -0
  39. package/dist/context/ChatSessionContext.d.ts +20 -0
  40. package/dist/hooks/useChat.d.ts +1 -0
  41. package/dist/hooks/useChatSubmit.d.ts +4 -2
  42. package/dist/index.d.ts +2 -1
  43. package/dist/style.css +1 -1
  44. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import { Button } from '../ui/button';
1
+ import { Button } from "@/components/ui/button";
2
2
  import { type LucideIcon } from "lucide-react";
3
3
  import type { ComponentProps, HTMLAttributes } from "react";
4
4
  export type ArtifactProps = HTMLAttributes<HTMLDivElement>;
@@ -1,5 +1,5 @@
1
- import { Badge } from '../ui/badge';
2
- import { CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';
1
+ import { Badge } from "@/components/ui/badge";
2
+ import { CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
3
3
  import { type LucideIcon } from "lucide-react";
4
4
  import type { ComponentProps, ReactNode } from "react";
5
5
  export type ChainOfThoughtProps = ComponentProps<"div"> & {
@@ -1,10 +1,10 @@
1
- import { Button } from '../ui/button';
1
+ import { Button } from "@/components/ui/button";
2
2
  import { type LucideProps } from "lucide-react";
3
3
  import type { ComponentProps, HTMLAttributes } from "react";
4
4
  export type CheckpointProps = HTMLAttributes<HTMLDivElement>;
5
5
  export declare const Checkpoint: ({ className, children, ...props }: CheckpointProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export type CheckpointIconProps = LucideProps;
7
- export declare const CheckpointIcon: ({ className, children, ...props }: CheckpointIconProps) => string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode>;
7
+ export declare const CheckpointIcon: ({ className, children, ...props }: CheckpointIconProps) => string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
8
8
  export type CheckpointTriggerProps = ComponentProps<typeof Button> & {
9
9
  tooltip?: string;
10
10
  };
@@ -1,4 +1,4 @@
1
- import { Button } from '../ui/button';
1
+ import { Button } from '@/components/ui/button';
2
2
  import { type ComponentProps, type HTMLAttributes } from 'react';
3
3
  /** Languages supported by the code block (subset bundled for single-file output) */
4
4
  export type CodeBlockLanguage = 'json' | 'typescript' | 'ts' | 'javascript' | 'js' | 'markdown' | 'md' | 'html' | 'css' | 'python' | 'py' | 'yaml' | 'yml' | 'rust' | 'rs' | 'go' | 'csharp' | 'cs' | 'sql' | 'shellscript' | 'sh' | 'bash' | 'toml';
@@ -11,6 +11,11 @@ type CodeBlockContextType = {
11
11
  code: string;
12
12
  };
13
13
  export declare const CodeBlockContext: import("react").Context<CodeBlockContextType>;
14
+ /** Returns the editor background/foreground for the active Shiki theme. */
15
+ export declare function getAiCodeColors(appearance: 'light' | 'dark'): {
16
+ bg: string;
17
+ fg: string;
18
+ };
14
19
  export declare function highlightCode(code: string, language: CodeBlockLanguage, showLineNumbers?: boolean): Promise<[string, string]>;
15
20
  export declare const CodeBlock: ({ code, language, showLineNumbers, className, children, ...props }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
16
21
  export type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {
@@ -1,5 +1,5 @@
1
- import { Alert, AlertDescription } from '../ui/alert';
2
- import { Button } from '../ui/button';
1
+ import { Alert, AlertDescription } from "@/components/ui/alert";
2
+ import { Button } from "@/components/ui/button";
3
3
  import type { ToolUIPart } from "ai";
4
4
  import { type ComponentProps, type ReactNode } from "react";
5
5
  type ToolUIPartApproval = {
@@ -1,5 +1,5 @@
1
- import { Button } from '../ui/button';
2
- import { HoverCard, HoverCardContent } from '../ui/hover-card';
1
+ import { Button } from "@/components/ui/button";
2
+ import { HoverCard, HoverCardContent } from "@/components/ui/hover-card";
3
3
  import type { LanguageModelUsage } from "ai";
4
4
  import { type ComponentProps } from "react";
5
5
  type ModelId = string;
@@ -22,11 +22,11 @@ export declare const ContextContentBody: ({ children, className, ...props }: Con
22
22
  export type ContextContentFooterProps = ComponentProps<"div">;
23
23
  export declare const ContextContentFooter: ({ children, className, ...props }: ContextContentFooterProps) => import("react/jsx-runtime").JSX.Element;
24
24
  export type ContextInputUsageProps = ComponentProps<"div">;
25
- export declare const ContextInputUsage: ({ className, children, ...props }: ContextInputUsageProps) => string | number | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | null;
25
+ export declare const ContextInputUsage: ({ className, children, ...props }: ContextInputUsageProps) => string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
26
26
  export type ContextOutputUsageProps = ComponentProps<"div">;
27
- export declare const ContextOutputUsage: ({ className, children, ...props }: ContextOutputUsageProps) => string | number | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | null;
27
+ export declare const ContextOutputUsage: ({ className, children, ...props }: ContextOutputUsageProps) => string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
28
28
  export type ContextReasoningUsageProps = ComponentProps<"div">;
29
- export declare const ContextReasoningUsage: ({ className, children, ...props }: ContextReasoningUsageProps) => string | number | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | null;
29
+ export declare const ContextReasoningUsage: ({ className, children, ...props }: ContextReasoningUsageProps) => string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
30
30
  export type ContextCacheUsageProps = ComponentProps<"div">;
31
- export declare const ContextCacheUsage: ({ className, children, ...props }: ContextCacheUsageProps) => string | number | true | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | null;
31
+ export declare const ContextCacheUsage: ({ className, children, ...props }: ContextCacheUsageProps) => string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
32
32
  export {};
@@ -1,4 +1,4 @@
1
- import { Button } from '../ui/button';
1
+ import { Button } from '@/components/ui/button';
2
2
  import type { ComponentProps } from 'react';
3
3
  import { StickToBottom } from 'use-stick-to-bottom';
4
4
  export type ConversationProps = ComponentProps<typeof StickToBottom> & {
@@ -1,6 +1,6 @@
1
- import { Badge } from '../ui/badge';
2
- import { Carousel } from '../ui/carousel';
3
- import { HoverCard } from '../ui/hover-card';
1
+ import { Badge } from "@/components/ui/badge";
2
+ import { Carousel } from "@/components/ui/carousel";
3
+ import { HoverCard } from "@/components/ui/hover-card";
4
4
  import { type ComponentProps } from "react";
5
5
  export type InlineCitationProps = ComponentProps<"span">;
6
6
  export declare const InlineCitation: ({ className, ...props }: InlineCitationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  export declare const PreWrapper: ({ children }: {
3
3
  children: React.ReactNode;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -11,4 +11,4 @@ export type MessageCodeBlockProps = React.ComponentProps<'code'>;
11
11
  * react-markdown v10 removed the `inline` prop. We use a Context set by
12
12
  * PreWrapper to distinguish block code (inside <pre>) from inline code.
13
13
  */
14
- export declare const MessageCodeBlock: import("react").MemoExoticComponent<({ className, children, ...props }: MessageCodeBlockProps) => import("react/jsx-runtime").JSX.Element>;
14
+ export declare const MessageCodeBlock: React.MemoExoticComponent<({ className, children, ...props }: MessageCodeBlockProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1,4 +1,4 @@
1
- import { Button } from '../ui/button';
1
+ import { Button } from '@/components/ui/button';
2
2
  import type { FileUIPart, UIMessage } from 'ai';
3
3
  import type { ComponentProps, HTMLAttributes } from 'react';
4
4
  import { StreamingMarkdown } from './streaming-markdown';
@@ -1,5 +1,5 @@
1
- import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from '../ui/command';
2
- import { Dialog, DialogContent, DialogTrigger } from '../ui/dialog';
1
+ import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "@/components/ui/command";
2
+ import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
3
3
  import type { ComponentProps, ReactNode } from "react";
4
4
  export type ModelSelectorProps = ComponentProps<typeof Dialog>;
5
5
  export declare const ModelSelector: (props: ModelSelectorProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '../ui/card';
1
+ import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
2
2
  import type { ComponentProps } from "react";
3
3
  export type NodeProps = ComponentProps<typeof Card> & {
4
4
  handles: {
@@ -1,4 +1,4 @@
1
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '../ui/dropdown-menu';
1
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
2
2
  import { type ComponentProps } from "react";
3
3
  export type OpenInProps = ComponentProps<typeof DropdownMenu> & {
4
4
  query: string;
@@ -1,5 +1,5 @@
1
- import { CardAction, CardContent, CardDescription, CardHeader, CardTitle } from '../ui/card';
2
- import { Collapsible, CollapsibleTrigger } from '../ui/collapsible';
1
+ import { CardAction, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
2
+ import { Collapsible, CollapsibleTrigger } from "@/components/ui/collapsible";
3
3
  import type { ComponentProps } from "react";
4
4
  export type PlanProps = ComponentProps<typeof Collapsible> & {
5
5
  isStreaming?: boolean;
@@ -1,8 +1,8 @@
1
- import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from '../ui/command';
2
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem } from '../ui/dropdown-menu';
3
- import { HoverCard, HoverCardContent, HoverCardTrigger } from '../ui/hover-card';
4
- import { InputGroupAddon, InputGroupButton, InputGroupTextarea } from '../ui/input-group';
5
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select';
1
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from "@/components/ui/command";
2
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdown-menu";
3
+ import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/components/ui/hover-card";
4
+ import { InputGroupAddon, InputGroupButton, InputGroupTextarea } from "@/components/ui/input-group";
5
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
6
6
  import type { ChatStatus, FileUIPart } from "ai";
7
7
  import { type ComponentProps, type FormEvent, type HTMLAttributes, type PropsWithChildren, type ReactNode, type RefObject } from "react";
8
8
  export type AttachmentsContext = {
@@ -1,6 +1,6 @@
1
- import { Button } from '../ui/button';
2
- import { Collapsible, CollapsibleContent } from '../ui/collapsible';
3
- import { ScrollArea } from '../ui/scroll-area';
1
+ import { Button } from "@/components/ui/button";
2
+ import { Collapsible, CollapsibleContent } from "@/components/ui/collapsible";
3
+ import { ScrollArea } from "@/components/ui/scroll-area";
4
4
  import type { ComponentProps } from "react";
5
5
  export type QueueMessagePart = {
6
6
  type: string;
@@ -1,4 +1,4 @@
1
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';
1
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
2
2
  import type { ComponentProps, ReactNode } from "react";
3
3
  type ReasoningContextValue = {
4
4
  isStreaming: boolean;
@@ -1,4 +1,4 @@
1
- import { CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';
1
+ import { CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
2
2
  import type { ComponentProps } from "react";
3
3
  export type SourcesProps = ComponentProps<"div">;
4
4
  export declare const Sources: ({ className, ...props }: SourcesProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- import { Button } from '../ui/button';
2
- import { ScrollArea } from '../ui/scroll-area';
1
+ import { Button } from "@/components/ui/button";
2
+ import { ScrollArea } from "@/components/ui/scroll-area";
3
3
  import type { ComponentProps } from "react";
4
4
  export type SuggestionsProps = ComponentProps<typeof ScrollArea>;
5
5
  export declare const Suggestions: ({ className, children, ...props }: SuggestionsProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';
1
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
2
2
  import type { ComponentProps } from "react";
3
3
  export type TaskItemFileProps = ComponentProps<"div">;
4
4
  export declare const TaskItemFile: ({ children, className, ...props }: TaskItemFileProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { Collapsible, CollapsibleContent } from '../ui/collapsible';
1
+ import { Collapsible, CollapsibleContent } from '@/components/ui/collapsible';
2
2
  import type { ToolUIPart } from 'ai';
3
3
  import type { ComponentProps } from 'react';
4
4
  export type ToolProps = ComponentProps<typeof Collapsible>;
@@ -1,5 +1,5 @@
1
- import { Button } from '../ui/button';
2
- import { Input } from '../ui/input';
1
+ import { Button } from "@/components/ui/button";
2
+ import { Input } from "@/components/ui/input";
3
3
  import type { ComponentProps, ReactNode } from "react";
4
4
  export type WebPreviewContextValue = {
5
5
  url: string;
@@ -1,20 +1,42 @@
1
1
  import type { FC } from 'react';
2
+ import { type AiAgentTheme, type ResolveSyntaxAppearanceFn } from '@/context/AiAgentThemeContext';
2
3
  import type { SuggestionType } from '../../types/chat';
3
4
  import type { DataSource } from '../../types/dataSource';
4
5
  export interface ChatPanelTranslations {
5
6
  title?: string;
6
7
  welcomeTitle?: string;
7
8
  welcomeDescription?: string;
9
+ suggestionsTitle?: string;
8
10
  placeholder?: string;
9
11
  disclaimer?: string;
12
+ clearChatTitle?: string;
13
+ clearChatDescription?: string;
14
+ clearChatConfirm?: string;
15
+ clearChatCancel?: string;
16
+ clearChatTooltipTitle?: string;
17
+ clearChatTooltipDescription?: string;
10
18
  }
11
19
  interface ChatPanelProps extends React.HTMLAttributes<HTMLDivElement> {
12
20
  dataSource: DataSource;
13
21
  className?: string;
14
22
  onClose?: () => void;
23
+ onMenuClick?: () => void;
15
24
  locale?: 'en' | 'es';
16
25
  translations?: ChatPanelTranslations;
17
26
  initialSuggestions?: SuggestionType[];
27
+ /** Host-controlled theme id. Defaults to `dark`. */
28
+ theme?: AiAgentTheme;
29
+ /** Optional mapper from theme id to syntax appearance (incl. CodeBlock Shiki light/dark). */
30
+ resolveSyntaxAppearance?: ResolveSyntaxAppearanceFn;
31
+ /** Called when the user toggles the expand/collapse button. The host can use this to drive `isExpanded` on the containing Drawer. */
32
+ onExpandedChange?: (expanded: boolean) => void;
33
+ /**
34
+ * When `true`, constrains width to the same formula as Drawer `contentWidth="default"`:
35
+ * `max-width: min(30vw, 507px)` and `min-width: 448px` (desktop). Does not change Drawer; use for standalone previews or hosts that do not wrap the panel in Drawer.
36
+ *
37
+ * @default false
38
+ */
39
+ viewportColumnWidth?: boolean;
18
40
  }
19
41
  export declare const ChatPanel: FC<ChatPanelProps>;
20
42
  export default ChatPanel;
@@ -0,0 +1,13 @@
1
+ import type { FC } from 'react';
2
+ interface ChatPanelClearDialogProps {
3
+ isOpen: boolean;
4
+ onOpenChange: (open: boolean) => void;
5
+ container: HTMLElement | null;
6
+ title: string;
7
+ description: string;
8
+ confirmLabel: string;
9
+ cancelLabel: string;
10
+ onConfirm: () => void;
11
+ }
12
+ declare const ChatPanelClearDialog: FC<ChatPanelClearDialogProps>;
13
+ export default ChatPanelClearDialog;
@@ -4,6 +4,11 @@ interface ChatPanelHeaderProps {
4
4
  isExpanded: boolean;
5
5
  onToggleExpand: () => void;
6
6
  onClose?: () => void;
7
+ onMenuClick?: () => void;
8
+ onClearChat?: () => void;
9
+ clearChatTooltipTitle?: string;
10
+ clearChatTooltipDescription?: string;
11
+ isOverlay?: boolean;
7
12
  }
8
13
  declare const ChatPanelHeader: FC<ChatPanelHeaderProps>;
9
14
  export default ChatPanelHeader;
@@ -3,8 +3,10 @@ import type { SuggestionType } from '../../types/chat';
3
3
  interface ChatPanelWelcomeProps {
4
4
  welcomeTitle: string;
5
5
  welcomeDescription: string;
6
+ suggestionsTitle?: string;
6
7
  suggestions: SuggestionType[];
7
8
  onSuggestionClick: (suggestion: SuggestionType) => void;
9
+ isOverlay?: boolean;
8
10
  }
9
11
  declare const ChatPanelWelcome: FC<ChatPanelWelcomeProps>;
10
12
  export default ChatPanelWelcome;
@@ -1,2 +1,3 @@
1
1
  export { ChatPanel, type ChatPanelTranslations } from './ChatPanel';
2
2
  export type { SuggestionType } from '../../types/chat';
3
+ export type { AiAgentTheme, SyntaxAppearance, ResolveSyntaxAppearanceFn, } from '../../context/AiAgentThemeContext';
@@ -2,8 +2,15 @@ declare const _default: {
2
2
  "title": "Foris Agent",
3
3
  "welcomeTitle": "How can I help you?",
4
4
  "welcomeDescription": "Choose a suggestion or ask me a question.",
5
+ "suggestionsTitle": "Suggestions",
5
6
  "placeholder": "Ask or create something...",
6
- "disclaimer": "Foris AI may make mistakes. Verify the responses."
7
+ "disclaimer": "Foris AI may make mistakes. Verify the responses.",
8
+ "clearChatTitle": "Clear current conversation",
9
+ "clearChatDescription": "All messages will be deleted and the current context will be lost. This action cannot be undone.",
10
+ "clearChatConfirm": "Clear conversation",
11
+ "clearChatCancel": "Cancel",
12
+ "clearChatTooltipTitle": "Clear current conversation",
13
+ "clearChatTooltipDescription": "The current conversation context will be lost."
7
14
  }
8
15
  ;
9
16
 
@@ -2,8 +2,15 @@ declare const _default: {
2
2
  "title": "Foris Agent",
3
3
  "welcomeTitle": "¿Cómo puedo ayudarte?",
4
4
  "welcomeDescription": "Puedes elegir una sugerencia o hacerme una pregunta.",
5
+ "suggestionsTitle": "Sugerencias",
5
6
  "placeholder": "Pregunta o crea algo...",
6
- "disclaimer": "Foris AI puede cometer errores. Verifica sus respuestas."
7
+ "disclaimer": "Foris AI puede cometer errores. Verifica sus respuestas.",
8
+ "clearChatTitle": "Limpiar conversación actual",
9
+ "clearChatDescription": "Se borrarán todos los mensajes y se perderá el contexto actual. Esta acción no se puede deshacer.",
10
+ "clearChatConfirm": "Limpiar conversación",
11
+ "clearChatCancel": "Cancelar",
12
+ "clearChatTooltipTitle": "Limpiar conversación actual",
13
+ "clearChatTooltipDescription": "Se perderá el contexto actual de la conversación."
7
14
  }
8
15
  ;
9
16
 
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { type VariantProps } from "class-variance-authority";
3
- import { Separator } from './separator';
3
+ import { Separator } from "@/components/ui/separator";
4
4
  declare const buttonGroupVariants: (props?: ({
5
5
  orientation?: "horizontal" | "vertical" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
4
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
5
5
  size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
3
- import { Button } from './button';
3
+ import { Button } from "@/components/ui/button";
4
4
  type CarouselApi = UseEmblaCarouselType[1];
5
5
  type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
6
6
  type CarouselOptions = UseCarouselParameters[0];
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { Command as CommandPrimitive } from "cmdk";
3
- import { Dialog } from './dialog';
3
+ import { Dialog } from "@/components/ui/dialog";
4
4
  declare function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>): import("react/jsx-runtime").JSX.Element;
5
5
  declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: React.ComponentProps<typeof Dialog> & {
6
6
  title?: string;
@@ -5,8 +5,9 @@ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogP
5
5
  declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
8
- declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
8
+ declare function DialogContent({ className, children, showCloseButton, container, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
9
9
  showCloseButton?: boolean;
10
+ container?: HTMLElement | null;
10
11
  }): import("react/jsx-runtime").JSX.Element;
11
12
  declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
12
13
  declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { type VariantProps } from 'class-variance-authority';
3
- import { Button } from './button';
3
+ import { Button } from '@/components/ui/button';
4
4
  declare function InputGroup({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
5
5
  declare const inputGroupAddonVariants: (props?: ({
6
6
  align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
@@ -0,0 +1,23 @@
1
+ import { type ReactNode } from 'react';
2
+ /** Extensible theme id supplied by the host (documented values: `light`, `dark`). */
3
+ export type AiAgentTheme = string;
4
+ /** Binary pipeline for Shiki and similar highlighters. */
5
+ export type SyntaxAppearance = 'light' | 'dark';
6
+ export type ResolveSyntaxAppearanceFn = (theme: AiAgentTheme) => SyntaxAppearance;
7
+ export declare function defaultResolveSyntaxAppearance(theme: AiAgentTheme): SyntaxAppearance;
8
+ export interface AiAgentThemeContextValue {
9
+ theme: AiAgentTheme;
10
+ syntaxAppearance: SyntaxAppearance;
11
+ }
12
+ /** @internal Consumed by components that need an optional fallback outside the provider. */
13
+ export declare const AiAgentThemeContext: import("react").Context<AiAgentThemeContextValue | null>;
14
+ export interface AiAgentThemeProviderProps {
15
+ children: ReactNode;
16
+ /** Host-controlled theme id. Defaults to `light` when omitted. */
17
+ theme?: AiAgentTheme;
18
+ /** Maps theme ids to Shiki light/dark pipeline; defaults to {@link defaultResolveSyntaxAppearance}. */
19
+ resolveSyntaxAppearance?: ResolveSyntaxAppearanceFn;
20
+ }
21
+ export declare function AiAgentThemeProvider({ children, theme: themeProp, resolveSyntaxAppearance: resolveSyntaxAppearanceProp, }: AiAgentThemeProviderProps): import("react/jsx-runtime").JSX.Element;
22
+ /** Internal: theme context for ai-agent components. Not part of the public package API. */
23
+ export declare function useAiAgentTheme(): AiAgentThemeContextValue;
@@ -0,0 +1,20 @@
1
+ import { type Dispatch, type ReactNode, type SetStateAction } from 'react';
2
+ import type { ChatMessage } from '../types/chat';
3
+ export interface ChatSessionContextValue {
4
+ messages: ChatMessage[];
5
+ setMessages: Dispatch<SetStateAction<ChatMessage[]>>;
6
+ }
7
+ export interface ChatSessionProviderProps {
8
+ children: ReactNode;
9
+ }
10
+ /**
11
+ * Holds chat message state above surfaces that mount/unmount ChatPanel
12
+ * (e.g. drawers). Descendant useChat calls use this state instead of local state.
13
+ */
14
+ export declare function ChatSessionProvider({ children }: ChatSessionProviderProps): import("react/jsx-runtime").JSX.Element;
15
+ /** Used by useChat; prefer useChatSession when the provider is required. */
16
+ export declare function useChatSessionOptional(): ChatSessionContextValue | null;
17
+ /**
18
+ * Access to shared session state. Requires an ancestor {@link ChatSessionProvider}.
19
+ */
20
+ export declare function useChatSession(): ChatSessionContextValue;
@@ -10,4 +10,5 @@ export interface OnSubmitProps {
10
10
  export declare const useChat: (api: string, headers?: Record<string, string>, apiManager?: ApiManager) => {
11
11
  onSubmit: ({ params, input, abortRef }: OnSubmitProps) => Promise<void>;
12
12
  messages: ChatMessage[];
13
+ clearMessages: () => void;
13
14
  };
@@ -1,14 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import { type PromptInputMessage } from '../components/ai-elements/prompt-input';
3
- import { type OnSubmitProps } from './useChat';
3
+ import type { ChatMessage } from '../types/chat';
4
4
  import type { DataSource } from '../types/dataSource';
5
+ import { type OnSubmitProps } from './useChat';
5
6
  interface UseChatSubmitOptions {
6
7
  dataSource: DataSource;
8
+ messages: ChatMessage[];
7
9
  onSubmit: (props: OnSubmitProps) => Promise<void>;
8
10
  resetUserScrolling: () => void;
9
11
  scrollToBottom: (immediate?: boolean) => void;
10
12
  }
11
- export declare const useChatSubmit: ({ dataSource, onSubmit, resetUserScrolling, scrollToBottom, }: UseChatSubmitOptions) => {
13
+ export declare const useChatSubmit: ({ dataSource, messages, onSubmit, resetUserScrolling, scrollToBottom, }: UseChatSubmitOptions) => {
12
14
  input: string;
13
15
  setInput: import("react").Dispatch<import("react").SetStateAction<string>>;
14
16
  isLoadingMessage: boolean;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export { ChatPanel, type ChatPanelTranslations, type SuggestionType, } from './components/chat-panel';
1
+ export { ChatPanel, type ChatPanelTranslations, type SuggestionType, type AiAgentTheme, type SyntaxAppearance, type ResolveSyntaxAppearanceFn, } from './components/chat-panel';
2
+ export { ChatSessionProvider, useChatSession, useChatSessionOptional, type ChatSessionContextValue, type ChatSessionProviderProps, } from './context/ChatSessionContext';
2
3
  export { ChatPanelMenu } from './ai-chat-panel-menu';
3
4
  export { SummaryCard, type SummaryCardProps, type SummaryCardTranslations, type SupportedLocale, } from './components/summary-card';
4
5
  export { PromptCodeEditor } from './ai-prompt-code-editor';