import { useEffect, useRef } from "react";
export function useAgentServerReconciler(input) {
    const { loadAgent } = input;
    const reconcileServerStateInFlightRef = useRef(false);
    const reconcileServerStateRef = useRef(null);
    useEffect(() => {
        reconcileServerStateRef.current = async () => {
            if (reconcileServerStateInFlightRef.current) {
                return;
            }
            reconcileServerStateInFlightRef.current = true;
            try {
                await loadAgent({ silent: true });
            }
            finally {
                reconcileServerStateInFlightRef.current = false;
            }
        };
    }, [loadAgent]);
    return reconcileServerStateRef;
}
//# sourceMappingURL=useAgentServerReconciler.js.map