write_text_stream() in the new stream.rs doesn't touch anything specific
to write_report (topic, findings, the agent) — it just drains a
MultiTurnStreamItem stream, writes each text chunk to a caller-provided
writer, and returns the accumulated string. Pulling it out lets it be
covered by unit tests against a mocked stream and an in-memory writer,
independent of a live model.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
No destructuring needed since only .text is used; matching the whole
Text struct and drops the now-unused rig::message::Text import.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
print!/println! each acquire stdout's lock internally; doing that per
streamed chunk in a tight loop adds needless contention. Lock once up
front and write!/writeln! through the held handle instead — which also
means the trailing newline must go through that same handle rather than
println!, since re-locking from the same thread would deadlock.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
print! already locks stdout per call, so the manual lock()/write!() was
extra ceremony over what the flush actually needed. Matches rig's own
cli_chatbot streaming example more closely.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Wires up starter.rs -> core.rs (CLI parsing and observability init moved
into core, main.rs left as a thin entry point) and switches the report
phase from Agent::prompt to rig's stream_prompt, printing each text
delta to stdout as it arrives instead of waiting for the full response.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>