teodor-new-chat-ui 4.3.389 → 4.3.391
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/api/chat-api.d.ts +2 -3
- package/dist/components/chat/MessageComponent.d.ts +2 -14
- package/dist/components/chat/MessageList.d.ts +1 -1
- package/dist/components/chat/MessageRow.d.ts +1 -1
- package/dist/components/chat/TimelineColumn.d.ts +1 -1
- package/dist/components/ui/command.d.ts +7 -7
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/context/providers/ChatSessionProvider.d.ts +2 -1
- package/dist/context/reducers/MessageReducer.d.ts +0 -5
- package/dist/context/reducers/utils/reducerUtils.d.ts +0 -17
- package/dist/hooks/useCheckpointMetadata.d.ts +2 -3
- package/dist/hooks/useCheckpointSelectors.d.ts +36 -0
- package/dist/hooks/useMessageMetadata.d.ts +1 -1
- package/dist/hooks/useThreadHistoryState.d.ts +2 -1
- package/dist/index.esm.js +6724 -7386
- package/dist/index.umd.js +52 -52
- package/dist/lib/attemptDetection.d.ts +13 -25
- package/dist/lib/chatUtils.d.ts +1 -3
- package/dist/lib/historyUtils.d.ts +1 -5
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/schemaUtils.d.ts +6 -0
- package/dist/lib/validation.d.ts +0 -4
- package/dist/types/index.d.ts +0 -1
- package/dist/types/models.d.ts +28 -28
- package/dist/types/requests.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/chat/checkpoint/dropdown.d.ts +0 -13
- package/dist/store/toolProgressStorage.d.ts +0 -8
- package/dist/types/timeline.d.ts +0 -28
|
@@ -11,34 +11,22 @@
|
|
|
11
11
|
* msg3 appears in multiple checkpoints = multiple attempts/versions
|
|
12
12
|
*/
|
|
13
13
|
import type { HydratedCheckpointSnapshot } from "@/types/models";
|
|
14
|
-
|
|
15
|
-
* Groups checkpoints by their last user message ID
|
|
16
|
-
* Returns a map where key is the user message ID, value is array of checkpoints containing it
|
|
17
|
-
*/
|
|
18
|
-
export declare function groupCheckpointsByLastUserMessageId(checkpoints: HydratedCheckpointSnapshot[]): Map<string, HydratedCheckpointSnapshot[]>;
|
|
19
|
-
/**
|
|
20
|
-
* Builds attempt metadata for all checkpoints based on their last user message ID
|
|
21
|
-
* Groups checkpoints that share the same user message ID as "attempts/versions"
|
|
22
|
-
* Enriches each checkpoint with attemptIndex, attemptCount, and isLatestAttempt
|
|
23
|
-
*/
|
|
24
|
-
export declare function buildAttemptMetadataMap(checkpoints: HydratedCheckpointSnapshot[]): Map<string, {
|
|
14
|
+
export interface AttemptMetadata {
|
|
25
15
|
attemptIndex: number;
|
|
26
16
|
attemptCount: number;
|
|
27
17
|
isLatestAttempt: boolean;
|
|
28
18
|
baseUserMessageId: string | null;
|
|
29
|
-
}
|
|
19
|
+
}
|
|
30
20
|
/**
|
|
31
|
-
*
|
|
32
|
-
* This
|
|
21
|
+
* Builds attempt metadata and reverse lookup for checkpoints grouped by their last user message ID.
|
|
22
|
+
* This performs a single grouping pass followed by metadata construction, avoiding redundant storage.
|
|
33
23
|
*/
|
|
34
|
-
export declare function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
isLatestAttempt: boolean;
|
|
44
|
-
}>>;
|
|
24
|
+
export declare function buildAttemptMaps(checkpoints: HydratedCheckpointSnapshot[]): {
|
|
25
|
+
attemptMetaById: Map<string, AttemptMetadata>;
|
|
26
|
+
userMessageIdToAttempts: Map<string, Array<{
|
|
27
|
+
checkpointId: string;
|
|
28
|
+
attemptIndex: number;
|
|
29
|
+
attemptCount: number;
|
|
30
|
+
isLatestAttempt: boolean;
|
|
31
|
+
}>>;
|
|
32
|
+
};
|
package/dist/lib/chatUtils.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { MessagePart } from "@/types";
|
|
2
|
-
export declare function fileToDataUrl(file: File): Promise<string>;
|
|
3
2
|
export declare function fileToBase64(file: File): Promise<string>;
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function processAttachments(api: unknown, files?: File[], uploadPath?: string, enableFileAgentRouting?: boolean, fileAgentId?: string, threadId?: string | null): Promise<{
|
|
3
|
+
export declare function processAttachments(files?: File[]): Promise<{
|
|
6
4
|
contentParts: MessagePart[];
|
|
7
5
|
filesInfo: Array<{
|
|
8
6
|
filename: string;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type { HistoryPayload, HydratedCheckpointSnapshot, PendingInterrupt
|
|
2
|
-
export type HistoryPendingInterrupt = PendingInterrupt;
|
|
1
|
+
import type { HistoryPayload, HydratedCheckpointSnapshot, PendingInterrupt } from "@/types";
|
|
3
2
|
export type HistoryHydrationResult = {
|
|
4
3
|
threadId: string;
|
|
5
4
|
latest: HydratedCheckpointSnapshot | null;
|
|
6
5
|
checkpoints: HydratedCheckpointSnapshot[];
|
|
7
|
-
timeline: TimelineCheckpoint[];
|
|
8
6
|
interrupt: PendingInterrupt;
|
|
9
|
-
snapshots: Record<string, HydratedCheckpointSnapshot>;
|
|
10
7
|
};
|
|
11
|
-
export declare function buildSnapshotKey(checkpointId: string | null | undefined, checkpointNs: string | null | undefined): string;
|
|
12
8
|
export declare function hydrateHistorySnapshots(history: HistoryPayload | null | undefined): HistoryHydrationResult;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type { ChatConfig } from "@/config/env";
|
|
|
23
23
|
export { del, get, getChatToken, onChatTokenChanged, post, put, setChatToken } from '../api/utils';
|
|
24
24
|
export { ChatSettings } from '@/components/settings/ChatSettings';
|
|
25
25
|
export type { ChatSettingsConfig } from '@/components/settings/ChatSettings';
|
|
26
|
-
export type { ChatMessage, ChatRequest,
|
|
26
|
+
export type { ChatMessage, ChatRequest, StateSnapshot, HistoryPayload, HydratedCheckpointSnapshot, MessagePart, PregelTask, Role, StreamEvent, TextPart, ThreadInfo, ThreadShareTarget, ThreadSummary, ToolEndEvent } from '@/types';
|
|
27
27
|
export { buildMessagePreviewMap } from './messagePreviews';
|
|
28
28
|
export type { ChatAppProps, SimpleChatProps } from '../components/chat/ChatApp';
|
|
29
29
|
export type { ChatProvidersProps } from '../context/ChatProviders';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type PlainObject = Record<string, unknown>;
|
|
2
|
+
export declare function toPlainObject(value: unknown): PlainObject | undefined;
|
|
3
|
+
export declare function readString(source: PlainObject | undefined, keys: string[]): string | undefined;
|
|
4
|
+
export declare function readNumber(source: PlainObject | undefined, keys: string[]): number | null;
|
|
5
|
+
export declare function extractConfigFields(source: unknown): PlainObject | undefined;
|
|
6
|
+
export {};
|
package/dist/lib/validation.d.ts
CHANGED
|
@@ -34,7 +34,3 @@ export declare function validateAndSanitizeTitle(title: string): string;
|
|
|
34
34
|
* Safe JSON parse with validation
|
|
35
35
|
*/
|
|
36
36
|
export declare function safeJsonParse(jsonString: string): unknown;
|
|
37
|
-
/**
|
|
38
|
-
* Input validation wrapper for React components
|
|
39
|
-
*/
|
|
40
|
-
export declare function withInputValidation<T extends (...args: unknown[]) => unknown>(fn: T, validator: (input: string) => string): T;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/models.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { TimelineCheckpoint } from "./timeline";
|
|
2
1
|
export type Role = "system" | "user" | "assistant" | "tool";
|
|
3
2
|
export type TextPart = {
|
|
4
3
|
type: "text";
|
|
@@ -94,50 +93,51 @@ export interface PregelTask {
|
|
|
94
93
|
state?: unknown;
|
|
95
94
|
[key: string]: unknown;
|
|
96
95
|
}
|
|
97
|
-
export interface CheckpointSnapshot {
|
|
98
|
-
createdAt?: string | null;
|
|
99
|
-
config?: Record<string, unknown> | null;
|
|
100
|
-
metadata?: Record<string, unknown> | null;
|
|
101
|
-
values: {
|
|
102
|
-
messages: ChatMessage[];
|
|
103
|
-
results?: unknown[];
|
|
104
|
-
active_agent?: string | null;
|
|
105
|
-
research_summary?: string | null;
|
|
106
|
-
[key: string]: unknown;
|
|
107
|
-
};
|
|
108
|
-
next: unknown[];
|
|
109
|
-
parentConfig?: Record<string, unknown> | null;
|
|
110
|
-
tasks?: PregelTask[] | null;
|
|
111
|
-
}
|
|
112
96
|
export type PendingInterrupt = {
|
|
113
97
|
id: string;
|
|
114
98
|
value: unknown;
|
|
115
99
|
} | null;
|
|
100
|
+
export interface StateSnapshot {
|
|
101
|
+
values: Record<string, unknown>;
|
|
102
|
+
next: string[];
|
|
103
|
+
config?: {
|
|
104
|
+
configurable?: Record<string, unknown>;
|
|
105
|
+
} | null;
|
|
106
|
+
metadata?: Record<string, unknown> | null;
|
|
107
|
+
created_at?: string;
|
|
108
|
+
createdAt?: string;
|
|
109
|
+
parent_config?: {
|
|
110
|
+
configurable?: Record<string, unknown>;
|
|
111
|
+
} | null;
|
|
112
|
+
parentConfig?: {
|
|
113
|
+
configurable?: Record<string, unknown>;
|
|
114
|
+
} | null;
|
|
115
|
+
tasks?: PregelTask[] | null;
|
|
116
|
+
interrupts?: unknown[] | null;
|
|
117
|
+
}
|
|
116
118
|
export interface HydratedCheckpointSnapshot {
|
|
119
|
+
messages: ChatMessage[];
|
|
117
120
|
checkpointId: string | null;
|
|
118
121
|
checkpointNs: string | null;
|
|
119
|
-
createdAt: string
|
|
122
|
+
createdAt: string;
|
|
120
123
|
parentId: string | null;
|
|
121
|
-
branchLabel: string | null;
|
|
122
|
-
lastUserMessageId: string | null;
|
|
123
|
-
messagesLen: number;
|
|
124
|
-
hasMessages: boolean;
|
|
125
|
-
messages: ChatMessage[];
|
|
126
|
-
nextCursor: string | null;
|
|
127
|
-
nextCursorNs: string | null;
|
|
128
124
|
interrupt: PendingInterrupt;
|
|
129
|
-
metadata
|
|
125
|
+
metadata: {
|
|
126
|
+
step: number;
|
|
127
|
+
source: string | null;
|
|
128
|
+
[key: string]: unknown;
|
|
129
|
+
};
|
|
130
130
|
config?: Record<string, unknown> | null;
|
|
131
131
|
parentConfig?: Record<string, unknown> | null;
|
|
132
132
|
next?: unknown[] | null;
|
|
133
133
|
tasks?: PregelTask[] | null;
|
|
134
|
-
|
|
134
|
+
nextCursor?: string | null;
|
|
135
|
+
nextCursorNs?: string | null;
|
|
135
136
|
}
|
|
136
137
|
export interface HistoryPayload {
|
|
137
138
|
version: "chat-history@1";
|
|
138
139
|
threadId: string;
|
|
139
|
-
checkpoints:
|
|
140
|
-
timeline?: TimelineCheckpoint[];
|
|
140
|
+
checkpoints: StateSnapshot[];
|
|
141
141
|
}
|
|
142
142
|
export interface CheckpointList {
|
|
143
143
|
thread_id: string;
|
package/dist/types/requests.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StreamCommand } from "./events";
|
|
2
|
-
import type { TimelineCheckpoint } from "
|
|
2
|
+
import type { TimelineCheckpoint } from "@/hooks/useCheckpointSelectors";
|
|
3
3
|
export interface ChatRequest {
|
|
4
4
|
threadId?: string | null;
|
|
5
5
|
payload?: Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CheckpointMeta } from "@/types/timeline";
|
|
2
|
-
type CheckpointOption = {
|
|
3
|
-
checkpointId: string | null;
|
|
4
|
-
};
|
|
5
|
-
type CheckpointDropdownProps = {
|
|
6
|
-
currentThreadId: string | null;
|
|
7
|
-
checkpointOptionsSorted: CheckpointOption[];
|
|
8
|
-
checkpointMetaById: Map<string, CheckpointMeta>;
|
|
9
|
-
lastCheckpointId: string | null;
|
|
10
|
-
goToCheckpoint: (checkpointId: string | null) => Promise<void>;
|
|
11
|
-
};
|
|
12
|
-
export default function CheckpointDropdown({ currentThreadId, checkpointOptionsSorted, checkpointMetaById, lastCheckpointId, goToCheckpoint, }: CheckpointDropdownProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ToolStreamEntry } from "@/types/toolStream";
|
|
2
|
-
export declare function persistToolProgress(messageId: string, entries: ToolStreamEntry[], metadata?: {
|
|
3
|
-
checkpointId?: string | null;
|
|
4
|
-
checkpointNs?: string | null;
|
|
5
|
-
threadId?: string | null;
|
|
6
|
-
}): void;
|
|
7
|
-
export declare function loadToolProgress(messageId: string): ToolStreamEntry[] | undefined;
|
|
8
|
-
export declare function clearToolProgressCache(): void;
|
package/dist/types/timeline.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type EditMeta = {
|
|
2
|
-
checkpointId?: string | null;
|
|
3
|
-
checkpointNs?: string | null;
|
|
4
|
-
};
|
|
5
|
-
export type TimelineCheckpoint = {
|
|
6
|
-
id: string;
|
|
7
|
-
label: string;
|
|
8
|
-
messageId: string | null;
|
|
9
|
-
step: number | null;
|
|
10
|
-
source: string | null;
|
|
11
|
-
createdAt: string | null;
|
|
12
|
-
next?: string | null;
|
|
13
|
-
parentConfig?: Record<string, unknown> | null;
|
|
14
|
-
};
|
|
15
|
-
export type CheckpointMeta = {
|
|
16
|
-
id: string;
|
|
17
|
-
step: number | null;
|
|
18
|
-
source: string | null;
|
|
19
|
-
createdAt: string | null;
|
|
20
|
-
namespace: string | null;
|
|
21
|
-
parentId: string | null;
|
|
22
|
-
};
|
|
23
|
-
export type CheckpointMetaWithAttempts = CheckpointMeta & {
|
|
24
|
-
attemptIndex: number;
|
|
25
|
-
attemptCount: number;
|
|
26
|
-
isLatestAttempt: boolean;
|
|
27
|
-
baseUserMessageId: string | null;
|
|
28
|
-
};
|