teodor-new-chat-ui 4.3.130 → 4.3.131
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/context/providers/chat-session/constants.d.ts +25 -0
- package/dist/context/providers/chat-session/snapshotUtils.d.ts +4 -0
- package/dist/context/providers/chat-session/useCheckpointCache.d.ts +19 -0
- package/dist/index.esm.js +6086 -6048
- package/dist/index.umd.js +40 -40
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { StreamEvent } from '@/types/api';
|
|
2
|
+
import type { StreamClosedInfo } from '../../services/useChatStreamingService';
|
|
3
|
+
export declare const HISTORY_RESPONSE_CACHE_LIMIT = 50;
|
|
4
|
+
export declare const HISTORY_REFRESH_DEBOUNCE_MS = 750;
|
|
5
|
+
export declare const HISTORY_PAYLOAD_VERSION = "chat-history@1";
|
|
6
|
+
export declare const RESUME_MAX_ATTEMPTS = 5;
|
|
7
|
+
export declare const RESUME_BASE_DELAY_MS = 1000;
|
|
8
|
+
export declare const RESUME_MAX_DELAY_MS = 15000;
|
|
9
|
+
export type HeartbeatEvent = Extract<StreamEvent, {
|
|
10
|
+
type: 'heartbeat';
|
|
11
|
+
}>;
|
|
12
|
+
export type StreamLaunchCallbacks = {
|
|
13
|
+
onOpen?: (info: {
|
|
14
|
+
threadId: string | null;
|
|
15
|
+
created: boolean;
|
|
16
|
+
}) => void;
|
|
17
|
+
onError?: (error: unknown) => void;
|
|
18
|
+
onGap?: (gap: {
|
|
19
|
+
from: number;
|
|
20
|
+
to: number;
|
|
21
|
+
}) => void;
|
|
22
|
+
onClosed?: (info: StreamClosedInfo) => void;
|
|
23
|
+
onConnectionError?: (message: string) => void;
|
|
24
|
+
onHeartbeat?: (event: HeartbeatEvent) => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HydratedCheckpointSnapshot } from '@/types/api';
|
|
2
|
+
export declare function buildHistoryFetchKey(threadId: string, checkpointId: string | null | undefined, checkpointNs: string | null | undefined): string;
|
|
3
|
+
export declare function mergeSnapshotExtras(existing: HydratedCheckpointSnapshot, incoming: HydratedCheckpointSnapshot): Pick<HydratedCheckpointSnapshot, 'metadata' | 'config' | 'parentConfig' | 'next' | 'tasks' | 'values'>;
|
|
4
|
+
export declare function sanitizeCheckpointSnapshots(snapshots: HydratedCheckpointSnapshot[]): HydratedCheckpointSnapshot[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type MutableRefObject } from 'react';
|
|
2
|
+
import type { HydratedCheckpointSnapshot } from '@/types/api';
|
|
3
|
+
type UpdateMode = 'replace' | 'prepend';
|
|
4
|
+
interface UseCheckpointCacheOptions {
|
|
5
|
+
currentThreadId: string | null;
|
|
6
|
+
currentThreadIdRef: MutableRefObject<string | null>;
|
|
7
|
+
}
|
|
8
|
+
export declare function useCheckpointCache({ currentThreadId, currentThreadIdRef }: UseCheckpointCacheOptions): {
|
|
9
|
+
threadCheckpoints: HydratedCheckpointSnapshot[];
|
|
10
|
+
syncActiveThreadCheckpoints: (threadId: string | null) => void;
|
|
11
|
+
updateCheckpointCache: (threadId: string, incoming: HydratedCheckpointSnapshot[], mode: UpdateMode) => void;
|
|
12
|
+
updateCheckpointSnapshots: (threadId: string, incoming: Record<string, HydratedCheckpointSnapshot>, mode: UpdateMode) => void;
|
|
13
|
+
applyCheckpointSummaries: (threadId: string | null, summaries: HydratedCheckpointSnapshot[]) => boolean;
|
|
14
|
+
clearThreadCaches: (threadId: string | null | undefined) => void;
|
|
15
|
+
resetThreadCheckpoints: () => void;
|
|
16
|
+
getSnapshotCache: (threadId?: string | null) => Map<string, HydratedCheckpointSnapshot>;
|
|
17
|
+
getSnapshotFromCache: (threadId: string, checkpointKey: string) => HydratedCheckpointSnapshot;
|
|
18
|
+
};
|
|
19
|
+
export {};
|