Skip to content
YosoiDocs

SurfaceConnection

yosoi.surface.SurfaceConnection

class SurfaceConnection:

Shared lifecycle for a source-specific browser or video connection.

Use a source’s open factory, then await close or use async with. Cancellation stops waiting; it does not prove that a dispatched effect was undone.

Source: python/yosoi/surface.py:1112

Members below are declared on this class. Inherited Pydantic methods and generated constructor signatures are not expanded.

def __init__(self, handle: _native.BrowserSurface | _native.VideoSession) -> None:

Wrap a native source connection; prefer its asynchronous factory.

Source: python/yosoi/surface.py:1119

async def __aenter__(self) -> Self:

Keep source resources alive until context cleanup.

Source: python/yosoi/surface.py:1123

async def __aexit__(self, *_: object) -> None:

Await source cleanup even when the context body raises.

Source: python/yosoi/surface.py:1127

async def ready(self) -> dict[str, object]:

Return capabilities and bounded initial evidence without granting control.

Source: python/yosoi/surface.py:1131

async def execute(self, command: Mapping[str, object]) -> dict[str, object]:

Execute one bounded Surface command through the source implementation.

Use serialized references from current evidence. Browser effects require live attachment, hot ownership and eligibility. An error can follow a dispatched effect; inspect retained evidence before retrying.

Source: python/yosoi/surface.py:1135

async def outcome(self) -> Outcome | None:

Snapshot retained evidence, including partial attempts, when enabled.

Source: python/yosoi/surface.py:1144

async def close(self) -> Outcome | None:

Await source cleanup and final retention; repeated calls are harmless.

Retained certainty and gaps remain available through outcome on failure.

Source: python/yosoi/surface.py:1149