Expand description
Letter wake for live sessions the node adopted (/m4a/adopt).
The old standalone mailbox daemon woke a session itself: its listener held the account’s push socket and, on a letter, pressed the turn on the provider’s leader. The node owns the accounts now, so it runs that listener itself, one per adopted account:
- child:
m4a-agent node-clientwith the account’s own store (no capability: the listener only receives and serves the account’s local send socket), supervised and restarted by the node; - on a letter, m4a runs its letter hook (
M4A_LETTER_HOOK), which is this binary in hook mode (hook_main): it reads the letter from stdin, starts a detached pusher and exits at once (m4a gives a hook 10 s); - the pusher sends the framed letter into the live session through the provider’s leader
(grok: ACP
session/load+session/prompt,gate4agent_wake::grok_leader), with the provider session id and working directory recorded at adoption.
Adoptions persist in <accounts root>/adopted.json (no secret: provider, session id, cwd,
nick, account ref, store root), so a node restart restarts the listeners. Nothing here embeds
a host, key or name.
Structs§
- Adoption
- One adopted live session.
Constants§
Functions§
- grok_
session_ cwd - Working directory of a grok session from the provider’s own index (
active_sessions.jsonrows{"session_id","cwd"}), falling back to the session file’scwdfield. - hook_
main - Hook / pusher entry.
None: this process is the ordinary node.Some(code): exit with it. - leader_
for - Leader endpoint of
provider(grok only for now). - letter_
prompt - The prompt a woken session gets: headers, how to answer, then the letter verbatim.
- listener_
env - Environment of the listener child for one adoption.
- load_
adoptions - restore
- Restarts the listeners of every saved adoption (node start).
- save_
adoption - Inserts or replaces the adoption of
(provider, session). - sole_
adoption - The provider session an attach with no session of its own belongs to: the only adoption of
that provider. Several adoptions are ambiguous (
None). - watch
- Starts (or restarts) the listener of
a, and the supervisor thread on first use.