teodor-new-chat-ui 4.3.384 → 4.3.385

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.
@@ -6,6 +6,7 @@
6
6
  * └─ ChatSessionProvider (threads, messages, and streaming state)
7
7
  */
8
8
  import type { ApiConfig } from '@/types/api';
9
+ import type { ToolEndEvent } from '@/types/events';
9
10
  import { type ReactNode } from 'react';
10
11
  export interface ChatProvidersProps {
11
12
  children: ReactNode;
@@ -18,8 +19,9 @@ export interface ChatProvidersProps {
18
19
  onError?: (error: string) => void;
19
20
  onAuthError?: (error: string) => void;
20
21
  onThreadChange?: (threadId: string | null) => void;
22
+ onToolEnd?: (event: ToolEndEvent) => void;
21
23
  }
22
- export declare function ChatProviders({ children, apiConfig, initialThreadId, initialCheckpointId, initialCheckpointNs, autoLoadInitial, onConnectionError, onError, onAuthError, onThreadChange, }: ChatProvidersProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare function ChatProviders({ children, apiConfig, initialThreadId, initialCheckpointId, initialCheckpointNs, autoLoadInitial, onConnectionError, onError, onAuthError, onThreadChange, onToolEnd, }: ChatProvidersProps): import("react/jsx-runtime").JSX.Element;
23
25
  export { useApi } from './providers/ApiProvider';
24
26
  export { useStream, useThreads, useThreadState } from './providers/ChatSessionProvider';
25
27
  export type { ApiContextValue, SendOptions, StreamContextValue, ThreadsContextValue, ThreadStateContextValue } from './types';
@@ -33,6 +33,7 @@
33
33
  */
34
34
  import type { ChatMessage, HydratedCheckpointSnapshot, PendingInterrupt, SharedThreadSummary, SmartOrgUser, StreamContextValue, ThreadSummary, TimelineCheckpoint } from '@/types/api';
35
35
  import type { ThreadStateMetadata } from '@/types/context';
36
+ import type { ToolEndEvent } from '@/types/events';
36
37
  import { type ReactNode } from 'react';
37
38
  interface ThreadsContextValue {
38
39
  threads: ThreadSummary[];
@@ -96,8 +97,9 @@ interface ChatSessionProviderProps {
96
97
  onAuthError?: (error: string) => void;
97
98
  onThreadChange?: (threadId: string | null) => void;
98
99
  onConnectionError?: (error: string) => void;
100
+ onToolEnd?: (event: ToolEndEvent) => void;
99
101
  }
100
- export declare function ChatSessionProvider({ children, initialThreadId, initialCheckpointId, initialCheckpointNs, autoLoadInitial, onError, onAuthError, onThreadChange, onConnectionError, }: ChatSessionProviderProps): import("react/jsx-runtime").JSX.Element;
102
+ export declare function ChatSessionProvider({ children, initialThreadId, initialCheckpointId, initialCheckpointNs, autoLoadInitial, onError, onAuthError, onThreadChange, onConnectionError, onToolEnd, }: ChatSessionProviderProps): import("react/jsx-runtime").JSX.Element;
101
103
  /**
102
104
  * Hook to check if the current component is within a ChatSessionProvider
103
105
  */
@@ -26,6 +26,9 @@ interface UseChatStreamingServiceOptions {
26
26
  onMessageEvent: (event: StreamEvent) => void;
27
27
  onStateHistory?: (event: StateHistoryEvent) => void;
28
28
  onUnhandledEvent?: (event: StreamEvent) => void;
29
+ onToolEvent?: (event: Extract<StreamEvent, {
30
+ type: 'tool.start' | 'tool.end';
31
+ }>) => void;
29
32
  onSequenceGap?: (gap: {
30
33
  from: number;
31
34
  to: number;
@@ -56,7 +59,7 @@ interface StartStreamCallbacks {
56
59
  * here means we continue to rely on the well-tested streaming hook for all SSE
57
60
  * behaviour while the provider focuses purely on state updates.
58
61
  */
59
- export declare function useChatStreamingService({ baseUrl, onThreadInfo, onMessageEvent, onStateHistory, onUnhandledEvent, onSequenceGap, onStreamClosed, onConnectionError, onAuthError, onHeartbeat, }: UseChatStreamingServiceOptions): {
62
+ export declare function useChatStreamingService({ baseUrl, onThreadInfo, onMessageEvent, onStateHistory, onUnhandledEvent, onSequenceGap, onStreamClosed, onConnectionError, onAuthError, onHeartbeat, onToolEvent, }: UseChatStreamingServiceOptions): {
60
63
  startStream: (request: ChatRequest, callbacks?: StartStreamCallbacks) => void;
61
64
  stop: () => void;
62
65
  isStreaming: boolean;