Record-count offset arithmetic for the inline (fileless) path, mirroring the
byte-offset semantics of read_new_transcript_lines: returns
(send_offset, next_offset) where send_offset is stamped on the request as
transcript_offset (base for the server’s per-line chunk_index) and
next_offset is persisted to .stream_offset.
Derive the event-level tool-error flag from inline transcript records.
OpenCode tool events carry no tool_use_id, so extract_is_error_from_transcript
can’t run; instead the plugin forwards a toolResult record whose isError
signals the outcome. Returns Some(true|false) for the first toolResult
record found, or None when there is none (non-tool events).
Returns (lines, start_offset, end_offset): start_offset is the seek
position read from offset_path (0 if absent), and end_offset is the
byte offset after the last line read (the old bytes_read).
Choose the transcript source for a stream event. Inline records (from a
plugin-based agent like OpenCode) win over the file-read result whenever the
hook event carries them — INCLUDING an empty vec, so an event with no new
records (e.g. OpenCode stop) preserves the prior record-count offset
instead of resetting it to the file-path’s 0.