small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo robot-docs sessions.md
21 kB · 301 lines
Markdown

# session attachment Session creation and user turn admission use durable [operation receipts](operations.md). An accepted submission survives a daemon restart while it waits for transcript consumption. A retry with the same operation ID returns the original admission. The CLI app package owns session ID resolution. Full lowercase UUIDv7 IDs address roots and children directly. Shortened IDs match only root sessions, with an exact match taking precedence over prefixes. A missing full ID returns the same no-match error as a missing prefix; resume never creates a replacement. Opening reads the root list and settings once, then captures the selected session once and adds a child to its initial list if needed. opening a session attaches the cli to its event stream and independently reads `GET /sessions/{session_id}?tail=0`. replayed history does not establish the session's live phase; status and live events do. an idle status is enough to enable the composer, including a persisted `interrupted` session after a daemon restart. a missing or unrecognized phase is display metadata, not a failed connection. before live status is known, enter preserves the draft; superseded status replies cannot unblock it. starting a new turn does not require `/compact` to change the old phase. ## Live status without a poll `GET /sessions/{session_id}?view=status` answers the live facts alone: `id`, `cursor`, `status`, `kernel`, `usage`, and `glances`. Its source is the session actor's own memory plus its kernel's port owner, never configuration, history, or a composition read; the one exception is a session whose sidebars no stream has published yet, where the handler observes the composition for that answer. Tail and replay parameters belong to the event stream and are refused here. Most of what that read covers also arrives on the stream, so a watching client needs no cadence of its own: - `kernel` carries `{"kernel": Kernel}`, the same object the session resource carries. `albedo_python` runs the closure the session register…