Expand description
SessionActor — owns THE Runtime + ConversationState for one
conversation and runs its turn machine (PLAN-phase2 §2.5).
Every method body is moved from an existing reactor site (TUI
dispatch.rs Abort/Submit/StreamingInput, stream_handler.rs
event-queue + stream arms, tui/mod.rs teardown, cmd/chat.rs
post-turn); the presentation halves stay client-side and are fed by
the envelopes this actor emits. Each StreamEvent is forwarded to
clients BEFORE the actor acts on it, so a client sees the same order it
sees today.
Invariants:
Runtime::clone()resets TTL latches. The actor clones it only for driver stream-start (Prepared→Started) and compaction. The stream-start clone shares the original’s TTL atomics viashare_ttl_latchesso a redundant 1h→5m downgrade notice per driver turn is avoided. The compaction clone is read-only+discarded and needs no sharing.emitis the ONLYseqincrement site.Detachnever touchesstream/cancel; onlyEnd(andCancel) stop a turn.
Structs§
- Session
Actor - Session
Task - The tokio task.
SessionTask::runis the reactor loop.
Constants§
Functions§
- idle_
end_ grace SYNAPS_DAEMON_IDLE_END_GRACE_SECS: how long a ZERO-turn session with no clients lingers before it ends (F18). Default 5 s — long enough for a client that disconnected mid-reconnect, short enough that open-and-close does not pin a Runtime for a minute.- park_
grace SYNAPS_DAEMON_PARK_GRACE_SECS:never→None(Parked disabled);n→ n seconds after the last detach once idle; default 60.- parked_
evict_ after SYNAPS_DAEMON_PARKED_EVICT_SECS: how long a PARKED session stays in the daemon’s map before it is evicted (EndReason::Evicted). Its state is on disk;--continue <id>rebuilds it exactly as after a daemon restart. The row only exists so--attach <id>/ the adopt banner can find it quickly. Default 1 h;never→ keep forever.- prompt_
abandon_ timeout SYNAPS_DAEMON_PROMPT_ABANDON_SECS: how long a pending host confirmation on a NON-driver session survives after the LAST client detaches before it is fail-closed answeredNone(deny) socan_park()can proceed. This bounds the resource pin from an ABANDONED prompt WITHOUT punishing a transient disconnect (SSH drop, sleep, wifi): a re-attach before expiry cancels it and the user answers the prompt normally. Default 1 h — generous enough that a human coming back from lunch still answers;never/0/off→None= disabled = pure pre-#112 behaviour (a prompt survives detach forever).
Type Aliases§
- Active
Stream - The in-flight response stream (tui/stream_handler.rs
ActiveStream).