Skip to main content

print_json_line

Function print_json_line 

Source
pub fn print_json_line<T: Serialize>(value: &T) -> Result<()>
Expand description

Compact JSON + LF on stdout (agent success / data path).

This is the single funnel every structured payload passes through, which is why agent-native shaping (crate::agent_shape) is applied here rather than at each of the fifteen call sites. Reducing before serialization is the whole point: shaping downstream with jaq would mean the oversized envelope was already built and written, so the tokens were already spent.

When no shaping flag was passed, crate::agent_shape::is_active short-circuits and the value is serialized directly — the default path pays no to_value round-trip.

§Errors

Serialization or stdout I/O (including BrokenPipe → exit 141).