pub struct AinlRuntime { /* private fields */ }Expand description
Orchestrates ainl-memory, persona snapshot state, and graph extraction for one agent.
Implementations§
Source§impl AinlRuntime
impl AinlRuntime
pub fn new(config: RuntimeConfig, store: SqliteGraphStore) -> Self
Sourcepub fn register_adapter(&mut self, adapter: impl PatchAdapter + 'static)
pub fn register_adapter(&mut self, adapter: impl PatchAdapter + 'static)
Register a crate::PatchAdapter keyed by [PatchAdapter::name] (e.g. procedural patch label).
Sourcepub fn registered_adapters(&self) -> Vec<&str>
pub fn registered_adapters(&self) -> Vec<&str>
Names of currently registered patch adapters.
pub fn with_hooks(self, hooks: impl TurnHooks + 'static) -> Self
Sourcepub fn sqlite_store(&self) -> &SqliteGraphStore
pub fn sqlite_store(&self) -> &SqliteGraphStore
Borrow the backing SQLite store (same connection as graph memory).
Sourcepub fn evolution_engine(&self) -> &EvolutionEngine
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).
Sourcepub fn evolution_engine_mut(&mut self) -> &mut EvolutionEngine
pub fn evolution_engine_mut(&mut self) -> &mut EvolutionEngine
Mutable access to the persona EvolutionEngine (see Self::evolution_engine).
Sourcepub fn apply_evolution_signals(&mut self, signals: Vec<RawSignal>) -> usize
pub fn apply_evolution_signals(&mut self, signals: Vec<RawSignal>) -> usize
Ingest explicit RawSignals without reading the graph (wrapper for EvolutionEngine::ingest_signals).
Sourcepub fn evolution_correction_tick(&mut self, axis: PersonaAxis, correction: f32)
pub fn evolution_correction_tick(&mut self, axis: PersonaAxis, correction: f32)
Apply a host correction nudge on one axis (EvolutionEngine::correction_tick).
Sourcepub fn persist_evolution_snapshot(&mut self) -> Result<PersonaSnapshot, String>
pub fn persist_evolution_snapshot(&mut self) -> Result<PersonaSnapshot, String>
Snapshot current axis EMA state and persist the evolution persona bundle to the store.
Sourcepub fn evolve_persona_from_graph_signals(
&mut self,
) -> Result<PersonaSnapshot, String>
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.
Sourcepub fn load_artifact(&self) -> Result<AinlGraphArtifact, String>
pub fn load_artifact(&self) -> Result<AinlGraphArtifact, String>
Boot: export + validate the agent subgraph.
Sourcepub fn compile_memory_context(&self) -> Result<MemoryContext, String>
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).
Sourcepub fn compile_memory_context_for(
&self,
user_message: Option<&str>,
) -> Result<MemoryContext, String>
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.
Sourcepub fn route_emit_edges(
&self,
episode_id: Uuid,
turn_output_payload: &Value,
) -> Result<(), String>
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).
Sourcepub fn run_turn(&mut self, input: TurnInput) -> Result<TurnOutput, String>
pub fn run_turn(&mut self, input: TurnInput) -> Result<TurnOutput, String>
Full single-turn orchestration (no LLM / no IR parse).
Sourcepub fn relevant_semantic_nodes(
&self,
user_message: &str,
all_semantic: Vec<AinlMemoryNode>,
limit: usize,
) -> Vec<AinlMemoryNode>
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).