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

Function agentRequest

src/agent-backend.ts:490–503  ·  view source on GitHub ↗
(action: string, payload: Record<string, any>)

Source from the content-addressed store, hash-verified

488 }
489
490 async function agentRequest(action: string, payload: Record<string, any>): Promise<any> {
491 const socket = await ensureAgentSocket();
492 const id = `a${++agentReqId}`;
493
494 return await new Promise((resolve, reject) => {
495 agentPending.set(id, { resolve, reject });
496 writeJsonLine(socket, { id, action, ...payload });
497 setTimeout(() => {
498 if (!agentPending.has(id)) return;
499 agentPending.delete(id);
500 reject(new Error("Timed out waiting for agent-browser response"));
501 }, REQUEST_TIMEOUT_MS);
502 });
503 }
504
505 async function agentCommand(action: string, payload: Record<string, any>): Promise<any> {
506 return await agentRequest(action, payload);

Callers 1

agentCommandFunction · 0.85

Calls 2

ensureAgentSocketFunction · 0.85
writeJsonLineFunction · 0.70

Tested by

no test coverage detected