teodor-new-chat-ui 4.3.397 → 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.
- package/dist/components/chat/MessageComponent.d.ts +1 -2
- package/dist/components/chat/MessageList.d.ts +3 -11
- package/dist/components/chat/MessageRow.d.ts +3 -10
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/context/providers/ChatSessionProvider.d.ts +2 -0
- package/dist/hooks/checkpoints/index.d.ts +1 -2
- package/dist/hooks/checkpoints/types.d.ts +1 -14
- package/dist/hooks/checkpoints/useCheckpointIndex.d.ts +2 -0
- package/dist/hooks/checkpoints/useMessageMetadata.d.ts +10 -31
- package/dist/hooks/useThreadHistoryState.d.ts +4 -2
- package/dist/hooks/useThreadsState.d.ts +1 -1
- package/dist/index.esm.js +5702 -5743
- package/dist/index.umd.js +45 -45
- package/dist/lib/attemptDetection.d.ts +2 -6
- package/dist/lib/checkpointIndex.d.ts +15 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/messageMetadataResolver.d.ts +32 -0
- package/dist/lib/messagePreviews.d.ts +1 -0
- package/dist/types/checkpoints.d.ts +33 -0
- package/package.json +1 -1
- package/dist/hooks/checkpoints/useCheckpointMetadata.d.ts +0 -33
- package/dist/hooks/checkpoints/useCheckpointSelectors.d.ts +0 -24
- /package/dist/context/services/{streaming/use-streaming-service.d.ts → use-streaming-service.d.ts} +0 -0
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* msg3 appears in multiple checkpoints = multiple attempts/versions
|
|
12
12
|
*/
|
|
13
13
|
import type { HydratedCheckpointSnapshot } from "@/types/models";
|
|
14
|
+
import type { CheckpointAttemptInfo } from "@/types/checkpoints";
|
|
14
15
|
export interface AttemptMetadata {
|
|
15
16
|
attemptIndex: number;
|
|
16
17
|
attemptCount: number;
|
|
@@ -23,10 +24,5 @@ export interface AttemptMetadata {
|
|
|
23
24
|
*/
|
|
24
25
|
export declare function buildAttemptMaps(checkpoints: HydratedCheckpointSnapshot[]): {
|
|
25
26
|
attemptMetaById: Map<string, AttemptMetadata>;
|
|
26
|
-
userMessageIdToAttempts: Map<string,
|
|
27
|
-
checkpointId: string;
|
|
28
|
-
attemptIndex: number;
|
|
29
|
-
attemptCount: number;
|
|
30
|
-
isLatestAttempt: boolean;
|
|
31
|
-
}>>;
|
|
27
|
+
userMessageIdToAttempts: Map<string, CheckpointAttemptInfo[]>;
|
|
32
28
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HydratedCheckpointSnapshot } from "@/types";
|
|
2
|
+
import type { CheckpointAttemptInfo, CheckpointMeta, CheckpointMetaWithAttempts, TimelineCheckpoint } from "@/types/checkpoints";
|
|
3
|
+
export interface CheckpointIndex {
|
|
4
|
+
checkpoints: HydratedCheckpointSnapshot[];
|
|
5
|
+
checkpointMetaById: Map<string, CheckpointMeta>;
|
|
6
|
+
checkpointIndexByKey: Map<string, CheckpointMeta[]>;
|
|
7
|
+
attemptMetaById: Map<string, CheckpointMetaWithAttempts>;
|
|
8
|
+
userMessageIdToAttempts: Map<string, CheckpointAttemptInfo[]>;
|
|
9
|
+
timeline: TimelineCheckpoint[];
|
|
10
|
+
messagePreviews: Map<string, string>;
|
|
11
|
+
getLatest: () => CheckpointMeta | undefined;
|
|
12
|
+
getCheckpoint: (id: string) => CheckpointMeta | undefined;
|
|
13
|
+
getAttempts: (userMessageId: string) => CheckpointAttemptInfo[];
|
|
14
|
+
}
|
|
15
|
+
export declare function buildCheckpointIndex(checkpoints: HydratedCheckpointSnapshot[]): CheckpointIndex;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export { ChatSettings } from '@/components/settings/ChatSettings';
|
|
|
23
23
|
export type { ChatSettingsConfig } from '@/components/settings/ChatSettings';
|
|
24
24
|
export type { ChatMessage, ChatRequest, StateSnapshot, HistoryPayload, HydratedCheckpointSnapshot, MessagePart, PregelTask, Role, StreamEvent, TextPart, ThreadInfo, ThreadShareTarget, ThreadSummary, ToolEndEvent } from '@/types';
|
|
25
25
|
export { buildMessagePreviewMap } from './messagePreviews';
|
|
26
|
+
export { buildCheckpointIndex } from './checkpointIndex';
|
|
27
|
+
export type { CheckpointIndex } from './checkpointIndex';
|
|
26
28
|
export type { ChatAppProps, SimpleChatProps } from '../components/chat/ChatApp';
|
|
27
29
|
export type { ChatProvidersProps } from '../context/ChatProviders';
|
|
28
30
|
export { ChatApp as default } from '../components/chat/ChatApp';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message Metadata Resolver
|
|
3
|
+
*
|
|
4
|
+
* Pure function that resolves checkpoint metadata for a single message.
|
|
5
|
+
* Extracted from the hook for:
|
|
6
|
+
* - Better testability (pure function)
|
|
7
|
+
* - Reusability outside React context
|
|
8
|
+
* - Clear separation of heuristics from memoization
|
|
9
|
+
*/
|
|
10
|
+
import type { ChatMessage, DefaultMessage } from "@/types";
|
|
11
|
+
import type { CheckpointIndex } from "@/lib/checkpointIndex";
|
|
12
|
+
import type { CheckpointMeta } from "@/types/checkpoints";
|
|
13
|
+
export interface ResolvedMessageMetadata {
|
|
14
|
+
checkpointCandidates: CheckpointMeta[];
|
|
15
|
+
defaultCheckpointId: string | null;
|
|
16
|
+
resolvedStep: number | null;
|
|
17
|
+
resolvedSource: string | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolves checkpoint metadata for a message given a checkpoint index.
|
|
21
|
+
*
|
|
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
|
|
27
|
+
*
|
|
28
|
+
* @param message - The message to resolve metadata for
|
|
29
|
+
* @param index - The pre-built checkpoint index (consolidates all lookup maps)
|
|
30
|
+
* @returns Resolved metadata including candidates and resolved step/source
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveMessageMetadata(message: ChatMessage | DefaultMessage | undefined, index: CheckpointIndex): ResolvedMessageMetadata;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChatMessage } from '@/types';
|
|
2
2
|
import type { HydratedCheckpointSnapshot } from '@/types/models';
|
|
3
|
+
export declare function getPreviewForMessage(message: ChatMessage): string;
|
|
3
4
|
/**
|
|
4
5
|
* Legacy function: builds a map of message ID -> preview text.
|
|
5
6
|
* This creates a single preview per message ID, with later occurrences overwriting earlier ones.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type EditMeta = {
|
|
2
|
+
checkpointId?: string | null;
|
|
3
|
+
checkpointNs?: string | null;
|
|
4
|
+
};
|
|
5
|
+
export type CheckpointMeta = {
|
|
6
|
+
id: string;
|
|
7
|
+
step: number | null;
|
|
8
|
+
source: string | null;
|
|
9
|
+
createdAt: string | null;
|
|
10
|
+
namespace: string | null;
|
|
11
|
+
parentId: string | null;
|
|
12
|
+
};
|
|
13
|
+
export type CheckpointMetaWithAttempts = CheckpointMeta & {
|
|
14
|
+
attemptIndex: number;
|
|
15
|
+
attemptCount: number;
|
|
16
|
+
isLatestAttempt: boolean;
|
|
17
|
+
baseUserMessageId: string | null;
|
|
18
|
+
};
|
|
19
|
+
export type CheckpointAttemptInfo = {
|
|
20
|
+
checkpointId: string;
|
|
21
|
+
attemptIndex: number;
|
|
22
|
+
attemptCount: number;
|
|
23
|
+
isLatestAttempt: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type TimelineCheckpoint = {
|
|
26
|
+
id: string;
|
|
27
|
+
messageId: string | null;
|
|
28
|
+
step: number | null;
|
|
29
|
+
source: string | null;
|
|
30
|
+
createdAt: string | null;
|
|
31
|
+
next?: string | null;
|
|
32
|
+
parentConfig?: Record<string, unknown> | null;
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useCheckpointMetadata Hook
|
|
3
|
-
*
|
|
4
|
-
* Builds checkpoint metadata maps from server checkpoint options.
|
|
5
|
-
*
|
|
6
|
-
* Encapsulates logic for:
|
|
7
|
-
* - Normalizing and sorting checkpoint options
|
|
8
|
-
* - Building checkpoint lookups (by ID, by step:source)
|
|
9
|
-
* - Detecting edited messages (attempt detection via buildAttemptMaps)
|
|
10
|
-
*
|
|
11
|
-
* This hook moves ~107 lines of metadata preparation logic from ChatInterface,
|
|
12
|
-
* resulting in cleaner separation of concerns.
|
|
13
|
-
*/
|
|
14
|
-
import type { HydratedCheckpointSnapshot } from "@/types";
|
|
15
|
-
import type { CheckpointMeta, CheckpointMetaWithAttempts } from "@/hooks/checkpoints/types";
|
|
16
|
-
export interface CheckpointMetadataResult {
|
|
17
|
-
checkpointMetaById: Map<string, CheckpointMeta>;
|
|
18
|
-
checkpointIndexByKey: Map<string, CheckpointMeta[]>;
|
|
19
|
-
attemptMetaById: Map<string, CheckpointMetaWithAttempts>;
|
|
20
|
-
userMessageIdToAttempts: Map<string, Array<{
|
|
21
|
-
checkpointId: string;
|
|
22
|
-
attemptIndex: number;
|
|
23
|
-
attemptCount: number;
|
|
24
|
-
isLatestAttempt: boolean;
|
|
25
|
-
}>>;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Hook to build and memoize checkpoint metadata from server options.
|
|
29
|
-
*
|
|
30
|
-
* @param checkpointOptions - Raw checkpoint snapshots from the server
|
|
31
|
-
* @returns Memoized metadata maps for efficient lookups
|
|
32
|
-
*/
|
|
33
|
-
export declare function useCheckpointMetadata(checkpointOptions: HydratedCheckpointSnapshot[]): CheckpointMetadataResult;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { HydratedCheckpointSnapshot, PendingInterrupt as Interrupt } from "@/types";
|
|
2
|
-
import type { CheckpointMeta, CheckpointMetaWithAttempts } from "@/hooks/checkpoints/types";
|
|
3
|
-
export type EditMeta = {
|
|
4
|
-
checkpointId?: string | null;
|
|
5
|
-
checkpointNs?: string | null;
|
|
6
|
-
};
|
|
7
|
-
export type TimelineCheckpoint = {
|
|
8
|
-
id: string;
|
|
9
|
-
label: string;
|
|
10
|
-
messageId: string | null;
|
|
11
|
-
step: number | null;
|
|
12
|
-
source: string | null;
|
|
13
|
-
createdAt: string | null;
|
|
14
|
-
next?: string | null;
|
|
15
|
-
parentConfig?: Record<string, unknown> | null;
|
|
16
|
-
};
|
|
17
|
-
export declare function findLatestUserMessageInCheckpoint(checkpoint: HydratedCheckpointSnapshot): string | null;
|
|
18
|
-
export declare function useCheckpointTimeline(checkpoints: HydratedCheckpointSnapshot[]): TimelineCheckpoint[];
|
|
19
|
-
export declare function useCheckpointMeta(checkpoints: HydratedCheckpointSnapshot[]): CheckpointMeta[];
|
|
20
|
-
export declare function useCheckpointAttempts(checkpoints: HydratedCheckpointSnapshot[]): CheckpointMetaWithAttempts[];
|
|
21
|
-
export declare function isExecutionPaused(snapshot: HydratedCheckpointSnapshot): boolean;
|
|
22
|
-
export declare function getCurrentInterrupt(snapshot: HydratedCheckpointSnapshot): Interrupt | null;
|
|
23
|
-
export declare function getLatestCheckpoint(checkpoints: HydratedCheckpointSnapshot[]): HydratedCheckpointSnapshot | undefined;
|
|
24
|
-
export declare function useCheckpointById(checkpoints: HydratedCheckpointSnapshot[], checkpointId: string | null): HydratedCheckpointSnapshot | undefined;
|
/package/dist/context/services/{streaming/use-streaming-service.d.ts → use-streaming-service.d.ts}
RENAMED
|
File without changes
|