import { useCallback, useEffect, useRef } from "react";
import { subscribeAgentSessionSocketMessages, } from "./useAgentSessionSync";
export function useAgentSessionSocketSource(editContext) {
    const editContextRef = useRef(editContext);
    useEffect(() => {
        editContextRef.current = editContext;
    }, [editContext]);
    const subscribeSessionSocketMessages = useCallback((handler) => subscribeAgentSessionSocketMessages({
        addSocketMessageListener: editContextRef.current?.addSocketMessageListener,
        onMessage: handler,
    }), []);
    return {
        editContextRef,
        subscribeSessionSocketMessages,
    };
}
//# sourceMappingURL=useAgentSessionSocketSource.js.map