import { useCallback } from "react";
export function useAgentSocketMessageRouter(input) {
    const { agent, handleAgentInfoSocketMessage, handleOperationSocketMessage, handleRunStartSocketMessage, handleUserMessageSocketMessage, handlePromptQueueSocketMessage, handleRunDeltaSocketMessage, handleRunStatusSocketMessage, handleRunResyncSocketMessage, handleRunCompletionSocketMessage, } = input;
    return useCallback((message) => {
        if (!agent) {
            return;
        }
        const messageType = message.type;
        if (handleAgentInfoSocketMessage(messageType, message.payload)) {
            return;
        }
        // Edit operations store agentId in op.user?.agentId, not payload.agentId.
        if (handleOperationSocketMessage(messageType, message.payload)) {
            return;
        }
        const agentId = message.payload?.agentId;
        if (agentId !== agent.id) {
            return;
        }
        if (handleRunStartSocketMessage(messageType, message.payload)) {
            return;
        }
        if (handleUserMessageSocketMessage(messageType, message.payload)) {
            return;
        }
        if (handlePromptQueueSocketMessage(messageType, message.payload)) {
            return;
        }
        if (handleRunDeltaSocketMessage(messageType, message.payload)) {
            return;
        }
        if (handleRunStatusSocketMessage(messageType, message.payload)) {
            return;
        }
        if (handleRunResyncSocketMessage(messageType, message.payload)) {
            return;
        }
        handleRunCompletionSocketMessage(messageType, message.payload);
    }, [
        agent,
        handleAgentInfoSocketMessage,
        handleOperationSocketMessage,
        handlePromptQueueSocketMessage,
        handleRunCompletionSocketMessage,
        handleRunDeltaSocketMessage,
        handleRunResyncSocketMessage,
        handleRunStartSocketMessage,
        handleRunStatusSocketMessage,
        handleUserMessageSocketMessage,
    ]);
}
//# sourceMappingURL=useAgentSocketMessageRouter.js.map