import { n as AgentEventPayload } from "./agent-events-vvbR5FCr.js";
import { a as ChatRunState, c as ToolEventRecipientRegistry, o as SessionEventSubscriberRegistry } from "./chat-abort-Bkz950s7.js";
import { t as loadGatewaySessionRow } from "./session-utils-aaJv8ET7.js";

//#region src/gateway/server-chat.d.ts
type ChatEventBroadcast = (event: string, payload: unknown, opts?: {
  dropIfSlow?: boolean;
}) => void;
type NodeSendToSession = (sessionKey: string, event: string, payload: unknown) => void;
type AgentEventHandlerOptions = {
  broadcast: ChatEventBroadcast;
  broadcastToConnIds: (event: string, payload: unknown, connIds: ReadonlySet<string>, opts?: {
    dropIfSlow?: boolean;
  }) => void;
  nodeSendToSession: NodeSendToSession;
  agentRunSeq: Map<string, number>;
  chatRunState: ChatRunState;
  resolveSessionKeyForRun: (runId: string) => string | undefined;
  clearAgentRunContext: (runId: string) => void;
  toolEventRecipients: ToolEventRecipientRegistry;
  sessionEventSubscribers: SessionEventSubscriberRegistry;
  loadGatewaySessionRowForSnapshot?: typeof loadGatewaySessionRow;
  lifecycleErrorRetryGraceMs?: number;
  isChatSendRunActive?: (runId: string) => boolean;
};
declare function createAgentEventHandler({
  broadcast,
  broadcastToConnIds,
  nodeSendToSession,
  agentRunSeq,
  chatRunState,
  resolveSessionKeyForRun,
  clearAgentRunContext,
  toolEventRecipients,
  sessionEventSubscribers,
  loadGatewaySessionRowForSnapshot,
  lifecycleErrorRetryGraceMs,
  isChatSendRunActive
}: AgentEventHandlerOptions): (evt: AgentEventPayload) => void;
//#endregion
export { createAgentEventHandler as i, ChatEventBroadcast as n, NodeSendToSession as r, AgentEventHandlerOptions as t };