pub struct SessionPersistenceSink { /* private fields */ }Expand description
An EventSink that persists every AgentEvent::MessageAppended event
to the session transcript file.
Wraps an Arc<Mutex<SessionWriter>> and calls
SessionWriter::append on every MessageAppended event. All other
event variants are silently ignored.
Persistence failures are non-fatal for the agent run but are logged at
error level because a missing line on disk would silently break
downstream orphan detection (g153).
§Locking notes
SessionWriter is not Send across .await points, so we keep the
mutex non-async (std::sync::Mutex). The critical section inside
emit is purely synchronous I/O — one serde_json::to_string +
write_all + flush per message — matching every other consumer of
Arc<Mutex<SessionWriter>> in the codebase.
Implementations§
Source§impl SessionPersistenceSink
impl SessionPersistenceSink
Sourcepub fn new(writer: Arc<Mutex<SessionWriter>>) -> Self
pub fn new(writer: Arc<Mutex<SessionWriter>>) -> Self
Create a new SessionPersistenceSink backed by the given writer.