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.
@@ -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
- * Creates a reverse lookup map: userMessageId -> array of attempt checkpoints
32
- * This allows looking up all the attempt versions by the user message ID
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 buildUserMessageIdToAttemptsMap(attemptMetaById: Map<string, {
35
- attemptIndex: number;
36
- attemptCount: number;
37
- isLatestAttempt: boolean;
38
- baseUserMessageId: string | null;
39
- }>): Map<string, Array<{
40
- checkpointId: string;
41
- attemptIndex: number;
42
- attemptCount: number;
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
+ };
@@ -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 uploadFileWithFallback(api: unknown, file: File, threadId?: string | null): Promise<string | null>;
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, TimelineCheckpoint } from "@/types";
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;
@@ -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, CheckpointSnapshot, HistoryPayload, HydratedCheckpointSnapshot, MessagePart, PregelTask, Role, StreamEvent, TextPart, ThreadInfo, ThreadShareTarget, ThreadSummary, ToolEndEvent } from '@/types';
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 {};
@@ -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;
@@ -2,5 +2,4 @@ export * from "./context";
2
2
  export * from "./events";
3
3
  export * from "./models";
4
4
  export * from "./requests";
5
- export * from "./timeline";
6
5
  export type TokenListener = (token: string | null) => void;
@@ -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 | null;
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?: Record<string, unknown> | null;
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
- values?: Omit<CheckpointSnapshot["values"], "messages"> | null;
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: CheckpointSnapshot[];
140
- timeline?: TimelineCheckpoint[];
140
+ checkpoints: StateSnapshot[];
141
141
  }
142
142
  export interface CheckpointList {
143
143
  thread_id: string;
@@ -1,5 +1,5 @@
1
1
  import type { StreamCommand } from "./events";
2
- import type { TimelineCheckpoint } from "./timeline";
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,6 +1,6 @@
1
1
  {
2
2
  "name": "teodor-new-chat-ui",
3
- "version": "4.3.389",
3
+ "version": "4.3.391",
4
4
  "description": "React chat UI components with streaming support, tool calls, and modern design",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.esm.js",
@@ -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;
@@ -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
- };