pub struct ActivationState { /* private fields */ }Expand description
Tracks per-entry activation state across conversation turns.
Owned by ContextWeaver and updated after
each assembly pass. Serializable alongside persistent state for
save/load support.
Implementations§
Source§impl ActivationState
impl ActivationState
pub fn new() -> Self
Sourcepub fn advance_turn(&mut self)
pub fn advance_turn(&mut self)
Advance to the next turn. Decrements sticky counters.
Sourcepub fn current_turn(&self) -> usize
pub fn current_turn(&self) -> usize
Current turn number.
Sourcepub fn record_activation(&mut self, entry_id: &str, sticky_turns: usize)
pub fn record_activation(&mut self, entry_id: &str, sticky_turns: usize)
Record that an entry was freshly activated on the current turn.
Updates the last_activated timestamp (used for cooldown checks)
and sets (or resets) the sticky counter.
This should only be called for fresh activations (keyword,
regex, constant, triggered) — NOT for sticky carry-forwards.
The caller (assemble Phase 4) is responsible for distinguishing
the two cases via ActivationReason.
The counter is stored as sticky_turns + 1 because advance_turn()
is called before assemble(). Without the +1, the first
advance after activation would immediately consume one count
before the entry ever gets carried forward, making
sticky_turns: N behave as N-1 additional turns.
Sourcepub fn is_on_cooldown(&self, entry_id: &str, cooldown: usize) -> bool
pub fn is_on_cooldown(&self, entry_id: &str, cooldown: usize) -> bool
Check if an entry is on cooldown.
Sourcepub fn is_sticky(&self, entry_id: &str) -> Option<usize>
pub fn is_sticky(&self, entry_id: &str) -> Option<usize>
Check if an entry is still sticky-active. Returns remaining turns.
Sourcepub fn sticky_entries(&self) -> impl Iterator<Item = (&str, usize)>
pub fn sticky_entries(&self) -> impl Iterator<Item = (&str, usize)>
Get all currently-sticky entry IDs with their remaining turns.
Trait Implementations§
Source§impl Clone for ActivationState
impl Clone for ActivationState
Source§fn clone(&self) -> ActivationState
fn clone(&self) -> ActivationState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more