pub struct FramePolicy {
pub window_budget: WindowBudget,
pub compaction: Option<Arc<dyn Compaction>>,
pub token_counter: Option<Arc<dyn TokenCounter>>,
}Expand description
Carrier of the frame-materialization policy: trigger budget, optional compaction, optional token counter. A runtime value assembled from port instances — the driver builds and owns it, and it orchestrates materialization itself, using only the fact machine’s public accessors. Placeholder semantics stay frame-local and non-persisting.
Fields§
§window_budget: WindowBudgetTrigger thresholds; the all-usize::MAX default never trips
compaction.
compaction: Option<Arc<dyn Compaction>>Compaction port applied when the trigger fires; absent means the lossless frame is always used.
token_counter: Option<Arc<dyn TokenCounter>>Token counter backing FramePolicy::estimate; absent means a zero
estimate, which never triggers compaction.
Implementations§
Source§impl FramePolicy
impl FramePolicy
Sourcepub fn estimate(&self, blocks: &[ContextBlock]) -> usize
pub fn estimate(&self, blocks: &[ContextBlock]) -> usize
Token estimate for a block list: the supplied counter if any,
else 0. A zero estimate never trips should_compact (default
WindowBudget thresholds are usize::MAX), so compaction is
genuinely opt-in via a wired TokenCounter.
Sourcepub async fn materialize(
&self,
ctx: &TurnContext,
round_id: RoundId,
) -> Result<ContextFrame, FrameError>
pub async fn materialize( &self, ctx: &TurnContext, round_id: RoundId, ) -> Result<ContextFrame, FrameError>
Materialize the model context for round_id under this policy.
Trigger evaluation stays canonical — the same state and the same
policy always yield the same frame. Compaction output is frame-local
and never written back into the fact state; the fact machine itself
only ever offers the lossless projection and never awaits behavior.
Trait Implementations§
Source§impl Clone for FramePolicy
impl Clone for FramePolicy
Source§fn clone(&self) -> FramePolicy
fn clone(&self) -> FramePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more