Skip to main content

ainl_persona/
extractor.rs

1//! Pull raw persona signals from `SqliteGraphStore` for one agent.
2
3use crate::signals::{extract_from_node, RawSignal};
4use ainl_memory::{GraphStore, SqliteGraphStore};
5
6const NODE_TYPES: [&str; 4] = ["episode", "semantic", "procedural", "persona"];
7
8pub struct GraphExtractor;
9
10impl GraphExtractor {
11    pub fn extract(store: &SqliteGraphStore, agent_id: &str) -> Result<Vec<RawSignal>, String> {
12        let mut raw = Vec::new();
13        for nt in NODE_TYPES {
14            let batch = store.find_by_type(nt)?;
15            for node in batch {
16                if node.agent_id != agent_id {
17                    continue;
18                }
19                raw.extend(extract_from_node(&node));
20            }
21        }
22        Ok(raw)
23    }
24}