pub struct TranscriptReader;Expand description
Reads and reconstructs message history from JSONL transcript files.
TranscriptReader is a zero-size marker type with only associated functions.
Use TranscriptReader::load to reconstruct a message history from a .jsonl file,
TranscriptReader::load_meta to read the companion .meta.json sidecar, and
TranscriptReader::find_by_prefix to resolve a short ID prefix to a full UUID.
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.