Skip to Content

Yield to User

yieldToUser hands control to the user and waits for specific conditions to be met.

How it works

When the worker needs the user to interact (e.g., log in, complete 2FA), it sends a worker.yield_to_user message with conditions. The session actor:

  1. Sends server.set_interactive to the client (shows the webview, hides the automation overlay)
  2. Evaluates conditions against the telemetry event stream
  3. When conditions match, sends server.command_result to the worker and server.set_interactive { interactive: false } to the client

Condition types

URL matching

Wait for the user to navigate to a URL matching a regex pattern:

{ "type": "url", "pattern": "https://example\\.com/dashboard.*" }

Network request matching

Wait for a specific network response:

{ "type": "networkRequest", "urlPattern": "https://api\\.example\\.com/token", "method": "POST" }

Selector (planned)

Wait for a DOM element to appear. Not yet implemented — requires client-side observation.

Optional yields

With optional: true and a timeout, the yield returns { matched: false } on timeout instead of failing the session.

Immediate resolution

The session actor checks existing events when the yield arrives. If conditions are already met, it resolves immediately without waiting.

Next steps

Last updated on