Expand description
An agent’s one mailbox, its threads and their participants (docs/adr/0008-agent-mailbox.md).
An agent is addressed sc:<machine>:agent:<name>. Its record names its main
session; a root addressed to it goes there. A thread is a root and its
replies, with a participant list: the session holding it, main (CC once the
thread is delegated), and whoever else wrote in it. Every message in a
thread is filed in each participant’s mailbox but its sender’s: a to
participant through its door, woken; a cc participant filed unread, not
woken. plan decides who receives one message; the senders
(mail_send, sessions.message) deliver it.
Structs§
- Agent
- One agent, as the mailbox needs it.
- Channel
- What a channel says about one of its lines: the platform’s ids, which the mailbox maps to its own.
- Participant
- One participant of a thread.
- Plan
- Who receives one message, as
plandecides it. - Recipient
- One receiver of a message.
- Thread
- A root and its replies.
Enums§
- Role
- A participant’s part in a thread.
Constants§
- AGENT_
HARNESS - The pseudo-harness of an agent address.
- RESUME_
WAIT - How long a send waits for a resumed session to be reachable again.
- SESSION_
THREAD_ PREFIX - Prefix of a thread that has no root message: a session someone started directly in an agent’s folder.
Functions§
- agent_
address - The address of the agent
nameon this machine. - agent_
of_ session - The agent
addressis a session of (its main, or a thread’s holder). - all_
agents - Every declared agent.
- all_
threads - Every thread the mailbox keeps, oldest first.
- close_
idle_ threads - End the process of every thread session the mailbox launched that has been
idle longer than its agent’s
idle_minutes(decision 9), throughsupercode close. Its transcript stays; the next reply in its thread resumes it. - copy_
typed_ lines - Copy each line a person typed into an agent’s session, since the last pass, to whoever is CC on it: a delegated thread’s holder’s lines to the thread’s CC participants (decision 11), and every agent session’s lines to the owner’s account manager (decision 17), filed unread and not woken. A session seen for the first time starts from now, so its history is not copied.
- declare
- Record
agent, replacing an earlier record of the same name. - delegate_
to - file_
unread - File
envelopeunread inaddress’s mailbox without waking it. - load
- The agent named
name, when one is declared. - owners_
account_ manager - The owner’s account manager, when one is named and declared.
- plan
- Who receives
envelope, sent toto, when an agent’s mailbox decides it;Nonewhen it is ordinary mail to one session. Sets the envelope’sthreadandin_reply_towhere the mailbox knows them better than the sender: a channel names its parent by its platform id. - register_
folder_ sessions - Register as a thread every running session started directly in an agent’s
folder that is neither its main session nor a thread’s holder: its terminal
is a thread (
s-<session id>), with main CC. - resumable
- Whether mail may resume the stopped session at
address: only a thread’s holder the mailbox launched itself, whichopenresumes with the arguments it was launched with. Any other stopped session keeps its mail waiting. - resume
- Resume the stopped session at
addressin a daemon pane, with its harness’s own resume (supercode open <session> --detach -- <its recorded mode>): never open’s unattended defaults. - root_
of_ main - Hand
threadtoholder: it becomes the thread’sto, and maincc.launchedsays the mailbox is starting the holder itself. A line that reached an agent’s main session through its own input (its terminal, or its DM in a Room: a channel’s turn into that session) is a root of the agent (RFC 0020 decision 11, “every line is a root”): its thread, held by main, with its sender, opened when main first acts on it.Nonewhenmainis no agent’s main session or the line is main’s own. - set_
owners_ account_ manager - Name
namethe owner’s account manager: every line the owner writes to any agent is filed in its main session’s mailbox as CC. - thread
- The thread
id, when the mailbox keeps one. - thread_
held_ by - The thread
addressholds for an agent other than as its main session: a delegated session holds exactly one (its side conversations aside). - thread_
of_ marker - The thread whose channel message has the platform id
marker. - threads_
of - The threads of the agent
name, oldest first. - update_
thread - Change the thread
idunder its lock, so two writers never lose each other’s participants, and return it as saved.createmakes it when it is not kept yet.