Skip to main content

AcpSessionStore

Struct AcpSessionStore 

Source
pub struct AcpSessionStore { /* private fields */ }

Implementations§

Source§

impl AcpSessionStore

Source

pub fn new(workspace_dir: &Path) -> Result<Self>

Source

pub fn create_session( &self, session_uuid: &str, agent_alias: &str, workspace_dir: &str, ) -> Result<i64>

Record a new session. Returns the integer id assigned by SQLite.

Source

pub fn load_session(&self, session_uuid: &str) -> Result<Option<AcpSessionData>>

Load session metadata and full message history for restore. Returns None if the session_uuid is not found.

Source

pub fn load_session_for_restore( &self, session_uuid: &str, ) -> Result<AcpSessionRestore>

Load only durable ACP rows that are allowed to become live sessions. Killed rows keep their transcript for history/export but are terminal for runtime restore paths.

Source

pub fn list_sessions(&self) -> Result<Vec<AcpSessionSummary>>

List all sessions as lightweight summaries, ordered by most recent activity first. This is the picker-facing read: it avoids the full message-history hydration that load_session performs.

Source

pub fn append_turn( &self, session_uuid: &str, messages: &[ConversationMessage], ) -> Result<()>

Append all ConversationMessages from one completed turn, decomposing AssistantToolCalls / ToolResults variants into the appropriate tables. Single transaction.

Source

pub fn set_token_count( &self, session_uuid: &str, token_count: u64, ) -> Result<()>

Overwrite the session’s token_count. Called after every turn with the latest provider-reported input_tokens.

Returns an error if session_uuid does not exist — a silent zero-row UPDATE would mask a race where the session was deleted out from under us, which the caller almost certainly wants to log.

Source

pub fn append_event( &self, session_uuid: &str, action: Action, outcome: EventOutcome, payload: Option<&str>, ) -> Result<()>

Record a session-lifecycle event. Caller passes typed enums; the SQLite layer is the only place strings appear. Same Action / EventOutcome values are used at the matching zeroclaw_log::record! call site.

Source

pub fn delete_session(&self, session_uuid: &str) -> Result<bool>

Delete a session and all its child rows (messages, tool calls, events cascade via FK). Returns true if the session existed.

Source

pub fn mark_session_killed(&self, session_uuid: &str) -> Result<bool>

Persist that an admin intentionally killed this ACP session. The transcript stays durable, but runtime rehydration must not revive it.

Source

pub fn is_session_killed(&self, session_uuid: &str) -> Result<bool>

Return whether this durable ACP session has been intentionally killed. Missing rows are not killed; callers can then use normal load handling to distinguish SESSION_NOT_FOUND from a terminal killed session.

Source

pub fn touch_session(&self, session_uuid: &str) -> Result<()>

Update last_activity without appending messages.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more