Reads an agent's subagent events; create one with
Agent$observe_subagents(). $snapshot() returns the current state and
$poll() the events since the last read. Reading never affects the
subagents, and every read checks access again with the agent's
DelegationDisclosure. Event sequence numbers count across all of the
agent's subagents. A cursor marks a position; it doesn't grant access.
Methods
DelegationSubscription$new()
Create a subscription, usually through
Agent$observe_subagents().
Usage
DelegationSubscription$new(lead, requester, delegation_id = NULL, after = NULL)Arguments
leadThe
Agentor LeadAgent to follow.requesterWho is reading, passed to the disclosure functions. Authenticate it first.
delegation_idOptional delegation ID, to follow one subagent.
afterA cursor from this agent to resume from, or
NULLto start now. A cursor from another agent is an error.
DelegationSubscription$snapshot()
Get the subagents' current state and move the cursor to
now, so the next $poll() returns only later events.
DelegationSubscription$poll()
Get the events since the last read and advance the cursor.
Ranges of events dropped before you read them are listed in gaps;
call $snapshot() to catch up. When following one subagent, a gap may
only cover other subagents' events.