pub struct RunReport {
pub agent: String,
pub task: String,
pub diff: String,
pub transcript: Vec<TurnRecord>,
pub usage: TokenUsage,
pub cost_usd: Option<f64>,
pub exit: ExitCode,
}Expand description
The full result of a run-task invocation, ready to render.
Why: One source of truth for both output forms keeps the human and JSON
reports in lockstep and makes the success path trivially testable.
What: agent is the top-level (PM) agent name; task is the request; diff
is the captured working-tree change; transcript is the ordered PM+engineer
turns; usage is the aggregated token usage; cost_usd is the summed cost;
exit is the computed outcome.
Test: run_task::tests::report_renders_json and report_renders_human.
Fields§
§agent: StringTop-level agent name (the PM).
task: StringThe task description that was run.
diff: StringCaptured working-tree diff (empty when nothing changed).
transcript: Vec<TurnRecord>Ordered transcript of every PM and engineer turn.
usage: TokenUsageAggregated token usage across the whole run.
cost_usd: Option<f64>Summed USD cost across the whole run (None when pricing is unavailable).
exit: ExitCodeComputed process exit outcome.
Implementations§
Source§impl RunReport
impl RunReport
Sourcepub fn render_json(&self) -> String
pub fn render_json(&self) -> String
Render the report as a single machine-readable JSON document.
Why: --json mode requires clean, parseable stdout; this is the only thing
printed in that mode.
What: Serialises all fields into a stable JSON object, including a status
string derived from exit, a cost_usd that is null when pricing is
unavailable, and (#2823) a build object naming the binary that produced
the run. Pretty-printed for readability without affecting parseability.
Test: run_task::tests::report_renders_json,
report::tests::report_json_carries_build_provenance.
Sourcepub fn render_human(&self) -> String
pub fn render_human(&self) -> String
Render the report as a human-readable summary.
Why: On a normal terminal the operator wants a scannable summary, not raw
JSON. The diff is shown verbatim; the transcript is condensed to one line
per turn; usage and cost are a footer.
What: Builds a multi-section string: a header (including the #2823 build
stamp, so a pasted terminal summary is as attributable as the JSON form),
the transcript (role, model, truncated text, tool calls), the diff (or
“no changes”), and a usage/cost footer.
Test: run_task::tests::report_renders_human,
report::tests::report_human_carries_build_provenance.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RunReport
impl RefUnwindSafe for RunReport
impl Send for RunReport
impl Sync for RunReport
impl Unpin for RunReport
impl UnsafeUnpin for RunReport
impl UnwindSafe for RunReport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more