teodor-new-chat-ui 4.3.176 → 4.3.178

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.
@@ -5,21 +5,18 @@
5
5
  * ApiProvider (auth token & API client)
6
6
  * └─ ChatSessionProvider (threads, messages, and streaming state)
7
7
  */
8
- import { type ReactNode } from 'react';
9
8
  import type { ApiConfig } from '@/types/api';
9
+ import { type ReactNode } from 'react';
10
10
  export interface ChatProvidersProps {
11
11
  children: ReactNode;
12
12
  apiConfig?: ApiConfig;
13
13
  initialThreadId?: string | null;
14
14
  autoLoadInitial?: boolean;
15
- disableAutoRestore?: boolean;
16
- enableFileAgentRouting?: boolean;
17
- fileAgentId?: string;
18
15
  onError?: (error: string) => void;
19
16
  onAuthError?: (error: string) => void;
20
17
  onThreadChange?: (threadId: string | null) => void;
21
18
  }
22
- export declare function ChatProviders({ children, apiConfig, initialThreadId, autoLoadInitial, disableAutoRestore, enableFileAgentRouting, fileAgentId, onError, onAuthError, onThreadChange, }: ChatProvidersProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function ChatProviders({ children, apiConfig, initialThreadId, autoLoadInitial, onError, onAuthError, onThreadChange, }: ChatProvidersProps): import("react/jsx-runtime").JSX.Element;
23
20
  export { useApi } from './providers/ApiProvider';
24
21
  export { useStream, useThreads, useThreadState } from './providers/ChatSessionProvider';
25
- export type { ApiContextValue, StreamContextValue, ThreadsContextValue, ThreadStateContextValue, SendOptions, } from './types';
22
+ export type { ApiContextValue, SendOptions, StreamContextValue, ThreadsContextValue, ThreadStateContextValue } from './types';
@@ -9,7 +9,7 @@
9
9
  */
10
10
  export { ChatProviders } from './ChatProviders';
11
11
  export { ApiProvider, useApi } from './providers/ApiProvider';
12
- export { ChatSessionProvider, useHasChatSession, useStream, useThreads, useThreadState } from './providers/ChatSessionProvider';
12
+ export { ChatSessionProvider, useStream, useThreads, useThreadState } from './providers/ChatSessionProvider';
13
13
  export { useMessagesReducer } from './reducers/MessageReducer';
14
14
  export type { ReducerStreamEvent } from './reducers/MessageReducer';
15
15
  export type { ApiContextValue, CoordinatorOptions, SendOptions, StreamContextValue, ThreadsContextValue, ThreadStateContextValue } from '@/types/api';
@@ -1,20 +1,72 @@
1
- import type { StreamContextValue, ThreadsContextValue, ThreadStateContextValue } from '@/types/api';
1
+ /**
2
+ * DEMO-SIMPLIFIED ChatSessionProvider
3
+ *
4
+ * This is a reduced version optimized for demo/development with ~50% fewer lines.
5
+ *
6
+ * REMOVED FOR SIMPLICITY:
7
+ * - localStorage/sessionStorage caching (causes stale data bugs!)
8
+ * - Complex cache eviction logic
9
+ * - Thread persistence to localStorage
10
+ * - Resume/reconnection exponential backoff
11
+ * - Token rotation debouncing
12
+ * - History response caching layers
13
+ *
14
+ * KEPT (Essential):
15
+ * - Thread management (load, create, delete, list)
16
+ * - Message streaming
17
+ * - Checkpoint navigation
18
+ * - Auth token handling
19
+ * - Event handling (stream, interrupts)
20
+ *
21
+ * RESULT: Much easier to debug, faster development, no stale cache issues
22
+ */
23
+ import type { ChatMessage, HydratedCheckpointSnapshot, PendingInterrupt, StreamContextValue, ThreadSummary } from '@/types/api';
2
24
  import { type ReactNode } from 'react';
3
- interface ChatSessionProviderPropsBase {
25
+ interface ThreadsContextValue {
26
+ threads: ThreadSummary[];
27
+ currentThreadId: string | null;
28
+ setCurrentThreadId: (id: string | null) => void;
29
+ isLoading: boolean;
30
+ error: string | null;
31
+ actions: {
32
+ createThread: (title?: string) => Promise<string | null>;
33
+ deleteThread: (threadId: string) => Promise<void>;
34
+ renameThread: (threadId: string, title: string) => Promise<void>;
35
+ refreshThreads: () => Promise<void>;
36
+ };
37
+ }
38
+ interface ThreadStateContextValue {
39
+ threadId: string | null;
40
+ messages: ChatMessage[];
41
+ interrupt: PendingInterrupt;
42
+ checkpoint: {
43
+ id: string | null;
44
+ namespace: string | null;
45
+ };
46
+ checkpoints: HydratedCheckpointSnapshot[];
47
+ metadata: any;
48
+ isLoading: boolean;
49
+ isHistoryLoading: boolean;
50
+ error: string | null;
51
+ hasMore: boolean;
52
+ loadOlder: () => Promise<void>;
53
+ clearState: () => void;
54
+ navigateToCheckpoint: (checkpointId: string, checkpointNs?: string | null) => Promise<void>;
55
+ returnToLatest: () => Promise<void>;
56
+ loadThread: (threadId: string, checkpointId?: string, checkpointNs?: string) => Promise<void>;
57
+ clearThread: () => Promise<void>;
58
+ respondToInterrupt: (interruptId: string, approved: boolean, value?: unknown) => Promise<void>;
59
+ }
60
+ interface ChatSessionProviderProps {
4
61
  children: ReactNode;
5
62
  initialThreadId?: string | null;
6
63
  autoLoadInitial?: boolean;
7
- disableAutoRestore?: boolean;
8
- enableFileAgentRouting?: boolean;
9
- fileAgentId?: string;
10
64
  onError?: (error: string) => void;
11
65
  onAuthError?: (error: string) => void;
12
66
  onThreadChange?: (threadId: string | null) => void;
13
67
  }
14
- export type ChatSessionProviderProps = ChatSessionProviderPropsBase;
15
- export declare function ChatSessionProvider({ children, initialThreadId, autoLoadInitial, disableAutoRestore, enableFileAgentRouting, fileAgentId, onError, onAuthError, onThreadChange, }: ChatSessionProviderProps): import("react/jsx-runtime").JSX.Element;
68
+ export declare function ChatSessionProvider({ children, initialThreadId, autoLoadInitial, onError, onAuthError, onThreadChange, }: ChatSessionProviderProps): import("react/jsx-runtime").JSX.Element;
16
69
  export declare function useThreads(): ThreadsContextValue;
17
70
  export declare function useThreadState(): ThreadStateContextValue;
18
71
  export declare function useStream(): StreamContextValue;
19
- export declare function useHasChatSession(): boolean;
20
72
  export {};