pub struct DurableAdaptiveSession { /* private fields */ }std only.Expand description
Durable Phase 1 Adaptive Kernel Protocol v1 session backed by a StateStore.
Phase 1 enforces Keep / Shadow only execution: no active parameter
mutations are permitted, every transition persists through StateStore
before committing in-memory state (fail-closed on storage errors), and
legacy schema v6 snapshots migrate to v7 without gaining active rights.
Implementations§
Source§impl DurableAdaptiveSession
impl DurableAdaptiveSession
Sourcepub fn open_keep(
store: Box<dyn StateStore>,
baseline_policy: PolicySnapshot,
) -> Result<Self>
pub fn open_keep( store: Box<dyn StateStore>, baseline_policy: PolicySnapshot, ) -> Result<Self>
Opens a durable Keep-only adaptive session backed by store.
Sourcepub fn open_shadow(
store: Box<dyn StateStore>,
config: AdaptiveConfig,
baseline_policy: PolicySnapshot,
) -> Result<Self>
pub fn open_shadow( store: Box<dyn StateStore>, config: AdaptiveConfig, baseline_policy: PolicySnapshot, ) -> Result<Self>
Opens a durable Shadow-mode adaptive session backed by store.
Even if config.mode requests AdaptiveMode::Active, Phase 1 clamps
the session to AdaptiveMode::Shadow so no executable parameter
mutation occurs.
Sourcepub fn open_active(
store: Box<dyn StateStore>,
config: AdaptiveConfig,
baseline_policy: PolicySnapshot,
) -> Result<Self>
pub fn open_active( store: Box<dyn StateStore>, config: AdaptiveConfig, baseline_policy: PolicySnapshot, ) -> Result<Self>
Opens a durable Active-mode adaptive session with explicit opt-in.
Legacy snapshots (schema < 7) still fail closed with
active_permission_granted == false and emit only Keep until migrated.
Sourcepub fn machine(&self) -> &AdaptiveStateMachine
pub fn machine(&self) -> &AdaptiveStateMachine
Returns a read-only view of the underlying protocol state machine.
Sourcepub fn schema_version(&self) -> u32
pub fn schema_version(&self) -> u32
Returns the loaded/migrated KernelSnapshot schema version.
Sourcepub fn propose(
&mut self,
req: ProposalRequest,
) -> Result<ProposalResponse, AdaptiveSessionError>
pub fn propose( &mut self, req: ProposalRequest, ) -> Result<ProposalResponse, AdaptiveSessionError>
Evaluates and durably persists a propose request (fail-closed on storage error).
Sourcepub fn acknowledge_applied(
&mut self,
receipt: ExecutionReceipt,
) -> Result<PolicySnapshot, AdaptiveSessionError>
pub fn acknowledge_applied( &mut self, receipt: ExecutionReceipt, ) -> Result<PolicySnapshot, AdaptiveSessionError>
Evaluates and durably persists an acknowledge_applied receipt.
Sourcepub fn feedback(
&mut self,
req: FeedbackRequest,
) -> Result<FeedbackReceipt, AdaptiveSessionError>
pub fn feedback( &mut self, req: FeedbackRequest, ) -> Result<FeedbackReceipt, AdaptiveSessionError>
Evaluates and durably persists an external feedback request.
Sourcepub fn record_expired_tombstone(
&mut self,
request_id: impl Into<String>,
) -> Result<(), AdaptiveSessionError>
pub fn record_expired_tombstone( &mut self, request_id: impl Into<String>, ) -> Result<(), AdaptiveSessionError>
Durably records an expired request tombstone so it can never re-execute across restarts.
Sourcepub fn confirmed_params(&self) -> &BTreeMap<String, f64>
pub fn confirmed_params(&self) -> &BTreeMap<String, f64>
Returns the currently confirmed parameter map (unchanged in Keep/Shadow modes).
Sourcepub fn confirmed_policy(&self) -> &PolicySnapshot
pub fn confirmed_policy(&self) -> &PolicySnapshot
Returns the currently confirmed PolicySnapshot.
Sourcepub fn active_permission_granted(&self) -> bool
pub fn active_permission_granted(&self) -> bool
Returns whether active adaptation permission is granted for this session.
Sourcepub fn recommend_recovery(
&self,
recovery_params: BTreeMap<String, f64>,
) -> Result<RecoveryRecommendation, AdaptiveSessionError>
pub fn recommend_recovery( &self, recovery_params: BTreeMap<String, f64>, ) -> Result<RecoveryRecommendation, AdaptiveSessionError>
Produces a bounded recovery recommendation under a strictly newer version.