pub fn expand_reduction(
log: &ReductionLog,
minted_view: &[ChatMessage],
recorded: Option<&[ChatMessage]>,
id: &str,
byte_range: Option<(usize, usize)>,
) -> Result<ExpandOutcome>Expand description
Resolve the expand_reduction(reduction_id, byte_range?) agent intrinsic
(SPEC.md TR-1 dev/01): the exact original bytes behind reduction id in
log, resolved against minted_view (hash-verified) with recorded
preferred for cap-diverged content — see the module doc comment for the
two-source contract. With byte_range = Some((start, end)), just that
[start, end) slice (end clamped to total_bytes, char-boundary-safe).
Errors, all model-recoverable:
- unknown
id→ names every currently-valid id (mirrors C4’s/expanderror style); - reversed range (
start > end) orstartbeyond the original’s total bytes → names the expected[start, end)form and the truetotal_bytes, rather than ever silently returning empty or full content the caller didn’t ask for.