hematite-cli 0.7.1

Senior SysAdmin, Network Admin, and Software Engineer living in your terminal. A high-precision local AI agent harness for LM Studio, Ollama, and other local OpenAI-compatible runtimes that runs 100% on your own silicon. Reads repos, edits files, runs builds, and inspects the machine it is running on—including full network state and workstation telemetry.
Documentation
/// Windows sleep inhibitor — prevents the OS from sleeping during active
/// inference or tool execution. Uses `SetThreadExecutionState` with
/// `ES_SYSTEM_REQUIRED` so the system stays awake without forcing the display on.
///
/// On non-Windows platforms this is a zero-cost no-op struct.
///
/// Usage: create a `SleepInhibitor` at the start of a model turn; it
/// automatically restores normal power policy when it drops.

#[cfg(target_os = "windows")]
mod imp {
    const ES_CONTINUOUS: u32 = 0x80000000;
    const ES_SYSTEM_REQUIRED: u32 = 0x00000001;

    #[link(name = "kernel32")]
    extern "system" {
        fn SetThreadExecutionState(esFlags: u32) -> u32;
    }

    pub struct SleepInhibitor;

    impl SleepInhibitor {
        pub fn acquire() -> Self {
            unsafe {
                SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
            }
            Self
        }
    }

    impl Drop for SleepInhibitor {
        fn drop(&mut self) {
            unsafe {
                SetThreadExecutionState(ES_CONTINUOUS);
            }
        }
    }
}

#[cfg(not(target_os = "windows"))]
mod imp {
    pub struct SleepInhibitor;
    impl SleepInhibitor {
        pub fn acquire() -> Self {
            Self
        }
    }
}

pub use imp::SleepInhibitor;