diff --git a/core/continuum-cognition/src/lib.rs b/core/continuum-cognition/src/lib.rs index 4a6121c0f3..874bc2f068 100644 --- a/core/continuum-cognition/src/lib.rs +++ b/core/continuum-cognition/src/lib.rs @@ -9,7 +9,7 @@ pub use continuum_live::*; pub use continuum_genome::genome; pub use continuum_memory::memory; pub use continuum_experience::{experience, recipe}; -pub use continuum_perception::{perception, rag}; +pub use continuum_perception::perception; pub mod cognition; pub mod commands; diff --git a/core/continuum-core/src/ipc/mod.rs b/core/continuum-core/src/ipc/mod.rs index 3678e3eda8..712e3ec7c8 100644 --- a/core/continuum-core/src/ipc/mod.rs +++ b/core/continuum-core/src/ipc/mod.rs @@ -39,7 +39,6 @@ use crate::modules::vision::VisionModule; /// - Modular runtime routes commands through ServiceModule trait (Phase 1+) use crate::persona::ChannelRegistry; use crate::cognition::conversation::types::PersonaState; -use crate::rag::RagEngine; use crate::runtime::{CommandResult, Runtime}; use crate::system_resources::SystemResourceMonitor; use crate::{log_debug, log_error, log_info}; diff --git a/core/continuum-core/src/ipc/prepare_unix_socket_path.rs b/core/continuum-core/src/ipc/prepare_unix_socket_path.rs index 07dac5c4da..00793a7474 100644 --- a/core/continuum-core/src/ipc/prepare_unix_socket_path.rs +++ b/core/continuum-core/src/ipc/prepare_unix_socket_path.rs @@ -74,7 +74,6 @@ pub(super) struct ServerState { pub(super) voice_service: Arc, /// Per-persona channel registries + state — DashMap: hot-path ops are &mut self. pub(super) channel_registries: Arc>, - pub(super) rag_engine: Arc, /// Server-side audio buffer pool for handle-based synthesis. pub(super) audio_pool: Arc, /// Tokio runtime handle for async operations from IPC threads. @@ -108,7 +107,6 @@ impl ServerState { memory_manager: Arc, runtime: Arc, channel_registries: Arc>, - rag_engine: Arc, voice_service: Arc, audio_pool: Arc, file_engines: Arc>, @@ -120,7 +118,6 @@ impl ServerState { Self { voice_service, channel_registries, - rag_engine, audio_pool, rt_handle, memory_manager, diff --git a/core/continuum-core/src/ipc/start_server.rs b/core/continuum-core/src/ipc/start_server.rs index c60134f840..3140927e0e 100644 --- a/core/continuum-core/src/ipc/start_server.rs +++ b/core/continuum-core/src/ipc/start_server.rs @@ -100,7 +100,6 @@ pub fn start_server( inference_modules::register_inference_modules(&runtime); let cognition_modules::CognitionHandles { - rag_engine, channel_registries, } = cognition_modules::register_cognition_and_memory_modules( &runtime, @@ -264,7 +263,6 @@ pub fn start_server( memory_manager, runtime, channel_registries, - rag_engine, call_plane.voice_service, audio_pool, file_engines, diff --git a/core/continuum-core/src/ipc/start_server/cognition_modules.rs b/core/continuum-core/src/ipc/start_server/cognition_modules.rs index 90aea25a6f..cd2199a37b 100644 --- a/core/continuum-core/src/ipc/start_server/cognition_modules.rs +++ b/core/continuum-core/src/ipc/start_server/cognition_modules.rs @@ -2,9 +2,8 @@ use super::*; -/// The two handles the IPC server state shares with these modules. +/// The handle the IPC server state shares with these modules. pub(super) struct CognitionHandles { - pub(super) rag_engine: Arc, pub(super) channel_registries: Arc>, } @@ -16,9 +15,8 @@ pub(super) fn register_cognition_and_memory_modules( serving_daemon: &Arc, ) -> CognitionHandles { // Shared state for per-persona cognition (unified: engine + inbox + rate limiter + sleep + adapters + genome) - let rag_engine = Arc::new(RagEngine::new()); let cognition_state = - Arc::new(CognitionState::new(rag_engine.clone()).with_gpu_manager(gpu_manager.clone())); + Arc::new(CognitionState::new().with_gpu_manager(gpu_manager.clone())); let personas = cognition_state.personas.clone(); runtime.register(Arc::new(CognitionModule::new(cognition_state))); @@ -51,7 +49,6 @@ pub(super) fn register_cognition_and_memory_modules( let rag_state = Arc::new(RagState::new(memory_manager.clone())); runtime.register(Arc::new(RagModule::new(rag_state))); CognitionHandles { - rag_engine, channel_registries, } } diff --git a/core/continuum-core/src/lib.rs b/core/continuum-core/src/lib.rs index 54bc70cdb8..e6022fbd3f 100644 --- a/core/continuum-core/src/lib.rs +++ b/core/continuum-core/src/lib.rs @@ -25,7 +25,7 @@ pub use continuum_engine::{ai, capacity, inference, inference_capability, model_ pub use continuum_hands::code; pub use continuum_live::{live, media}; pub use continuum_mind::{ - cognition, context, experience, genome, memory, perception, persona, rag, recipe, vdd, + cognition, context, experience, genome, memory, perception, persona, recipe, vdd, }; pub use continuum_kernel::{ concurrency, docker_tier, docker_tier_pool, entity_schemas, governor, gpu, identity, logging, orm, @@ -60,4 +60,3 @@ pub use persona::{CognitionDecision, PersonaCognitionEngine, PersonaInbox, Prior // Usage: clog_info!("Session started"); clog_warn!("Warning"); etc. pub use ipc::start_server; pub use logging::{extract_component, module_path_to_category}; -pub use rag::{LlmMessage, MessageRole, RagContext, RagEngine, RagOptions}; diff --git a/core/continuum-core/tests/architecture_killer_loop_burst_cognition.rs b/core/continuum-core/tests/architecture_killer_loop_burst_cognition.rs index 88c7735494..3d09b783e7 100644 --- a/core/continuum-core/tests/architecture_killer_loop_burst_cognition.rs +++ b/core/continuum-core/tests/architecture_killer_loop_burst_cognition.rs @@ -74,7 +74,6 @@ use continuum_core::persona::message_cache::RecentMessageCache; use continuum_core::cognition::conversation::persona_identity::PersonaIdentity; use continuum_core::cognition::conversation::types::{PersonaState, SenderType}; use continuum_core::persona::{analyze_burst, BurstEvaluateResult, RateLimiterState, SleepState}; -use continuum_core::rag::RagEngine; fn make_chat(room: Uuid, sender: &str, content: &str) -> Arc { Arc::new(ChatQueueItem { @@ -114,9 +113,8 @@ impl PersonaHarness { fn new(name: &str) -> Self { let persona_id = Uuid::new_v4(); let identity = PersonaIdentity::new(persona_id, name); - let rag_engine = Arc::new(RagEngine::new()); let (_tx, rx) = tokio::sync::watch::channel(false); - let engine = PersonaCognitionEngine::new(persona_id, name.into(), rag_engine, rx); + let engine = PersonaCognitionEngine::new(persona_id, name.into(), rx); Self { persona_id, identity, diff --git a/core/continuum-mind/src/commands/cognition/create_engine.rs b/core/continuum-mind/src/commands/cognition/create_engine.rs index 7b4baf3889..c9fbc792d8 100644 --- a/core/continuum-mind/src/commands/cognition/create_engine.rs +++ b/core/continuum-mind/src/commands/cognition/create_engine.rs @@ -51,7 +51,6 @@ crate::action_command! { let cognition = PersonaCognition::new( p.persona_id, p.persona_name.clone(), - this.state.rag_engine.clone(), ); this.state.personas.insert(p.persona_id, cognition); diff --git a/core/continuum-mind/src/commands/persona/turn_frame/execute.rs b/core/continuum-mind/src/commands/persona/turn_frame/execute.rs index f771a841aa..0963942327 100644 --- a/core/continuum-mind/src/commands/persona/turn_frame/execute.rs +++ b/core/continuum-mind/src/commands/persona/turn_frame/execute.rs @@ -338,7 +338,6 @@ mod tests { use crate::cognition::workspace::TurnMetrics; use crate::persona::PersonaCognition; use crate::cognition::conversation::types::{InboxMessage, Modality, SenderType}; - use crate::rag::RagEngine; use crate::sdk_codegen::{AccessLevel, ActionCommand, Ctx}; // Build a TurnExecute command over a fresh CognitionState carrying one live persona @@ -347,11 +346,10 @@ mod tests { // (that needs a real adapter + model). So a turn WITH messages here exercises the // not-hosted fail-loud path; the real settle_step outcome is validated live via `uu`. fn command_with_persona(persona_id: Uuid) -> (TurnExecute, Arc) { - let rag_engine = Arc::new(RagEngine::new()); - let state = Arc::new(CognitionState::new(rag_engine.clone())); + let state = Arc::new(CognitionState::new()); state.personas.insert( persona_id, - PersonaCognition::new(persona_id, "Test Persona".to_string(), rag_engine), + PersonaCognition::new(persona_id, "Test Persona".to_string()), ); ( TurnExecute { @@ -410,8 +408,7 @@ mod tests { // BEFORE touching the brain — idle ticks are routine, never a caller error. #[tokio::test] async fn absent_persona_is_noop_not_error() { - let rag_engine = Arc::new(RagEngine::new()); - let state = Arc::new(CognitionState::new(rag_engine)); + let state = Arc::new(CognitionState::new()); let cmd = TurnExecute { state }; let out = cmd diff --git a/core/continuum-mind/src/lib.rs b/core/continuum-mind/src/lib.rs index 4a38fea7d8..c4ffdbca15 100644 --- a/core/continuum-mind/src/lib.rs +++ b/core/continuum-mind/src/lib.rs @@ -9,7 +9,7 @@ pub use continuum_live::*; pub use continuum_genome::genome; pub use continuum_memory::memory; pub use continuum_experience::{experience, recipe}; -pub use continuum_perception::{perception, rag}; +pub use continuum_perception::perception; pub use continuum_academy::cognition; pub mod activity; diff --git a/core/continuum-mind/src/modules/cognition.rs b/core/continuum-mind/src/modules/cognition.rs index fe836363f5..dc459a6b13 100644 --- a/core/continuum-mind/src/modules/cognition.rs +++ b/core/continuum-mind/src/modules/cognition.rs @@ -35,7 +35,6 @@ use crate::gpu::GpuMemoryManager; use continuum_text_analysis::LoopDetector; use crate::persona::{PersonaCognition, PersonaInboxFrame, PersonaTurnFrame, PersonaTurnFrameReplayRecord}; -use crate::rag::RagEngine; use crate::runtime::{CommandResult, LateBound, ModuleConfig, ModuleContext, ModulePriority, ServiceModule}; use async_trait::async_trait; use dashmap::DashMap; @@ -50,23 +49,26 @@ use uuid::Uuid; /// One lock acquisition gives atomic access to engine + inbox + rate limiter + /// sleep state + adapter registry + genome engine. /// -/// `rag_engine` and `loop_detector` are shared across all personas. +/// `loop_detector` is shared across all personas. pub struct CognitionState { /// Unified per-persona state: 7 maps → 1. pub personas: Arc>, - /// Shared RAG engine (not per-persona). - pub rag_engine: Arc, /// Shared loop detector (not per-persona). pub loop_detector: LoopDetector, /// GPU memory manager — real VRAM budgets for genome paging. pub gpu_manager: Option>, } +impl Default for CognitionState { + fn default() -> Self { + Self::new() + } +} + impl CognitionState { - pub fn new(rag_engine: Arc) -> Self { + pub fn new() -> Self { Self { personas: Arc::new(DashMap::new()), - rag_engine, loop_detector: LoopDetector::new(), gpu_manager: None, } @@ -98,7 +100,7 @@ impl CognitionState { // No lock is held across anything but the insert (a `len()` inside `or_insert_with` // re-entered the shard lock and self-deadlocked the live core once). self.personas.entry(persona_uuid).or_insert_with(|| { - PersonaCognition::new(persona_uuid, String::new(), self.rag_engine.clone()) + PersonaCognition::new(persona_uuid, String::new()) }) } } @@ -401,7 +403,6 @@ mod turn_frame_recording_tests { mod get_or_create_persona_locking { use super::*; use crate::gpu::GpuMemoryManager; - use crate::rag::RagEngine; use std::sync::mpsc; use std::time::Duration; @@ -422,7 +423,6 @@ mod turn_frame_recording_tests { fn create_with_gpu_manager_does_not_self_deadlock() { let (done_tx, done_rx) = mpsc::channel(); std::thread::spawn(move || { - let rag = Arc::new(RagEngine::new()); let (ptx, prx) = tokio::sync::watch::channel(0.0f32); let gpu = Arc::new(GpuMemoryManager::new_for_test( 24 * 1024 * 1024 * 1024, // total VRAM @@ -434,7 +434,7 @@ mod turn_frame_recording_tests { ptx, prx, )); - let state = CognitionState::new(rag).with_gpu_manager(gpu); + let state = CognitionState::new().with_gpu_manager(gpu); let id = Uuid::new_v4(); // First call runs the lazy-create closure (the budget read); the // guard drops at the end of each statement, so the second call diff --git a/core/continuum-mind/src/persona/cognition.rs b/core/continuum-mind/src/persona/cognition.rs index 4ce9afd0cc..7f4f618cf5 100644 --- a/core/continuum-mind/src/persona/cognition.rs +++ b/core/continuum-mind/src/persona/cognition.rs @@ -11,10 +11,8 @@ use super::inbox::PersonaInbox; use crate::cognition::conversation::types::{InboxMessage, PersonaState, SenderType}; -use crate::rag::RagEngine; use dashmap::DashSet; use serde::{Deserialize, Serialize}; -use std::sync::Arc; use std::time::Instant; use tokio::sync::watch; use tracing::debug; @@ -80,8 +78,6 @@ pub struct PersonaCognitionEngine { mention_marker: Box, state: PersonaState, inbox: PersonaInbox, - #[allow(dead_code)] // Will be used for RAG context building - rag_engine: Arc, // Deduplication evaluated_messages: DashSet, @@ -95,7 +91,6 @@ impl PersonaCognitionEngine { pub fn new( persona_id: Uuid, persona_name: String, - rag_engine: Arc, shutdown_rx: watch::Receiver, ) -> Self { let name_lower = persona_name.to_lowercase().into_boxed_str(); @@ -106,7 +101,6 @@ impl PersonaCognitionEngine { mention_marker, state: PersonaState::new(), inbox: PersonaInbox::new(persona_id), - rag_engine, evaluated_messages: DashSet::new(), shutdown_rx, } @@ -333,9 +327,8 @@ mod tests { use tokio::sync::watch; async fn create_test_engine() -> PersonaCognitionEngine { - let rag_engine = Arc::new(RagEngine::new()); let (_shutdown_tx, shutdown_rx) = watch::channel(false); - PersonaCognitionEngine::new(Uuid::new_v4(), "TestBot".into(), rag_engine, shutdown_rx) + PersonaCognitionEngine::new(Uuid::new_v4(), "TestBot".into(), shutdown_rx) } #[tokio::test] @@ -427,10 +420,9 @@ mod tests { async fn is_mentioned_uses_cached_lowercase_via_engine() { // Constructs the engine with a mixed-case name; verifies all // four casing variants resolve through the same cached state. - let rag_engine = Arc::new(RagEngine::new()); let (_tx, rx) = watch::channel(false); let engine = - PersonaCognitionEngine::new(Uuid::new_v4(), "Helper AI".into(), rag_engine, rx); + PersonaCognitionEngine::new(Uuid::new_v4(), "Helper AI".into(), rx); assert!(engine.is_mentioned("@helper ai please")); assert!(engine.is_mentioned("@HELPER AI")); assert!(engine.is_mentioned("Hey helper ai, can you...")); diff --git a/core/continuum-mind/src/persona/evaluator/tests.rs b/core/continuum-mind/src/persona/evaluator/tests.rs index 697a5e7369..917c710fdf 100644 --- a/core/continuum-mind/src/persona/evaluator/tests.rs +++ b/core/continuum-mind/src/persona/evaluator/tests.rs @@ -2,16 +2,13 @@ use super::*; use continuum_base::time::EpochMs; use crate::persona::message_cache::{CachedMessage, SenderCategory}; - use crate::rag::RagEngine; - use std::sync::Arc; use tokio::sync::watch; fn test_engine(name: &str) -> (PersonaCognitionEngine, Uuid) { - let rag_engine = Arc::new(RagEngine::new()); let (_tx, rx) = watch::channel(false); let id = Uuid::new_v4(); ( - PersonaCognitionEngine::new(id, name.into(), rag_engine, rx), + PersonaCognitionEngine::new(id, name.into(), rx), id, ) } diff --git a/core/continuum-mind/src/persona/service_loop/tests/part_3.rs b/core/continuum-mind/src/persona/service_loop/tests/part_3.rs index bf6599d137..1c7f3a096b 100644 --- a/core/continuum-mind/src/persona/service_loop/tests/part_3.rs +++ b/core/continuum-mind/src/persona/service_loop/tests/part_3.rs @@ -78,7 +78,6 @@ fn test_obligations(hosted: &HostedPersona) -> crate::persona::obligation::Oblig cognition: Arc::new(crate::persona::unified::PersonaCognition::new( persona_id, "Paige".to_string(), - Arc::new(crate::rag::RagEngine::new()), )), // #195 slice 2: build via the same helper production // uses, NOT a copy-pasted template. If a future PR diff --git a/core/continuum-mind/src/persona/supervisor/materialize_adapters.rs b/core/continuum-mind/src/persona/supervisor/materialize_adapters.rs index a2beed6175..1cc0fef37f 100644 --- a/core/continuum-mind/src/persona/supervisor/materialize_adapters.rs +++ b/core/continuum-mind/src/persona/supervisor/materialize_adapters.rs @@ -196,11 +196,9 @@ pub async fn materialize_adapters( // set_airc_source so compose_for_turn has engram + airc both // available the moment her service loop iterates (task #148). // The runtime IS an AircTranscriptReader by trait bound. - let rag_engine = Arc::new(crate::rag::RagEngine::new()); let mut cognition = crate::persona::unified::PersonaCognition::new( identity.peer_id.as_uuid(), identity.agent_name.clone(), - rag_engine, ); // One airc source: it delivers her rooms to cognition and takes the read receipt // of every sent prompt (her cursor moves through what she was shown, never at delivery). diff --git a/core/continuum-mind/src/persona/unified.rs b/core/continuum-mind/src/persona/unified.rs index 3413f98952..4db9e5e393 100644 --- a/core/continuum-mind/src/persona/unified.rs +++ b/core/continuum-mind/src/persona/unified.rs @@ -20,7 +20,6 @@ use crate::persona::rag_capture::{ NoopRagCaptureSink, RagCaptureEvent, RagCaptureSink, RecordingRagSource, }; use crate::cognition::recall_metadata::RecallMetadataRegistry; -use crate::rag::RagEngine; use std::sync::Arc; use uuid::Uuid; @@ -49,7 +48,7 @@ pub struct PersonaCognition { /// state (salience, access_count, last_accessed_ms, /// protected_until_ms). Shared with AdmissionState (admit-time /// writes flow through there) and with the future recall scorer - /// + decay tick (read-mostly hot paths). Per-persona because each + /// and decay tick (read-mostly hot paths). Per-persona because each /// persona's recall state is independent. pub recall_metadata: Arc, /// The persona's live-airc RAG source, per @@ -101,9 +100,9 @@ impl PersonaCognition { /// Create a new PersonaCognition with default sub-states. /// Engine and inbox require persona_id; everything else uses defaults. /// Capture sink defaults to `NoopRagCaptureSink` (zero overhead). - pub fn new(persona_id: Uuid, persona_name: String, rag_engine: Arc) -> Self { + pub fn new(persona_id: Uuid, persona_name: String) -> Self { let sink: Arc = Arc::new(NoopRagCaptureSink); - Self::with_capture_sink(persona_id, persona_name, rag_engine, sink) + Self::with_capture_sink(persona_id, persona_name, sink) } /// Create with a custom capture sink — production callers swap @@ -113,14 +112,13 @@ impl PersonaCognition { pub fn with_capture_sink( persona_id: Uuid, persona_name: String, - rag_engine: Arc, capture_sink: Arc, ) -> Self { let (_, shutdown_rx) = tokio::sync::watch::channel(false); let recall_metadata = Arc::new(RecallMetadataRegistry::new()); let admission = Arc::new(AdmissionState::new(recall_metadata.clone())); Self { - engine: PersonaCognitionEngine::new(persona_id, persona_name, rag_engine, shutdown_rx), + engine: PersonaCognitionEngine::new(persona_id, persona_name, shutdown_rx), inbox: PersonaInbox::new(persona_id), rate_limiter: RateLimiterState::default(), sleep_state: SleepState::default(), @@ -175,7 +173,7 @@ impl PersonaCognition { /// Called by the supervisor at boot with the same `Airc` handle that /// backs `airc_source` (it satisfies `AircRosterReader`). Decorated /// with the brain's `capture_sink` so roster deliveries are recorded - /// + replayable on the same wire as engrams and airc transcript + /// and replayable on the same wire as engrams and airc transcript /// (per [[persona-record-replay-is-a-product-requirement]]). Boot- /// time wire, not a per-turn allocation. pub fn set_roster_source(&mut self, raw_source: Arc) { @@ -296,8 +294,7 @@ mod tests { #[test] fn test_persona_cognition_defaults() { let id = Uuid::new_v4(); - let rag = Arc::new(RagEngine::new()); - let pc = PersonaCognition::new(id, "TestBot".into(), rag); + let pc = PersonaCognition::new(id, "TestBot".into()); assert_eq!(pc.engine.persona_id(), id); assert!(pc.inbox.is_empty()); @@ -338,7 +335,7 @@ mod tests { // capture decorator, airc first; nothing unbound appears. #[tokio::test] async fn compose_for_turn_delivers_every_item_of_her_bound_sources() { - let mut pc = PersonaCognition::new(Uuid::new_v4(), "TestBot".into(), Arc::new(RagEngine::new())); + let mut pc = PersonaCognition::new(Uuid::new_v4(), "TestBot".into()); assert!(pc.compose_for_turn(1_000_000, None).await.deliveries.is_empty(), "nothing bound, nothing delivered"); pc.set_airc_source(Arc::new(CannedSource { id: "airc", items: 300 })); let (cached, _) = crate::cognition::cached_source::CachedRagSource::new(Arc::new(CannedSource { id: "roster", items: 40 })); @@ -357,7 +354,7 @@ mod tests { let sink = Arc::new(InMemoryRagCaptureSink::new()); let sink_dyn: Arc = sink.clone(); let mut pc = - PersonaCognition::with_capture_sink(id, "Kimi".into(), Arc::new(RagEngine::new()), sink_dyn); + PersonaCognition::with_capture_sink(id, "Kimi".into(), sink_dyn); pc.set_airc_source(Arc::new(CannedSource { id: "airc", items: 2 })); let mind = crate::cognition::mind_room::mind_room_id(id); let _ = pc.compose_for_turn(1_000_000, Some(mind)).await; @@ -372,7 +369,7 @@ mod tests { async fn compose_for_turn_emits_capture_events_for_replay() { let sink = Arc::new(InMemoryRagCaptureSink::new()); let sink_dyn: Arc = sink.clone(); - let mut pc = PersonaCognition::with_capture_sink(Uuid::new_v4(), "TestBot".into(), Arc::new(RagEngine::new()), sink_dyn); + let mut pc = PersonaCognition::with_capture_sink(Uuid::new_v4(), "TestBot".into(), sink_dyn); pc.set_airc_source(Arc::new(CannedSource { id: "airc", items: 2 })); let _ = pc.compose_for_turn(1_000_000, None).await; let kinds: Vec<&str> = sink @@ -406,7 +403,7 @@ mod tests { async fn concurrent_composes_tag_every_delivery_with_its_own_turn() { let sink = Arc::new(InMemoryRagCaptureSink::new()); let sink_dyn: Arc = sink.clone(); - let mut pc = PersonaCognition::with_capture_sink(Uuid::new_v4(), "TestBot".into(), Arc::new(RagEngine::new()), sink_dyn); + let mut pc = PersonaCognition::with_capture_sink(Uuid::new_v4(), "TestBot".into(), sink_dyn); pc.set_airc_source(Arc::new(CannedSource { id: "airc", items: 2 })); let pc = Arc::new(pc); let (a, b) = (Arc::clone(&pc), Arc::clone(&pc)); diff --git a/core/continuum-perception/src/lib.rs b/core/continuum-perception/src/lib.rs index eb319565b0..1424185b3d 100644 --- a/core/continuum-perception/src/lib.rs +++ b/core/continuum-perception/src/lib.rs @@ -1,10 +1,8 @@ //! continuum-perception: a mind's senses (`perception/*` commands: observe, look, interact, -//! hot-edit) and the RAG engine that assembles her context, cut out of continuum-mind -//! (MODULE-ARCHITECTURE.md section 9.2, card 2f5b275b). Depends only on the live layer and -//! below; continuum-mind re-exports both modules under their old paths. +//! hot-edit), cut out of continuum-mind (MODULE-ARCHITECTURE.md section 9.2, card 2f5b275b). +//! Depends only on the live layer and below; continuum-mind re-exports it under its old path. pub use continuum_live::*; pub mod perception; -pub mod rag; pub mod search; diff --git a/core/continuum-perception/src/rag/budget.rs b/core/continuum-perception/src/rag/budget.rs deleted file mode 100644 index 69cabf71bf..0000000000 --- a/core/continuum-perception/src/rag/budget.rs +++ /dev/null @@ -1,131 +0,0 @@ -//! RAG Budget Manager -//! -//! Allocates token budget across sources based on priority - -use super::types::BudgetAllocation; - -/// Source registration for budget allocation -#[derive(Debug, Clone)] -pub struct SourceConfig { - pub name: String, - pub priority: u8, // Higher = more important (0-100) - pub default_percent: u8, // Default budget percentage - pub min_tokens: usize, // Minimum tokens needed to be useful -} - -/// Budget manager allocates tokens across RAG sources -pub struct BudgetManager { - total_budget: usize, -} - -impl BudgetManager { - pub fn new(total_budget: usize) -> Self { - Self { total_budget } - } - - /// Allocate budget across sources based on priority - pub fn allocate(&self, sources: &[SourceConfig]) -> Vec { - if sources.is_empty() { - return vec![]; - } - - // Calculate total priority weight - let total_priority: u32 = sources.iter().map(|s| s.priority as u32).sum(); - if total_priority == 0 { - return vec![]; - } - - // Allocate proportionally by priority - sources - .iter() - .map(|source| { - let proportion = source.priority as f64 / total_priority as f64; - let allocated = (self.total_budget as f64 * proportion) as usize; - let allocated = allocated.max(source.min_tokens); - - BudgetAllocation { - source_name: source.name.clone(), - allocated_tokens: allocated, - priority: source.priority, - } - }) - .collect() - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_budget_allocation_by_priority() { - let manager = BudgetManager::new(1000); - - let sources = vec![ - SourceConfig { - name: "identity".to_string(), - priority: 95, - default_percent: 10, - min_tokens: 100, - }, - SourceConfig { - name: "conversation".to_string(), - priority: 80, - default_percent: 50, - min_tokens: 200, - }, - SourceConfig { - name: "memory".to_string(), - priority: 70, - default_percent: 20, - min_tokens: 100, - }, - ]; - - let allocations = manager.allocate(&sources); - - assert_eq!(allocations.len(), 3); - - // Identity has highest priority, should get most tokens proportionally - let identity = allocations - .iter() - .find(|a| a.source_name == "identity") - .unwrap(); - let conversation = allocations - .iter() - .find(|a| a.source_name == "conversation") - .unwrap(); - - // 95/(95+80+70) = 95/245 ≈ 0.388 → ~388 tokens - assert!(identity.allocated_tokens > 350); - assert!(identity.allocated_tokens < 450); - - // Conversation: 80/245 ≈ 0.327 → ~327 tokens - assert!(conversation.allocated_tokens > 280); - assert!(conversation.allocated_tokens < 380); - } - - #[test] - fn test_minimum_tokens_respected() { - let manager = BudgetManager::new(100); // Small budget - - let sources = vec![SourceConfig { - name: "identity".to_string(), - priority: 10, - default_percent: 10, - min_tokens: 200, // More than total budget! - }]; - - let allocations = manager.allocate(&sources); - - // Should respect minimum even if over budget - assert_eq!(allocations[0].allocated_tokens, 200); - } - - #[test] - fn test_empty_sources() { - let manager = BudgetManager::new(1000); - let allocations = manager.allocate(&[]); - assert!(allocations.is_empty()); - } -} diff --git a/core/continuum-perception/src/rag/engine.rs b/core/continuum-perception/src/rag/engine.rs deleted file mode 100644 index cd809ef06c..0000000000 --- a/core/continuum-perception/src/rag/engine.rs +++ /dev/null @@ -1,237 +0,0 @@ -//! RAG Engine - Context Composition -//! -//! Loads every applicable source (sequentially, see `build_context`) and composes -//! them into one context with per-source timings. - -use super::budget::{BudgetManager, SourceConfig}; -use super::sources::RagSource; -use super::types::{LlmMessage, RagContext, RagOptions, RagSection, SourceTiming}; -use std::sync::Arc; -use std::time::Instant; -use tracing::{info, warn}; - -/// RAG Engine - composes context from multiple sources -pub struct RagEngine { - sources: Vec>, - default_budget: usize, -} - -impl RagEngine { - pub fn new() -> Self { - Self { - sources: Vec::new(), - default_budget: 8000, // Default token budget - } - } - - /// Register a RAG source - pub fn register_source(&mut self, source: Arc) { - self.sources.push(source); - } - - /// Build RAG context — sources load SEQUENTIALLY (see step 4: IPC dispatch blocks - /// rayon threads on these results, so parallel loads starved the pool). - pub async fn build_context(&self, options: RagOptions) -> RagContext { - let start = Instant::now(); - - // 1. Filter applicable sources - let applicable: Vec<_> = self - .sources - .iter() - .filter(|s| s.is_applicable(&options)) - .cloned() - .collect(); - - if applicable.is_empty() { - warn!("No applicable RAG sources for room={}", options.room_id); - return self.empty_context(options, start); - } - - info!( - "RAG: {} sources applicable for room={} (voice_mode={})", - applicable.len(), - options.room_id, - options.is_voice_mode() - ); - - // 2. Get source configs for budget allocation - let source_configs: Vec = applicable.iter().map(|s| s.config()).collect(); - - // 3. Allocate budget - let budget_manager = BudgetManager::new(options.max_tokens.max(self.default_budget)); - let allocations = budget_manager.allocate(&source_configs); - - // 4. Load ALL sources SEQUENTIALLY to avoid Rayon thread starvation - // (IPC dispatch uses Rayon threads that block waiting for these results) - let sections: Vec = applicable - .iter() - .zip(allocations.iter()) - .map(|(source, allocation)| { - let source_start = Instant::now(); - - // Load source (this is the expensive part) - let mut section = source.load(&options, allocation.allocated_tokens); - - section.load_time_ms = source_start.elapsed().as_secs_f64() * 1000.0; - section - }) - .collect(); - - // 5. Compose final context - let context = self.compose(options.clone(), sections, start); - - info!( - "RAG: Composed context in {:.1}ms ({} tokens, {} sources)", - context.composition_time_ms, - context.total_tokens, - context.source_timings.len() - ); - - context - } - - /// Compose sections into final context - fn compose( - &self, - options: RagOptions, - sections: Vec, - start: Instant, - ) -> RagContext { - let mut system_parts: Vec = Vec::new(); - let mut messages: Vec = Vec::new(); - let mut total_tokens = 0; - let mut timings: Vec = Vec::new(); - - // Sort sections by priority (from source config) - // Higher priority sources go first in system prompt - let mut sorted_sections = sections; - sorted_sections.sort_by(|_a, _b| { - // Preserve order based on source registration (assumed priority order) - // TODO: Sort by priority from source config - std::cmp::Ordering::Equal - }); - - for section in sorted_sections { - // Collect system prompt sections - if let Some(prompt_section) = §ion.system_prompt_section { - if !prompt_section.is_empty() { - system_parts.push(prompt_section.clone()); - } - } - - // Collect messages - messages.extend(section.messages.clone()); - - // Track tokens and timing - total_tokens += section.token_count; - timings.push(SourceTiming { - name: section.source_name.clone(), - load_time_ms: section.load_time_ms, - token_count: section.token_count, - }); - } - - // Build system prompt - let system_prompt = system_parts.join("\n\n---\n\n"); - - RagContext { - persona_id: options.persona_id, - room_id: options.room_id, - system_prompt, - messages, - total_tokens, - composition_time_ms: start.elapsed().as_secs_f64() * 1000.0, - source_timings: timings, - } - } - - fn empty_context(&self, options: RagOptions, start: Instant) -> RagContext { - RagContext { - persona_id: options.persona_id, - room_id: options.room_id, - system_prompt: String::new(), - messages: Vec::new(), - total_tokens: 0, - composition_time_ms: start.elapsed().as_secs_f64() * 1000.0, - source_timings: Vec::new(), - } - } -} - -impl Default for RagEngine { - fn default() -> Self { - Self::new() - } -} - -#[cfg(test)] -mod tests { - use super::super::sources::MockSource; - use super::*; - use uuid::Uuid; - - // what this catches: a source skipped, loaded twice, or reported out of registration - // order, and a timing that is the source's own claim rather than the engine's - // measurement. Lower bounds only: a sleep lasts AT LEAST its duration on any host, - // so no load, CPU or scheduler can fail this — the old `< 250 ms` ceiling failed on - // a loaded M5 (card c4d84be3) and asserted a parallelism the engine does not have - // (sources load sequentially, see `build_context`). - #[tokio::test] - async fn every_applicable_source_loads_once_in_order_and_the_engine_times_it() { - let mut engine = RagEngine::new(); - engine.register_source(Arc::new(MockSource::new("fast", 10, 100))); - engine.register_source(Arc::new(MockSource::new("slow", 50, 500))); - engine.register_source(Arc::new(MockSource::new("medium", 30, 200))); - - let options = RagOptions { - room_id: Uuid::new_v4(), - persona_id: Uuid::new_v4(), - max_tokens: 4000, - ..Default::default() - }; - - let context = engine.build_context(options).await; - - let names: Vec<&str> = context.source_timings.iter().map(|t| t.name.as_str()).collect(); - assert_eq!(names, vec!["fast", "slow", "medium"], "each source once, in registration order"); - assert_eq!(context.total_tokens, 800, "every section's tokens are counted"); - for (timing, slept_ms) in context.source_timings.iter().zip([10.0, 50.0, 30.0]) { - assert!( - timing.load_time_ms >= slept_ms, - "{} measured {:.1} ms but slept {slept_ms} ms: the engine must time the load itself", - timing.name, - timing.load_time_ms - ); - } - let loads: f64 = context.source_timings.iter().map(|t| t.load_time_ms).sum(); - assert!( - context.composition_time_ms >= loads, - "the composition window ({:.1} ms) covers every load ({loads:.1} ms)", - context.composition_time_ms - ); - } - - #[tokio::test] - async fn test_voice_mode_filters_sources() { - let mut engine = RagEngine::new(); - - // One source that skips voice mode - engine.register_source(Arc::new(MockSource::new_skip_voice("semantic", 50, 100))); - // One source that works in voice mode - engine.register_source(Arc::new(MockSource::new("identity", 10, 100))); - - let options = RagOptions { - room_id: Uuid::new_v4(), - persona_id: Uuid::new_v4(), - max_tokens: 4000, - voice_session_id: Some(Uuid::new_v4()), // Voice mode! - ..Default::default() - }; - - let context = engine.build_context(options).await; - - // Only identity should load (semantic skips voice mode) - assert_eq!(context.source_timings.len(), 1); - assert_eq!(context.source_timings[0].name, "identity"); - } -} diff --git a/core/continuum-perception/src/rag/mod.rs b/core/continuum-perception/src/rag/mod.rs deleted file mode 100644 index 52ea744bba..0000000000 --- a/core/continuum-perception/src/rag/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -//! RAG (Retrieval-Augmented Generation) Engine -//! -//! Parallel source loading, budget allocation, context composition. -//! This is the brain's memory retrieval system. -//! -//! Design: All sources load in PARALLEL via rayon, not serial. -//! Target: <500ms total composition time (currently 20+ seconds in TypeScript) - -pub mod budget; -pub mod engine; -pub mod sources; -pub mod types; - -pub use engine::RagEngine; -pub use types::*; diff --git a/core/continuum-perception/src/rag/sources/conversation.rs b/core/continuum-perception/src/rag/sources/conversation.rs deleted file mode 100644 index 6eac74d357..0000000000 --- a/core/continuum-perception/src/rag/sources/conversation.rs +++ /dev/null @@ -1,98 +0,0 @@ -//! Conversation History Source -//! -//! Loads recent conversation messages from the current room -//! Priority: 80 (high - conversation context is critical) - -use super::{RagSource, SourceConfig}; -use crate::rag::types::{LlmMessage, RagOptions, RagSection}; -use tracing::debug; - -/// Conversation history source - what's been said in this room? -pub struct ConversationHistorySource { - // TODO: Database connection for message lookup -} - -impl ConversationHistorySource { - pub fn new() -> Self { - Self {} - } -} - -impl Default for ConversationHistorySource { - fn default() -> Self { - Self::new() - } -} - -impl RagSource for ConversationHistorySource { - fn name(&self) -> &str { - "conversation-history" - } - - fn config(&self) -> SourceConfig { - SourceConfig { - name: self.name().to_string(), - priority: 80, // High - conversation context is critical - default_percent: 50, - min_tokens: 500, - } - } - - fn is_applicable(&self, _options: &RagOptions) -> bool { - // Always applicable - every response needs conversation context - true - } - - fn load(&self, options: &RagOptions, allocated_budget: usize) -> RagSection { - debug!( - "Loading conversation history for room {} (budget: {} tokens)", - options.room_id, allocated_budget - ); - - // TODO: Load from database - // Calculate max messages based on budget (assume ~30 tokens per message) - let _max_messages = allocated_budget / 30; - - // For now, return empty messages (will be filled by DB query) - let messages: Vec = vec![]; - - RagSection { - source_name: self.name().to_string(), - token_count: 0, // Will be calculated from actual messages - load_time_ms: 0.0, // Will be set by engine - messages, - system_prompt_section: None, // Conversation goes in messages, not system prompt - metadata: Default::default(), - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use uuid::Uuid; - - #[test] - fn test_conversation_always_applicable() { - let source = ConversationHistorySource::new(); - let options = RagOptions { - room_id: Uuid::new_v4(), - persona_id: Uuid::new_v4(), - ..Default::default() - }; - - assert!(source.is_applicable(&options)); - } - - #[test] - fn test_conversation_priority() { - let source = ConversationHistorySource::new(); - assert_eq!(source.config().priority, 80); - } - - #[test] - fn test_conversation_high_budget() { - let source = ConversationHistorySource::new(); - assert_eq!(source.config().default_percent, 50); // Gets half the budget - } -} diff --git a/core/continuum-perception/src/rag/sources/identity.rs b/core/continuum-perception/src/rag/sources/identity.rs deleted file mode 100644 index ac1737b2be..0000000000 --- a/core/continuum-perception/src/rag/sources/identity.rs +++ /dev/null @@ -1,112 +0,0 @@ -//! Persona Identity Source -//! -//! Loads persona identity (name, bio, system prompt) -//! Priority: 95 (highest - identity is foundational) - -use super::{RagSource, SourceConfig}; -use crate::rag::types::{RagOptions, RagSection}; -use tracing::debug; - -/// Persona identity source - who is this AI? -pub struct PersonaIdentitySource { - // TODO: Database connection for persona lookup -} - -impl PersonaIdentitySource { - pub fn new() -> Self { - Self {} - } -} - -impl Default for PersonaIdentitySource { - fn default() -> Self { - Self::new() - } -} - -impl RagSource for PersonaIdentitySource { - fn name(&self) -> &str { - "persona-identity" - } - - fn config(&self) -> SourceConfig { - SourceConfig { - name: self.name().to_string(), - priority: 95, // Highest - identity is foundational - default_percent: 10, - min_tokens: 200, - } - } - - fn is_applicable(&self, _options: &RagOptions) -> bool { - // Always applicable - every response needs identity - true - } - - fn load(&self, options: &RagOptions, allocated_budget: usize) -> RagSection { - debug!( - "Loading persona identity for {} (budget: {} tokens)", - options.persona_id, allocated_budget - ); - - // TODO: Load from database - // For now, return placeholder - let system_prompt = format!( - "## Persona Identity\n\nYou are a helpful AI assistant.\nPersona ID: {}", - options.persona_id - ); - - let tokens = continuum_base::token_estimate::estimate_prompt_tokens(&system_prompt) as usize; - - RagSection { - source_name: self.name().to_string(), - token_count: tokens, - load_time_ms: 0.0, // Will be set by engine - messages: vec![], - system_prompt_section: Some(system_prompt), - metadata: Default::default(), - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use uuid::Uuid; - - #[test] - fn test_identity_always_applicable() { - let source = PersonaIdentitySource::new(); - let options = RagOptions { - room_id: Uuid::new_v4(), - persona_id: Uuid::new_v4(), - ..Default::default() - }; - - assert!(source.is_applicable(&options)); - } - - #[test] - fn test_identity_high_priority() { - let source = PersonaIdentitySource::new(); - assert_eq!(source.config().priority, 95); - } - - #[test] - fn test_identity_loads_system_prompt() { - let source = PersonaIdentitySource::new(); - let options = RagOptions { - room_id: Uuid::new_v4(), - persona_id: Uuid::new_v4(), - ..Default::default() - }; - - let section = source.load(&options, 1000); - - assert!(section.system_prompt_section.is_some()); - assert!(section - .system_prompt_section - .unwrap() - .contains("Persona Identity")); - } -} diff --git a/core/continuum-perception/src/rag/sources/mod.rs b/core/continuum-perception/src/rag/sources/mod.rs deleted file mode 100644 index 16cb765bb3..0000000000 --- a/core/continuum-perception/src/rag/sources/mod.rs +++ /dev/null @@ -1,96 +0,0 @@ -//! RAG Sources -//! -//! Each source implements the RagSource trait; the engine loads them in order - -mod conversation; -mod identity; - -pub use conversation::ConversationHistorySource; -pub use identity::PersonaIdentitySource; - -use super::budget::SourceConfig; -use super::types::{RagOptions, RagSection}; - -/// Trait for RAG sources - implement this to add new sources -pub trait RagSource: Send + Sync { - /// Source name (for logging/debugging) - fn name(&self) -> &str; - - /// Source configuration (priority, budget allocation) - fn config(&self) -> SourceConfig; - - /// Check if this source applies to the current context - fn is_applicable(&self, options: &RagOptions) -> bool; - - /// Load content from this source - /// Called once per build, in registration order (`RagEngine::build_context`) - fn load(&self, options: &RagOptions, allocated_budget: usize) -> RagSection; -} - -/// Mock source for testing source loading: sleeps `delay_ms`, yields `tokens` -#[cfg(test)] -pub struct MockSource { - name: String, - delay_ms: u64, - tokens: usize, - skip_voice: bool, -} - -#[cfg(test)] -impl MockSource { - pub fn new(name: &str, delay_ms: u64, tokens: usize) -> Self { - Self { - name: name.to_string(), - delay_ms, - tokens, - skip_voice: false, - } - } - - pub fn new_skip_voice(name: &str, delay_ms: u64, tokens: usize) -> Self { - Self { - name: name.to_string(), - delay_ms, - tokens, - skip_voice: true, - } - } -} - -#[cfg(test)] -impl RagSource for MockSource { - fn name(&self) -> &str { - &self.name - } - - fn config(&self) -> SourceConfig { - SourceConfig { - name: self.name.clone(), - priority: 50, - default_percent: 20, - min_tokens: 100, - } - } - - fn is_applicable(&self, options: &RagOptions) -> bool { - // Skip voice mode if configured - if self.skip_voice && options.is_voice_mode() { - return false; - } - true - } - - fn load(&self, _options: &RagOptions, _allocated_budget: usize) -> RagSection { - // Simulate load time - std::thread::sleep(std::time::Duration::from_millis(self.delay_ms)); - - RagSection { - source_name: self.name.clone(), - token_count: self.tokens, - load_time_ms: self.delay_ms as f64, - messages: vec![], - system_prompt_section: Some(format!("Mock content from {}", self.name)), - metadata: Default::default(), - } - } -} diff --git a/core/continuum-perception/src/rag/types.rs b/core/continuum-perception/src/rag/types.rs deleted file mode 100644 index f03b66584d..0000000000 --- a/core/continuum-perception/src/rag/types.rs +++ /dev/null @@ -1,130 +0,0 @@ -//! RAG Core Types -//! -//! Single source of truth for RAG types - exported to TypeScript via ts-rs -//! TypeScript should import from protocol/typescript/rag/index.ts - -use serde::{Deserialize, Serialize}; -use ts_rs::TS; -use uuid::Uuid; - -/// Message role in conversation -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, TS)] -#[serde(rename_all = "lowercase")] -#[ts(export, export_to = "../../../protocol/typescript/rag/MessageRole.ts")] -pub enum MessageRole { - System, - User, - Assistant, -} - -/// LLM message format -#[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export, export_to = "../../../protocol/typescript/rag/LlmMessage.ts")] -pub struct LlmMessage { - pub role: MessageRole, - pub content: String, - pub name: Option, - pub timestamp: Option, -} - -/// Section loaded by a RAG source (internal, not exported to TS) -#[derive(Debug, Clone, Default)] -pub struct RagSection { - pub source_name: String, - pub token_count: usize, - pub load_time_ms: f64, - pub messages: Vec, - pub system_prompt_section: Option, - pub metadata: RagMetadata, -} - -/// Metadata attached to RAG sections -#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export, export_to = "../../../protocol/typescript/rag/RagMetadata.ts")] -pub struct RagMetadata { - /// Additional metadata as key-value pairs - #[ts(type = "Record")] - pub extra: std::collections::HashMap, -} - -/// Options for RAG context building -#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] -#[ts(export, export_to = "../../../protocol/typescript/rag/RagOptions.ts")] -pub struct RagOptions { - #[ts(type = "string")] - pub room_id: Uuid, - #[ts(type = "string")] - pub persona_id: Uuid, - pub max_tokens: usize, - #[ts(optional, type = "string")] - pub voice_session_id: Option, - pub skip_semantic_search: bool, - #[ts(optional)] - pub current_message: Option, -} - -impl RagOptions { - pub fn is_voice_mode(&self) -> bool { - self.voice_session_id.is_some() - } -} - -/// Timing info for each source - performance metrics -#[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export, export_to = "../../../protocol/typescript/rag/SourceTiming.ts")] -pub struct SourceTiming { - pub name: String, - pub load_time_ms: f64, - pub token_count: usize, -} - -/// Complete RAG context ready for LLM - the output of RAG engine -#[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export, export_to = "../../../protocol/typescript/rag/RagContext.ts")] -pub struct RagContext { - #[ts(type = "string")] - pub persona_id: Uuid, - #[ts(type = "string")] - pub room_id: Uuid, - pub system_prompt: String, - pub messages: Vec, - pub total_tokens: usize, - pub composition_time_ms: f64, - pub source_timings: Vec, -} - -/// Budget allocation for a source (internal, not exported) -#[derive(Debug, Clone)] -pub struct BudgetAllocation { - pub source_name: String, - pub allocated_tokens: usize, - pub priority: u8, -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_voice_mode_detection() { - let mut opts = RagOptions::default(); - assert!(!opts.is_voice_mode()); - - opts.voice_session_id = Some(Uuid::new_v4()); - assert!(opts.is_voice_mode()); - } - - #[test] - fn test_llm_message_serialization() { - let msg = LlmMessage { - role: MessageRole::User, - content: "Hello".to_string(), - name: Some("test-user".to_string()), - timestamp: Some(1234567890), - }; - - let json = serde_json::to_string(&msg).unwrap(); - assert!(json.contains("\"role\":\"user\"")); - assert!(json.contains("\"content\":\"Hello\"")); - } -} diff --git a/protocol/typescript/rag/LlmMessage.ts b/protocol/typescript/rag/LlmMessage.ts deleted file mode 100644 index 9546ae8d39..0000000000 --- a/protocol/typescript/rag/LlmMessage.ts +++ /dev/null @@ -1,7 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { MessageRole } from "./MessageRole"; - -/** - * LLM message format - */ -export type LlmMessage = { role: MessageRole, content: string, name: string | null, timestamp: bigint | null, }; diff --git a/protocol/typescript/rag/MessageRole.ts b/protocol/typescript/rag/MessageRole.ts deleted file mode 100644 index 43dd7c809b..0000000000 --- a/protocol/typescript/rag/MessageRole.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Message role in conversation - */ -export type MessageRole = "system" | "user" | "assistant"; diff --git a/protocol/typescript/rag/RagContext.ts b/protocol/typescript/rag/RagContext.ts deleted file mode 100644 index 3bcc1e981d..0000000000 --- a/protocol/typescript/rag/RagContext.ts +++ /dev/null @@ -1,8 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -import type { LlmMessage } from "./LlmMessage"; -import type { SourceTiming } from "./SourceTiming"; - -/** - * Complete RAG context ready for LLM - the output of RAG engine - */ -export type RagContext = { persona_id: string, room_id: string, system_prompt: string, messages: Array, total_tokens: number, composition_time_ms: number, source_timings: Array, }; diff --git a/protocol/typescript/rag/RagMetadata.ts b/protocol/typescript/rag/RagMetadata.ts deleted file mode 100644 index 1f3df92e97..0000000000 --- a/protocol/typescript/rag/RagMetadata.ts +++ /dev/null @@ -1,10 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Metadata attached to RAG sections - */ -export type RagMetadata = { -/** - * Additional metadata as key-value pairs - */ -extra: Record, }; diff --git a/protocol/typescript/rag/RagOptions.ts b/protocol/typescript/rag/RagOptions.ts deleted file mode 100644 index a278f3c437..0000000000 --- a/protocol/typescript/rag/RagOptions.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Options for RAG context building - */ -export type RagOptions = { room_id: string, persona_id: string, max_tokens: number, voice_session_id?: string, skip_semantic_search: boolean, current_message?: string, }; diff --git a/protocol/typescript/rag/SourceTiming.ts b/protocol/typescript/rag/SourceTiming.ts deleted file mode 100644 index 00fed348ca..0000000000 --- a/protocol/typescript/rag/SourceTiming.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -/** - * Timing info for each source - performance metrics - */ -export type SourceTiming = { name: string, load_time_ms: number, token_count: number, }; diff --git a/protocol/typescript/rag/index.ts b/protocol/typescript/rag/index.ts index 8ffd99008e..9337dd423c 100644 --- a/protocol/typescript/rag/index.ts +++ b/protocol/typescript/rag/index.ts @@ -8,19 +8,13 @@ export type { ConsciousnessTemporalInfo } from './ConsciousnessTemporalInfo'; export type { CustomSection } from './CustomSection'; export type { CustomSourceParams } from './CustomSourceParams'; export type { EmptyMetadata } from './EmptyMetadata'; -export type { LlmMessage } from './LlmMessage'; export type { MemorySourceMetadata } from './MemorySourceMetadata'; export type { MemorySourceParams } from './MemorySourceParams'; -export type { MessageRole } from './MessageRole'; export type { ProjectSourceParams } from './ProjectSourceParams'; export type { RagComposeRequest } from './RagComposeRequest'; export type { RagComposeResult } from './RagComposeResult'; -export type { RagContext } from './RagContext'; -export type { RagMetadata } from './RagMetadata'; -export type { RagOptions } from './RagOptions'; export type { RagSection } from './RagSection'; export type { RagSourceMetadata } from './RagSourceMetadata'; export type { RagSourceRequest } from './RagSourceRequest'; export type { RagSourceResult } from './RagSourceResult'; export type { SceneSourceParams } from './SceneSourceParams'; -export type { SourceTiming } from './SourceTiming';