DMN: wire dream hours reminder into Foraging state
The hours_since_last_dream() function existed but wasn't called after refactoring moved the DMN prompts from hooks to Rust. Now shows "You haven't dreamed in X hours" when >= 18h since last dream session. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
4603947506
commit
81e0632cf3
1 changed files with 15 additions and 2 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
use crate::thalamus::idle::{hours_since_last_dream, DREAM_INTERVAL_HOURS};
|
||||||
|
|
||||||
/// DMN state machine.
|
/// DMN state machine.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
@ -138,10 +139,22 @@ impl State {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
State::Foraging => {
|
State::Foraging => {
|
||||||
|
let dream_hint = {
|
||||||
|
let hours = hours_since_last_dream();
|
||||||
|
if hours >= DREAM_INTERVAL_HOURS {
|
||||||
|
format!(
|
||||||
|
" You haven't dreamed in {} hours — consider running \
|
||||||
|
~/.consciousness/tools/dream-start.sh.",
|
||||||
|
hours
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
|
}
|
||||||
|
};
|
||||||
format!(
|
format!(
|
||||||
"[dmn] Foraging time. {} Follow whatever catches your attention — \
|
"[dmn] Foraging time. {} Follow whatever catches your attention — \
|
||||||
memory files, code, ideas. Call yield_to_user when you want to rest.{}",
|
memory files, code, ideas. Call yield_to_user when you want to rest.{}{}",
|
||||||
idle_info, stuck_warning
|
idle_info, dream_hint, stuck_warning
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
State::Resting { since } => {
|
State::Resting { since } => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue