Skip to main content

ReductionKind

Enum ReductionKind 

Source
pub enum ReductionKind {
    ToolOutputTruncated {
        original_bytes: usize,
        kept_bytes: usize,
    },
    FileReadElided {
        path: PathBuf,
        read_log: ReadLogEntry,
    },
    ImageRedacted {
        part_index: usize,
    },
    TurnsCleared {
        first: usize,
        last: usize,
        summary: Option<SpanSummary>,
    },
    ToolInputElided {
        original_bytes: usize,
        path: Option<PathBuf>,
        content_hash: String,
        call_id: String,
        field: String,
    },
    OutputNormalized {
        original_bytes: usize,
        normalized_bytes: usize,
    },
    FileReadDiffed {
        path: PathBuf,
        base: MessageAddr,
        base_hash: String,
        new_hash: String,
        original_bytes: usize,
        diff_bytes: usize,
    },
    DuplicateOutput {
        canonical: MessageAddr,
        original_bytes: usize,
    },
    Superseded {
        by: MessageAddr,
        original_bytes: usize,
    },
}
Expand description

What kind of reduction produced a placeholder, and the data specific to that kind. String forms (for the stub grammar) map 1:1 onto these variants.

Variants§

§

ToolOutputTruncated

A7: an oversized tool result truncated in the view (sidecar keeps the full bytes).

Fields

§original_bytes: usize

Total size of the original content, in bytes.

§kept_bytes: usize

Size of the kept prefix, in bytes.

§

FileReadElided

A8: a read-type tool result elided because the file is unchanged on disk since it was read.

Fields

§path: PathBuf

The file that was read.

§read_log: ReadLogEntry

The read-log entry recording what was read and when.

§

ImageRedacted

A9: an image content part redacted to a stub.

Fields

§part_index: usize

Index of the redacted part within the message’s content_parts.

§

TurnsCleared

A10: a contiguous run of old turns cleared from the view.

Fields

§first: usize

Address of the first cleared message (inclusive).

§last: usize

Address of the last cleared message (inclusive).

§summary: Option<SpanSummary>

TR-7 (T20): present only when this span’s placeholder carries an LLM-generated summary paragraph rather than the deterministic [turns cleared] stub — None whenever ReductionPolicy::summarize_cleared_turns is off (the default, SPEC.md TR-7 dev/01), or the side-call was skipped/fell back for any other reason (below the cost-guard floor, errored, timed out). Purely a view-layer/audit annotation: invert/verify_log ignore this field entirely and restore/verify byte-exact originals from first/last/Reduction::ptr alone, same as before this field existed (SPEC.md TR-7 dev/02).

§

ToolInputElided

TR-10: an already-executed, successful tool_use call’s disk-persisted payload argument (e.g. write_file’s content) elided from its serialized arguments, leaving every other argument (e.g. path) verbatim. The assistant-side twin of A7 (tool RESULTS) / A8 (stale file READS): the reduced slot here is a tool_use’s arguments, not a tool_result’s content.

Beyond the spec statement’s original_bytes/path/content_hash, this carries call_id/field so a single reduction can address one specific tool_call’s one specific payload field — necessary since a single assistant message can carry more than one tool_calls entry (mirrors Self::ImageRedacted’s part_index playing the same role for content_parts).

Fields

§original_bytes: usize

Byte length of the elided payload field’s ORIGINAL value (not the whole arguments string) — the stub’s size figure.

§path: Option<PathBuf>

The file path the payload was written to, when recoverable from a sibling path argument — None if the tool’s schema has none.

§content_hash: String

blake3 hex digest of the elided payload field’s ORIGINAL value. Verified before ever restoring it (mirrors SidecarPtr::content_hash, but hashes just the field’s value — the sub-span actually removed); also what probe_tool_input_fresh compares a fresh disk read against for the freshness matrix.

§call_id: String

The elided tool_call’s stable supercode_interchange::ToolCall::id within the addressed assistant message’s tool_calls — disambiguates when a single assistant turn issues more than one tool call.

§field: String

Name of the elided payload argument field (e.g. "content") — which key inside arguments was replaced.

§

OutputNormalized

