pub struct SessionState {
pub id: String,
pub created_at: String,
pub title: Option<String>,
pub runtime: Arc<Mutex<AgentRuntime>>,
pub plan_approval_gate: Arc<PlanApprovalGate>,
pub interrupt_token: Arc<Mutex<Option<CancellationToken>>>,
}Expand description
Internal session state (not directly serialized to clients).
The AgentRuntime owns the transcript; this struct adds HTTP-layer
metadata (id, created_at) and the broadcast channel for SSE clients.
Fields§
§id: String§created_at: String§title: Option<String>Optional human-readable title, settable via PATCH /sessions/:id.
runtime: Arc<Mutex<AgentRuntime>>Runtime is wrapped in a per-session Mutex so concurrent HTTP requests for the same session are serialized without blocking the global lock.
plan_approval_gate: Arc<PlanApprovalGate>Shared gate for plan-mode approval. Stored here so HTTP handlers can approve/reject without taking the runtime Mutex (which may be held by a running agent turn).
interrupt_token: Arc<Mutex<Option<CancellationToken>>>Goal-170: cancellation token for the currently running agent turn.
POST /sessions/:id/interrupt cancels this token, which causes
the kernel to exit with FinishReason::Cancelled at the next step
boundary. Replaced with a fresh token at the start of every turn.
Auto Trait Implementations§
impl !RefUnwindSafe for SessionState
impl !UnwindSafe for SessionState
impl Freeze for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl UnsafeUnpin for SessionState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more