@teodorruskvi/chat-core 0.1.34 → 0.1.36
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/features/conversation/contexts/ThreadsProvider.d.ts +6 -1
- package/dist/features/conversation/contexts/reducers/MessageReducer.d.ts +3 -6
- package/dist/features/conversation/hooks/useChatSession.d.ts +12 -14
- package/dist/features/conversation/hooks/useThreadHistoryState.d.ts +5 -1
- package/dist/features/streaming/contexts/StreamingProvider.d.ts +6 -1
- package/dist/features/streaming/contexts/types.d.ts +1 -0
- package/dist/index.esm.js +1825 -2183
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +7 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/types/domain/messages.d.ts +9 -0
- package/dist/types/domain/streaming.d.ts +2 -1
- package/package.json +1 -1
- package/dist/features/persistence/checkpoints/utils/editUtils.d.ts +0 -11
|
@@ -7,4 +7,9 @@ export interface ThreadsProviderProps {
|
|
|
7
7
|
onThreadChange?: (threadId: string | null) => void;
|
|
8
8
|
}
|
|
9
9
|
export declare function ThreadsProvider({ children, initialThreadId, onError, onThreadChange, }: ThreadsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare function useThreads(
|
|
10
|
+
export declare function useThreads(options: {
|
|
11
|
+
optional: true;
|
|
12
|
+
}): ThreadsContextValue | null;
|
|
13
|
+
export declare function useThreads(options?: {
|
|
14
|
+
optional?: false;
|
|
15
|
+
}): ThreadsContextValue;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import type { ChatMessage } from "@/types";
|
|
2
2
|
import type { StreamEvent } from "@/types/domain/streaming";
|
|
3
|
-
import type { MessagesState, MessagesAction } from "@/types/domain/messages";
|
|
3
|
+
import type { MessagesState, MessagesAction, ChatStatus } from "@/types/domain/messages";
|
|
4
4
|
export declare const initialMessagesState: MessagesState;
|
|
5
5
|
export declare function messagesReducer(state: MessagesState, action: MessagesAction): MessagesState;
|
|
6
6
|
export declare function useMessagesReducer(initial?: ChatMessage[]): {
|
|
7
|
+
readonly setStatus: (status: ChatStatus, error?: string | null) => void;
|
|
7
8
|
readonly reset: (messages?: ChatMessage[]) => void;
|
|
8
9
|
readonly seed: (messages: ChatMessage[], opts?: {
|
|
9
10
|
checkpointId?: string | null;
|
|
10
11
|
checkpointNs?: string | null;
|
|
11
|
-
pendingInterrupt?:
|
|
12
|
-
id: string;
|
|
13
|
-
value: any;
|
|
14
|
-
} | null;
|
|
12
|
+
pendingInterrupt?: any | null;
|
|
15
13
|
values?: Record<string, any>;
|
|
16
14
|
}) => void;
|
|
17
|
-
readonly prepend: (messages: ChatMessage[]) => void;
|
|
18
15
|
readonly pushUser: (message: ChatMessage, editingMessageId?: string | null) => void;
|
|
19
16
|
readonly onEvent: (ev: StreamEvent) => void;
|
|
20
17
|
readonly state: MessagesState;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
type UseChatSessionOptions = string | {
|
|
2
2
|
threadId?: string;
|
|
3
|
+
lazy?: boolean;
|
|
3
4
|
} | undefined;
|
|
4
|
-
export declare function useChatSession(options?: UseChatSessionOptions): {
|
|
5
|
+
export declare function useChatSession<TValues = Record<string, any>>(options?: UseChatSessionOptions): {
|
|
5
6
|
threadId: string | null;
|
|
7
|
+
status: import("../../../types/domain/messages").ChatStatus;
|
|
6
8
|
messages: any[];
|
|
7
9
|
isLoading: boolean;
|
|
8
10
|
isHistoryLoading: boolean;
|
|
9
11
|
error: string | null;
|
|
10
|
-
values:
|
|
12
|
+
values: TValues;
|
|
11
13
|
taskMessagesByScope: Record<string, import("../../../types").ChatMessage[]>;
|
|
12
|
-
metadata: {
|
|
13
|
-
assemblingMessageId: string | null;
|
|
14
|
-
} | undefined;
|
|
14
|
+
metadata: {} | undefined;
|
|
15
15
|
navigateToCheckpoint: (checkpointId: string, checkpointNs?: string | null) => Promise<void>;
|
|
16
16
|
returnToLatest: () => Promise<void>;
|
|
17
17
|
checkpoint: {
|
|
18
18
|
id: string | null;
|
|
19
|
-
namespace: string | null;
|
|
19
|
+
namespace: string | null | undefined;
|
|
20
20
|
} | null;
|
|
21
21
|
checkpoints: import("../../../types").HydratedCheckpointSnapshot[];
|
|
22
22
|
checkpointIndex: import("../../persistence/checkpoints/utils/checkpointIndex").CheckpointIndex | {
|
|
@@ -36,14 +36,12 @@ export declare function useChatSession(options?: UseChatSessionOptions): {
|
|
|
36
36
|
submit: (input: import("../../../types").StreamSubmitPayload, callbacks?: import("../../../types").StreamCallbacks) => Promise<void>;
|
|
37
37
|
stop: () => void;
|
|
38
38
|
clearThread: () => Promise<void> | void;
|
|
39
|
-
setCurrentThreadId: (id: string | null) => void;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
renameThread: (threadId: string, title: string) => Promise<void>;
|
|
46
|
-
shareThread: (threadId: string, sharedWithUserId: string) => Promise<void>;
|
|
39
|
+
setCurrentThreadId: ((id: string | null) => void) | (() => void);
|
|
40
|
+
loadHistory: () => Promise<void>;
|
|
41
|
+
createThread: any;
|
|
42
|
+
deleteThread: any;
|
|
43
|
+
renameThread: any;
|
|
44
|
+
shareThread: any;
|
|
47
45
|
threads: import("../../../types").ThreadSummary[];
|
|
48
46
|
isThreadsLoading: boolean;
|
|
49
47
|
};
|
|
@@ -43,5 +43,9 @@ interface ThreadHistoryResult {
|
|
|
43
43
|
resetHistoryState: () => void;
|
|
44
44
|
clearState: () => void;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Refactored useThreadHistoryState
|
|
48
|
+
* Focuses on a clean loading lifecycle and removes complex imperative refs.
|
|
49
|
+
*/
|
|
50
|
+
export declare function useThreadHistoryState({ api, fileApi, seed, onError, currentThreadId, autoLoadInitial, isStreaming, getMessages, }: UseThreadHistoryStateOptions): ThreadHistoryResult;
|
|
47
51
|
export {};
|
|
@@ -14,6 +14,11 @@ interface StreamingProviderProps {
|
|
|
14
14
|
onStreamingChange?: (isStreaming: boolean) => void;
|
|
15
15
|
}
|
|
16
16
|
export declare function StreamingProvider({ children, onError, onAuthError, onConnectionError, onToolEnd, onUpdateEvent, onCustomEvent, onMetadataEvent, onFinish, onStreamingChange, }: StreamingProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export declare function useStream(
|
|
17
|
+
export declare function useStream(options: {
|
|
18
|
+
optional: true;
|
|
19
|
+
}): StreamContextValue | null;
|
|
20
|
+
export declare function useStream(options?: {
|
|
21
|
+
optional?: false;
|
|
22
|
+
}): StreamContextValue;
|
|
18
23
|
export declare function useHasChatSession(): boolean;
|
|
19
24
|
export {};
|
|
@@ -31,6 +31,7 @@ export interface ThreadsContextValue {
|
|
|
31
31
|
addThreadFromEvent: (threadInfo: ThreadInfoEvent) => void;
|
|
32
32
|
}
|
|
33
33
|
export interface ThreadStateContextValue {
|
|
34
|
+
status: import("@/types/domain/messages").ChatStatus;
|
|
34
35
|
threadId: string | null;
|
|
35
36
|
messages: ChatMessage[];
|
|
36
37
|
taskMessagesByScope: Record<string, ChatMessage[]>;
|