pub struct StreamFacts {
pub requests: Vec<EconomicsRequest>,
pub models: Vec<EconomicsModelTotal>,
pub reported_cost_microusd: Option<u64>,
pub tools: BTreeMap<String, u64>,
pub orientation: EconomicsOrientation,
pub turns: Option<u64>,
pub ended: String,
pub is_error: bool,
pub tools_offered: Vec<String>,
pub mcp_servers: Vec<String>,
}Expand description
What read_stream recovers from one session’s transcript: the numeric and structural
parts of an EconomicsSession. The caller adds what the transcript does not know
(index, prompt digest, wall clock).
use majordomus_cli::economics::usage::{read_stream, StreamFacts};
let line = concat!(
r#"{"type":"assistant","message":{"id":"m1","model":"m","content":[],"#,
r#""usage":{"input_tokens":4,"output_tokens":1}}}"#,
);
let facts: StreamFacts = read_stream(line).unwrap();
assert_eq!(facts.requests[0].input_tokens, 4);
assert_eq!(facts.ended, "no_result", "no closing `result` event: the session never finished");
assert!(facts.is_error);Fields§
§requests: Vec<EconomicsRequest>Requests, deduplicated by message id, in first-seen order. An event that carries no message id is a request of its own: nothing says it repeats another.
models: Vec<EconomicsModelTotal>The harness’s per-model totals from its closing result event.
reported_cost_microusd: Option<u64>The harness’s total_cost_usd, in millionths of a dollar.
tools: BTreeMap<String, u64>Tool calls by name.
orientation: EconomicsOrientationOrientation before the first edit.
turns: Option<u64>Turns.
ended: StringHow the session ended.
is_error: boolWhether the harness reported an error.
tools_offered: Vec<String>Tools the harness offered, from its init event.
mcp_servers: Vec<String>MCP servers the harness connected, from its init event.
Trait Implementations§
Source§impl Clone for StreamFacts
impl Clone for StreamFacts
Source§fn clone(&self) -> StreamFacts
fn clone(&self) -> StreamFacts
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StreamFacts
impl Debug for StreamFacts
Source§impl Default for StreamFacts
impl Default for StreamFacts
Source§fn default() -> StreamFacts
fn default() -> StreamFacts
Returns the “default value” for a type. Read more
Source§impl PartialEq for StreamFacts
impl PartialEq for StreamFacts
Source§fn eq(&self, other: &StreamFacts) -> bool
fn eq(&self, other: &StreamFacts) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StreamFacts
Auto Trait Implementations§
impl Freeze for StreamFacts
impl RefUnwindSafe for StreamFacts
impl Send for StreamFacts
impl Sync for StreamFacts
impl Unpin for StreamFacts
impl UnsafeUnpin for StreamFacts
impl UnwindSafe for StreamFacts
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
Mutably borrows from an owned value. Read more