pub struct CompactionReceipt {Show 16 fields
pub schema_version: u32,
pub receipt_id: String,
pub session_id: Option<String>,
pub transcript_id: Option<String>,
pub mode: String,
pub reason: String,
pub strategy: String,
pub engine_strategy: String,
pub archived_messages: usize,
pub estimated_tokens_before: usize,
pub estimated_tokens_after: usize,
pub snapshot_asset_id: Option<String>,
pub instruction_mode: Option<String>,
pub instruction_source: Option<String>,
pub compaction_policy: Option<Value>,
pub recap: Option<RecapMetrics>,
}Expand description
One serializable, versioned record of a single transcript compaction. See the module docs for how it flows through every projection.
Fields§
§schema_version: u32Schema version. Lets readers migrate: a receipt read from an older
persisted transcript that predates a meaning change carries its original
version, and a transcript with no embedded receipt at all is migrated by
the record builder (see compaction_events_from_transcript).
receipt_id: StringStable identity for this compaction operation, shared verbatim across the transcript event id, the live event, ACP, and the observability record.
session_id: Option<String>Owning agent session, when the compaction ran against one.
transcript_id: Option<String>Owning transcript, when known. Best-effort provenance; the record’s
transcript_id is sourced authoritatively from the transcript itself.
mode: StringCall-site surface that initiated compaction (CompactMode::as_str).
reason: StringWhy compaction fired (CompactionTrigger::as_str, or a host-supplied
reason such as context_overflow).
strategy: StringUser-facing policy label (may be broader than the engine strategy).
engine_strategy: StringEngine strategy actually used after honoring any PreCompact Modify.
archived_messages: usize§estimated_tokens_before: usize§estimated_tokens_after: usize§snapshot_asset_id: Option<String>Id of the pre-compaction snapshot asset, when one was built.
instruction_mode: Option<String>§instruction_source: Option<String>§compaction_policy: Option<Value>§recap: Option<RecapMetrics>Observation-mask recap metrics; None for the LLM/truncate/custom
strategies, which do not spend a recap budget.
Implementations§
Source§impl CompactionReceipt
impl CompactionReceipt
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
Serialize the receipt for verbatim embedding under metadata.receipt on
the transcript event.
Sourcepub fn from_event_metadata(metadata: Option<&Value>) -> Option<Self>
pub fn from_event_metadata(metadata: Option<&Value>) -> Option<Self>
Read a receipt embedded under metadata.receipt on a transcript
compaction event. Returns None when the key is absent (a legacy
transcript written before receipts existed) or malformed, so the caller
can fall back to the legacy flat-metadata migration path.
Sourcepub fn from_host_payload(session_id: &str, payload: &Value) -> Self
pub fn from_host_payload(session_id: &str, payload: &Value) -> Self
Normalize a host-script compaction payload — the dict .harn code hands
to agent_record_compaction / __host_agent_record_compaction — into a
receipt at the builtin boundary, minting a fresh receipt_id. This is the
one place the host-driven shape is validated, so the .harn auto-compact
path yields the same unified receipt as the Rust lifecycle paths.
Trait Implementations§
Source§impl Clone for CompactionReceipt
impl Clone for CompactionReceipt
Source§fn clone(&self) -> CompactionReceipt
fn clone(&self) -> CompactionReceipt
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 CompactionReceipt
impl Debug for CompactionReceipt
Source§impl Default for CompactionReceipt
impl Default for CompactionReceipt
Source§fn default() -> CompactionReceipt
fn default() -> CompactionReceipt
Source§impl<'de> Deserialize<'de> for CompactionReceiptwhere
CompactionReceipt: Default,
impl<'de> Deserialize<'de> for CompactionReceiptwhere
CompactionReceipt: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for CompactionReceipt
Source§impl PartialEq for CompactionReceipt
impl PartialEq for CompactionReceipt
Source§impl Serialize for CompactionReceipt
impl Serialize for CompactionReceipt
impl StructuralPartialEq for CompactionReceipt
Auto Trait Implementations§
impl Freeze for CompactionReceipt
impl RefUnwindSafe for CompactionReceipt
impl Send for CompactionReceipt
impl Sync for CompactionReceipt
impl Unpin for CompactionReceipt
impl UnsafeUnpin for CompactionReceipt
impl UnwindSafe for CompactionReceipt
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);