pub struct TurnLedger {Show 18 fields
pub turn_id: u64,
pub seq: u64,
pub origin: Option<TurnOrigin>,
pub trigger: Option<TurnTrigger>,
pub absorbed: Vec<TurnTrigger>,
pub started_at_ms: u64,
pub passes: u32,
pub active: bool,
pub inputs: u32,
pub counted_passes: u32,
pub output_tokens: u64,
pub cost_usd: f64,
pub steps: u32,
pub duration_api_ms: u64,
pub last_pass_ended_at_ms: Option<u64>,
pub settle_until_ms: Option<u64>,
pub ended_at_ms: Option<u64>,
pub end: Option<TurnEnd>,
}Expand description
The turn as the user sees it: from leaving idle to returning to it with
nothing queued, over however many CLI passes that took (turn-model spec
§3.1, §4.3). Published as agentturn on every change; the pane’s parser is
typed against the generated frontend/types/rpc/TurnLedger.ts.
Fields§
§turn_id: u64Unique per block: the start time in ms, bumped past the previous id.
seq: u64Bumped on every change, under the tracker’s lock. Publishes run after
the lock is released, so two can land out of order; the pane keeps the
highest seq (#4492).
origin: Option<TurnOrigin>What started the turn; None when its first pass was unlabelled.
trigger: Option<TurnTrigger>The same, for display: what kind of thing, and who.
absorbed: Vec<TurnTrigger>The labelled inputs that arrived after the turn started, in order,
up to ABSORBED_CAP.
started_at_ms: u64§passes: u32CLI passes so far, the running one included.
active: boolA pass is running now.
inputs: u32Inputs that arrived after the turn started (mid-pass, or starting a pass that joined).
counted_passes: u32Passes whose result figures are in the sums below. The pane adds
its live count for the running pass only while that pass isn’t
counted yet, so a pass is never counted twice.
output_tokens: u64Summed over the counted passes’ result frames.
cost_usd: f64§steps: u32Model calls (result.num_turns, which counts steps, not turns).
duration_api_ms: u64§last_pass_ended_at_ms: Option<u64>§settle_until_ms: Option<u64>Between passes, while a next pass is expected: the turn is over if none starts by then.
ended_at_ms: Option<u64>§end: Option<TurnEnd>Implementations§
Source§impl TurnLedger
impl TurnLedger
fn absorb(&mut self, trigger: Option<TurnTrigger>)
fn add_stats(&mut self, stats: PassStats)
Sourcefn settling_at(&self, now: u64) -> bool
fn settling_at(&self, now: u64) -> bool
Whether a pass starting at now may still join this turn as a
continuation: no pass running, not ended, and inside the settle window.
Sourcefn ended_at(&self, now: u64) -> Option<u64>
fn ended_at(&self, now: u64) -> Option<u64>
When the turn ended: its recorded end, or its last pass’s end once
it is done settling with no next pass (nothing writes the end then).
None while a pass runs or a next one is expected.
Sourcefn close_if_lapsed(&mut self, now: u64)
fn close_if_lapsed(&mut self, now: u64)
Record the end of a turn that is over by ended_at but has no end
written yet: one whose settle window ran out.
Trait Implementations§
Source§impl Clone for TurnLedger
impl Clone for TurnLedger
Source§fn clone(&self) -> TurnLedger
fn clone(&self) -> TurnLedger
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TurnLedger
impl Debug for TurnLedger
Source§impl PartialEq for TurnLedger
impl PartialEq for TurnLedger
Source§impl Serialize for TurnLedger
impl Serialize for TurnLedger
impl StructuralPartialEq for TurnLedger
Source§impl TS for TurnLedger
impl TS for TurnLedger
Source§type WithoutGenerics = TurnLedger
type WithoutGenerics = TurnLedger
WithoutGenerics should just be Self.
If the type does have generic parameters, then all generic parameters must be replaced with
a dummy type, e.g ts_rs::Dummy or (). The only requirement for these dummy types is that
EXPORT_TO must be None. Read moreSource§type OptionInnerType = TurnLedger
type OptionInnerType = TurnLedger
std::option::Option<T>, then this associated type is set to T.
All other implementations of TS should set this type to Self instead.Source§fn docs() -> Option<String>
fn docs() -> Option<String>
TS is derived, docs are
automatically read from your doc comments or #[doc = ".."] attributesSource§fn decl_concrete(cfg: &Config) -> String
fn decl_concrete(cfg: &Config) -> String
TS::decl().
If this type is not generic, then this function is equivalent to TS::decl().Source§fn decl(cfg: &Config) -> String
fn decl(cfg: &Config) -> String
type User = { user_id: number, ... }.
This function will panic if the type has no declaration. Read moreSource§fn inline(cfg: &Config) -> String
fn inline(cfg: &Config) -> String
{ user_id: number }.
This function will panic if the type cannot be inlined.Source§fn inline_flattened(cfg: &Config) -> String
fn inline_flattened(cfg: &Config) -> String
Source§fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_generics(v: &mut impl TypeVisitor)where
Self: 'static,
Source§fn output_path() -> Option<PathBuf>
fn output_path() -> Option<PathBuf>
T should be exported, relative to the output directory.
The returned path does not include any base directory. Read moreSource§fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
fn visit_dependencies(v: &mut impl TypeVisitor)where
Self: 'static,
§fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
fn dependencies(cfg: &Config) -> Vec<Dependency>where
Self: 'static,
§fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export_all]. Read more§fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
fn export_all(cfg: &Config) -> Result<(), ExportError>where
Self: 'static,
TS::export]. Read moreAuto Trait Implementations§
impl Freeze for TurnLedger
impl RefUnwindSafe for TurnLedger
impl Send for TurnLedger
impl Sync for TurnLedger
impl Unpin for TurnLedger
impl UnsafeUnpin for TurnLedger
impl UnwindSafe for TurnLedger
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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