import { useCallback } from "react";
export function useAgentLoadedRunStateSync(input) {
    const { isStoppingRef, isWaitingRef, setIsWaitingForResponse, setIsConnecting, setIsAgentThinking, } = input;
    return useCallback((status) => {
        if (isStoppingRef.current) {
            return;
        }
        if (status.isRunning || status.hasStreaming) {
            setIsWaitingForResponse(true);
            isWaitingRef.current = true;
            setIsAgentThinking(true);
            return;
        }
        setIsWaitingForResponse(false);
        isWaitingRef.current = false;
        if (status.waitingForApproval || status.waitingForInput) {
            setIsConnecting(false);
            setIsAgentThinking(false);
            return;
        }
        setIsConnecting(false);
        setIsAgentThinking(false);
    }, [
        isStoppingRef,
        isWaitingRef,
        setIsAgentThinking,
        setIsConnecting,
        setIsWaitingForResponse,
    ]);
}
//# sourceMappingURL=useAgentLoadedRunStateSync.js.map