Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/.venv
__pycache__/
.pytest_cache/
*.profraw
lcov.info
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ serde = { version = "1", features = ["derive"] }
[dev-dependencies]
tempfile = "3"
filetime = "0.2"
libc = "0.2"

[profile.release]
strip = true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Fork. Watch. Control. From anywhere.
*Named for the Norse guardian who watches over Bifrost — Heimdall sees all, hears all, and nothing escapes on his watch.*

[![CI](https://github.com/nazq/heimdall/actions/workflows/ci.yml/badge.svg)](https://github.com/nazq/heimdall/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/nazq/heimdall/graph/badge.svg)](https://codecov.io/gh/nazq/heimdall)
[![codecov](https://codecov.io/gh/nazq/heimdall/graph/badge.svg?token=opgTAX2W8k)](https://codecov.io/gh/nazq/heimdall)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Rust](https://img.shields.io/badge/rust-2024_edition-orange.svg)](https://www.rust-lang.org/)

Expand Down
2 changes: 1 addition & 1 deletion src/attach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const STATUS_POLL_INTERVAL: std::time::Duration =
/// (Ctrl-\ or session exit), the supervisor keeps running in the background.
pub fn launch_and_attach(params: SessionParams) -> anyhow::Result<()> {
let exe = std::env::current_exe()?;
let child_args = params.to_detach_args();
let child_args = params.to_detach_args()?;

// Spawn supervisor in background with setsid() for terminal independence.
let _supervisor = unsafe {
Expand Down
3 changes: 3 additions & 0 deletions src/classify/claude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ impl StateClassifier for ClaudeClassifier {
self.state_entered_at = now_ms;
self.pending_state = None;
}
}

#[cfg(test)]
impl ClaudeClassifier {
fn state_name(&self, state: u8) -> &'static str {
match state {
0x00 => "idle",
Expand Down
7 changes: 0 additions & 7 deletions src/classify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ pub trait StateClassifier: Send {

/// Force state to Dead (on child exit).
fn set_dead(&mut self, now_ms: u64);

/// Human-readable name for a state byte.
fn state_name(&self, state: u8) -> &'static str;
}

/// Create a classifier from config.
Expand Down Expand Up @@ -96,7 +93,6 @@ mod tests {
debounce_ms: 200,
});
assert_eq!(c.state(), ProcessState::Idle);
assert_eq!(c.state_name(0x01), "thinking"); // only claude knows "thinking"
}

#[test]
Expand All @@ -105,15 +101,12 @@ mod tests {
idle_threshold_ms: 3000,
});
assert_eq!(c.state(), ProcessState::Idle);
assert_eq!(c.state_name(0x04), "active"); // simple knows "active"
assert_eq!(c.state_name(0x01), "unknown"); // simple doesn't know "thinking"
}

#[test]
fn from_config_none() {
let c = from_config(&ClassifierConfig::None);
assert_eq!(c.state(), ProcessState::Idle);
assert_eq!(c.state_name(0x01), "idle"); // none reports everything as idle
}

/// Issue #6: classifier orthogonality — simple uses Active, claude never does.
Expand Down
3 changes: 3 additions & 0 deletions src/classify/none.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ impl StateClassifier for NoneClassifier {
}

fn set_dead(&mut self, _now_ms: u64) {}
}

#[cfg(test)]
impl NoneClassifier {
fn state_name(&self, state: u8) -> &'static str {
match state {
0xFF => "dead",
Expand Down
3 changes: 3 additions & 0 deletions src/classify/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ impl StateClassifier for SimpleClassifier {
self.current_state = ProcessState::Dead;
self.state_entered_at = now_ms;
}
}

#[cfg(test)]
impl SimpleClassifier {
fn state_name(&self, state: u8) -> &'static str {
match state {
0x00 => "idle",
Expand Down
Loading
Loading