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
FileReadElided
A8: a read-type tool result elided because the file is unchanged on disk since it was read.
Fields
read_log: ReadLogEntryThe read-log entry recording what was read and when.
ImageRedacted
A9: an image content part redacted to a stub.
TurnsCleared
A10: a contiguous run of old turns cleared from the view.
Fields
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: usizeByte 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: Stringblake3 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: StringThe 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.
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
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
base: MessageAddrWhere the base (prior full) read lives in the canonical full view.
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: MessageAddrWhere the earlier, byte-identical instance lives in the canonical full view, at the moment this reduction was minted.
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: MessageAddrWhere the newer (successor) result lives in the canonical full view, at the moment this reduction was minted.
Trait Implementations§
Source§impl Clone for ReductionKind
impl Clone for ReductionKind
Source§fn clone(&self) -> ReductionKind
fn clone(&self) -> ReductionKind
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 ReductionKind
impl Debug for ReductionKind
Source§impl<'de> Deserialize<'de> for ReductionKind
impl<'de> Deserialize<'de> for ReductionKind
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ReductionKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ReductionKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for ReductionKind
Source§impl From<&ReductionKind> for Kind
impl From<&ReductionKind> for Kind
Source§fn from(k: &ReductionKind) -> Kind
fn from(k: &ReductionKind) -> Kind
Source§impl PartialEq for ReductionKind
impl PartialEq for ReductionKind
Source§impl Serialize for ReductionKind
impl Serialize for ReductionKind
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for ReductionKind
Auto Trait Implementations§
impl Freeze for ReductionKind
impl RefUnwindSafe for ReductionKind
impl Send for ReductionKind
impl Sync for ReductionKind
impl Unpin for ReductionKind
impl UnsafeUnpin for ReductionKind
impl UnwindSafe for ReductionKind
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.