InteractScreen in chat.rs owns conversation/autonomous/tools panes, textarea, input history, scroll state. App is now just shared state (status, sampling params, agent_state, channel_status, idle_info). Event loop holds InteractScreen separately for UiMessage routing. Overlay screens (F2-F5) in screens vec. F-key switching preserves state across screen changes. handle_ui_message moved from App to InteractScreen. handle_key split: global keys on App, screen keys in tick(). draw dispatch eliminated — each screen draws itself. Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
89 lines
2.4 KiB
Rust
89 lines
2.4 KiB
Rust
// consciousness — unified crate for memory, agents, and subconscious processes
|
|
//
|
|
// thought/ — shared cognitive substrate (tools, context, memory ops)
|
|
// hippocampus/ — memory storage, retrieval, consolidation
|
|
// subconscious/ — autonomous agents (reflect, surface, consolidate, ...)
|
|
// user/ — interactive agent (TUI, tools, API clients)
|
|
|
|
/// Debug logging macro — writes to ~/.consciousness/logs/debug.log
|
|
#[macro_export]
|
|
macro_rules! dbglog {
|
|
($($arg:tt)*) => {{
|
|
use std::io::Write;
|
|
let log_dir = std::path::PathBuf::from(
|
|
std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string()))
|
|
.join(".consciousness/logs");
|
|
let _ = std::fs::create_dir_all(&log_dir);
|
|
if let Ok(mut f) = std::fs::OpenOptions::new()
|
|
.create(true).append(true)
|
|
.open(log_dir.join("debug.log"))
|
|
{
|
|
let _ = writeln!(f, $($arg)*);
|
|
}
|
|
}};
|
|
}
|
|
|
|
// User interface (TUI, CLI)
|
|
pub mod user;
|
|
|
|
// Cognitive layer (session state machine, DMN, identity)
|
|
pub mod mind;
|
|
|
|
// Shared cognitive infrastructure — used by both agent and subconscious
|
|
pub mod agent;
|
|
|
|
// Memory graph
|
|
pub mod hippocampus;
|
|
|
|
// Autonomous agents
|
|
pub mod subconscious;
|
|
|
|
// Unified configuration
|
|
pub mod config;
|
|
|
|
// Session state
|
|
pub mod session;
|
|
|
|
// Shared utilities
|
|
pub mod util;
|
|
|
|
// CLI handlers
|
|
pub mod cli;
|
|
|
|
// TUI for memory-search
|
|
// tui moved to src/user/tui/ (consciousness binary screens)
|
|
|
|
// Thalamus — universal notification routing and channel infrastructure
|
|
pub mod thalamus;
|
|
|
|
// Claude Code integration layer (idle timer, hooks, daemon CLI)
|
|
pub mod claude;
|
|
|
|
// Re-export at crate root — capnp codegen emits `crate::daemon_capnp::` paths
|
|
pub use thalamus::daemon_capnp;
|
|
|
|
// Generated capnp bindings
|
|
pub mod memory_capnp {
|
|
include!(concat!(env!("OUT_DIR"), "/schema/memory_capnp.rs"));
|
|
}
|
|
|
|
pub mod channel_capnp {
|
|
include!(concat!(env!("OUT_DIR"), "/schema/channel_capnp.rs"));
|
|
}
|
|
|
|
// Re-exports — all existing crate::X paths keep working
|
|
pub use hippocampus::{
|
|
store, graph, lookups, cursor, query,
|
|
similarity, spectral, neuro, counters,
|
|
transcript, memory,
|
|
};
|
|
pub use hippocampus::query::engine as search;
|
|
pub use hippocampus::query::parser as query_parser;
|
|
|
|
pub use subconscious as agents;
|
|
pub use subconscious::{
|
|
audit, consolidate,
|
|
digest, daemon,
|
|
};
|
|
// Backward compat: memory_search moved from subconscious::hook to claude::hook
|
|
pub use claude::hook as memory_search;
|