diff --git a/packages/react/src/api/AssistantRuntime.ts b/packages/react/src/api/AssistantRuntime.ts index 1b14d4edd..0856a944c 100644 --- a/packages/react/src/api/AssistantRuntime.ts +++ b/packages/react/src/api/AssistantRuntime.ts @@ -13,17 +13,37 @@ import { } from "./ThreadManagerRuntime"; export type AssistantRuntime = { + /** + * The currently selected main thread. + */ thread: ThreadRuntime; + + /** + * The thread manager, to rename, archive and delete threads. + */ threadManager: ThreadManagerRuntime; + /** + * Switch to a new thread. + */ switchToNewThread(): void; + /** + * Switch to a thread. + * + * @param threadId The thread ID to switch to. + */ switchToThread(threadId: string): void; /** * @deprecated Use `switchToNewThread` instead. This will be removed in 0.6.0. */ switchToThread(threadId: string | null): void; + /** + * Register a model config provider. Model config providers are configuration such as system message, temperature, etc. that are set in the frontend. + * + * @param provider The model config provider to register. + */ registerModelConfigProvider(provider: ModelConfigProvider): Unsubscribe; /** diff --git a/packages/react/src/api/ThreadRuntime.ts b/packages/react/src/api/ThreadRuntime.ts index 4d2a00e1c..554ed6077 100644 --- a/packages/react/src/api/ThreadRuntime.ts +++ b/packages/react/src/api/ThreadRuntime.ts @@ -77,12 +77,38 @@ export type ThreadRuntimeCoreBinding = SubscribableWithState< }; export type ThreadState = Readonly<{ + /** + * The thread ID. + */ threadId: string; + /** + * Whether the thread is disabled. Disabled threads cannot receive new messages. + */ isDisabled: boolean; + + /** + * Whether the thread is running. A thread is considered running when there is an active stream connection to the backend. + */ isRunning: boolean; + + /** + * The capabilities of the thread, such as whether the thread supports editing, branch switching, etc. + */ capabilities: RuntimeCapabilities; + + /** + * The messages in the currently selected branch of the thread. + */ messages: readonly ThreadMessage[]; + + /** + * Follow up message suggestions to show the user. + */ suggestions: readonly ThreadSuggestion[]; + + /** + * Custom extra information provided by the runtime. + */ extras: unknown; /**