Skip to content
YosoiDocs

Session

yosoi.surface.Session

class Session:

In-memory evidence session for an external live adapter.

Args: index: Initial immutable evidence. policy: Reader, history and event bounds, defaulting to one cursor.

Attaching declares that the adapter is observing its source. This class does not launch a browser, install a DOM observer or dispatch actions by itself.

Source: python/yosoi/surface.py:1363

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

def __init__(self, index: Surface, policy: SessionPolicy | None=None) -> None:

Create detached state with no action authority.

Source: python/yosoi/surface.py:1374

def cursor(self) -> Cursor:

Allocate a reader within policy; Rust rejects capacity exhaustion.

Source: python/yosoi/surface.py:1380

def attach(self) -> None:

Declare the external observer live, without promoting any cursor.

Source: python/yosoi/surface.py:1384

def detach(self) -> None:

Detach observation and revoke hot authority and pending leases.

Source: python/yosoi/surface.py:1388

def invalidate(self, reason: str) -> None:

Mark observation uncertain until an adapter publishes fresh evidence.

Source: python/yosoi/surface.py:1392

def publish(self, index: Surface) -> None:

Publish a new immutable capture, invalidating stale focused evidence.

Source: python/yosoi/surface.py:1396

def outcome(self) -> Outcome | None:

Snapshot retained evidence, or return None when archive policy is off.

Source: python/yosoi/surface.py:1400

def close(self) -> Outcome | None:

Close logical readers and return the final policy outcome.

This revokes authority and preserves pending effects as unknown. External provider cleanup remains caller-owned. Repeated calls return the same data.

Source: python/yosoi/surface.py:1405

@property
def current(self) -> Surface:

Return an immutable index safe to retain after subsequent publication.

Source: python/yosoi/surface.py:1415

@property
def hot_owner(self) -> int | None:

Return the single hot cursor identity, or None.

Source: python/yosoi/surface.py:1420