teodor-new-chat-ui 4.3.413 → 4.3.414

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.
@@ -9,10 +9,9 @@
9
9
  */
10
10
  import type { ChatMessage, DefaultMessage } from "@/types";
11
11
  import type { CheckpointIndex } from "../utils/checkpointIndex";
12
- import { type ResolvedMessageMetadata } from "../utils/messageMetadataResolver";
12
+ import type { ResolvedMessageMetadata } from "../types";
13
13
  /**
14
14
  * Hook to resolve and memoize metadata for a single message.
15
15
  * Uses the pure resolver function and adds React memoization.
16
16
  */
17
17
  export declare function useMessageMetadata(message: ChatMessage | DefaultMessage | undefined, index: CheckpointIndex): ResolvedMessageMetadata;
18
- export type { ResolvedMessageMetadata };
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Checkpoint metadata + timeline helpers used by checkpoint features.
3
+ * Re-export the shared checkpoint models as well.
4
+ */
5
+ export * from "./models";
1
6
  export type EditMeta = {
2
7
  checkpointId?: string | null;
3
8
  checkpointNs?: string | null;
@@ -9,12 +14,17 @@ export type CheckpointMeta = {
9
14
  createdAt: string | null;
10
15
  namespace: string | null;
11
16
  parentId: string | null;
17
+ attemptIndex?: number;
18
+ attemptCount?: number;
19
+ isLatestAttempt?: boolean;
20
+ baseUserMessageId?: string | null;
21
+ messageId?: string | null;
22
+ next?: string | null;
23
+ parentConfig?: Record<string, unknown> | null;
12
24
  };
13
- export type CheckpointMetaWithAttempts = CheckpointMeta & {
14
- attemptIndex: number;
15
- attemptCount: number;
16
- isLatestAttempt: boolean;
17
- baseUserMessageId: string | null;
25
+ export type ResolvedMessageMetadata = {
26
+ checkpointCandidates: CheckpointMeta[];
27
+ defaultCheckpointId: string | null;
18
28
  };
19
29
  export type CheckpointAttemptInfo = {
20
30
  checkpointId: string;
@@ -0,0 +1,45 @@
1
+ import type { ChatMessage } from "@/features/messaging/types";
2
+ import type { PendingInterrupt, PregelTask } from "@/features/core/types/models";
3
+ /**
4
+ * Checkpoint domain models representing LangGraph snapshots and history payloads.
5
+ */
6
+ export interface CheckpointSnapshot {
7
+ values: Record<string, unknown>;
8
+ next?: string[];
9
+ config?: Record<string, unknown>;
10
+ metadata?: {
11
+ source?: string;
12
+ step?: number;
13
+ writes?: Record<string, unknown>;
14
+ execution_time?: number;
15
+ };
16
+ tasks?: PregelTask[];
17
+ created_at?: string;
18
+ createdAt?: string;
19
+ parentConfig?: Record<string, unknown>;
20
+ parent_config?: Record<string, unknown>;
21
+ }
22
+ export interface HydratedCheckpointSnapshot {
23
+ checkpointId: string | null;
24
+ checkpointNs: string | null;
25
+ parentId: string | null;
26
+ createdAt: string;
27
+ messages: ChatMessage[];
28
+ nextCursor: string | null;
29
+ nextCursorNs: string | null;
30
+ interrupt: PendingInterrupt;
31
+ metadata: {
32
+ step: number;
33
+ source: string | null;
34
+ [key: string]: unknown;
35
+ };
36
+ config: Record<string, unknown> | null;
37
+ parentConfig: Record<string, unknown> | null;
38
+ next: string[] | null;
39
+ tasks: Record<string, unknown>[] | null;
40
+ }
41
+ export interface HistoryPayload {
42
+ version: string;
43
+ threadId: string;
44
+ checkpoints: CheckpointSnapshot[];
45
+ }
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * msg3 appears in multiple checkpoints = multiple attempts/versions
12
12
  */
13
- import type { HydratedCheckpointSnapshot } from "@/features/core/types";
13
+ import type { HydratedCheckpointSnapshot } from "@/features/checkpoint/types";
14
14
  import type { CheckpointAttemptInfo } from "../types";
15
15
  export interface AttemptMetadata {
16
16
  attemptIndex: number;
@@ -1,10 +1,8 @@
1
1
  import type { HydratedCheckpointSnapshot } from "@/types";
2
- import type { CheckpointAttemptInfo, CheckpointMeta, CheckpointMetaWithAttempts, TimelineCheckpoint } from "../types";
2
+ import type { CheckpointAttemptInfo, CheckpointMeta, TimelineCheckpoint } from "../types";
3
3
  export interface CheckpointIndex {
4
4
  checkpoints: HydratedCheckpointSnapshot[];
5
- checkpointMetaById: Map<string, CheckpointMeta>;
6
- checkpointIndexByKey: Map<string, CheckpointMeta[]>;
7
- attemptMetaById: Map<string, CheckpointMetaWithAttempts>;
5
+ checkpointMetaByCheckpointId: Map<string, CheckpointMeta>;
8
6
  userMessageIdToAttempts: Map<string, CheckpointAttemptInfo[]>;
9
7
  timeline: TimelineCheckpoint[];
10
8
  messagePreviews: Map<string, string>;
@@ -9,24 +9,16 @@
9
9
  */
10
10
  import type { ChatMessage, DefaultMessage } from "@/types";
11
11
  import type { CheckpointIndex } from "./checkpointIndex";
12
- import type { CheckpointMeta } from "../types";
13
- export interface ResolvedMessageMetadata {
14
- checkpointCandidates: CheckpointMeta[];
15
- defaultCheckpointId: string | null;
16
- resolvedStep: number | null;
17
- resolvedSource: string | null;
18
- }
12
+ import type { ResolvedMessageMetadata } from "../types";
19
13
  /**
20
14
  * Resolves checkpoint metadata for a message given a checkpoint index.
21
15
  *
22
- * Handles:
23
- * - Multi-source step/source fallback (additionalKwargs > responseMetadata > index)
24
- * - Checkpoint candidate lookup by step:source key
25
- * - Attempt filtering for edited/multi-version messages
26
- * - Attempt metadata enrichment
16
+ * Direct lookup strategy:
17
+ * - If message has explicit checkpointId: lookup and return that checkpoint + attempt metadata
18
+ * - If no checkpointId: return empty candidates
27
19
  *
28
20
  * @param message - The message to resolve metadata for
29
21
  * @param index - The pre-built checkpoint index (consolidates all lookup maps)
30
- * @returns Resolved metadata including candidates and resolved step/source
22
+ * @returns Resolved metadata including candidates and selected checkpoint
31
23
  */
32
24
  export declare function resolveMessageMetadata(message: ChatMessage | DefaultMessage | undefined, index: CheckpointIndex): ResolvedMessageMetadata;
@@ -1,4 +1,4 @@
1
- import type { HydratedCheckpointSnapshot } from '@/features/core/types';
1
+ import type { HydratedCheckpointSnapshot } from '@/features/checkpoint/types';
2
2
  import type { ChatMessage } from '@/types';
3
3
  export declare function getPreviewForMessage(message: ChatMessage): string;
4
4
  /**
@@ -1,4 +1,4 @@
1
- import type { AgentDetail, AgentSchemaInfo, AgentSummary, HistoryPayload, SharedThreadSummary, StateSnapshot, ThreadInfo, ThreadShareResponse, ThreadSummary, TokenListener } from "@/types";
1
+ import type { AgentDetail, AgentSchemaInfo, AgentSummary, HistoryPayload, SharedThreadSummary, CheckpointSnapshot, ThreadInfo, ThreadShareResponse, ThreadSummary, TokenListener } from "@/types";
2
2
  import { getChatToken, onChatTokenChanged, setChatToken } from "../utils";
3
3
  export declare class ChatApi {
4
4
  get baseUrl(): string;
@@ -26,7 +26,7 @@ export declare class ChatApi {
26
26
  threadId: string;
27
27
  checkpointId?: string;
28
28
  checkpointNs?: string;
29
- }): Promise<StateSnapshot>;
29
+ }): Promise<CheckpointSnapshot>;
30
30
  getStateHistory(params: {
31
31
  threadId: string;
32
32
  checkpointId?: string;
@@ -1,84 +1,3 @@
1
- export type Role = "system" | "user" | "assistant" | "tool";
2
- export type TextPart = {
3
- type: "text";
4
- text: string;
5
- };
6
- export type ImagePart = {
7
- type: "image_url";
8
- url: string;
9
- mimeType?: string;
10
- alt?: string;
11
- };
12
- export type FilePart = {
13
- type: "file";
14
- url: string;
15
- mimeType?: string;
16
- name?: string;
17
- size?: number;
18
- sourceType?: string;
19
- };
20
- export type ToolCallPart = {
21
- type: "tool_call";
22
- id: string;
23
- name: string;
24
- args: Record<string, unknown>;
25
- };
26
- export type InterruptPart = {
27
- type: "interrupt";
28
- value?: any;
29
- [key: string]: unknown;
30
- };
31
- export type MessagePart = TextPart | ImagePart | FilePart | ToolCallPart | InterruptPart;
32
- export type PlotData = {
33
- format?: string;
34
- content_base64?: string;
35
- url?: string;
36
- mimeType?: string;
37
- mime_type?: string;
38
- plotId?: string;
39
- artifactId?: string;
40
- [key: string]: unknown;
41
- };
42
- export interface MessageArtifact {
43
- [key: string]: unknown;
44
- }
45
- export type ArtifactPreview = {
46
- src: string;
47
- alt: string;
48
- label?: string;
49
- };
50
- export interface ChatMessage {
51
- id: string;
52
- threadId?: string;
53
- role: Role;
54
- content: MessagePart[];
55
- createdAt: string;
56
- artifacts?: MessageArtifact[];
57
- artifactPreviews?: Record<string, ArtifactPreview>;
58
- edited?: boolean;
59
- checkpointId?: string | null;
60
- checkpointNs?: string | null;
61
- branchLabel?: string;
62
- toolCalls?: Array<{
63
- id: string;
64
- name: string;
65
- args: Record<string, unknown>;
66
- }>;
67
- artifact?: MessageArtifact;
68
- name?: string;
69
- model?: string;
70
- additionalKwargs?: Record<string, unknown>;
71
- responseMetadata?: Record<string, unknown>;
72
- __syntheticStreaming?: boolean;
73
- }
74
- export interface DefaultMessage {
75
- type?: "default_message";
76
- id?: string;
77
- threadId?: string;
78
- role: Role;
79
- content: string;
80
- createdAt?: string;
81
- }
82
1
  export interface PregelTask {
83
2
  [key: string]: unknown;
84
3
  }
@@ -86,95 +5,15 @@ export type PendingInterrupt = {
86
5
  id: string;
87
6
  value: unknown;
88
7
  } | null;
89
- export interface StateSnapshot {
90
- values: Record<string, unknown>;
91
- next?: string[];
92
- config?: Record<string, unknown>;
93
- metadata?: {
94
- source?: string;
95
- step?: number;
96
- writes?: Record<string, unknown>;
97
- execution_time?: number;
98
- };
99
- tasks?: PregelTask[];
100
- created_at?: string;
101
- createdAt?: string;
102
- parentConfig?: Record<string, unknown>;
103
- parent_config?: Record<string, unknown>;
104
- }
105
- export interface HydratedCheckpointSnapshot {
106
- checkpointId: string | null;
107
- checkpointNs: string | null;
108
- parentId: string | null;
109
- createdAt: string;
110
- messages: ChatMessage[];
111
- nextCursor: string | null;
112
- nextCursorNs: string | null;
113
- interrupt: PendingInterrupt;
114
- metadata: {
115
- step: number;
116
- source: string | null;
117
- [key: string]: unknown;
118
- };
119
- config: Record<string, unknown> | null;
120
- parentConfig: Record<string, unknown> | null;
121
- next: string[] | null;
122
- tasks: Record<string, unknown>[] | null;
123
- }
124
- export interface HistoryPayload {
125
- version: string;
126
- threadId: string;
127
- checkpoints: StateSnapshot[];
128
- }
129
- export interface CheckpointList {
130
- checkpoints: Array<{
131
- checkpoint_id: string;
132
- checkpoint_ns: string | null;
133
- checkpoint_config: Record<string, unknown> | null;
134
- }>;
135
- }
136
- export interface StatePayload {
137
- [key: string]: unknown;
138
- }
139
8
  export interface Envelope<T = unknown> {
140
9
  type?: string;
141
10
  data?: T;
142
11
  error?: string;
143
12
  metadata?: Record<string, unknown>;
144
13
  }
145
- export interface ThreadSummary {
146
- threadId: string;
147
- title: string;
148
- createdAt: string;
149
- updatedAt: string;
150
- messageCount: number;
151
- lastMessage?: string | null;
152
- created?: boolean | null;
153
- ready?: boolean | null;
154
- }
155
- export interface SharedThreadSummary extends ThreadSummary {
156
- sharedAt: string;
157
- sharedBy?: string;
158
- sharedByUserId?: string;
159
- }
160
- export interface ThreadShareResponse {
161
- success: boolean;
162
- threadId: string;
163
- shareUrl?: string;
164
- message?: string;
165
- }
166
- export interface ThreadShareTarget {
167
- type: "email" | "link" | "user";
168
- value: string;
169
- id?: string;
170
- label?: string;
171
- secondaryLabel?: string;
172
- sharedByUserId?: string;
173
- }
174
- export interface ThreadInfo extends ThreadSummary {
175
- description?: string;
176
- isArchived?: boolean;
177
- tags?: string[];
14
+ export type TokenListener = (token: string | null) => void;
15
+ export interface ExcelUploadResponse {
16
+ [key: string]: unknown;
178
17
  }
179
18
  export interface AgentSummary {
180
19
  id: string;
@@ -196,8 +35,4 @@ export interface AgentSchemaInfo {
196
35
  schema?: Record<string, unknown>;
197
36
  [key: string]: unknown;
198
37
  }
199
- export type TokenListener = (token: string | null) => void;
200
- export interface ExcelUploadResponse {
201
- [key: string]: unknown;
202
- }
203
38
  export declare function isEnvelope(x: unknown): x is Envelope<unknown>;
@@ -1 +1,2 @@
1
1
  export * from "./components";
2
+ export * from "./types";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Re-exporting entry point for messaging feature’s domain models.
3
+ */
4
+ export * from "./models";
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Messaging domain models for conversation rendering and artifacts.
3
+ */
4
+ export type Role = "system" | "user" | "assistant" | "tool";
5
+ export type TextPart = {
6
+ type: "text";
7
+ text: string;
8
+ };
9
+ export type ImagePart = {
10
+ type: "image_url";
11
+ url: string;
12
+ mimeType?: string;
13
+ alt?: string;
14
+ };
15
+ export type FilePart = {
16
+ type: "file";
17
+ url: string;
18
+ mimeType?: string;
19
+ name?: string;
20
+ size?: number;
21
+ sourceType?: string;
22
+ };
23
+ export type ToolCallPart = {
24
+ type: "tool_call";
25
+ id: string;
26
+ name: string;
27
+ args: Record<string, unknown>;
28
+ };
29
+ export type InterruptPart = {
30
+ type: "interrupt";
31
+ value?: any;
32
+ [key: string]: unknown;
33
+ };
34
+ export type MessagePart = TextPart | ImagePart | FilePart | ToolCallPart | InterruptPart;
35
+ export type PlotData = {
36
+ format?: string;
37
+ content_base64?: string;
38
+ url?: string;
39
+ mimeType?: string;
40
+ mime_type?: string;
41
+ plotId?: string;
42
+ artifactId?: string;
43
+ [key: string]: unknown;
44
+ };
45
+ export interface MessageArtifact {
46
+ [key: string]: unknown;
47
+ }
48
+ export type ArtifactPreview = {
49
+ src: string;
50
+ alt: string;
51
+ label?: string;
52
+ };
53
+ export interface ChatMessage {
54
+ id: string;
55
+ threadId?: string;
56
+ role: Role;
57
+ content: MessagePart[];
58
+ createdAt: string;
59
+ artifacts?: MessageArtifact[];
60
+ artifactPreviews?: Record<string, ArtifactPreview>;
61
+ edited?: boolean;
62
+ checkpointId?: string | null;
63
+ checkpointNs?: string | null;
64
+ branchLabel?: string;
65
+ toolCalls?: Array<{
66
+ id: string;
67
+ name: string;
68
+ args: Record<string, unknown>;
69
+ }>;
70
+ artifact?: MessageArtifact;
71
+ name?: string;
72
+ model?: string;
73
+ additionalKwargs?: Record<string, unknown>;
74
+ responseMetadata?: Record<string, unknown>;
75
+ __syntheticStreaming?: boolean;
76
+ }
77
+ export interface DefaultMessage {
78
+ type?: "default_message";
79
+ id?: string;
80
+ threadId?: string;
81
+ role: Role;
82
+ content: string;
83
+ createdAt?: string;
84
+ }
@@ -1,3 +1,4 @@
1
1
  export { useThreadsState } from "./hooks/useThreadsState";
2
2
  export { useThreadHistoryState } from "./hooks/useThreadHistoryState";
3
3
  export * from "./contexts";
4
+ export * from "./types";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Public exports for thread domain types.
3
+ */
4
+ export * from "./models";
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Thread domain models for summaries, sharing, and details.
3
+ */
4
+ export interface ThreadSummary {
5
+ threadId: string;
6
+ title: string;
7
+ createdAt: string;
8
+ updatedAt: string;
9
+ messageCount: number;
10
+ lastMessage?: string | null;
11
+ created?: boolean | null;
12
+ ready?: boolean | null;
13
+ }
14
+ export interface SharedThreadSummary extends ThreadSummary {
15
+ sharedAt: string;
16
+ sharedBy?: string;
17
+ sharedByUserId?: string;
18
+ }
19
+ export interface ThreadShareResponse {
20
+ success: boolean;
21
+ threadId: string;
22
+ shareUrl?: string;
23
+ message?: string;
24
+ }
25
+ export interface ThreadShareTarget {
26
+ type: "email" | "link" | "user";
27
+ value: string;
28
+ id?: string;
29
+ label?: string;
30
+ secondaryLabel?: string;
31
+ sharedByUserId?: string;
32
+ }
33
+ export interface ThreadInfo extends ThreadSummary {
34
+ description?: string;
35
+ isArchived?: boolean;
36
+ tags?: string[];
37
+ }
@@ -1,6 +1,6 @@
1
1
  import * as ResizablePrimitive from "react-resizable-panels";
2
2
  declare const ResizablePanelGroup: ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => import("react/jsx-runtime").JSX.Element;
3
- declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLAnchorElement | HTMLElement | HTMLDivElement | HTMLButtonElement | HTMLSpanElement | HTMLParagraphElement | HTMLObjectElement | HTMLSourceElement | HTMLLinkElement | HTMLDataElement | HTMLHeadElement | HTMLBodyElement | HTMLMapElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
3
+ declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement | HTMLElement | HTMLButtonElement | HTMLSpanElement | HTMLParagraphElement | HTMLAnchorElement | HTMLObjectElement | HTMLDataElement | HTMLSourceElement | HTMLLinkElement | HTMLMapElement | HTMLMetaElement | HTMLTitleElement | HTMLHeadElement | HTMLBodyElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
4
4
  className?: string | undefined;
5
5
  collapsedSize?: number | undefined;
6
6
  collapsible?: boolean | undefined;