MCPcopy Create free account
hub / github.com/ephraimduncan/opencode-cursor / startBridge

Function startBridge

src/proxy.ts:1325–1336  ·  view source on GitHub ↗

Spawn a bridge, send the initial request frame, and start heartbeat.

(
  accessToken: string,
  requestBytes: Uint8Array,
)

Source from the content-addressed store, hash-verified

1323
1324/** Spawn a bridge, send the initial request frame, and start heartbeat. */
1325function 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
1338function handleStreamingResponse(
1339 payload: CursorRequestPayload,

Callers 2

handleStreamingResponseFunction · 0.85
collectFullResponseFunction · 0.85

Calls 3

spawnBridgeFunction · 0.85
frameConnectMessageFunction · 0.85
makeHeartbeatBytesFunction · 0.85

Tested by

no test coverage detected