surfaces¶
The closed catalog and its renderers.
coalitionkit_surfaces ¶
Surfaces: AG-UI 1.0 feed and agent sessions and validated A2UI v0.9 trees.
AgentSession ¶
Interrupts and agent text for one viewer. Answers become owner-signed decisions.
ConsentError ¶
Bases: Exception
A consent answer was refused. code is stable; detail is safe to show.
Composed
dataclass
¶
A surface's three messages (createSurface first) and whether they are the fallback.
FeedSession ¶
Frames for one connected viewer. Pure state machine: the caller supplies time and wakes.
start ¶
A new run with a fresh snapshot. Connecting, reconnecting and rotating all call this.
changed ¶
Call after a bus wake. A delta only when this viewer's own projection changed.
room_delta ¶
Patch only the room key of the last state sent, without reading the host.
is_stale ¶
Something outside the log changed this viewer's extra state (the room engine's step).
fail ¶
End the run with RUN_ERROR. The renderer keeps its last good surface and reconnects.
publish_surface ¶
publish_surface(
surface_id: str,
components: list[Document],
data_model: Any = None,
known_events: Collection[str] | None = None,
) -> bool
Queue a composed surface. Returns False when it failed validation and the fallback layout was queued instead. Callers pass content already limited to this viewer.
KeepAlive
dataclass
¶
An SSE comment line. It carries no data and exists only to hold the connection open.
SurfaceHub ¶
refused ¶
Keep only safe refusal metadata, never the refused payload or error detail.
view_as ¶
Compose only values present in both projections; never merge their scopes.
say ¶
Deliver only to this viewer, independently on the feed and legacy agent channel.
stream
async
¶
SSE text for one connection. Subscribes before the first snapshot so nothing is lost.
OwnerSigner ¶
Bases: Protocol
Turns a person's yes or no into a signed coalition.decide envelope.
subject is {kind, id, revision}. choice is the value the decision names (the
subject id for every kind except tension_option). The returned envelope must be signed
by the agent key and carry a consent_sig made with the OWNER key. The surface verifies
that before it sends anything.
ViewerAuth ¶
Bases: Protocol
Maps a bearer token to the participant it speaks for, or None.
bound_number ¶
A number tied to the event it came from: the only form of a number the catalog accepts.
fallback_components ¶
The fixed layout shown when a composed tree fails validation.
open_requests ¶
Pending consent rows of this decider on the host ledger, for the current revision only.
load_catalog ¶
Read the typed catalog: {catalogId, components: {Name: {props: {p: {type, ...}}}}}.
Every prop has a type from PROP_TYPES, an optional required flag and, for
enum, its values. Props of type child and children hold component ids.
validate_components ¶
validate_components(
catalog: Catalog,
components: Any,
known_events: Collection[str] | None = None,
) -> list[str]
Every reason the tree must not be sent. An empty list means it passes.
apply_patch ¶
Apply a patch to a copy of document; used by renderers' tests and the property test.
json_patch ¶
An RFC 6902 patch that turns previous into current (empty when equal).