@teodorruskvi/chat-core 0.1.13 → 0.1.15
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/hooks/useChatController.d.ts +3 -1
- package/dist/features/conversation/hooks/useThreadHistoryState.d.ts +6 -3
- package/dist/features/persistence/checkpoints/utils/historyUtils.d.ts +3 -0
- package/dist/features/streaming/contexts/types.d.ts +2 -2
- package/dist/features/streaming/hooks/types.d.ts +1 -1
- package/dist/features/streaming/index.d.ts +1 -1
- package/dist/index.esm.js +1714 -1623
- 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/lib/core.d.ts +1 -1
- package/dist/types/domain/streaming.d.ts +7 -7
- package/package.json +1 -1
|
@@ -30,8 +30,10 @@ export interface UseChatControllerProps {
|
|
|
30
30
|
onEvent?: (event: StreamEvent) => void;
|
|
31
31
|
/** The active thread ID for draft isolation */
|
|
32
32
|
threadId?: string | null;
|
|
33
|
+
/** Whether to clear the composer after a successful send (default: true). */
|
|
34
|
+
clearComposerOnSend?: boolean;
|
|
33
35
|
}
|
|
34
|
-
export declare function useChatController({ submit, chatRequest, lastCheckpointId, lastCheckpointNs, onMessageSent, onExcelUploadSuccess, onError, enableMessageEditing, messages, setPendingAssistantResponse, project, onEvent, threadId, }: UseChatControllerProps): {
|
|
36
|
+
export declare function useChatController({ submit, chatRequest, lastCheckpointId, lastCheckpointNs, onMessageSent, onExcelUploadSuccess, onError, enableMessageEditing, messages, setPendingAssistantResponse, project, onEvent, threadId, clearComposerOnSend, }: UseChatControllerProps): {
|
|
35
37
|
editingMessageId: string | null;
|
|
36
38
|
editingInitialValue: string;
|
|
37
39
|
inputError: string | null;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { ChatApi } from "@/shared/core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ValuesEvent } from "@/features/streaming";
|
|
3
3
|
import type { ChatMessage, HydratedCheckpointSnapshot } from "@/types";
|
|
4
4
|
import type { TimelineCheckpoint } from "@/features/persistence/checkpoints/types";
|
|
5
5
|
import type { PendingInterrupt } from "@/types";
|
|
6
6
|
import type { CheckpointIndex } from "@/features/persistence/checkpoints/utils/checkpointIndex";
|
|
7
7
|
interface UseThreadHistoryStateOptions {
|
|
8
8
|
api: ChatApi;
|
|
9
|
+
fileApi?: {
|
|
10
|
+
getFileInfo: (fileId: string) => Promise<any>;
|
|
11
|
+
};
|
|
9
12
|
seed: (messages: ChatMessage[], opts?: {
|
|
10
13
|
checkpointId?: string | null;
|
|
11
14
|
checkpointNs?: string | null;
|
|
@@ -34,11 +37,11 @@ interface ThreadHistoryResult {
|
|
|
34
37
|
navigateToCheckpoint: (checkpointId: string, checkpointNs?: string | null) => Promise<void>;
|
|
35
38
|
setCurrentCheckpointId: (checkpointId: string | null, checkpointNs?: string | null) => void;
|
|
36
39
|
returnToLatest: () => Promise<void>;
|
|
37
|
-
|
|
40
|
+
handleValuesEvent: (event: ValuesEvent) => void;
|
|
38
41
|
markSkipNextLoad: (threadId: string | null) => void;
|
|
39
42
|
markStreamPendingThread: (threadId: string | null) => void;
|
|
40
43
|
resetHistoryState: () => void;
|
|
41
44
|
clearState: () => void;
|
|
42
45
|
}
|
|
43
|
-
export declare function useThreadHistoryState({ api, seed, onError, currentThreadId, initialThreadId, initialCheckpointId, initialCheckpointNs, autoLoadInitial, isStreaming, getMessages, }: UseThreadHistoryStateOptions): ThreadHistoryResult;
|
|
46
|
+
export declare function useThreadHistoryState({ api, fileApi, seed, onError, currentThreadId, initialThreadId, initialCheckpointId, initialCheckpointNs, autoLoadInitial, isStreaming, getMessages, }: UseThreadHistoryStateOptions): ThreadHistoryResult;
|
|
44
47
|
export {};
|
|
@@ -5,4 +5,7 @@ export type HistoryHydrationResult = {
|
|
|
5
5
|
checkpoints: HydratedCheckpointSnapshot[];
|
|
6
6
|
interrupt: PendingInterrupt;
|
|
7
7
|
};
|
|
8
|
+
export declare function refreshHistoryFileUrls(history: HistoryPayload | null | undefined, fileApi: {
|
|
9
|
+
getFileInfo: (fileId: string) => Promise<any>;
|
|
10
|
+
}): Promise<HistoryPayload | null>;
|
|
8
11
|
export declare function hydrateHistorySnapshots(history: HistoryPayload | null | undefined): HistoryHydrationResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChatMessage, ProjectInfo, ThreadSummary, PendingInterrupt, HydratedCheckpointSnapshot } from "@/types";
|
|
2
2
|
import type { TimelineCheckpoint } from "@/features/persistence/checkpoints/types";
|
|
3
3
|
import type { CheckpointIndex } from "@/features/persistence/checkpoints/utils/checkpointIndex";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ValuesEvent } from "@/types/domain/streaming";
|
|
5
5
|
import type { MutableRefObject } from "react";
|
|
6
6
|
import type { ThreadInfoEvent } from "@/types/domain/streaming";
|
|
7
7
|
export interface ThreadsContextValue {
|
|
@@ -63,7 +63,7 @@ export interface ThreadStateContextValue {
|
|
|
63
63
|
clearThread: () => Promise<void> | void;
|
|
64
64
|
respondToInterrupt: (approved: boolean, value?: unknown, options?: any) => Promise<void>;
|
|
65
65
|
messagePreviews: Map<string, string>;
|
|
66
|
-
|
|
66
|
+
handleValuesEvent: (payload: ValuesEvent) => void;
|
|
67
67
|
markSkipNextLoad: (threadId: string) => void;
|
|
68
68
|
markStreamPendingThread: (threadId: string) => void;
|
|
69
69
|
resetHistoryState: () => void;
|
|
@@ -29,7 +29,7 @@ export type UseStreamApi = {
|
|
|
29
29
|
lastSeq: number;
|
|
30
30
|
lastCheckpointId: string | null;
|
|
31
31
|
lastCheckpointNs: string | null;
|
|
32
|
-
|
|
32
|
+
lastValues: HistoryPayload | null;
|
|
33
33
|
error?: string | null;
|
|
34
34
|
}) => void;
|
|
35
35
|
onConnectionError?: (message: string) => void;
|
|
@@ -2,4 +2,4 @@ export * from "./contexts";
|
|
|
2
2
|
export { useStream, useStream as useStreamingHook } from "./hooks/use-stream";
|
|
3
3
|
export type { UseStreamApi, UseChatStreamOptions, ActiveRunContext, } from "./hooks/types";
|
|
4
4
|
export * from "./utils";
|
|
5
|
-
export type { ToolEndEvent, ThreadInfoEvent,
|
|
5
|
+
export type { ToolEndEvent, ThreadInfoEvent, ValuesEvent } from "@/types/domain/streaming";
|