The Open Standard for Generative UI
remote merge
abhishek18424c351677
diff --cc frontend-sdk/packages/react-core/src/types.tsindex 9f8931069,c57af481e..06c455191--- a/frontend-sdk/packages/react-core/src/types.ts+++ b/frontend-sdk/packages/react-core/src/types.ts@@@ -1,30 -1,33 +1,46 @@@import { Message as VercelMessage } from "ai";+import { z } from "zod";+ /** Represents a chat message, extending Vercel's Message type */export type Message = VercelMessage;+ /**+ * Represents a message being created, with an optional ID+ * @extends Omit<Message, "id">+ */export type CreateMessage = Omit<Message, "id"> & {id?: Message["id"];};+ /**+ * Function type for converting between message types+ * @template T - The source message type+ */export type MessageConverter<T = Message> = (message: T) => Message;+export interface GenUITool<T extends z.ZodSchema = z.ZodSchema> {+ name: string;+ description: string;+ parameters: T;+ Component: React.ComponentType<+ z.infer<T> & {+ toolCallId: string;+ addToolResult: (args: { toolCallId: string; result: unknown }) => void;+ }+ >;+}++ /**+ * Represents a chat thread+ */export type Thread = {+ /** Unique identifier for the thread */threadId: string;+ /** Title of the thread */title: string;+ /** Creation timestamp */createdAt: Date;+ /** Indicates if the thread is currently processing */isRunning: boolean;};@@@ -47,23 -54,29 +67,31 @@@ export type ThreadState<T = Message> =isRunning?: boolean | undefined;messages: T[];error: Error | null | undefined;+ tools: { [id: string]: GenUITool };};+ /**+ * Combines thread state and actions+ * @template T - The message type used in the thread+ */export type ThreadManager<T = Message> = ThreadState<T> & ThreadActions<T>;+ /**+ * Represents the state of the thread list+ */export type ThreadListState = {threads: Thread[];isLoading: boolean;error: Error | null | undefined;};+ /**+ * Actions available for managing the thread list+ */export type ThreadListActions = {- // trigger load threadload: () => void;- // switch to new threadswitchToNew: () => void;+ selectThread: (threadId: string) => void;updateThread: (thread: Thread) => void;deleteThread: (threadId: string) => void;};