@foris/ai-agent 1.0.6 → 1.0.7

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 (42) hide show
  1. package/dist/ai-agent.es.js +13380 -12719
  2. package/dist/ai-agent.umd.js +67 -92
  3. package/dist/components/chat-panel/chat-panel/ChatPanel.d.ts +1 -16
  4. package/dist/components/chat-panel/chat-panel/chatPanel.constants.d.ts +6 -0
  5. package/dist/components/chat-panel/chat-panel/chatPanel.types.d.ts +70 -4
  6. package/dist/components/chat-panel/chat-panel/index.d.ts +2 -1
  7. package/dist/components/chat-panel/error-connection-fullbody/ErrorConnectionFullBody.d.ts +4 -0
  8. package/dist/components/chat-panel/error-connection-fullbody/errorConnectionFullBody.type.d.ts +11 -0
  9. package/dist/components/chat-panel/error-connection-fullbody/index.d.ts +2 -0
  10. package/dist/components/chat-panel/error-connection-inline/ErrorConnectionInline.d.ts +4 -0
  11. package/dist/components/chat-panel/error-connection-inline/errorConnectionInline.type.d.ts +10 -0
  12. package/dist/components/chat-panel/error-connection-inline/index.d.ts +2 -0
  13. package/dist/components/chat-panel/footer/Footer.d.ts +1 -8
  14. package/dist/components/chat-panel/footer/footer.type.d.ts +18 -0
  15. package/dist/components/chat-panel/footer/index.d.ts +1 -0
  16. package/dist/components/chat-panel/locale/en.json.d.ts +23 -1
  17. package/dist/components/chat-panel/locale/es.json.d.ts +23 -1
  18. package/dist/components/chat-panel/message-item/AssistantResponseFooter.d.ts +13 -0
  19. package/dist/components/chat-panel/message-item/MessageItem.d.ts +12 -0
  20. package/dist/components/chat-panel/message-item/MessageItem.test.d.ts +0 -0
  21. package/dist/components/chat-panel/reasoning-trace/ReasoningTrace.d.ts +4 -0
  22. package/dist/components/chat-panel/reasoning-trace/index.d.ts +2 -0
  23. package/dist/components/chat-panel/reasoning-trace/reasoningTrace.type.d.ts +12 -0
  24. package/dist/components/chat-panel/thinking-indicator/ThinkingIndicator.d.ts +8 -0
  25. package/dist/components/chat-panel/thinking-indicator/index.d.ts +1 -0
  26. package/dist/components/ui/card/Card.d.ts +4 -0
  27. package/dist/components/ui/card/Card.test.d.ts +0 -0
  28. package/dist/components/ui/card/card.types.d.ts +9 -0
  29. package/dist/components/ui/card/index.d.ts +2 -0
  30. package/dist/components/ui/thinking-text/ThinkingText.d.ts +7 -0
  31. package/dist/components/ui/thinking-text/index.d.ts +1 -0
  32. package/dist/components/ui/tooltip.d.ts +8 -3
  33. package/dist/hooks/chat.constants.d.ts +2 -0
  34. package/dist/hooks/useChat.d.ts +8 -4
  35. package/dist/hooks/useChatSubmit.d.ts +2 -2
  36. package/dist/hooks/useConnectivityPing.d.ts +27 -0
  37. package/dist/hooks/useSplitChunks.d.ts +11 -2
  38. package/dist/hooks/useSplitChunks.test.d.ts +1 -0
  39. package/dist/hooks/useThinkingPhase.d.ts +19 -0
  40. package/dist/hooks/useThinkingPhase.test.d.ts +1 -0
  41. package/dist/style.css +1 -1
  42. package/package.json +5 -3
@@ -2,22 +2,7 @@ import type { FC } from 'react';
2
2
  import { type AiAgentTheme, type ResolveSyntaxAppearanceFn } from '@/context/AiAgentThemeContext';
3
3
  import type { SuggestionType } from '../../../types/chat';
