Skip to main content

Module mail_agent

Module mail_agent 

Source
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 plan decides 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 name on this machine.
agent_of_session
The agent address is 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), through supercode 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 envelope unread in address’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 to to, when an agent’s mailbox decides it; None when it is ordinary mail to one session. Sets the envelope’s thread and in_reply_to where 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, which open resumes with the arguments it was launched with. Any other stopped session keeps its mail waiting.
resume
Resume the stopped session at address in 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 thread to holder: it becomes the thread’s to, and main cc. launched says 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. None when main is no agent’s main session or the line is main’s own.
set_owners_account_manager
Name name the 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 address holds 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 id under its lock, so two writers never lose each other’s participants, and return it as saved. create makes it when it is not kept yet.