teodor-new-chat-ui 4.3.396 → 4.3.398

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.
@@ -2,7 +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 { CheckpointMeta, CheckpointMetaWithAttempts, EditMeta } from "@/hooks/useCheckpointSelectors";
5
+ import type { CheckpointMeta, EditMeta } from "@/hooks/checkpoints";
6
6
  export interface MessageComponentProps {
7
7
  message: ChatMessage | DefaultMessage;
8
8
  messageIndex: number;
@@ -36,7 +36,6 @@ export interface MessageComponentProps {
36
36
  onSelectCheckpoint?: (checkpointId: string | null, parentCheckpointId?: string | null, isLatest?: boolean) => Promise<void> | void;
37
37
  defaultCheckpointId?: string | null;
38
38
  messageParentCheckpointId?: string | null;
39
- attemptMeta?: CheckpointMetaWithAttempts | null;
40
39
  }
41
40
  export declare const MessageComponent: import("react").NamedExoticComponent<MessageComponentProps>;
42
41
  export default MessageComponent;
@@ -1,5 +1,6 @@
1
1
  import type { ChatMessage, DefaultMessage, PendingInterrupt } from "@/types";
2
- import type { CheckpointMeta, CheckpointMetaWithAttempts, EditMeta, TimelineCheckpoint } from "@/hooks/useCheckpointSelectors";
2
+ import type { EditMeta, TimelineCheckpoint } from "@/hooks/checkpoints";
3
+ import type { CheckpointIndex } from "@/lib/checkpointIndex";
3
4
  import React from "react";
4
5
  export interface MessageListProps {
5
6
  messages: (ChatMessage | DefaultMessage)[];
@@ -34,19 +35,10 @@ export interface MessageListProps {
34
35
  onInterruptActionEnd?: () => void;
35
36
  showToolMessages?: boolean;
36
37
  showArtifactPreviews?: boolean;
37
- checkpointMetaById?: Map<string, CheckpointMeta>;
38
- checkpointIndexByKey?: Map<string, CheckpointMeta[]>;
39
- attemptMetaById?: Map<string, CheckpointMetaWithAttempts>;
40
- userMessageIdToAttempts?: Map<string, Array<{
41
- checkpointId: string;
42
- attemptIndex: number;
43
- attemptCount: number;
44
- isLatestAttempt: boolean;
45
- }>>;
38
+ checkpointIndex?: CheckpointIndex;
46
39
  activeCheckpointId?: string | null;
47
40
  onSelectCheckpoint?: (checkpointId: string | null) => Promise<void> | void;
48
41
  timelineCheckpoints?: TimelineCheckpoint[];
49
- messagePreviews?: Map<string, string>;
50
42
  /** If true, creates a synthetic thinking message when isStreaming=true and no assistant message exists */
51
43
  createSyntheticThinkingMessage?: boolean;
52
44
  }
@@ -1,5 +1,6 @@
1
1
  import type { ChatMessage, DefaultMessage, PendingInterrupt } from "@/types";
2
- import type { CheckpointMeta, CheckpointMetaWithAttempts, EditMeta } from "@/hooks/useCheckpointSelectors";
2
+ import type { EditMeta } from "@/hooks/checkpoints";
3
+ import type { CheckpointIndex } from "@/lib/checkpointIndex";
3
4
  import React from "react";
4
5
  export declare const getMessageDomKey: (message: ChatMessage | DefaultMessage | undefined, index: number) => string;
5
6
  export interface MessageRowProps {
@@ -20,15 +21,7 @@ export interface MessageRowProps {
20
21
  onInterruptActionEnd?: () => void;
21
22
  showToolMessages: boolean;
22
23
  showArtifactPreviews: boolean;
23
- checkpointMetaById?: Map<string, CheckpointMeta>;
24
- checkpointIndexByKey?: Map<string, CheckpointMeta[]>;
25
- attemptMetaById?: Map<string, CheckpointMetaWithAttempts>;
26
- userMessageIdToAttempts?: Map<string, Array<{
27
- checkpointId: string;
28
- attemptIndex: number;
29
- attemptCount: number;
30
- isLatestAttempt: boolean;
31
- }>>;
24
+ checkpointIndex?: CheckpointIndex;
32
25
  activeCheckpointId?: string | null;
33
26
  onSelectCheckpoint?: (checkpointId: string | null) => Promise<void> | void;
34
27
  }
@@ -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 | HTMLParagraphElement | HTMLObjectElement | HTMLSourceElement | HTMLMapElement | HTMLDataElement | HTMLHeadElement | HTMLLinkElement | HTMLBodyElement | HTMLInputElement | HTMLTitleElement | HTMLImageElement | HTMLLabelElement | HTMLOutputElement | HTMLSlotElement | HTMLStyleElement | HTMLDialogElement | HTMLOptionElement | HTMLTableElement | HTMLAnchorElement | HTMLHeadingElement | HTMLLIElement | HTMLOListElement | HTMLSelectElement | HTMLSpanElement | HTMLUListElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLLegendElement | HTMLMetaElement | 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 | HTMLParagraphElement | HTMLObjectElement | HTMLSourceElement | HTMLMapElement | HTMLDataElement | HTMLHeadElement | HTMLLinkElement | HTMLBodyElement | HTMLMetaElement | HTMLTitleElement | HTMLImageElement | HTMLLabelElement | HTMLOutputElement | HTMLSlotElement | HTMLStyleElement | HTMLDialogElement | HTMLOptionElement | HTMLTableElement | HTMLAnchorElement | HTMLHeadingElement | HTMLInputElement | HTMLLIElement | HTMLOListElement | 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"> & {
4
4
  className?: string | undefined;
5
5
  collapsedSize?: number | undefined;
6
6
  collapsible?: boolean | undefined;
@@ -31,8 +31,9 @@
31
31
  *
32
32
  * RESULT: Much easier to debug, faster development, no stale cache issues
33
33
  */
34
+ import type { CheckpointIndex } from '@/lib/checkpointIndex';
34
35
  import type { ChatMessage, HydratedCheckpointSnapshot, PendingInterrupt, SharedThreadSummary, StreamContextValue, ThreadSummary } from '@/types';
35
- import type { TimelineCheckpoint } from "@/hooks/useCheckpointSelectors";
36
+ import type { TimelineCheckpoint } from "@/hooks/checkpoints";
36
37
  import type { ThreadStateMetadata } from '@/types/context';
37
38
  import type { ToolEndEvent } from '@/types/events';
38
39
  import { type ReactNode } from 'react';
@@ -66,6 +67,7 @@ interface ThreadStateContextValue {
66
67
  namespace: string | null;
67
68
  };
68
69
  checkpoints: HydratedCheckpointSnapshot[];
70
+ checkpointIndex: CheckpointIndex;
69
71
  timelineCheckpoints: TimelineCheckpoint[];
70
72
  metadata: ThreadStateMetadata | null;
71
73
  isLoading: boolean;
@@ -0,0 +1,3 @@
1
+ export * from "./types";
2
+ export * from "./useMessageMetadata";
3
+ export * from "./useCheckpointIndex";
@@ -0,0 +1 @@
1
+ export * from "@/types/checkpoints";
@@ -0,0 +1,2 @@
1
+ import type { HydratedCheckpointSnapshot } from "@/types";
2
+ export declare function useCheckpointIndex(checkpoints: HydratedCheckpointSnapshot[]): import("@/lib/checkpointIndex").CheckpointIndex;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * useMessageMetadata Hook
3
+ *
4
+ * Thin hook wrapper around resolveMessageMetadata() that handles memoization.
5
+ *
6
+ * @param message - The message to resolve metadata for
7
+ * @param index - The pre-built checkpoint index (contains all lookup maps)
8
+ * @returns Memoized resolved metadata
9
+ */
10
+ import type { ChatMessage, DefaultMessage } from "@/types";
11
+ import type { CheckpointIndex } from "@/lib/checkpointIndex";
12
+ import { type ResolvedMessageMetadata } from "@/lib/messageMetadataResolver";
13
+ /**
14
+ * Hook to resolve and memoize metadata for a single message.
15
+ * Uses the pure resolver function and adds React memoization.
16
+ */
17
+ export declare function useMessageMetadata(message: ChatMessage | DefaultMessage | undefined, index: CheckpointIndex): ResolvedMessageMetadata;
18
+ export type { ResolvedMessageMetadata };
@@ -1,8 +1,9 @@
1
1
  import type { ChatApi } from "@/api/chat-api";
2
- import type { StateHistoryEvent } from "@/context/services/streaming/use-streaming-service";
2
+ import type { StateHistoryEvent } from "@/context/services/use-streaming-service";
3
3
  import type { ChatMessage, HydratedCheckpointSnapshot } from "@/types";
4
- import type { TimelineCheckpoint } from "@/hooks/useCheckpointSelectors";
4
+ import type { TimelineCheckpoint } from "@/types/checkpoints";
5
5
  import type { PendingInterrupt } from "@/types/models";
6
+ import type { CheckpointIndex } from "@/lib/checkpointIndex";
6
7
  interface UseThreadHistoryStateOptions {
7
8
  api: ChatApi;
8
9
  seed: (messages: ChatMessage[], opts?: {
@@ -23,6 +24,7 @@ interface UseThreadHistoryStateOptions {
23
24
  interface ThreadHistoryResult {
24
25
  threadCheckpoints: HydratedCheckpointSnapshot[];
25
26
  threadTimeline: TimelineCheckpoint[];
27
+ checkpointIndex: CheckpointIndex;
26
28
  isLoadingThread: boolean;
27
29
  isHistoryLoading: boolean;
28
30
  isLoadingCheckpoint: boolean;
@@ -1,6 +1,6 @@
1
1
  import { type MutableRefObject } from 'react';
2
2
  import type { ChatApi } from '@/api/chat-api';
3
- import type { ThreadInfoEvent } from '@/context/services/streaming/use-streaming-service';
3
+ import type { ThreadInfoEvent } from '@/context/services/use-streaming-service';
4
4
  import type { SharedThreadSummary, ThreadSummary } from '@/types';
5
5
  interface ThreadActions {
6
6
  createThread: (title?: string) => Promise<string | null>;