pub struct CompilePolicy {Show 13 fields
pub response_reserve_tokens: u64,
pub near_dup_dedup: bool,
pub disabled_rules: Vec<String>,
pub chunk: ChunkPolicy,
pub record_events: bool,
pub store_sources: bool,
pub source_ttl_seconds: Option<u64>,
pub event_ttl_seconds: Option<u64>,
pub pricing: Option<PricingTable>,
pub importance: ImportanceWeights,
pub normalize_log_timestamps: bool,
pub ids_as_strings: bool,
pub slim_response: bool,
}Expand description
Tuning knobs of one compilation. Default is the recommended profile.
Fields§
§response_reserve_tokens: u64Tokens kept aside for the model’s answer; the compiler packs into
token_budget − response_reserve_tokens. Default 0: the caller
knows their generation length, the compiler does not guess it.
near_dup_dedup: boolCollapse near-duplicates (case/whitespace variants) in addition to
exact duplicates. Default true.
disabled_rules: Vec<String>Rule ids to disable (e.g. "abstract.log_dedup"). Disabled rules are
skipped during classification; their fragments fall through to the
next matching rule.
chunk: ChunkPolicyHow oversized fragments are split before packing. Only
ChunkPolicy::max_chunk_bytes and ChunkPolicy::boundary apply
here — the compiler forces overlap_bytes to 0, since it emits
pieces by concatenation and an overlap prefix would duplicate content
reported as verbatim. overlap_bytes is honoured only by the
standalone crate::context::chunk::chunk_text API.
record_events: boolMemory bridge only: record a compilation event (metadata and hashes,
never fragment content) so savings stay aggregatable. Default
true; set false to opt out entirely.
store_sources: boolMemory bridge only: store each distinct fragment’s original (as an
internal system fact, invisible to normal recall) so its
ctx://source/<hash> handle round-trips. Default true.
source_ttl_seconds: Option<u64>TTL applied to stored sources (None keeps them until forgotten).
event_ttl_seconds: Option<u64>TTL applied to compilation events (None keeps them).
pricing: Option<PricingTable>Caller-supplied pricing table so the insights also report the
estimated cost avoided for super::model::CompileRequest::target_model — the
wire channel for cost accounting (MCP and the bindings cannot
reach the Rust-only super::ContextCompiler::with_pricing builder).
Takes precedence over a builder-injected table. None (default)
reports tokens only.
importance: ImportanceWeightsMemory bridge only: usage-driven importance blend over the pulled
memories (RL confidence + batch-relative recency). The struct-level
#[serde(default)] keeps 0.8.0 requests wire-compatible.
normalize_log_timestamps: boolOpt-in, deterministic: before abstract.log_dedup groups a kind = "log" fragment’s repeated lines, mask each line’s volatile prefix
(ISO/syslog timestamps, bracketed hex/pid counters) with fixed
patterns — never a caller-supplied regex, so the collapse stays
reproducible — so lines identical modulo timestamp collapse into one
annotated line instead of surviving as distinct entries. The emitted
line is still the first occurrence’s exact bytes; only the grouping
key changes. Default false: masking is opt-in because it changes
what “duplicate” means for logs, so callers who rely on the previous
byte-exact grouping keep it unless they ask. See the crate README’s
“Normalizing timestamped logs” section for the exact patterns.
ids_as_strings: boolWire-compat opt-in for the MCP context tools (compile_context,
explain_compilation): when true, every super::wire::ID_KEYS
field of the RESPONSE (fragment_id, content_hash, memory_id,
fragment_ids) is rewritten into its decimal-string form, through
the exact same tree walk the Node and WASM bindings already apply on
every response (super::wire::stringify_id_fields). A raw MCP
client — one that talks JSON-RPC directly, without either binding —
parses ids as JS numbers (IEEE-754 doubles), which silently lose
precision above 2^53; string ids round-trip exactly. Default
false: existing MCP clients keep today’s byte-identical numeric
response unless they opt in.
slim_response: boolQuick win (V2a-2): when true, sections and decisions are
emptied out of the response after compilation — content,
insights, risk, warnings, sources, and retrieval_handles
are unaffected. The full audit trail (sections/decisions) is
still recoverable: re-compile the same request without
slim_response (compilation is deterministic, so nothing is lost,
only not sent this time). Default false.
Trait Implementations§
Source§impl Clone for CompilePolicy
impl Clone for CompilePolicy
Source§fn clone(&self) -> CompilePolicy
fn clone(&self) -> CompilePolicy
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 CompilePolicy
impl Debug for CompilePolicy
Source§impl Default for CompilePolicy
impl Default for CompilePolicy
Source§impl<'de> Deserialize<'de> for CompilePolicywhere
CompilePolicy: Default,
impl<'de> Deserialize<'de> for CompilePolicywhere
CompilePolicy: 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>,
Source§impl JsonSchema for CompilePolicy
impl JsonSchema for CompilePolicy
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for CompilePolicy
impl RefUnwindSafe for CompilePolicy
impl Send for CompilePolicy
impl Sync for CompilePolicy
impl Unpin for CompilePolicy
impl UnsafeUnpin for CompilePolicy
impl UnwindSafe for CompilePolicy
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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);