T30/TR-4: a bash/exec tool result whose ANSI color codes and carriage-return/erase-line/cursor-up redraws were collapsed down to their final rendered content (normalize::normalize). A VIEW normalization (SPEC.md B10: lossy presentation over a lossless sidecar) — the rendered CONTENT is fully preserved; only presentation bytes (escape sequences, superseded redraw frames) are removed.

Fields

§original_bytes: usize

Total byte size of the raw captured output before normalization.

§normalized_bytes: usize

Byte size of the normalized (final-rendered) text, excluding the honesty trailer appended alongside it in the view.

§

FileReadDiffed

TR-3 (T26): a read-type tool result for a file already read earlier this session, whose content has since changed — replaced with a unified diff against that prior (base) read rather than shown in full, because the diff is materially smaller than the full content (see ReductionPolicy::diff_max_percent).

The base is always a genuine full read, resolved straight from the canonical message slice (project_messages’s msgs parameter, never mutated) — never a previously-diffed or -elided reduction’s own (reduced) content, so diffs never compound (SPEC.md TR-3 dev/04: “no diff-of-diff”).

ptr (on the containing Reduction) addresses THIS read (the re-read being replaced) and pins new_hash as its content hash — invert/expand_reduction restore the full re-read byte-exact through it, identically to ReductionKind::FileReadElided. base/base_hash are extra provenance: which prior read the diff is against, and its content hash at diff-mint time, so a caller can tell whether that base itself has since drifted.

Fields

§path: PathBuf

The file that was read.

§base: MessageAddr

Where the base (prior full) read lives in the canonical full view.

§base_hash: String

Hash of the base read’s content, at the time this diff was minted.

§new_hash: String

Hash of this (new) read’s full content — equal to ptr.content_hash on the containing Reduction.

§original_bytes: usize

Size of the full new (re-read) content, in bytes.

§diff_bytes: usize

Size of the projected unified-diff text, in bytes (excludes the stub placeholder line itself).

§

DuplicateOutput

TR-2 (T15): a tool result byte-identical to an earlier one still addressable in the view, replaced by a stub naming the earlier (“canonical”) instance. canonical is informational only — display (the stub summary) and rehydration context — never part of the restore path: like every other kind, SidecarPtr::addr on this reduction’s own Reduction::ptr points at THIS message’s own address, so invert/expand_reduction recover it independent of whatever later happens to canonical’s own slot (SPEC.md TR-2 dev/04: the canonical instance may itself be truncated or cleared afterward without ever affecting this pointer).

Fields

§canonical: MessageAddr

Where the earlier, byte-identical instance lives in the canonical full view, at the moment this reduction was minted.

§original_bytes: usize

Total size of the original (duplicated) content, in bytes.

§

Superseded

TR-6 (T16): a tool result superseded by a LATER result of the SAME tool called with the SAME canonicalized arguments (supersede::canonical_key) — an old failing cargo test run obsoleted by the newest run, a stale directory listing, an outdated git diff. Unlike Self::DuplicateOutput (TR-2), the two contents are NOT required to be byte-identical — a stale FAILING run and a later PASSING one of the identical command are exactly the case this exists for.

by is informational only — display (the stub summary) and provenance — never part of the restore path: like every other kind, SidecarPtr::addr on this reduction’s own Reduction::ptr points at THIS message’s own address, so invert/expand_reduction recover it independent of whatever later happens to by’s own slot (mirrors TR-2 dev/04’s guarantee for DuplicateOutput::canonical: the successor may itself be truncated, superseded again, or cleared afterward without ever affecting this pointer).

Fields

§by: MessageAddr

Where the newer (successor) result lives in the canonical full view, at the moment this reduction was minted.

§original_bytes: usize

Total size of the original (superseded) content, in bytes.

Trait Implementations§

Source§

impl Clone for ReductionKind

Source§

fn clone(&self) -> ReductionKind

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 ReductionKind

Source§

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

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

impl<'de> Deserialize<'de> for ReductionKind

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<ReductionKind, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

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

impl Eq for ReductionKind

Source§

impl From<&ReductionKind> for Kind

Source§

fn from(k: &ReductionKind) -> Kind

Converts to this type from the input type.
Source§

impl PartialEq for ReductionKind

Source§

fn eq(&self, other: &ReductionKind) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ReductionKind

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ReductionKind

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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