pub struct TranscriptWriter { /* private fields */ }Implementations§
Source§impl TranscriptWriter
impl TranscriptWriter
pub fn new(root: impl Into<PathBuf>, agent_id: impl Into<String>) -> Self
Sourcepub fn with_tenant_id(self, tenant_id: Option<String>) -> Self
pub fn with_tenant_id(self, tenant_id: Option<String>) -> Self
Tag the writer with its owning tenant so
every emitted TranscriptAppended event carries tenant_id.
Boot wire reads agent.tenant_id and threads it through.
None is the legacy / single-tenant case (default).
Sourcepub fn with_extras(
root: impl Into<PathBuf>,
agent_id: impl Into<String>,
redactor: Arc<Redactor>,
index: Option<Arc<TranscriptsIndex>>,
) -> Self
pub fn with_extras( root: impl Into<PathBuf>, agent_id: impl Into<String>, redactor: Arc<Redactor>, index: Option<Arc<TranscriptsIndex>>, ) -> Self
Wrap the writer with a redactor and/or FTS index. Both are
optional — Redactor::disabled() and None reproduce the
behavior of Self::new.
Sourcepub fn with_emitter(self, emitter: Arc<dyn AgentEventEmitter>) -> Self
pub fn with_emitter(self, emitter: Arc<dyn AgentEventEmitter>) -> Self
Install a firehose emitter. Replaces the
default NoopAgentEventEmitter. Call AFTER with_extras
(or use the standalone factory from boot wiring).
pub fn root(&self) -> &Path
Sourcepub fn agent_id(&self) -> &str
pub fn agent_id(&self) -> &str
Owning agent id this writer was
pinned to at construction. The
TranscriptWriterAppender adapter (in nexo-setup)
uses it for a defense-in-depth check that operator
stamps cannot cross into a different agent’s
transcript via the shared writer instance.
Sourcepub async fn append_entry(
&self,
session_id: Uuid,
entry: TranscriptEntry,
) -> Result<()>
pub async fn append_entry( &self, session_id: Uuid, entry: TranscriptEntry, ) -> Result<()>
Append one entry to the session transcript. Writes a header first if
the file doesn’t exist yet. When a redactor is active, the entry’s
content is rewritten before any persistence path sees it. When an
FTS index is wired, the (possibly redacted) content is also inserted
best-effort — JSONL stays the source of truth.
Sourcepub async fn read_session(
&self,
session_id: Uuid,
) -> Result<Vec<TranscriptLine>>
pub async fn read_session( &self, session_id: Uuid, ) -> Result<Vec<TranscriptLine>>
Read every line of a session transcript back into memory. Unknown lines are skipped so the reader is forward-compatible with future line variants.
Auto Trait Implementations§
impl !RefUnwindSafe for TranscriptWriter
impl !UnwindSafe for TranscriptWriter
impl Freeze for TranscriptWriter
impl Send for TranscriptWriter
impl Sync for TranscriptWriter
impl Unpin for TranscriptWriter
impl UnsafeUnpin for TranscriptWriter
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more