MCPcopy Create free account
hub / github.com/different-ai/opencode-browser / connectToAgent

Function connectToAgent

src/agent-backend.ts:427–436  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

425 const agentPending = new Map<string, PendingRequest>();
426
427 async function connectToAgent(): Promise<net.Socket> {
428 return await new Promise((resolve, reject) => {
429 const socket =
430 connection.type === "unix"
431 ? net.createConnection(connection.path)
432 : net.createConnection({ host: connection.host, port: connection.port });
433 socket.once("connect", () => resolve(socket));
434 socket.once("error", (err) => reject(err));
435 });
436 }
437
438 async function ensureAgentSocket(): Promise<net.Socket> {
439 if (agentSocket && !agentSocket.destroyed) return agentSocket;

Callers 1

ensureAgentSocketFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected