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 pressed the turn on the provider’s leader. The node owns the accounts now,
so it runs that listener in-process, one thread per adopted account (mail4agent’s library:
open the account store, sync/push, new inbound letters). The store dedups by event and never
hands over the account’s own messages; each letter goes to a per-session queue whose one
worker pushes it into the live session through the leader (grok: ACP session/load +
session/prompt, gate4agent_wake::grok_leader), with the session id and cwd recorded at
adoption, so at most one push runs into a session at a time.
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. - is_
watched - Whether a listener of this account is currently wanted (started and not replaced).
- 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.
- load_
adoptions - restore
- Restarts the listeners of every saved adoption (node start). Returns how many started.
- restore_
from_ env - Node start: restore when the node has m4a accounts configured; says why not otherwise.
- 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 in-process mailbox listener of
a.