Skip to main content

SessionWriter

Struct SessionWriter 

Source
pub struct SessionWriter { /* private fields */ }
Expand description

Append-only writer for a single zig session log file.

Mirrors zag’s SessionLogWriter (zag-agent/src/session_log.rs:344). Every emit increments seq, stamps ts, serializes one JSON line, and flushes — so a tailer reading the file sees the event within one poll cycle.

Implementations§

Source§

impl SessionWriter

Source

pub fn create( workflow_name: &str, workflow_path: &str, prompt: Option<&str>, tier_count: usize, ) -> Result<Self, ZigError>

Create a new session: generate a UUID, ensure the project sessions dir, open the log file for append, emit ZigSessionStarted, and upsert both indexes.

Source

pub fn session_id(&self) -> &str

The session id (UUID) for this writer.

Source

pub fn log_path(&self) -> &Path

The on-disk log path.

Source

pub fn tier_started( &self, tier_index: usize, step_names: Vec<String>, ) -> Result<(), ZigError>

Source

pub fn step_started( &self, step_name: &str, tier_index: usize, zag_session_id: &str, zag_command: &str, model: Option<&str>, prompt_preview: &str, ) -> Result<(), ZigError>

Source

pub fn step_output( &self, step_name: &str, stream: OutputStream, line: &str, ) -> Result<(), ZigError>

Source

pub fn step_completed( &self, step_name: &str, exit_code: i32, duration_ms: u64, saved_vars: Vec<String>, ) -> Result<(), ZigError>

Source

pub fn step_failed( &self, step_name: &str, exit_code: Option<i32>, attempt: u32, error: &str, ) -> Result<(), ZigError>

Source

pub fn step_skipped( &self, step_name: &str, reason: &str, ) -> Result<(), ZigError>

Source

pub fn heartbeat(&self) -> Result<(), ZigError>

Source

pub fn ended( &self, status: SessionStatus, duration_ms: u64, ) -> Result<(), ZigError>

Emit ZigSessionEnded and stamp the indexes with ended_at/status.

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.

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> Same for T

Source§

type Output = T

Should always be Self
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.