import { useCallback } from "react";
export function useAgentSessionErrorBridge(input) {
    const { state, actions } = input;
    const error = state.error;
    const setError = useCallback((nextError) => {
        const resolvedError = typeof nextError === "function" ? nextError(error) : nextError;
        if (Object.is(resolvedError, error)) {
            return;
        }
        actions.replaceError(resolvedError);
    }, [actions, error]);
    return { error, setError };
}
//# sourceMappingURL=useAgentSessionErrorBridge.js.map