Skip to main content

AinlRuntime

Struct AinlRuntime 

Source
pub struct AinlRuntime { /* private fields */ }
Expand description

Orchestrates ainl-memory, persona snapshot state, and graph extraction for one agent.

Implementations§

Source§

impl AinlRuntime

Source

pub fn new(config: RuntimeConfig, store: SqliteGraphStore) -> Self

Source

pub fn register_adapter(&mut self, adapter: impl PatchAdapter + 'static)

Register a crate::PatchAdapter keyed by [PatchAdapter::name] (e.g. procedural patch label).

Source

pub fn registered_adapters(&self) -> Vec<&str>

Names of currently registered patch adapters.

Source

pub fn with_hooks(self, hooks: impl TurnHooks + 'static) -> Self

Source

pub fn sqlite_store(&self) -> &SqliteGraphStore

Borrow the backing SQLite store (same connection as graph memory).

Source

pub fn evolution_engine(&self) -> &EvolutionEngine

Borrow the persona EvolutionEngine for this runtime’s agent.

This is the same EvolutionEngine instance held by GraphExtractorTask::evolution_engine. Scheduled GraphExtractorTask::run_pass continues to feed graph + pattern signals into it; hosts may also call EvolutionEngine::ingest_signals, EvolutionEngine::correction_tick, EvolutionEngine::extract_signals, or EvolutionEngine::evolve directly, then Self::persist_evolution_snapshot to write the PersonaSnapshot row (crate::EVOLUTION_TRAIT_NAME).

Source

pub fn evolution_engine_mut(&mut self) -> &mut EvolutionEngine

Mutable access to the persona EvolutionEngine (see Self::evolution_engine).

Source

pub fn apply_evolution_signals(&mut self, signals: Vec<RawSignal>) -> usize

Ingest explicit RawSignals without reading the graph (wrapper for EvolutionEngine::ingest_signals).

Source

pub fn evolution_correction_tick(&mut self, axis: PersonaAxis, correction: f32)

Apply a host correction nudge on one axis (EvolutionEngine::correction_tick).

Source

pub fn persist_evolution_snapshot(&mut self) -> Result<PersonaSnapshot, String>

Snapshot current axis EMA state and persist the evolution persona bundle to the store.

Source

pub fn evolve_persona_from_graph_signals( &mut self, ) -> Result<PersonaSnapshot, String>

Graph-backed evolution only: extract signals from the store, ingest, write (EvolutionEngine::evolve).

This does not run semantic recurrence_count bumps or the extractor’s extract_pass heuristics — use GraphExtractorTask::run_pass for the full scheduled pipeline.

Source

pub fn load_artifact(&self) -> Result<AinlGraphArtifact, String>

Boot: export + validate the agent subgraph.

Source

pub fn compile_memory_context(&self) -> Result<MemoryContext, String>

Same as Self::compile_memory_context_for with user_message: None (semantic relevance falls back to the latest episode’s user_message when present).

Source

pub fn compile_memory_context_for( &self, user_message: Option<&str>, ) -> Result<MemoryContext, String>

Build MemoryContext from the live store plus current extractor axis state.

Source

pub fn route_emit_edges( &self, episode_id: Uuid, turn_output_payload: &Value, ) -> Result<(), String>

Route EMIT_TO edges from an episode to hook targets (host implements TurnHooks::on_emit).

Source

pub fn run_turn(&mut self, input: TurnInput) -> Result<TurnOutput, String>

Full single-turn orchestration (no LLM / no IR parse).

Source

pub fn relevant_semantic_nodes( &self, user_message: &str, all_semantic: Vec<AinlMemoryNode>, limit: usize, ) -> Vec<AinlMemoryNode>

Score and rank semantic nodes for the current user text (ainl-semantic-tagger topic tags + recurrence).

Source

pub fn dispatch_patches( &mut self, patches: &[AinlMemoryNode], frame: &HashMap<String, Value>, ) -> Vec<PatchDispatchResult>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more