Arcana::Mail::Sessions
Session records and runners, as the dot-ai spec has them (Mail:
Runners, Session records; Draft 0.5 for registered runners), kept the
same way whichever program writes them, so each reads the others'.
Where Arcana is the carrier, its hooks keep a record of each session
(Hook), and delivery tells the newest open session of each project
it put mail into through that session's runner (tell_project).
Arcana never pushes into a session itself: its own tell says when a
session will hear at the end of its turn, and otherwise that it can't
push (own_tell). Pushing belongs to the runners.
Constants
A record ended (or whose harness went) this long ago may be removed.
What a runner's or a carrier's name may be: never a path or a command line.
How long a runner's tell may take before it's given up on.
Class methods
The runner of a session the hooks record: the program that started
it, by DOT_AI_BY; else Arcana, the hooks' carrier. There's no
default runner.
The harness's process, for Claude Code or Codex: the nearest
process above this one, within three, that is the harness's (a hook
runs under a shell it starts). For Codex, only under codex --no-daemon, whose TUI runs its app server itself; a hook its
daemon runs (codex app-server, which outlives its sessions) gets
none.
The records of the project at root's sessions, newest first.
Whether a record's session is still open: not ended, and its harness's process, where it names one, still there.
Arcana's own tell, for a session whose runner is Arcana: 3 when
there's no record or its session isn't open (marking it ended), 0
when it's busy (its Stop tells it), and 4 otherwise, since Arcana
never pushes.
The record at path as fields; empty when there's none.
Writes the session's record in state state. Its runner and
harness's process are found at its start and kept after.
The program of the runner name, as it registered it; nil where it
hasn't, or where its registration or its program fails the checks:
the folder and the file the person's, the line an absolute path to
an executable that's the person's (or root's), checked at what a
link leads to, and none of them writable by anyone else.
Where runners register: runners/NAME, a line holding the
runner's program's absolute path.
Tells the project at root, whose inbox mail has just reached: its
newest open session, through its runner, so two sessions don't both
answer the mail. Status 0: told, or will be at the end of its turn;
3: not open, so the next newest; 4: can't push, so the session hears
at its next start or Stop, from the hooks. Arcana's own sessions it
answers for itself (own_tell); others', through the program their
runner registered (runner_path). A record naming a runner that
hasn't registered, or whose registration fails the checks, is left
alone, as if it answered 4: its session has hooks, so it hears at
its Stop, and telling an older one as well would have two answer. A
runner that fails is named in a not told: line to io: the mail
was delivered all the same.