@@ -29,7 +29,11 @@ import type { HooksConfigResolved } from "./hooks.js";
2929import type { AuthorizedGatewayHttpRequest } from "./http-auth-utils.js" ;
3030import { createMcpAppSandboxHttpServer } from "./mcp-app-sandbox-http.js" ;
3131import { isLoopbackHost , resolveGatewayListenHosts } from "./net.js" ;
32- import type { GatewayBroadcastFn , GatewayBroadcastToConnIdsFn } from "./server-broadcast-types.js" ;
32+ import type {
33+ GatewayBroadcastFn ,
34+ GatewayBroadcastToConnIdsFn ,
35+ GatewayBufferedAmountFn ,
36+ } from "./server-broadcast-types.js" ;
3337import { createGatewayBroadcaster } from "./server-broadcast.js" ;
3438import {
3539 type ChatRunEntry ,
@@ -127,6 +131,7 @@ export async function createGatewayRuntimeState(params: {
127131 clients : Set < GatewayWsClient > ;
128132 broadcast : GatewayBroadcastFn ;
129133 broadcastToConnIds : GatewayBroadcastToConnIdsFn ;
134+ getBufferedAmount : GatewayBufferedAmountFn ;
130135 agentRunSeq : Map < string , number > ;
131136 dedupe : Map < string , DedupeEntry > ;
132137 chatRunState : ReturnType < typeof createChatRunState > ;
@@ -156,7 +161,9 @@ export async function createGatewayRuntimeState(params: {
156161 const resolvePluginRouteRegistry = ( ) =>
157162 params . getPluginRouteRegistry ?.( ) ?? params . pluginRegistry ;
158163 const clients = new Set < GatewayWsClient > ( ) ;
159- const { broadcast, broadcastToConnIds } = createGatewayBroadcaster ( { clients } ) ;
164+ const { broadcast, broadcastToConnIds, getBufferedAmount } = createGatewayBroadcaster ( {
165+ clients,
166+ } ) ;
160167
161168 let loadedHooksRequestHandler : HooksRequestHandler | null = null ;
162169 const handleHooksRequest : HooksRequestHandler = async ( req , res ) => {
@@ -461,6 +468,7 @@ export async function createGatewayRuntimeState(params: {
461468 clients,
462469 broadcast,
463470 broadcastToConnIds,
471+ getBufferedAmount,
464472 agentRunSeq,
465473 dedupe,
466474 chatRunState,
0 commit comments