4
4
  import type { DataSource } from '../../../types/dataSource';
5
- export interface ChatPanelTranslations {
6
- title?: string;
7
- welcomeTitle?: string;
8
- welcomeDescription?: string;
9
- suggestionsTitle?: string;
10
- placeholder?: string;
11
- disclaimer?: string;
12
- clearChatTitle?: string;
13
- clearChatDescription?: string;
14
- clearChatConfirm?: string;
15
- clearChatCancel?: string;
16
- clearChatTooltipTitle?: string;
17
- clearChatTooltipDescription?: string;
18
- suggestionsTooltipTitle?: string;
19
- suggestionsTooltipDescription?: string;
20
- }
5
+ import type { ChatPanelTranslations } from './chatPanel.types';
21
6
  interface ChatPanelProps extends React.HTMLAttributes<HTMLDivElement> {
22
7
  dataSource: DataSource;
23
8
  className?: string;
@@ -0,0 +1,6 @@
1
+ import type { MessageType } from './chatPanel.types';
2
+ /**
3
+ * Mock fixtures for dev / storybook visibility of every MessageType variant.
4
+ * Not used by production code paths.
5
+ */
6
+ export declare const MOCK_MESSAGES: MessageType[];
@@ -1,7 +1,47 @@
1
1
  import type { ToolCall } from '../../../types/chat';
2
- export type MessageType = {
2
+ export type ErrorMessageKind = 'connection' | 'response';
3
+ export interface ChatPanelTranslations {
4
+ title?: string;
5
+ welcomeTitle?: string;
6
+ welcomeDescription?: string;
7
+ suggestionsTitle?: string;
8
+ placeholder?: string;
9
+ placeholderProcessing?: string;
10
+ placeholderDisconnected?: string;
11
+ processingTooltip?: string;
12
+ sendMessageAriaLabel?: string;
13
+ disclaimer?: string;
14
+ clearChatTitle?: string;
15
+ clearChatDescription?: string;
16
+ clearChatConfirm?: string;
17
+ clearChatCancel?: string;
18
+ clearChatTooltipTitle?: string;
19
+ clearChatTooltipDescription?: string;
20
+ suggestionsTooltipTitle?: string;
21
+ suggestionsTooltipDescription?: string;
22
+ footerResponseCopyTooltip?: string;
23
+ footerResponseCopiedTooltip?: string;
24
+ errorFullBodyTitle?: string;
25
+ errorFullBodyDescription?: string;
26
+ errorFullBodyRetry?: string;
27
+ errorFullBodyReconnecting?: string;
28
+ errorConnectionInlineTitle?: string;
29
+ errorConnectionInlineRetry?: string;
30
+ errorResponseTitle?: string;
31
+ errorResponseRetry?: string;
32
+ thinkingStep1?: string;
33
+ thinkingStep2?: string;
34
+ thinkingUsingTool?: string;
35
+ thinkingPreparing?: string;
36
+ reasoningTraceSingular?: string;
37
+ reasoningTracePlural?: string;
38
+ reasoningTraceParameters?: string;
39
+ reasoningTraceResult?: string;
40
+ }
41
+ export interface UserMessage {
3
42
  key: string;
4
- from: 'user' | 'assistant';
43
+ from: 'user';
44
+ generatedAt?: number;
5
45
  sources?: {
6
46
  href: string;
7
47
  title: string;
@@ -14,5 +54,31 @@ export type MessageType = {
14
54
  content: string;
15
55
  duration: number;
16
56
  };
17
- tool?: ToolCall;
18
- };
57
+ tools?: ToolCall[];
58
+ }
59
+ export interface AssistantMessage {
60
+ key: string;
61
+ from: 'assistant';
62
+ generatedAt?: number;
63
+ sources?: {
64
+ href: string;
65
+ title: string;
66
+ }[];
67
+ versions: {
68
+ id: string;
69
+ content: string;
70
+ }[];
71
+ reasoning?: {
72
+ content: string;
73
+ duration: number;
74
+ };
75
+ tools?: ToolCall[];
76
+ }
77
+ export interface ErrorMessage {
78
+ key: string;
79
+ from: 'error';
80
+ kind: ErrorMessageKind;
81
+ failedUserMessageKey: string;
82
+ }
83
+ export type MessageType = UserMessage | AssistantMessage | ErrorMessage;
84
+ export declare const isErrorMessage: (message: MessageType) => message is ErrorMessage;
@@ -1,2 +1,3 @@
1
- export { ChatPanel, type ChatPanelTranslations } from './ChatPanel';
1
+ export { ChatPanel } from './ChatPanel';
2
+ export type { ChatPanelTranslations } from './chatPanel.types';
2
3
  export type { MessageType } from './chatPanel.types';
@@ -0,0 +1,4 @@
1
+ import { type FC } from 'react';
2
+ import type { ErrorConnectionFullBodyProps } from './errorConnectionFullBody.type';
3
+ declare const ErrorConnectionFullBody: FC<ErrorConnectionFullBodyProps>;
4
+ export default ErrorConnectionFullBody;
@@ -0,0 +1,11 @@
1
+ export interface ErrorConnectionFullBodyTranslations {
2
+ title?: string;
3
+ description?: string;
4
+ retryLabel?: string;
5
+ reconnectingLabel?: string;
6
+ }
7
+ export interface ErrorConnectionFullBodyProps {
8
+ onRetry: () => Promise<void> | void;
9
+ translations?: ErrorConnectionFullBodyTranslations;
10
+ className?: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ export { default as ErrorConnectionFullBody } from './ErrorConnectionFullBody';
2
+ export type { ErrorConnectionFullBodyProps, ErrorConnectionFullBodyTranslations, } from './errorConnectionFullBody.type';
@@ -0,0 +1,4 @@
1
+ import type { FC } from 'react';
2
+ import type { ErrorConnectionInlineProps } from './errorConnectionInline.type';
3
+ declare const ErrorConnectionInline: FC<ErrorConnectionInlineProps>;
4
+ export default ErrorConnectionInline;
@@ -0,0 +1,10 @@
1
+ export interface ErrorConnectionInlineTranslations {
2
+ title?: string;
3
+ retryLabel?: string;
4
+ }
5
+ export interface ErrorConnectionInlineProps {
6
+ failedUserMessageKey: string;
7
+ onRetry: (failedUserMessageKey: string) => Promise<void> | void;
8
+ translations?: ErrorConnectionInlineTranslations;
9
+ className?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ export { default as ErrorConnectionInline } from './ErrorConnectionInline';
2
+ export type { ErrorConnectionInlineProps, ErrorConnectionInlineTranslations, } from './errorConnectionInline.type';
@@ -1,11 +1,4 @@
1
1
  import type { FC } from 'react';
2
- interface FooterProps {
3
- input: string;
4
- onInputChange: (value: string) => void;
5
- onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
6
- onKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
7
- placeholder: string;
8
- disclaimer: string;
9
- }
2
+ import type { FooterProps } from './footer.type';
10
3
  declare const Footer: FC<FooterProps>;
11
4
  export default Footer;
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ export type FooterState = 'idle' | 'processing' | 'disconnected';
3
+ export interface FooterTranslations {
4
+ placeholderIdle: string;
5
+ placeholderProcessing: string;
6
+ placeholderDisconnected: string;
7
+ processingTooltip: string;
8
+ sendMessageAriaLabel: string;
9
+ }
10
+ export interface FooterProps {
11
+ input: string;
12
+ onInputChange: (value: string) => void;
13
+ onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
14
+ onKeyDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void;
15
+ state: FooterState;
16
+ disclaimer: string;
17
+ translations: FooterTranslations;
18
+ }
@@ -1 +1,2 @@
1
1
  export { default as Footer } from './Footer';
2
+ export type { FooterProps, FooterState, FooterTranslations, } from './footer.type';
@@ -4,6 +4,10 @@ declare const _default: {
4
4
  "welcomeDescription": "Choose a suggestion or ask me a question.",
5
5
  "suggestionsTitle": "Suggestions",
6
6
  "placeholder": "Ask or create something...",
7
+ "placeholderProcessing": "Processing request...",
8
+ "placeholderDisconnected": "Not available",
9
+ "processingTooltip": "You have a request in progress",
10
+ "sendMessageAriaLabel": "Send message",
7
11
  "disclaimer": "Foris AI may make mistakes. Verify the responses.",
8
12
  "clearChatTitle": "Clear current conversation",
9
13
  "clearChatDescription": "All messages will be deleted and the current context will be lost. This action cannot be undone.",
@@ -12,7 +16,25 @@ declare const _default: {
12
16
  "clearChatTooltipTitle": "Clear current conversation",
13
17
  "clearChatTooltipDescription": "The current conversation context will be lost.",
14
18
  "suggestionsTooltipTitle": "Suggestions",
15
- "suggestionsTooltipDescription": "Select an option"
19
+ "suggestionsTooltipDescription": "Select an option",
20
+ "footerResponseCopyTooltip": "Copy",
21
+ "footerResponseCopiedTooltip": "Copied",
22
+ "errorFullBodyTitle": "We couldn't connect",
23
+ "errorFullBodyDescription": "Please check your internet connection and try again.",
24
+ "errorFullBodyRetry": "Try again",
25
+ "errorFullBodyReconnecting": "Reconnecting...",
26
+ "errorResponseTitle": "We couldn't generate a response. Try again or ask another question.",
27
+ "errorResponseRetry": "Retry",
28
+ "errorConnectionInlineTitle": "We couldn't send your message. Check your connection and try again.",
29
+ "errorConnectionInlineRetry": "Retry",
30
+ "thinkingStep1": "Thinking...",
31
+ "thinkingStep2": "Understanding your request...",
32
+ "thinkingUsingTool": "Using: {tool}",
33
+ "thinkingPreparing": "Preparing response...",
34
+ "reasoningTraceSingular": "Reasoning · 1 tool used",
35
+ "reasoningTracePlural": "Reasoning · {count} tools used",
36
+ "reasoningTraceParameters": "Parameters",
37
+ "reasoningTraceResult": "Result"
16
38
  }
17
39
  ;
18
40
 
@@ -4,6 +4,10 @@ declare const _default: {
4
4
  "welcomeDescription": "Puedes elegir una sugerencia o hacerme una pregunta.",
5
5
  "suggestionsTitle": "Sugerencias",
6
6
  "placeholder": "Pregunta o crea algo...",
7
+ "placeholderProcessing": "Procesando solicitud...",
8
+ "placeholderDisconnected": "No disponible",
9
+ "processingTooltip": "Tienes una solicitud en curso",
10
+ "sendMessageAriaLabel": "Enviar mensaje",
7
11
  "disclaimer": "Foris AI puede cometer errores. Verifica sus respuestas.",
8
12
  "clearChatTitle": "Limpiar conversación actual",
9
13
  "clearChatDescription": "Se borrarán todos los mensajes y se perderá el contexto actual. Esta acción no se puede deshacer.",
@@ -12,7 +16,25 @@ declare const _default: {
12
16
  "clearChatTooltipTitle": "Limpiar conversación actual",
13
17
  "clearChatTooltipDescription": "Se perderá el contexto actual de la conversación.",
14
18
  "suggestionsTooltipTitle": "Sugerencias",
15
- "suggestionsTooltipDescription": "Selecciona una opción"
19
+ "suggestionsTooltipDescription": "Selecciona una opción",
20
+ "footerResponseCopyTooltip": "Copiar",
21
+ "footerResponseCopiedTooltip": "Copiado",
22
+ "errorFullBodyTitle": "No pudimos conectarnos",
23
+ "errorFullBodyDescription": "Por favor, verifica tu conexión a internet e intenta nuevamente",
24
+ "errorFullBodyRetry": "Vuelve a intentarlo",
25
+ "errorFullBodyReconnecting": "Reconectando...",
26
+ "errorResponseTitle": "No fue posible generar una respuesta. Intenta de nuevo o haz otra pregunta.",
27
+ "errorResponseRetry": "Reintentar",
28
+ "errorConnectionInlineTitle": "No pudimos enviar tu mensaje. Verifica tu conexión e intenta de nuevo.",
29
+ "errorConnectionInlineRetry": "Reintentar",
30
+ "thinkingStep1": "Pensando...",
31
+ "thinkingStep2": "Entendiendo tu solicitud...",
32
+ "thinkingUsingTool": "Usando: {tool}",
33
+ "thinkingPreparing": "Preparando respuesta...",
34
+ "reasoningTraceSingular": "Razonamiento · 1 herramienta utilizada",
35
+ "reasoningTracePlural": "Razonamiento · {count} herramientas utilizadas",
36
+ "reasoningTraceParameters": "Parámetros",
37
+ "reasoningTraceResult": "Resultado"
16
38
  }
17
39
  ;
18
40
 
@@ -0,0 +1,13 @@
1
+ import type { FC, ReactNode } from 'react';
2
+ /** Figma time row: lowercase meridiem (e.g. `pm` not `PM`). */
3
+ export declare function formatAssistantGenerationTime(locale: 'en' | 'es', ms: number): string;
4
+ export interface AssistantResponseFooterProps {
5
+ children: ReactNode;
6
+ textToCopy: string;
7
+ generatedAt?: number;
8
+ locale: 'en' | 'es';
9
+ copyTooltip: string;
10
+ copiedTooltip: string;
11
+ regionLabel?: string;
12
+ }
13
+ export declare const AssistantResponseFooter: FC<AssistantResponseFooterProps>;
@@ -2,6 +2,18 @@ import type { FC } from 'react';
2
2
  import type { MessageType } from '../chat-panel/chatPanel.types';
3
3
  interface MessageItemProps {
4
4
  message: MessageType;
5
+ locale?: 'en' | 'es';
6
+ footerResponseCopyTooltip?: string;
7
+ footerResponseCopiedTooltip?: string;
8
+ onRetryMessage?: (key?: string) => Promise<void> | void;
9
+ errorConnectionInlineTitle?: string;
10
+ errorConnectionInlineRetry?: string;
11
+ errorResponseTitle?: string;
12
+ errorResponseRetry?: string;
13
+ reasoningTraceSingular?: string;
14
+ reasoningTracePlural?: string;
15
+ reasoningTraceParameters?: string;
16
+ reasoningTraceResult?: string;
5
17
  }
6
18
  declare const MessageItem: FC<MessageItemProps>;
7
19
  export default MessageItem;
@@ -0,0 +1,4 @@
1
+ import { type FC } from 'react';
2
+ import type { ReasoningTraceProps } from './reasoningTrace.type';
3
+ declare const ReasoningTrace: FC<ReasoningTraceProps>;
4
+ export { ReasoningTrace };
@@ -0,0 +1,2 @@
1
+ export { ReasoningTrace } from './ReasoningTrace';
2
+ export type { ReasoningTraceProps, ReasoningTraceTranslations } from './reasoningTrace.type';
@@ -0,0 +1,12 @@
1
+ import type { ToolCall } from '../../../types/chat';
2
+ export interface ReasoningTraceTranslations {
3
+ headerSingular?: string;
4
+ headerPlural?: string;
5
+ parameters?: string;
6
+ result?: string;
7
+ }
8
+ export interface ReasoningTraceProps {
9
+ tools: ToolCall[];
10
+ translations?: ReasoningTraceTranslations;
11
+ className?: string;
12
+ }
@@ -0,0 +1,8 @@
1
+ import { type FC } from 'react';
2
+ import type { ThinkingPhase } from '../../../hooks/useThinkingPhase';
3
+ interface ThinkingIndicatorProps {
4
+ phase: ThinkingPhase;
5
+ label: string;
6
+ }
7
+ declare const ThinkingIndicator: FC<ThinkingIndicatorProps>;
8
+ export { ThinkingIndicator };
@@ -0,0 +1 @@
1
+ export { ThinkingIndicator } from './ThinkingIndicator';
@@ -0,0 +1,4 @@
1
+ import type { FC } from 'react';
2
+ import type { CardProps } from './card.types';
3
+ declare const Card: FC<CardProps>;
4
+ export default Card;
File without changes
@@ -0,0 +1,9 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ export type CardVariant = 'warning';
3
+ export type CardTypo = 'border' | 'opacity';
4
+ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
5
+ variant?: CardVariant;
6
+ typo?: CardTypo;
7
+ children: ReactNode;
8
+ className?: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ export { default as Card } from './Card';
2
+ export type { CardProps, CardVariant, CardTypo } from './card.types';
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ interface ThinkingTextProps {
3
+ text: string;
4
+ className?: string;
5
+ }
6
+ declare const ThinkingText: FC<ThinkingTextProps>;
7
+ export { ThinkingText };
@@ -0,0 +1 @@
1
+ export { ThinkingText } from './ThinkingText';
@@ -1,7 +1,12 @@
1
- import * as React from "react";
2
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
1
+ import * as React from 'react';
2
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
3
3
  declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
4
+ /**
5
+ * Requires a `<TooltipProvider>` ancestor. Unlike the previous version, this
6
+ * component no longer provides its own provider — wrap a shared
7
+ * `<TooltipProvider>` around the subtree that contains tooltips.
8
+ */
4
9
  declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
5
10
  declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
6
- declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
11
+ declare function TooltipContent({ sideOffset, arrowPadding, collisionPadding, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
7
12
  export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -0,0 +1,2 @@
1
+ /** Default chat stream identifier shared by useChat and useConnectivityPing. */
2
+ export declare const DEFAULT_CHAT_STREAM_ID = "demo-123";
@@ -1,14 +1,18 @@
1
- import type { MutableRefObject } from 'react';
2
1
  import { ApiManager } from '@foris/mango-core';
3
2
  import type { ChatMessage } from '../types/chat';
3
+ import { DEFAULT_CHAT_STREAM_ID } from './chat.constants';
4
4
  export interface OnSubmitProps {
5
- params?: any;
5
+ params?: Record<string, unknown>;
6
6
  input: string;
7
- abortRef: MutableRefObject<AbortController | null>;
8
7
  }
8
+ export { DEFAULT_CHAT_STREAM_ID };
9
9
  /** When apiManager is passed, streaming uses mango (fetch or axios depending on delegate). */
10
10
  export declare const useChat: (api: string, headers?: Record<string, string>, apiManager?: ApiManager) => {
11
- onSubmit: ({ params, input, abortRef }: OnSubmitProps) => Promise<void>;
11
+ onSubmit: ({ params, input }: OnSubmitProps) => Promise<void>;
12
12
  messages: ChatMessage[];
13
+ isLoading: boolean;
14
+ retryLastMessage: (key?: string) => Promise<void>;
13
15
  clearMessages: () => void;
16
+ initialLoadError: boolean;
17
+ retryInitialPing: () => Promise<void>;
14
18
  };
@@ -6,14 +6,14 @@ import { type OnSubmitProps } from './useChat';
6
6
  interface UseChatSubmitOptions {
7
7
  dataSource: DataSource;
8
8
  messages: ChatMessage[];
9
+ isLoading: boolean;
9
10
  onSubmit: (props: OnSubmitProps) => Promise<void>;
10
11
  resetUserScrolling: () => void;
11
12
  scrollToBottom: (immediate?: boolean) => void;
12
13
  }
13
- export declare const useChatSubmit: ({ dataSource, messages, onSubmit, resetUserScrolling, scrollToBottom, }: UseChatSubmitOptions) => {
14
+ export declare const useChatSubmit: ({ dataSource, messages, isLoading, onSubmit, resetUserScrolling, scrollToBottom, }: UseChatSubmitOptions) => {
14
15
  input: string;
15
16
  setInput: import("react").Dispatch<import("react").SetStateAction<string>>;
16
- isLoadingMessage: boolean;
17
17
  isChatStarted: boolean;
18
18
  handleSubmit: (message: PromptInputMessage) => Promise<void>;
19
19
  handleFooterSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Non-empty `message` for the connectivity POST (chat APIs reject empty messages).
3
+ * Backend may treat this sentinel as a no-op until a dedicated ping exists.
4
+ */
5
+ export declare const CONNECTIVITY_PROBE_MESSAGE = "[connectivity-probe]";
6
+ /**
7
+ * Same JSON shape as `useChat` / `postStream` (`chat_id` + `message`). When the
8
+ * backend exposes a dedicated ping contract, switch the body / URL here.
9
+ */
10
+ export declare const CONNECTIVITY_PROBE_BODY: string;
11
+ /**
12
+ * Stable string for cache keys so the same logical headers map to the same entry.
13
+ * Exported for tests that reset or assert cache behaviour.
14
+ */
15
+ export declare function pingHeadersFingerprint(headers?: Record<string, string>): string;
16
+ /** Drop cached probe(s) for `url` (all header variants), or clear the entire cache. */
17
+ export declare const resetConnectivityPingCache: (url?: string) => void;
18
+ export interface UseConnectivityPingResult {
19
+ initialLoadError: boolean;
20
+ retryInitialPing: () => Promise<void>;
21
+ }
22
+ /**
23
+ * Fires a one-shot `POST` connectivity probe per page session for `(pingUrl, headers)`.
24
+ * Body matches the streaming chat payload (`chat_id` + `message`) because many backends
25
+ * reject `HEAD` (405). Replace with a dedicated ping payload when the API supports it.
26
+ */
27
+ export declare const useConnectivityPing: (pingUrl?: string, headers?: Record<string, string>) => UseConnectivityPingResult;
@@ -1,3 +1,12 @@
1
- export declare const useSplitChunks: (setMessages: any) => {
2
- splitChunks: (res: any) => Promise<void>;
1
+ import type React from 'react';
2
+ import type { StreamResponse } from '@foris/mango-core';
3
+ import type { ChatMessage } from '../types/chat';
4
+ export type SplitChunksResult = {
5
+ ok: true;
6
+ } | {
7
+ ok: false;
8
+ error: Error;
9
+ };
10
+ export declare const useSplitChunks: (setMessages: React.Dispatch<React.SetStateAction<ChatMessage[]>>) => {
11
+ splitChunks: (res: StreamResponse) => Promise<SplitChunksResult>;
3
12
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { ToolCall } from '../types/chat';
2
+ export type ThinkingPhase = 'idle' | 'thinking' | 'tool' | 'preparing' | 'done';
3
+ interface UseThinkingPhaseOptions {
4
+ isLoading: boolean;
5
+ streamingTools: ToolCall[];
6
+ streamingContent: string;
7
+ labels: {
8
+ step1: string;
9
+ step2: string;
10
+ usingTool: string;
11
+ preparing: string;
12
+ };
13
+ }
14
+ interface UseThinkingPhaseResult {
15
+ phase: ThinkingPhase;
16
+ label: string;
17
+ }
18
+ export declare const useThinkingPhase: ({ isLoading, streamingTools, streamingContent, labels, }: UseThinkingPhaseOptions) => UseThinkingPhaseResult;
19
+ export {};
@@ -0,0 +1 @@
1
+ export {};