MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / waitFor

Function waitFor

packages/hosts/mcp/src/browser-approval-store.ts:42–58  ·  view source on GitHub ↗
(executionId: string)

Source from the content-addressed store, hash-verified

40 });
41
42 const waitFor = (executionId: string): Effect.Effect<BrowserApprovalDecision | null> =>
43 Effect.gen(function* () {
44 const existing = yield* take(executionId);
45 if (existing) return existing;
46
47 const waiter = waiters.get(executionId) ?? (yield* Deferred.make<BrowserApprovalDecision>());
48 waiters.set(executionId, waiter);
49 const decision = yield* Deferred.await(waiter).pipe(
50 Effect.ensuring(
51 Effect.sync(() => {
52 if (waiters.get(executionId) === waiter) waiters.delete(executionId);
53 }),
54 ),
55 );
56 yield* take(executionId);
57 return decision;
58 });
59
60 return {
61 store: { takeResponse: take, waitForResponse: waitFor },

Callers

nothing calls this directly

Calls 5

takeFunction · 0.85
getMethod · 0.65
setMethod · 0.65
syncMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected