pub struct ClosedLoopSession<O = MultiModalObserver, D = ConstrainedDecisionMaker, E = SandboxedExecutor>{
pub kernel: Kernel<O, D, E>,
/* private fields */
}Available on crate feature
std only.Expand description
Stateful coordinator for running the kernel with internal or external telemetry.
The session retains layer switches, cooldown state, and external-step bookkeeping between
calls. Create it from a kernel and a KernelConfig, then invoke one of the
ClosedLoopKernel step methods.
§Examples
use omega_cognitive_kernel::{
api::{ClosedLoopKernel, ClosedLoopSession},
persist::MemoryStateStore,
Kernel, KernelConfig,
};
fn main() -> omega_cognitive_kernel::Result<()> {
let config = KernelConfig::default();
let kernel = Kernel::open_with_store(Box::new(MemoryStateStore::new()))?;
let mut session = ClosedLoopSession::from_kernel(kernel, &config);
assert!(session.switches().l0);
let directive = session.step_internal().expect("internal step succeeds");
assert!(directive.step_id > 0);
assert!(directive.keep_steady);
Ok(())
}Fields§
§kernel: Kernel<O, D, E>Kernel instance managed by this session.
Implementations§
Source§impl<O, D, E> ClosedLoopSession<O, D, E>
impl<O, D, E> ClosedLoopSession<O, D, E>
Sourcepub fn from_kernel(kernel: Kernel<O, D, E>, config: &KernelConfig) -> Self
pub fn from_kernel(kernel: Kernel<O, D, E>, config: &KernelConfig) -> Self
Creates a session from a kernel and configuration, restoring saved loop state when present.
Sourcepub fn cooldown(&self) -> &CooldownTracker
pub fn cooldown(&self) -> &CooldownTracker
Returns the cooldown tracker used to limit consecutive policy updates.
Trait Implementations§
Source§impl<O, D, E> ClosedLoopKernel for ClosedLoopSession<O, D, E>
impl<O, D, E> ClosedLoopKernel for ClosedLoopSession<O, D, E>
Source§type Error = OmegaError
type Error = OmegaError
Error returned when a step cannot be processed.
Source§fn switches(&self) -> LayerSwitches
fn switches(&self) -> LayerSwitches
Returns the layer switches currently used by the kernel.
Source§fn step_internal(&mut self) -> Result<ControlDirective, Self::Error>
fn step_internal(&mut self) -> Result<ControlDirective, Self::Error>
Runs one step using the kernel’s internal world adapters.
Source§fn step_external(
&mut self,
telemetry: StepTelemetry,
) -> Result<ControlDirective, Self::Error>
fn step_external( &mut self, telemetry: StepTelemetry, ) -> Result<ControlDirective, Self::Error>
Processes one externally measured step and returns the resulting control directive.
Auto Trait Implementations§
impl<O = MultiModalObserver, D = ConstrainedDecisionMaker, E = SandboxedExecutor> !Freeze for ClosedLoopSession<O, D, E>
impl<O = MultiModalObserver, D = ConstrainedDecisionMaker, E = SandboxedExecutor> !RefUnwindSafe for ClosedLoopSession<O, D, E>
impl<O = MultiModalObserver, D = ConstrainedDecisionMaker, E = SandboxedExecutor> !Sync for ClosedLoopSession<O, D, E>
impl<O = MultiModalObserver, D = ConstrainedDecisionMaker, E = SandboxedExecutor> !UnwindSafe for ClosedLoopSession<O, D, E>
impl<O, D, E> Forget for ClosedLoopSession<O, D, E>
impl<O, D, E> Move for ClosedLoopSession<O, D, E>
impl<O, D, E> Send for ClosedLoopSession<O, D, E>where
E: Send,
D: Send,
O: Send,
RawVecInner: Send,
NonZero<i32>: Send,
Utc: Send,
Cell<u32>: Send,
NodeRef<Owned, String, Strategy, LeafOrInternal>: Send,
BoxRaw<(String, Strategy)>: Send,
NodeRef<Owned, String, f64, LeafOrInternal>: Send,
BoxRaw<(String, f64)>: Send,
NodeRef<Owned, String, String, LeafOrInternal>: Send,
BoxRaw<(String, String)>: Send,
BoxRaw<dyn FnMut(&AuditEvent) + Send>: Send,
BoxRaw<dyn StateStore>: Send,
impl<O, D, E> Unpin for ClosedLoopSession<O, D, E>where
E: Unpin,
D: Unpin,
O: Unpin,
*const u8 is !null: Unpin,
NonZero<i32>: Unpin,
Utc: Unpin,
*const LeafNode<String, Strategy> is !null: Unpin,
Box<(String, Strategy)>: Unpin,
*const LeafNode<String, f64> is !null: Unpin,
Box<(String, f64)>: Unpin,
*const LeafNode<String, String> is !null: Unpin,
Box<(String, String)>: Unpin,
Box<dyn FnMut(&AuditEvent) + Send>: Unpin,
Box<dyn StateStore>: Unpin,
impl<O, D, E> UnsafeUnpin for ClosedLoopSession<O, D, E>where
O: UnsafeUnpin,
D: UnsafeUnpin,
E: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<Case>: UnsafeUnpin,
*const LeafNode<String, Strategy> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Strategy)>>: UnsafeUnpin,
*const LeafNode<String, f64> is !null: UnsafeUnpin,
PhantomData<Box<(String, f64)>>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<(CognitivePatch, String)>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
PhantomData<MetaMetrics>: UnsafeUnpin,
PhantomData<MetaCacheEntry>: UnsafeUnpin,
PhantomData<f64>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const dyn FnMut(&AuditEvent) + Send is !null: UnsafeUnpin,
PhantomData<dyn FnMut(&AuditEvent) + Send>: UnsafeUnpin,
*const dyn StateStore is !null: UnsafeUnpin,
PhantomData<dyn StateStore>: UnsafeUnpin,
PhantomData<ParameterSpec>: UnsafeUnpin,
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