Skip to content

ViewPolicy

autogen.beta.network.views.base.ViewPolicy #

Bases: Protocol

Per-participant projection.

Implementations must be deterministic functions of the input WAL slice — calling project twice with the same input must produce the same events.

name instance-attribute #

name

project async #

project(wal, *, participant_id, channel, render_envelope, name_for=default_name_resolver)

Convert the WAL slice this participant should see into model events.

render_envelope is provided by the channel's adapter so the view stays adapter-neutral. name_for resolves an agent_id to its human-facing Passport.name for views that want to label projection lines with the sender — built-in views that don't label simply ignore it.

Source code in autogen/beta/network/views/base.py
async def project(
    self,
    wal: list[Envelope],
    *,
    participant_id: str,
    channel: ChannelMetadata,
    render_envelope: EnvelopeRenderer,
    name_for: NameResolver = default_name_resolver,
) -> list[BaseEvent]:
    """Convert the WAL slice this participant should see into model
    events.

    ``render_envelope`` is provided by the channel's adapter so the
    view stays adapter-neutral. ``name_for`` resolves an
    ``agent_id`` to its human-facing ``Passport.name`` for views
    that want to label projection lines with the sender — built-in
    views that don't label simply ignore it.
    """
    ...