pub struct TranscriptReader;Expand description
Reads and reconstructs message history from JSONL transcript files.
Implementations§
Source§impl TranscriptReader
impl TranscriptReader
Sourcepub fn load(path: &Path) -> Result<Vec<Message>, SubAgentError>
pub fn load(path: &Path) -> Result<Vec<Message>, SubAgentError>
Load all messages from a JSONL transcript file.
Malformed lines are skipped with a warning. An empty or missing file
returns an empty Vec. If the file does not exist at all but a matching
.meta.json sidecar exists, returns SubAgentError::Transcript with a
clear message so the caller knows the data is gone rather than silently
degrading to a fresh start.
§Errors
Returns SubAgentError::Transcript on unrecoverable I/O failures, or
when the transcript file is missing but meta exists (data-loss guard).
Sourcepub fn load_meta(
dir: &Path,
agent_id: &str,
) -> Result<TranscriptMeta, SubAgentError>
pub fn load_meta( dir: &Path, agent_id: &str, ) -> Result<TranscriptMeta, SubAgentError>
Load the meta sidecar for an agent.
§Errors
Returns SubAgentError::NotFound if the file does not exist,
SubAgentError::Transcript on parse failure.
Sourcepub fn find_by_prefix(dir: &Path, prefix: &str) -> Result<String, SubAgentError>
pub fn find_by_prefix(dir: &Path, prefix: &str) -> Result<String, SubAgentError>
Find the full agent ID by scanning dir for .meta.json files whose names
start with prefix.
§Errors
Returns SubAgentError::NotFound if no match is found,
SubAgentError::AmbiguousId if multiple matches are found,
SubAgentError::Transcript on I/O failure.
Auto Trait Implementations§
impl Freeze for TranscriptReader
impl RefUnwindSafe for TranscriptReader
impl Send for TranscriptReader
impl Sync for TranscriptReader
impl Unpin for TranscriptReader
impl UnsafeUnpin for TranscriptReader
impl UnwindSafe for TranscriptReader
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request