Skip to main content

CheckpointData

Struct CheckpointData 

Source
pub struct CheckpointData {
    pub session_id: SessionId,
    pub user_input: String,
    pub step: CheckpointStep,
    pub turn_count: u32,
    pub version: u32,
    pub backend: ActionFormat,
    pub migrated_from: Option<MigrationSource>,
    pub run_state: Option<RunState>,
}

Fields§

§session_id: SessionId§user_input: String§step: CheckpointStep§turn_count: u32§version: u32

Payload version (CHECKPOINT_VERSION on native writes; 0 for the pre-versioning corpus, which had no such field). Never backfilled.

§backend: ActionFormat

Backend affinity pin (OV-5+11): the action protocol this payload speaks. Absent on the wire means the pre-labeling tool-call corpus — the step shape itself is the evidence.

§migrated_from: Option<MigrationSource>

Source mark set when the payload was converted on read (T5 migration layer). Absent for natively written data.

§run_state: Option<RunState>

The counting evidence (D5+OV-11): co-written with the step in the one journal line, so the recorded batch and the counts can never disagree across a crash window. Native writes ALWAYS carry it (new stores Some); on the wire it is optional so the pre-T7 corpus (and converted legacy payloads) stay readable with the field genuinely absent — restores of those fall back to the old-format paths, never guessed (不猜不回填).

Implementations§

Source§

impl CheckpointData

Source

pub fn new( session_id: SessionId, user_input: impl Into<String>, step: CheckpointStep, turn_count: u32, backend: ActionFormat, run_state: RunState, ) -> Self

Native checkpoint of CHECKPOINT_VERSION, pinned to backend, with the counting state co-written (D5+OV-11 事务同写).

Source

pub fn verify_for_resume(&self, expected: ActionFormat) -> Result<(), String>

The T5 persistence contract, checked before resume: the checkpoint must speak the resuming backend’s protocol, and every action payload must carry a matching format label. Refusals spell out the mismatch.

Source

pub fn verify_for_resume_any( &self, accepted: &[ActionFormat], ) -> Result<(), String>

The same contract over the set of formats one runtime can resume (T10c): a session may interleave built-in tool-call turns with a mounted backend’s turns, so the pin check accepts every format the runtime is assembled with — and refuses a pin naming a backend it does not carry (“mount it to resume this session”), never a silent replay through the wrong protocol.

Trait Implementations§

Source§

impl Clone for CheckpointData

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CheckpointData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CheckpointData

CheckpointData is read through the T5 migration layer: native shapes first, then the pre-M3 shapes (converted, marked). Deserialize is manual so the version/backend/source-mark contract lives in one place — Serialize stays derived and always writes the native shape.

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CheckpointData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more