pub struct ContextWindowPolicy {
pub max_context_tokens: usize,
pub max_output_tokens: usize,
pub min_recent_messages: usize,
pub enable_prompt_cache: bool,
pub autocompact_threshold: Option<usize>,
pub compaction_mode: ContextCompactionMode,
pub compaction_raw_suffix_messages: usize,
}Expand description
Context window management policy.
Pure data struct used by [ContextPlugin] to configure context
management. Lives in the contract layer so plugin crates can construct
it without depending on tirea-agentos.
Fields§
§max_context_tokens: usizeModel’s total context window size in tokens.
max_output_tokens: usizeTokens reserved for model output.
min_recent_messages: usizeMinimum number of recent messages to always preserve (never truncated).
enable_prompt_cache: boolWhether to enable prompt caching (Anthropic cache_control: ephemeral).
autocompact_threshold: Option<usize>Token count threshold that triggers auto-compaction. None disables.
Used by ContextPlugin to decide when to compact history.
compaction_mode: ContextCompactionModeAuto-compaction strategy to use when autocompact_threshold is reached.
compaction_raw_suffix_messages: usizeNumber of recent raw messages to preserve in
ContextCompactionMode::KeepRecentRawSuffix mode.
Trait Implementations§
Source§impl Clone for ContextWindowPolicy
impl Clone for ContextWindowPolicy
Source§fn clone(&self) -> ContextWindowPolicy
fn clone(&self) -> ContextWindowPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextWindowPolicy
impl Debug for ContextWindowPolicy
Source§impl Default for ContextWindowPolicy
impl Default for ContextWindowPolicy
Source§fn default() -> ContextWindowPolicy
fn default() -> ContextWindowPolicy
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ContextWindowPolicy
impl<'de> Deserialize<'de> for ContextWindowPolicy
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContextWindowPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContextWindowPolicy, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ContextWindowPolicy
impl Serialize for ContextWindowPolicy
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ContextWindowPolicy
impl RefUnwindSafe for ContextWindowPolicy
impl Send for ContextWindowPolicy
impl Sync for ContextWindowPolicy
impl Unpin for ContextWindowPolicy
impl UnwindSafe for ContextWindowPolicy
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
Mutably borrows from an owned value. Read more