move Claude Code-specific code from thalamus/ to claude/
Separates the Claude-specific daemon (idle timer, tmux pane detection,
prompt injection, RPC server, session hooks) from the universal
infrastructure (channels, supervisor, notify, daemon protocol).
thalamus/ now contains only substrate-independent code: the channel
client/supervisor, notification system, daemon_capnp protocol, and
shared helpers (now(), home()).
claude/ contains: idle.rs, tmux.rs, context.rs, rpc.rs, config.rs,
hook.rs (moved from subconscious/), plus the daemon CLI and server
startup code from thalamus/mod.rs.
All re-exports preserved for backward compatibility.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-03 19:14:39 -04:00
|
|
|
// thalamus/ — universal notification routing and channel infrastructure
|
2026-04-03 17:31:17 -04:00
|
|
|
//
|
move Claude Code-specific code from thalamus/ to claude/
Separates the Claude-specific daemon (idle timer, tmux pane detection,
prompt injection, RPC server, session hooks) from the universal
infrastructure (channels, supervisor, notify, daemon protocol).
thalamus/ now contains only substrate-independent code: the channel
client/supervisor, notification system, daemon_capnp protocol, and
shared helpers (now(), home()).
claude/ contains: idle.rs, tmux.rs, context.rs, rpc.rs, config.rs,
hook.rs (moved from subconscious/), plus the daemon CLI and server
startup code from thalamus/mod.rs.
All re-exports preserved for backward compatibility.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-03 19:14:39 -04:00
|
|
|
// Contains the shared daemon protocol, notification system, channel
|
|
|
|
|
// client/supervisor, and utility helpers used by both Claude-specific
|
|
|
|
|
// code (in claude/) and the future substrate-independent consciousness
|
|
|
|
|
// binary.
|
2026-04-03 17:31:17 -04:00
|
|
|
|
2026-04-03 18:46:14 -04:00
|
|
|
pub mod channels;
|
split idle state: thalamus (universal) + claude (tmux wrapper)
thalamus/idle.rs: pure state machine — activity tracking, EWMA,
timers, sleep/quiet/dream state, notifications. No tmux, no
Claude Code dependencies.
claude/idle.rs: wraps thalamus state via Deref, adds claude_pane
tracking, tmux prompt injection, dream nudges, context building.
The Claude-specific tick() loop stays here.
The consciousness binary can now use thalamus::idle::State directly,
fed by TUI key events instead of tmux pane scraping.
Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-03 19:25:20 -04:00
|
|
|
pub mod idle;
|
2026-04-03 18:46:14 -04:00
|
|
|
pub mod supervisor;
|
2026-04-03 17:31:17 -04:00
|
|
|
pub mod notify;
|
|
|
|
|
|
|
|
|
|
pub mod daemon_capnp {
|
|
|
|
|
include!(concat!(env!("OUT_DIR"), "/schema/daemon_capnp.rs"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
use std::path::PathBuf;
|
move Claude Code-specific code from thalamus/ to claude/
Separates the Claude-specific daemon (idle timer, tmux pane detection,
prompt injection, RPC server, session hooks) from the universal
infrastructure (channels, supervisor, notify, daemon protocol).
thalamus/ now contains only substrate-independent code: the channel
client/supervisor, notification system, daemon_capnp protocol, and
shared helpers (now(), home()).
claude/ contains: idle.rs, tmux.rs, context.rs, rpc.rs, config.rs,
hook.rs (moved from subconscious/), plus the daemon CLI and server
startup code from thalamus/mod.rs.
All re-exports preserved for backward compatibility.
Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-03 19:14:39 -04:00
|
|
|
use std::time::{SystemTime, UNIX_EPOCH};
|
2026-04-03 17:31:17 -04:00
|
|
|
|
|
|
|
|
pub fn now() -> f64 {
|
|
|
|
|
SystemTime::now()
|
|
|
|
|
.duration_since(UNIX_EPOCH)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.as_secs_f64()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn home() -> PathBuf {
|
|
|
|
|
PathBuf::from(std::env::var("HOME").unwrap_or_else(|_| "/root".into()))
|
|
|
|
|
}
|