/** * Global stream status flags for a specific component in a message. * Represents the aggregate state across all props for this component only. * Once a component completes, its status remains stable regardless of other generations. */ export interface StreamStatus { /** * Indicates no tokens have been received for any prop and generation is not active. * Useful for showing initial loading states before any data arrives. */ isPending: boolean; /** * Indicates active streaming - at least one prop is still streaming. * Use this to show loading animations or skeleton states during data transmission. */ isStreaming: boolean; /** * Indicates successful completion - component streaming is done AND every prop finished without error. * Safe to render the final component when this is true. */ isSuccess: boolean; /** * Indicates a fatal error occurred in any prop or the stream itself. * Check streamError for details about what went wrong. */ isError: boolean; /** * The first fatal error encountered during streaming (if any). * Will be undefined if no errors occurred. */ streamError?: Error; } /** * Streaming status flags for individual component props. * Tracks the state of each prop as it streams from the LLM. */ export interface PropStatus { /** * Indicates no tokens have been received for this specific prop yet. * The prop value is still undefined, null, or empty string. */ isPending: boolean; /** * Indicates at least one token has been received but streaming is not complete. * The prop has partial content that may still be updating. */ isStreaming: boolean; /** * Indicates this prop has finished streaming successfully. * The prop value is complete and stable. */ isSuccess: boolean; /** * The error that occurred during streaming (if any). * Will be undefined if no error occurred for this prop. */ error?: Error; } /** * Track streaming status for Tambo component props. * * **Important**: Props update repeatedly during streaming and may be partial. * Use `propStatus.?.isSuccess` before treating a prop as complete. * * Pair with `useTamboComponentState` to disable inputs while streaming. * @see {@link https://docs.tambo.co/concepts/generative-interfaces/component-state} * @template Props - Component props type * @returns `streamStatus` (overall) and `propStatus` (per-prop) flags * @throws {Error} When used outside a rendered component * @example * ```tsx * // Wait for entire stream * const { streamStatus } = useTamboStreamStatus(); * if (!streamStatus.isSuccess) return ; * return ; * ``` * @example * ```tsx * // Highlight in-flight props * const { propStatus } = useTamboStreamStatus(); *

* {title} *

* ``` */ export declare function useTamboStreamStatus>(): { streamStatus: StreamStatus; propStatus: Partial>; }; //# sourceMappingURL=use-tambo-v1-stream-status.d.ts.map