import type { ThreadRuntime } from "../runtime/ThreadRuntime.js";
import type { ModelContext } from "@assistant-ui/core";
/**
* @deprecated Use `useAui()` with `aui.thread()` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12
*
* Hook to access the ThreadRuntime from the current context.
*
* The ThreadRuntime provides access to thread-level state and actions,
* including message management, thread state, and composer functionality.
*
* @param options Configuration options
* @param options.optional Whether the hook should return null if no context is found
* @returns The ThreadRuntime instance, or null if optional is true and no context exists
*
* @example
* ```tsx
* // Before:
* function MyComponent() {
* const runtime = useThreadRuntime();
* const handleSendMessage = (text: string) => {
* runtime.append({ role: "user", content: [{ type: "text", text }] });
* };
* return ;
* }
*
* // After:
* function MyComponent() {
* const aui = useAui();
* const handleSendMessage = (text: string) => {
* aui.thread().append({ role: "user", content: [{ type: "text", text }] });
* };
* return ;
* }
* ```
*/
export declare function useThreadRuntime(options?: {
optional?: false | undefined;
}): ThreadRuntime;
export declare function useThreadRuntime(options?: {
optional?: boolean | undefined;
}): ThreadRuntime | null;
/**
* @deprecated Use `useAuiState((s) => s.thread)` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12
*
* Hook to access the current thread state.
*
* This hook provides reactive access to the thread's state, including messages,
* running status, capabilities, and other thread-level properties.
*
* @param selector Optional selector function to pick specific state properties
* @returns The selected thread state or the entire thread state if no selector provided
*
* @example
* ```tsx
* // Before:
* function ThreadStatus() {
* const isRunning = useThread((state) => state.isRunning);
* const messageCount = useThread((state) => state.messages.length);
* return
Running: {isRunning}, Messages: {messageCount}
;
* }
*
* // After:
* function ThreadStatus() {
* const isRunning = useAuiState((s) => s.thread.isRunning);
* const messageCount = useAuiState((s) => s.thread.messages.length);
* return Running: {isRunning}, Messages: {messageCount}
;
* }
* ```
*/
export declare const useThread: {
(): import("@assistant-ui/core").ThreadState;
(selector: (state: import("@assistant-ui/core").ThreadState) => TSelected): TSelected;
(selector: ((state: import("@assistant-ui/core").ThreadState) => TSelected) | undefined): import("@assistant-ui/core").ThreadState | TSelected;
(options: {
optional?: false | undefined;
}): import("@assistant-ui/core").ThreadState;
(options: {
optional?: boolean | undefined;
}): import("@assistant-ui/core").ThreadState | null;
(options: {
optional?: false | undefined;
selector: (state: import("@assistant-ui/core").ThreadState) => TSelected;
}): TSelected;
(options: {
optional?: false | undefined;
selector: ((state: import("@assistant-ui/core").ThreadState) => TSelected) | undefined;
}): import("@assistant-ui/core").ThreadState | TSelected;
(options: {
optional?: boolean | undefined;
selector: (state: import("@assistant-ui/core").ThreadState) => TSelected;
}): TSelected | null;
(options: {
optional?: boolean | undefined;
selector: ((state: import("@assistant-ui/core").ThreadState) => TSelected) | undefined;
}): import("@assistant-ui/core").ThreadState | TSelected | null;
};
/**
* @deprecated Use `useAuiState((s) => s.thread.composer)` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12
*/
export declare const useThreadComposer: {
(): import("@assistant-ui/core").ThreadComposerState;
(selector: (state: import("@assistant-ui/core").ThreadComposerState) => TSelected): TSelected;
(selector: ((state: import("@assistant-ui/core").ThreadComposerState) => TSelected) | undefined): import("@assistant-ui/core").ThreadComposerState | TSelected;
(options: {
optional?: false | undefined;
}): import("@assistant-ui/core").ThreadComposerState;
(options: {
optional?: boolean | undefined;
}): import("@assistant-ui/core").ThreadComposerState | null;
(options: {
optional?: false | undefined;
selector: (state: import("@assistant-ui/core").ThreadComposerState) => TSelected;
}): TSelected;
(options: {
optional?: false | undefined;
selector: ((state: import("@assistant-ui/core").ThreadComposerState) => TSelected) | undefined;
}): import("@assistant-ui/core").ThreadComposerState | TSelected;
(options: {
optional?: boolean | undefined;
selector: (state: import("@assistant-ui/core").ThreadComposerState) => TSelected;
}): TSelected | null;
(options: {
optional?: boolean | undefined;
selector: ((state: import("@assistant-ui/core").ThreadComposerState) => TSelected) | undefined;
}): import("@assistant-ui/core").ThreadComposerState | TSelected | null;
};
/**
* @deprecated Use `useAuiState((s) => s.thread.modelContext)` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12
*/
export declare function useThreadModelContext(options?: {
optional?: false | undefined;
}): ModelContext;
export declare function useThreadModelContext(options?: {
optional?: boolean | undefined;
}): ModelContext | null;
//# sourceMappingURL=ThreadContext.d.ts.map