Constructs a CdpRemoteBrowserSession.
A PlaywrightBrowserAdapter already launched and attached to the backend's CDP endpoint.
The CDP connect endpoint URL the adapter is attached to.
The backend's capability flags (drives capability gating).
The driver-supplied backend hooks for live-view / native-AI / release.
Optional backend display name for capability-error messages.
ProtectedAdapterThe connected computer-use adapter, exposed to subclasses / backends that need raw perception
(GetVisibleText, GetAccessibilitySnapshot, QueryElement) beyond the Base session surface.
Protected: not part of the public IRemoteBrowserSession contract.
Captures a one-off screenshot of the current viewport.
The screenshot image, Base64-encoded.
Closes the session and releases the backend browser/container. Idempotent — safe to call once teardown has already begun.
A promise that resolves once the session is fully torn down.
Executes a single agent RemoteBrowserAction over CDP.
The action to perform; narrow on action.Kind.
The action result.
Returns the Chrome DevTools Protocol endpoint for this session — the one primitive every backend exposes and the engine's computer-use loop connects to.
The CDP websocket/connect endpoint URL.
Returns the browser's current URL synchronously (last known to the session).
The current page URL.
Returns an embeddable live-view URL so humans can watch the browser without MJ encoding frames.
Capability-gated by LiveView. Backends without it reject with import('./capability-errors').RemoteBrowserCapabilityNotSupportedError.
The live-view URL.
reads the live page's current selection via the adapter's GetSelectionText (which runs
window.getSelection().toString() in the page). Gated by HumanTakeover like RouteHumanInput —
copy-out is part of the human-control path. Best-effort: an adapter read failure is logged and mapped to
'' so a best-effort copy never throws past the gate (and a page with nothing selected yields '').
Delegates a high-level natural-language intent to the backend's own AI-control harness (e.g. Browserbase Stagehand) instead of MJ's computer-use loop.
Capability-gated by NativeAIControl. Backends without it reject.
The natural-language intent (e.g. 'log in with the test account').
The action result.
Navigates the browser to a URL. Convenience over IRemoteBrowserSession.ExecuteAction
with a navigate action.
The absolute URL to load.
The action result (success + resulting URL).
by contract (the Base signature returns void): the human-takeover input is
mapped to a computer-use action and dispatched on the adapter, but we do not await it. Any
rejection is logged and swallowed so a single dropped pointer/key event never tears down the
takeover stream.
Optionaloptions: RunComputerUseGoalOptionscomputer-use against THIS session's already-attached adapter (same instance the human watches —
no second CDP attach). Wires per-step progress + barge-in (options.Signal → engine Stop()), then
maps the rich ComputerUseResult onto the transport-neutral RemoteBrowserGoalResult.
by BACKEND IMPLEMENTATION (v1): if the driver's ICdpSessionBackend provides no
StartAudioCapture hook, this throws RemoteBrowserCapabilityNotSupportedError — the same
shape as a non-streaming backend rejecting StartScreencast. Otherwise it delegates to the
backend (handing it the connected adapter), retaining the returned handle for teardown. Idempotent:
a re-call while already streaming audio is a no-op.
Begins streaming encoded viewport frames to onFrame (the source for the channel's ScreenOut
track).
Capability-gated by ScreenStreaming. Backends without it reject.
Invoked with each encoded RemoteBrowserScreencastFrame.
A promise that resolves once the screencast has started.
by BACKEND IMPLEMENTATION (v1): throws RemoteBrowserCapabilityNotSupportedError on a
backend with no StartAudioCapture hook. Best-effort otherwise: stops the active capture (if any)
and clears the handle.
Stops a screencast previously started with IRemoteBrowserSession.StartScreencast.
Capability-gated by ScreenStreaming. Backends without it reject.
A promise that resolves once streaming has stopped.
StaticSetOverrides the computer-use goal-engine factory (the injection seam — production binds the MJ engine; tests inject a fake).
The factory that builds a goal engine per run.
The shared, CDP-backed live remote-browser session. Constructed by import('./base-cdp-remote-browser-provider').BaseCdpRemoteBrowserProvider.Connect with an already-launched (CDP-attached) PlaywrightBrowserAdapter, the CDP endpoint string, the backend's capability flags, and the driver's ICdpSessionBackend hooks.