import type { MessageRuntime } from "../runtime/MessageRuntime.js"; /** * @deprecated Use `useAui()` with `aui.message()` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12 * * Hook to access the MessageRuntime from the current context. * * The MessageRuntime provides access to message-level state and actions, * including message content, status, editing capabilities, and branching. * * @param options Configuration options * @param options.optional Whether the hook should return null if no context is found * @returns The MessageRuntime instance, or null if optional is true and no context exists * * @example * ```tsx * // Before: * function MessageActions() { * const runtime = useMessageRuntime(); * const handleReload = () => { * runtime.reload(); * }; * const handleEdit = () => { * runtime.startEdit(); * }; * return ( *
* * *
* ); * } * * // After: * function MessageActions() { * const aui = useAui(); * const handleReload = () => { * aui.message().reload(); * }; * const handleEdit = () => { * aui.message().startEdit(); * }; * return ( *
* * *
* ); * } * ``` */ export declare function useMessageRuntime(options?: { optional?: false | undefined; }): MessageRuntime; export declare function useMessageRuntime(options?: { optional?: boolean | undefined; }): MessageRuntime | null; /** * @deprecated Use `useAuiState((s) => s.message)` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12 * * Hook to access the current message state. * * This hook provides reactive access to the message's state, including content, * role, status, and other message-level properties. * * @param selector Optional selector function to pick specific state properties * @returns The selected message state or the entire message state if no selector provided * * @example * ```tsx * // Before: * function MessageContent() { * const role = useMessage((state) => state.role); * const content = useMessage((state) => state.content); * const isLoading = useMessage((state) => state.status.type === "running"); * return ( *
* {isLoading ? "Loading..." : content.map(part => part.text).join("")} *
* ); * } * * // After: * function MessageContent() { * const role = useAuiState((s) => s.message.role); * const content = useAuiState((s) => s.message.content); * const isLoading = useAuiState((s) => s.message.status.type === "running"); * return ( *
* {isLoading ? "Loading..." : content.map(part => part.text).join("")} *
* ); * } * ``` */ export declare const useMessage: { (): import("@assistant-ui/core").MessageState; (selector: (state: import("@assistant-ui/core").MessageState) => TSelected): TSelected; (selector: ((state: import("@assistant-ui/core").MessageState) => TSelected) | undefined): import("@assistant-ui/core").MessageState | TSelected; (options: { optional?: false | undefined; }): import("@assistant-ui/core").MessageState; (options: { optional?: boolean | undefined; }): import("@assistant-ui/core").MessageState | null; (options: { optional?: false | undefined; selector: (state: import("@assistant-ui/core").MessageState) => TSelected; }): TSelected; (options: { optional?: false | undefined; selector: ((state: import("@assistant-ui/core").MessageState) => TSelected) | undefined; }): import("@assistant-ui/core").MessageState | TSelected; (options: { optional?: boolean | undefined; selector: (state: import("@assistant-ui/core").MessageState) => TSelected; }): TSelected | null; (options: { optional?: boolean | undefined; selector: ((state: import("@assistant-ui/core").MessageState) => TSelected) | undefined; }): import("@assistant-ui/core").MessageState | TSelected | null; }; /** * @deprecated Use `useAuiState((s) => s.message.composer)` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12 */ export declare const useEditComposer: { (): import("@assistant-ui/core").EditComposerState; (selector: (state: import("@assistant-ui/core").EditComposerState) => TSelected): TSelected; (selector: ((state: import("@assistant-ui/core").EditComposerState) => TSelected) | undefined): import("@assistant-ui/core").EditComposerState | TSelected; (options: { optional?: false | undefined; }): import("@assistant-ui/core").EditComposerState; (options: { optional?: boolean | undefined; }): import("@assistant-ui/core").EditComposerState | null; (options: { optional?: false | undefined; selector: (state: import("@assistant-ui/core").EditComposerState) => TSelected; }): TSelected; (options: { optional?: false | undefined; selector: ((state: import("@assistant-ui/core").EditComposerState) => TSelected) | undefined; }): import("@assistant-ui/core").EditComposerState | TSelected; (options: { optional?: boolean | undefined; selector: (state: import("@assistant-ui/core").EditComposerState) => TSelected; }): TSelected | null; (options: { optional?: boolean | undefined; selector: ((state: import("@assistant-ui/core").EditComposerState) => TSelected) | undefined; }): import("@assistant-ui/core").EditComposerState | TSelected | null; }; //# sourceMappingURL=MessageContext.d.ts.map