Rename mind/dmn.rs to mind/subconscious.rs
The file contains both the DMN state machine and the subconscious agent orchestration. Renaming to match the conceptual grouping — next step is adding mind/unconscious.rs for the standalone graph maintenance agents (organize, linker, etc.) that don't need conversation context. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
24b211dc35
commit
9704e7a698
4 changed files with 28 additions and 28 deletions
|
|
@ -4,7 +4,7 @@
|
|||
// Everything about how the mind operates, separate from the
|
||||
// user interface (TUI, CLI) and the agent execution (tools, API).
|
||||
|
||||
pub mod dmn;
|
||||
pub mod subconscious;
|
||||
pub mod identity;
|
||||
pub mod log;
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ use crate::agent::api::ApiClient;
|
|||
use crate::config::{AppConfig, SessionConfig};
|
||||
use crate::subconscious::learn;
|
||||
|
||||
pub use dmn::{SubconsciousSnapshot, Subconscious};
|
||||
pub use subconscious::{SubconsciousSnapshot, Subconscious};
|
||||
|
||||
use crate::agent::context::{AstNode, NodeBody, Section, Ast, ContextState};
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ pub struct MindState {
|
|||
/// True while a turn is in progress.
|
||||
pub turn_active: bool,
|
||||
/// DMN state
|
||||
pub dmn: dmn::State,
|
||||
pub dmn: subconscious::State,
|
||||
pub dmn_turns: u32,
|
||||
pub max_dmn_turns: u32,
|
||||
/// Whether memory scoring is running.
|
||||
|
|
@ -150,8 +150,8 @@ impl MindState {
|
|||
Self {
|
||||
input: Vec::new(),
|
||||
turn_active: false,
|
||||
dmn: if dmn::is_off() { dmn::State::Off }
|
||||
else { dmn::State::Resting { since: Instant::now() } },
|
||||
dmn: if subconscious::is_off() { subconscious::State::Off }
|
||||
else { subconscious::State::Resting { since: Instant::now() } },
|
||||
dmn_turns: 0,
|
||||
max_dmn_turns,
|
||||
scoring_in_flight: false,
|
||||
|
|
@ -175,7 +175,7 @@ impl MindState {
|
|||
self.dmn_turns = 0;
|
||||
self.consecutive_errors = 0;
|
||||
self.last_user_input = Instant::now();
|
||||
self.dmn = dmn::State::Engaged;
|
||||
self.dmn = subconscious::State::Engaged;
|
||||
Some(text)
|
||||
}
|
||||
|
||||
|
|
@ -190,21 +190,21 @@ impl MindState {
|
|||
self.consecutive_errors = 0;
|
||||
}
|
||||
self.last_turn_had_tools = turn_result.had_tool_calls;
|
||||
self.dmn = dmn::transition(
|
||||
self.dmn = subconscious::transition(
|
||||
&self.dmn,
|
||||
turn_result.yield_requested,
|
||||
turn_result.had_tool_calls,
|
||||
target == StreamTarget::Conversation,
|
||||
);
|
||||
if turn_result.dmn_pause {
|
||||
self.dmn = dmn::State::Paused;
|
||||
self.dmn = subconscious::State::Paused;
|
||||
self.dmn_turns = 0;
|
||||
}
|
||||
turn_result.model_switch.clone()
|
||||
}
|
||||
Err(_) => {
|
||||
self.consecutive_errors += 1;
|
||||
self.dmn = dmn::State::Resting { since: Instant::now() };
|
||||
self.dmn = subconscious::State::Resting { since: Instant::now() };
|
||||
None
|
||||
}
|
||||
}
|
||||
|
|
@ -212,18 +212,18 @@ impl MindState {
|
|||
|
||||
/// DMN tick — returns a prompt and target if we should run a turn.
|
||||
fn dmn_tick(&mut self) -> Option<(String, StreamTarget)> {
|
||||
if matches!(self.dmn, dmn::State::Paused | dmn::State::Off) {
|
||||
if matches!(self.dmn, subconscious::State::Paused | subconscious::State::Off) {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.dmn_turns += 1;
|
||||
if self.dmn_turns > self.max_dmn_turns {
|
||||
self.dmn = dmn::State::Resting { since: Instant::now() };
|
||||
self.dmn = subconscious::State::Resting { since: Instant::now() };
|
||||
self.dmn_turns = 0;
|
||||
return None;
|
||||
}
|
||||
|
||||
let dmn_ctx = dmn::DmnContext {
|
||||
let dmn_ctx = subconscious::DmnContext {
|
||||
user_idle: self.last_user_input.elapsed(),
|
||||
consecutive_errors: self.consecutive_errors,
|
||||
last_turn_had_tools: self.last_turn_had_tools,
|
||||
|
|
@ -234,7 +234,7 @@ impl MindState {
|
|||
|
||||
fn interrupt(&mut self) {
|
||||
self.input.clear();
|
||||
self.dmn = dmn::State::Resting { since: Instant::now() };
|
||||
self.dmn = subconscious::State::Resting { since: Instant::now() };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ impl Mind {
|
|||
MindCommand::NewSession => {
|
||||
{
|
||||
let mut s = self.shared.lock().unwrap();
|
||||
s.dmn = dmn::State::Resting { since: Instant::now() };
|
||||
s.dmn = subconscious::State::Resting { since: Instant::now() };
|
||||
s.dmn_turns = 0;
|
||||
}
|
||||
let new_log = log::ConversationLog::new(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue