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
impl SessionWriter
Sourcepub fn create(
workflow_name: &str,
workflow_path: &str,
prompt: Option<&str>,
tier_count: usize,
) -> Result<Self, ZigError>
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.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
The session id (UUID) for this writer.
pub fn tier_started( &self, tier_index: usize, step_names: Vec<String>, ) -> Result<(), ZigError>
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>
pub fn step_output( &self, step_name: &str, stream: OutputStream, line: &str, ) -> Result<(), ZigError>
pub fn step_completed( &self, step_name: &str, exit_code: i32, duration_ms: u64, saved_vars: Vec<String>, ) -> Result<(), ZigError>
pub fn step_failed( &self, step_name: &str, exit_code: Option<i32>, attempt: u32, error: &str, ) -> Result<(), ZigError>
pub fn step_skipped( &self, step_name: &str, reason: &str, ) -> Result<(), ZigError>
pub fn heartbeat(&self) -> Result<(), ZigError>
Auto Trait Implementations§
impl !Freeze for SessionWriter
impl RefUnwindSafe for SessionWriter
impl Send for SessionWriter
impl Sync for SessionWriter
impl Unpin for SessionWriter
impl UnsafeUnpin for SessionWriter
impl UnwindSafe for SessionWriter
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
Mutably borrows from an owned value. Read more