teodor-new-chat-ui 4.3.321 → 4.3.323
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/{lib → api}/chat-api.d.ts +1 -18
- package/dist/api/utils.d.ts +21 -0
- package/dist/components/chat/MessageComponent.d.ts +1 -1
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/context/providers/ApiProvider.d.ts +1 -1
- package/dist/hooks/useCheckpointMetadata.d.ts +34 -0
- package/dist/hooks/useMessageMetadata.d.ts +39 -0
- package/dist/index.esm.js +5931 -5884
- package/dist/index.umd.js +46 -46
- package/dist/lib/historyUtils.d.ts +16 -0
- package/dist/lib/index.d.ts +2 -2
- package/dist/types/api.d.ts +1 -0
- package/dist/types/context.d.ts +1 -1
- package/package.json +1 -1
- /package/dist/{lib → api}/file-api.d.ts +0 -0
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Chat-only API Client
|
|
3
|
-
*
|
|
4
|
-
* This client only handles chat-related operations. Authentication is handled
|
|
5
|
-
* by the host application which passes tokens via apiConfig.
|
|
6
|
-
*/
|
|
7
1
|
import type { AgentDetail, AgentSchemaInfo, AgentSummary, CheckpointList, CheckpointSnapshot, HistoryPayload, ThreadInfo, ThreadSummary } from "@/types/api";
|
|
8
|
-
import {
|
|
9
|
-
export declare function resolveChatBaseUrl(baseUrl?: string): string;
|
|
10
|
-
type TokenListener = (token: string | null) => void;
|
|
11
|
-
export declare function getChatToken(): string | null;
|
|
12
|
-
export declare function setChatToken(token: string | null): void;
|
|
13
|
-
export declare function onChatTokenChanged(callback: TokenListener): () => void;
|
|
14
|
-
declare const httpClient: AxiosInstance;
|
|
15
|
-
export declare function get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
16
|
-
export declare function post<T = unknown, B = unknown>(url: string, body?: B, config?: AxiosRequestConfig): Promise<T>;
|
|
17
|
-
export declare function put<T = unknown, B = unknown>(url: string, body?: B, config?: AxiosRequestConfig): Promise<T>;
|
|
18
|
-
export declare function del<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
2
|
+
import type { TokenListener } from "../types/api";
|
|
19
3
|
export declare class ChatApi {
|
|
20
4
|
get baseUrl(): string;
|
|
21
5
|
updateConfig(config: {
|
|
@@ -52,7 +36,6 @@ export declare class ChatApi {
|
|
|
52
36
|
listCheckpointSummaries(threadId: string): Promise<CheckpointList["items"]>;
|
|
53
37
|
}
|
|
54
38
|
export declare const chatApiClient: ChatApi;
|
|
55
|
-
export { httpClient };
|
|
56
39
|
export default chatApiClient;
|
|
57
40
|
export declare const ApiClient: typeof ChatApi;
|
|
58
41
|
export declare const Api: typeof ChatApi;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat-only API Client
|
|
3
|
+
*
|
|
4
|
+
* This client only handles chat-related operations. Authentication is handled
|
|
5
|
+
* by the host application which passes tokens via apiConfig.
|
|
6
|
+
*/
|
|
7
|
+
import type { TokenListener } from "@/types/api";
|
|
8
|
+
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
9
|
+
export declare function resolveChatBaseUrl(baseUrl?: string): string;
|
|
10
|
+
export declare function getChatToken(): string | null;
|
|
11
|
+
export declare function setChatToken(token: string | null): void;
|
|
12
|
+
export declare function onChatTokenChanged(callback: TokenListener): () => void;
|
|
13
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
14
|
+
export declare const HISTORY_TIMEOUT_MS = 90000;
|
|
15
|
+
declare const httpClient: AxiosInstance;
|
|
16
|
+
export declare function get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
17
|
+
export declare function post<T = unknown, B = unknown>(url: string, body?: B, config?: AxiosRequestConfig): Promise<T>;
|
|
18
|
+
export declare function put<T = unknown, B = unknown>(url: string, body?: B, config?: AxiosRequestConfig): Promise<T>;
|
|
19
|
+
export declare function del<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
20
|
+
export declare function unwrap<T>(response: unknown): T;
|
|
21
|
+
export { httpClient };
|
|
@@ -45,7 +45,7 @@ export interface MessageComponentProps {
|
|
|
45
45
|
onInterruptActionEnd?: () => void;
|
|
46
46
|
checkpointCandidates?: MessageCheckpointMeta[];
|
|
47
47
|
activeCheckpointId?: string | null;
|
|
48
|
-
onSelectCheckpoint?: (checkpointId: string | null, parentCheckpointId?: string | null) => Promise<void> | void;
|
|
48
|
+
onSelectCheckpoint?: (checkpointId: string | null, parentCheckpointId?: string | null, isLatest?: boolean) => Promise<void> | void;
|
|
49
49
|
defaultCheckpointId?: string | null;
|
|
50
50
|
messageParentCheckpointId?: string | null;
|
|
51
51
|
attemptMeta?: CheckpointMetaWithAttempts | null;
|
|
@@ -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<
|
|
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 | HTMLSlotElement | HTMLStyleElement | HTMLTitleElement | 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"> & {
|
|
4
4
|
className?: string | undefined;
|
|
5
5
|
collapsedSize?: number | undefined;
|
|
6
6
|
collapsible?: boolean | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ApiProvider - Lowest level context providing API client and auth token
|
|
3
3
|
*/
|
|
4
|
+
import type { ApiConfig, ApiContextValue } from '@/types/api';
|
|
4
5
|
import { type ReactNode } from 'react';
|
|
5
|
-
import type { ApiContextValue, ApiConfig } from '@/types/api';
|
|
6
6
|
export interface ApiProviderProps {
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
apiConfig?: ApiConfig;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 buildAttemptMetadataMap)
|
|
10
|
+
* - Creating reverse user message ID → attempts lookup
|
|
11
|
+
*
|
|
12
|
+
* This hook moves ~107 lines of metadata preparation logic from ChatInterface,
|
|
13
|
+
* resulting in cleaner separation of concerns.
|
|
14
|
+
*/
|
|
15
|
+
import type { HydratedCheckpointSnapshot } from "@/types/api";
|
|
16
|
+
import type { CheckpointMeta, CheckpointMetaWithAttempts } from "@/types/timeline";
|
|
17
|
+
export interface CheckpointMetadataResult {
|
|
18
|
+
checkpointMetaById: Map<string, CheckpointMeta>;
|
|
19
|
+
checkpointIndexByKey: Map<string, CheckpointMeta[]>;
|
|
20
|
+
attemptMetaById: Map<string, CheckpointMetaWithAttempts>;
|
|
21
|
+
userMessageIdToAttempts: Map<string, Array<{
|
|
22
|
+
checkpointId: string;
|
|
23
|
+
attemptIndex: number;
|
|
24
|
+
attemptCount: number;
|
|
25
|
+
isLatestAttempt: boolean;
|
|
26
|
+
}>>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Hook to build and memoize checkpoint metadata from server options.
|
|
30
|
+
*
|
|
31
|
+
* @param checkpointOptions - Raw checkpoint snapshots from the server
|
|
32
|
+
* @returns Memoized metadata maps for efficient lookups
|
|
33
|
+
*/
|
|
34
|
+
export declare function useCheckpointMetadata(checkpointOptions: HydratedCheckpointSnapshot[]): CheckpointMetadataResult;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useMessageMetadata Hook
|
|
3
|
+
*
|
|
4
|
+
* Resolves and enriches metadata for a single message, including:
|
|
5
|
+
* - Checkpoint candidates (versions/branches of a conversation)
|
|
6
|
+
* - Attempt information (if message was edited/attempted multiple times)
|
|
7
|
+
* - Resolved step/source from multiple possible sources
|
|
8
|
+
*
|
|
9
|
+
* This hook encapsulates ~120 lines of complex metadata resolution logic
|
|
10
|
+
* that was previously embedded in MessageList.tsx's render function.
|
|
11
|
+
*/
|
|
12
|
+
import type { ChatMessage, DefaultMessage } from "@/types/api";
|
|
13
|
+
import type { CheckpointMeta, CheckpointMetaWithAttempts } from "@/types/timeline";
|
|
14
|
+
export interface MetadataResolverMaps {
|
|
15
|
+
checkpointMetaById?: Map<string, CheckpointMeta>;
|
|
16
|
+
checkpointIndexByKey?: Map<string, CheckpointMeta[]>;
|
|
17
|
+
attemptMetaById?: Map<string, CheckpointMetaWithAttempts>;
|
|
18
|
+
userMessageIdToAttempts?: Map<string, Array<{
|
|
19
|
+
checkpointId: string;
|
|
20
|
+
attemptIndex: number;
|
|
21
|
+
attemptCount: number;
|
|
22
|
+
isLatestAttempt: boolean;
|
|
23
|
+
}>>;
|
|
24
|
+
}
|
|
25
|
+
export interface ResolvedMessageMetadata {
|
|
26
|
+
checkpointCandidates: CheckpointMeta[];
|
|
27
|
+
defaultCheckpointId: string | null;
|
|
28
|
+
attemptMeta: CheckpointMetaWithAttempts | null;
|
|
29
|
+
resolvedStep: number | null;
|
|
30
|
+
resolvedSource: string | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Hook to resolve metadata for a single message.
|
|
34
|
+
*
|
|
35
|
+
* @param message - The message to resolve metadata for (ChatMessage or DefaultMessage)
|
|
36
|
+
* @param maps - Container with all required metadata lookup maps
|
|
37
|
+
* @returns Resolved metadata including candidates, attempt info, and step/source
|
|
38
|
+
*/
|
|
39
|
+
export declare function useMessageMetadata(message: ChatMessage | DefaultMessage | undefined, maps: MetadataResolverMaps): ResolvedMessageMetadata;
|