import { useCallback } from "react";
export function useAgentContextUpdateHandler(input) {
    const { setAgentMetadata } = input;
    return useCallback((contextData) => {
        if (!contextData) {
            return;
        }
        try {
            setAgentMetadata((prev) => {
                const current = (prev || {});
                const updated = { ...current };
                if (contextData.additionalData) {
                    updated.additionalData = {
                        ...(current.additionalData || {}),
                        ...(contextData.additionalData || {}),
                    };
                }
                if (Array.isArray(contextData.childAgents)) {
                    updated.childAgents = contextData.childAgents;
                }
                return updated;
            });
        }
        catch (error) {
            console.error("[AgentTerminal] Error handling ContextUpdate:", error);
        }
    }, [setAgentMetadata]);
}
//# sourceMappingURL=useAgentContextUpdateHandler.js.map