pub struct AcpSessionStore { /* private fields */ }Implementations§
Source§impl AcpSessionStore
impl AcpSessionStore
pub fn new(workspace_dir: &Path) -> Result<Self>
Sourcepub fn create_session(
&self,
session_uuid: &str,
agent_alias: &str,
workspace_dir: &str,
) -> Result<i64>
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.
Sourcepub fn load_session(&self, session_uuid: &str) -> Result<Option<AcpSessionData>>
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.
Sourcepub fn load_session_for_restore(
&self,
session_uuid: &str,
) -> Result<AcpSessionRestore>
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.
Sourcepub fn list_sessions(&self) -> Result<Vec<AcpSessionSummary>>
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.
Sourcepub fn append_turn(
&self,
session_uuid: &str,
messages: &[ConversationMessage],
) -> Result<()>
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.
Sourcepub fn set_token_count(
&self,
session_uuid: &str,
token_count: u64,
) -> Result<()>
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.
Sourcepub fn append_event(
&self,
session_uuid: &str,
action: Action,
outcome: EventOutcome,
payload: Option<&str>,
) -> Result<()>
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.
Sourcepub fn delete_session(&self, session_uuid: &str) -> Result<bool>
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.
Sourcepub fn mark_session_killed(&self, session_uuid: &str) -> Result<bool>
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.
Sourcepub fn is_session_killed(&self, session_uuid: &str) -> Result<bool>
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.
Sourcepub fn touch_session(&self, session_uuid: &str) -> Result<()>
pub fn touch_session(&self, session_uuid: &str) -> Result<()>
Update last_activity without appending messages.