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.
@@ -1,4 +1,4 @@
1
- import type { AgentDetail, AgentSchemaInfo, AgentSummary, CheckpointList, CheckpointSnapshot, HistoryPayload, SharedThreadSummary, ThreadInfo, ThreadShareResponse, ThreadSummary } from "@/types";
1
+ import type { AgentDetail, AgentSchemaInfo, AgentSummary, HistoryPayload, SharedThreadSummary, StateSnapshot, ThreadInfo, ThreadShareResponse, ThreadSummary } from "@/types";
2
2
  import type { TokenListener } from "../types";
3
3
  import { getChatToken, onChatTokenChanged, setChatToken } from "./utils";
4
4
  export declare class ChatApi {
@@ -27,7 +27,7 @@ export declare class ChatApi {
27
27
  threadId: string;
28
28
  checkpointId?: string;
29
29
  checkpointNs?: string;
30
- }): Promise<CheckpointSnapshot>;
30
+ }): Promise<StateSnapshot>;
31
31
  getStateHistory(params: {
32
32
  threadId: string;
33
33
  checkpointId?: string;
@@ -36,7 +36,6 @@ export declare class ChatApi {
36
36
  cancelRun(threadId: string): Promise<{
37
37
  status: string;
38
38
  }>;
39
- listCheckpointSummaries(threadId: string): Promise<CheckpointList["items"]>;
40
39
  unshareThread(threadId: string, shareId: string): Promise<{
41
40
  ok: boolean;
42
41
  shareId: string;
@@ -2,19 +2,7 @@
2
2
  * Message Component - With truncatable tool messages and responsive design
3
3
  */
4
4
  import type { ChatMessage, DefaultMessage, PendingInterrupt } from "@/types";
5
- import type { CheckpointMetaWithAttempts } from "@/types/timeline";
6
- type MessageCheckpointMeta = {
7
- id: string;
8
- step: number | null;
9
- source: string | null;
10
- createdAt: string | null;
11
- namespace: string | null;
12
- parentId: string | null;
13
- };
14
- type EditMeta = {
15
- checkpointId?: string | null;
16
- checkpointNs?: string | null;
17
- };
5
+ import type { CheckpointMeta, CheckpointMetaWithAttempts, EditMeta } from "@/hooks/useCheckpointSelectors";
18
6
  export interface MessageComponentProps {
19
7
  message: ChatMessage | DefaultMessage;
20
8
  messageIndex: number;
@@ -43,7 +31,7 @@ export interface MessageComponentProps {
43
31
  disableInterruptActions?: boolean;
44
32
  onInterruptActionStart?: () => void;
45
33
  onInterruptActionEnd?: () => void;
46
- checkpointCandidates?: MessageCheckpointMeta[];
34
+ checkpointCandidates?: CheckpointMeta[];
47
35
  activeCheckpointId?: string | null;
48
36
  onSelectCheckpoint?: (checkpointId: string | null, parentCheckpointId?: string | null, isLatest?: boolean) => Promise<void> | void;
49
37
  defaultCheckpointId?: string | null;
@@ -1,5 +1,5 @@
1
1
  import type { ChatMessage, DefaultMessage, PendingInterrupt } from "@/types";
2
- import type { CheckpointMeta, CheckpointMetaWithAttempts, EditMeta, TimelineCheckpoint } from "@/types/timeline";
2
+ import type { CheckpointMeta, CheckpointMetaWithAttempts, EditMeta, TimelineCheckpoint } from "@/hooks/useCheckpointSelectors";
3
3
  import React from "react";
4
4
  export interface MessageListProps {
5
5
  messages: (ChatMessage | DefaultMessage)[];
@@ -1,5 +1,5 @@
1
1
  import type { ChatMessage, DefaultMessage, PendingInterrupt } from "@/types";
2
- import type { CheckpointMeta, CheckpointMetaWithAttempts, EditMeta } from "@/types/timeline";
2
+ import type { CheckpointMeta, CheckpointMetaWithAttempts, EditMeta } from "@/hooks/useCheckpointSelectors";
3
3
  import React from "react";
4
4
  export declare const getMessageDomKey: (message: ChatMessage | DefaultMessage | undefined, index: number) => string;
5
5
  export interface MessageRowProps {
@@ -1,4 +1,4 @@
1
- import type { TimelineCheckpoint } from "@/types/timeline";
1
+ import type { TimelineCheckpoint } from "@/hooks/useCheckpointSelectors";
2
2
  export interface TimelineColumnProps {
3
3
  timelineEntries: TimelineCheckpoint[];
4
4
  activeCheckpointId?: string | null;
@@ -6,7 +6,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
6
6
  ref?: React.Ref<HTMLDivElement>;
7
7
  } & {
8
8
  asChild?: boolean;
9
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
9
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
10
10
  label?: string;
11
11
  shouldFilter?: boolean;
12
12
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -24,7 +24,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
24
24
  ref?: React.Ref<HTMLInputElement>;
25
25
  } & {
26
26
  asChild?: boolean;
27
- }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
27
+ }, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
28
28
  value?: string;
29
29
  onValueChange?: (search: string) => void;
30
30
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -34,7 +34,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
34
34
  ref?: React.Ref<HTMLDivElement>;
35
35
  } & {
36
36
  asChild?: boolean;
37
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
37
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
38
38
  label?: string;
39
39
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
40
40
  declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
@@ -43,14 +43,14 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
43
43
  ref?: React.Ref<HTMLDivElement>;
44
44
  } & {
45
45
  asChild?: boolean;
46
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
46
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
47
47
  declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
48
48
  children?: React.ReactNode;
49
49
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
50
50
  ref?: React.Ref<HTMLDivElement>;
51
51
  } & {
52
52
  asChild?: boolean;
53
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
53
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
54
54
  heading?: React.ReactNode;
55
55
  value?: string;
56
56
  forceMount?: boolean;
@@ -59,7 +59,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
59
59
  ref?: React.Ref<HTMLDivElement>;
60
60
  } & {
61
61
  asChild?: boolean;
62
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
62
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
63
63
  alwaysRender?: boolean;
64
64
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
65
65
  declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
@@ -68,7 +68,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
68
68
  ref?: React.Ref<HTMLDivElement>;
69
69
  } & {
70
70
  asChild?: boolean;
71
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
71
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
72
72
  disabled?: boolean;
73
73
  onSelect?: (value: string) => void;
74
74
  value?: string;
@@ -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<HTMLButtonElement | HTMLElement | HTMLTextAreaElement | HTMLFormElement | HTMLDivElement | HTMLObjectElement | HTMLDataElement | HTMLHeadElement | HTMLLinkElement | HTMLBodyElement | HTMLMapElement | HTMLMetaElement | HTMLLabelElement | HTMLSourceElement | HTMLOutputElement | HTMLTitleElement | HTMLSlotElement | HTMLStyleElement | HTMLDialogElement | HTMLImageElement | HTMLOptionElement | HTMLTableElement | HTMLAnchorElement | HTMLHeadingElement | HTMLInputElement | HTMLLIElement | HTMLOListElement | HTMLParagraphElement | HTMLSelectElement | HTMLSpanElement | HTMLUListElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLLegendElement | HTMLMeterElement | HTMLOptGroupElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement | HTMLMenuElement | HTMLTableCaptionElement | HTMLPictureElement>, "id" | "onResize"> & {
3
+ declare const ResizablePanel: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLButtonElement | HTMLElement | HTMLTextAreaElement | HTMLFormElement | HTMLDivElement | HTMLObjectElement | HTMLSourceElement | HTMLDataElement | HTMLHeadElement | HTMLLinkElement | HTMLBodyElement | HTMLMapElement | HTMLInputElement | HTMLTitleElement | HTMLSlotElement | HTMLStyleElement | HTMLDialogElement | HTMLImageElement | HTMLOptionElement | HTMLTableElement | HTMLAnchorElement | HTMLHeadingElement | HTMLLabelElement | HTMLLIElement | HTMLOListElement | HTMLParagraphElement | HTMLSelectElement | HTMLSpanElement | HTMLUListElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLLegendElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTimeElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement | HTMLMenuElement | HTMLTableCaptionElement | HTMLPictureElement>, "id" | "onResize"> & {
4
4
  className?: string | undefined;
5
5
  collapsedSize?: number | undefined;
6
6
  collapsible?: boolean | undefined;
@@ -31,7 +31,8 @@
31
31
  *
32
32
  * RESULT: Much easier to debug, faster development, no stale cache issues
33
33
  */
34
- import type { ChatMessage, HydratedCheckpointSnapshot, PendingInterrupt, SharedThreadSummary, StreamContextValue, ThreadSummary, TimelineCheckpoint } from '@/types';
34
+ import type { ChatMessage, HydratedCheckpointSnapshot, PendingInterrupt, SharedThreadSummary, StreamContextValue, ThreadSummary } from '@/types';
35
+ import type { TimelineCheckpoint } from "@/hooks/useCheckpointSelectors";
35
36
  import type { ThreadStateMetadata } from '@/types/context';
36
37
  import type { ToolEndEvent } from '@/types/events';
37
38
  import { type ReactNode } from 'react';
@@ -1,15 +1,10 @@
1
1
  import type { ChatMessage, PendingInterrupt, StreamEvent } from "@/types";
2
- import type { ToolStreamEntry } from "@/types/toolStream";
3
2
  export interface MessagesState {
4
3
  messages: ChatMessage[];
5
4
  assemblingId: string | null;
6
5
  lastCheckpointId: string | null;
7
6
  lastCheckpointNs: string | null;
8
- toolIndex: Record<string, string>;
9
- toolStreamingMessageId: string | null;
10
- toolStreamingStack: string[];
11
7
  pendingInterrupt: PendingInterrupt;
12
- toolTimelines: Record<string, ToolStreamEntry[]>;
13
8
  messagesStreamMeta?: Record<string, {
14
9
  lastSeq?: number | null;
15
10
  lastText?: string;
@@ -1,24 +1,8 @@
1
1
  import type { ChatMessage, MessagePart } from "@/types";
2
- import type { ToolStreamEntry } from "@/types/toolStream";
3
2
  export declare function sanitizeHistory(messages: ChatMessage[]): ChatMessage[];
4
3
  export declare function replaceMessageAtIndex(messages: ChatMessage[], index: number, message: ChatMessage): ChatMessage[];
5
4
  export declare function stripInterruptParts(messages: ChatMessage[]): ChatMessage[];
6
5
  export declare function findLastAssistantId(messages: ChatMessage[]): string | null;
7
- export declare function collectToolEventIds(ev: {
8
- id?: unknown;
9
- call_id?: unknown;
10
- callId?: unknown;
11
- }): string[];
12
- export declare function gatherIdsForMapping(message: ChatMessage | null, candidates: string[]): string[];
13
- export declare function mapToolIdsToMessage(toolIndex: Record<string, string>, messageId: string, ids: string[]): Record<string, string>;
14
- export declare function mergeToolMetadata(existing: ChatMessage | undefined, toolCallIds: string[], toolName: string, toolArgs?: Record<string, unknown>): Record<string, unknown>;
15
- export declare function appendToolTimelineEntry(messages: ChatMessage[], messageId: string, entry: Omit<ToolStreamEntry, "id" | "timestamp" | "idx">): ChatMessage[];
16
- export declare function pushToolToStack(stack: string[], toolId: string): string[];
17
- export declare function removeToolFromStack(stack: string[], toolId: string): string[];
18
- export declare function syncToolTimelines(messages: ChatMessage[], existing: Record<string, ToolStreamEntry[]>): {
19
- messages: ChatMessage[];
20
- toolTimelines: Record<string, ToolStreamEntry[]>;
21
- };
22
6
  export declare function getFullTextFromParts(parts: MessagePart[]): string;
23
7
  export declare function mergePartsWithMeta(baseParts: MessagePart[], deltaParts: MessagePart[], metaIn: {
24
8
  lastSeq?: number | null;
@@ -34,4 +18,3 @@ export declare function mergePartsWithMeta(baseParts: MessagePart[], deltaParts:
34
18
  export declare function computeSuffix(existing: string, incoming: string): string;
35
19
  export declare function stampLastAssistantCheckpoint(messages: ChatMessage[], checkpointId: string, checkpointNs?: string | null): ChatMessage[];
36
20
  export declare function nameFromModel(model?: string): string | null;
37
- export declare function getToolProgress(message: ChatMessage): ToolStreamEntry[];
@@ -6,14 +6,13 @@
6
6
  * Encapsulates logic for:
7
7
  * - Normalizing and sorting checkpoint options
8
8
  * - Building checkpoint lookups (by ID, by step:source)
9
- * - Detecting edited messages (attempt detection via buildAttemptMetadataMap)
10
- * - Creating reverse user message ID → attempts lookup
9
+ * - Detecting edited messages (attempt detection via buildAttemptMaps)
11
10
  *
12
11
  * This hook moves ~107 lines of metadata preparation logic from ChatInterface,
13
12
  * resulting in cleaner separation of concerns.
14
13
  */
15
14
  import type { HydratedCheckpointSnapshot } from "@/types";
16
- import type { CheckpointMeta, CheckpointMetaWithAttempts } from "@/types/timeline";
15
+ import type { CheckpointMeta, CheckpointMetaWithAttempts } from "@/hooks/useCheckpointSelectors";
17
16
  export interface CheckpointMetadataResult {
18
17
  checkpointMetaById: Map<string, CheckpointMeta>;
19
18
  checkpointIndexByKey: Map<string, CheckpointMeta[]>;
@@ -0,0 +1,36 @@
1
+ import type { HydratedCheckpointSnapshot, PendingInterrupt as Interrupt } from "@/types";
2
+ export type EditMeta = {
3
+ checkpointId?: string | null;
4
+ checkpointNs?: string | null;
5
+ };
6
+ export type TimelineCheckpoint = {
7
+ id: string;
8
+ label: string;
9
+ messageId: string | null;
10
+ step: number | null;
11
+ source: string | null;
12
+ createdAt: string | null;
13
+ next?: string | null;
14
+ parentConfig?: Record<string, unknown> | null;
15
+ };
16
+ export declare function useCheckpointTimeline(checkpoints: HydratedCheckpointSnapshot[]): TimelineCheckpoint[];
17
+ export type CheckpointMeta = {
18
+ id: string;
19
+ step: number | null;
20
+ source: string | null;
21
+ createdAt: string | null;
22
+ namespace: string | null;
23
+ parentId: string | null;
24
+ };
25
+ export declare function useCheckpointMeta(checkpoints: HydratedCheckpointSnapshot[]): CheckpointMeta[];
26
+ export type CheckpointMetaWithAttempts = CheckpointMeta & {
27
+ attemptIndex: number;
28
+ attemptCount: number;
29
+ isLatestAttempt: boolean;
30
+ baseUserMessageId: string | null;
31
+ };
32
+ export declare function useCheckpointAttempts(checkpoints: HydratedCheckpointSnapshot[]): CheckpointMetaWithAttempts[];
33
+ export declare function isExecutionPaused(snapshot: HydratedCheckpointSnapshot): boolean;
34
+ export declare function getCurrentInterrupt(snapshot: HydratedCheckpointSnapshot): Interrupt | null;
35
+ export declare function getLatestCheckpoint(checkpoints: HydratedCheckpointSnapshot[]): HydratedCheckpointSnapshot | undefined;
36
+ export declare function useCheckpointById(checkpoints: HydratedCheckpointSnapshot[], checkpointId: string | null): HydratedCheckpointSnapshot | undefined;
@@ -10,7 +10,7 @@
10
10
  * that was previously embedded in MessageList.tsx's render function.
11
11
  */
12
12
  import type { ChatMessage, DefaultMessage } from "@/types";
13
- import type { CheckpointMeta, CheckpointMetaWithAttempts } from "@/types/timeline";
13
+ import type { CheckpointMeta, CheckpointMetaWithAttempts } from "@/hooks/useCheckpointSelectors";
14
14
  export interface MetadataResolverMaps {
15
15
  checkpointMetaById?: Map<string, CheckpointMeta>;
16
16
  checkpointIndexByKey?: Map<string, CheckpointMeta[]>;
@@ -1,6 +1,7 @@
1
1
  import type { ChatApi } from "@/api/chat-api";
2
2
  import type { StateHistoryEvent } from "@/context/services/streaming/use-streaming-service";
3
- import type { ChatMessage, HydratedCheckpointSnapshot, TimelineCheckpoint } from "@/types";
3
+ import type { ChatMessage, HydratedCheckpointSnapshot } from "@/types";
4
+ import type { TimelineCheckpoint } from "@/hooks/useCheckpointSelectors";
4
5
  import type { PendingInterrupt } from "@/types/models";
5
6
  interface UseThreadHistoryStateOptions {
6
7
  api: ChatApi;