"use client";
import { useAui, useAuiState } from "@assistant-ui/store";
import type { ComposerRuntime } from "../runtime/ComposerRuntime";
import { createStateHookForRuntime } from "../../context/react/utils/createStateHookForRuntime";
/**
* @deprecated Use `useAui()` with `aui.composer()` instead. See migration guide: https://assistant-ui.com/docs/migrations/v0-12
*
* Hook to access the ComposerRuntime from the current context.
*
* The ComposerRuntime provides access to composer state and actions for message
* composition, including text input, attachments, and sending functionality.
* This hook automatically resolves to either the message's edit composer or
* the thread's main composer depending on the context.
*
* @param options Configuration options
* @param options.optional Whether the hook should return null if no context is found
* @returns The ComposerRuntime instance, or null if optional is true and no context exists
*
* @example
* ```tsx
* // Before:
* function ComposerActions() {
* const runtime = useComposerRuntime();
* const handleSend = () => {
* if (runtime.getState().canSend) {
* runtime.send();
* }
* };
* const handleCancel = () => {
* if (runtime.getState().canCancel) {
* runtime.cancel();
* }
* };
* return (
*