Skip to main content

read_new_lines

Function read_new_lines 

Source
pub fn read_new_lines(
    transcript: &Path,
    offset_path: &Path,
) -> Result<(Vec<Value>, i64, i64)>
Expand description

Read the lines appended to transcript since the offset stored in offset_path (0 when absent). Returns (lines, start_offset, end_offset) with the meaning of commands::stream::read_new_transcript_lines: start_offset goes on the request as transcript_offset, end_offset is the next read position.

Unlike that reader, it stops before a trailing line with no newline yet. A subagent running in the background appends to its file while the parent’s hooks fire, so a hook can catch a line half-written; counting it as read would skip the rest of that line for good. Offsets are exact byte counts.

A corrupt offset file is an error rather than a restart from 0: chunk indexes derive from the start offset, so re-reading from elsewhere would give the same lines new indexes and the server would store them twice.