Spawn a bridge, send the initial request frame, and start heartbeat.
( accessToken: string, requestBytes: Uint8Array, )
| 1323 | |
| 1324 | /** Spawn a bridge, send the initial request frame, and start heartbeat. */ |
| 1325 | function startBridge( |
| 1326 | accessToken: string, |
| 1327 | requestBytes: Uint8Array, |
| 1328 | ): { bridge: ReturnType<typeof spawnBridge>; heartbeatTimer: NodeJS.Timeout } { |
| 1329 | const bridge = spawnBridge({ |
| 1330 | accessToken, |
| 1331 | rpcPath: "/agent.v1.AgentService/Run", |
| 1332 | }); |
| 1333 | bridge.write(frameConnectMessage(requestBytes)); |
| 1334 | const heartbeatTimer = setInterval(() => bridge.write(makeHeartbeatBytes()), 5_000); |
| 1335 | return { bridge, heartbeatTimer }; |
| 1336 | } |
| 1337 | |
| 1338 | function handleStreamingResponse( |
| 1339 | payload: CursorRequestPayload, |
no test coverage detected