# Vitals for Windows How the Windows PC your agents run on is doing, live: the CPU as an equalizer with a column per core, memory, swap and load as segmented meters, an NVIDIA graphics card's temperature and load, network in and out, and every fixed disk, with a one-word health check (OK, WARN or HOT, and why). It opens as a floating window (Ctrl+Shift+M) or sits in the side panel beside Files and Changes. Connected Linux and macOS machines are read the way the original [herdr-vitals](https://github.com/mrolafsson/herdr-vitals) mod reads them. ![Vitals for Windows](preview.png) ## What you see - **Title bar** (window: 480px wide; panel: the panel's width): a pulse icon and "Vitals", a machine dropdown ("this computer" or a connected machine), "Less"/"More" (compact or full), "Update", and a close cross. - **Update notice** under the title bar, only after Update is clicked: "Up to date", or the new version with Update now / Not now, and a warning naming any mod files the person changed. - **Header:** host name (15px semibold), Windows edition, core count and uptime in dim 11.5px, and a health pill (green OK, yellow WARN, red HOT). - **CPU:** an equalizer, one column per core (past 24, neighbours share a column), segments lit from the bottom in the theme's green, yellow then red, peaks holding and falling. Beside it the overall percentage in 30px mono, "% busy", and user/sys. Under it a thin history strip of the last readings. - **Memory and load:** Memory, Swap and Load meters of 22 segments. - **Graphics** (NVIDIA only): "Graphics · ", Temp (°C) and Load (with VRAM used) meters. - **Network:** In (accent colour) and Out (magenta) on a log scale up to a gigabit. - **Disks:** each fixed drive (C:, D:, ...) with how full it is and whether it is an SSD, HDD or NVMe drive. - **Window:** label, meter, value and a dim note in one row. **Side panel:** two columns, the label then the meter with value and note under it; meters, core columns and the history strip stretch to the panel's width. ## How it behaves - A reading every 2 seconds while it's shown; nothing when closed. - Compact (Less) shows CPU, memory and all disks together; the choice is remembered. - In the window the cross closes it; in the side panel it hides the panel. Escape closes the dropdown, then the window. - `vitals.next` / `vitals.prev` change the machine, `vitals.demo` shows made-up machines, `vitals.update` checks for an update and `vitals.install` installs it. - Health: CPU over 80% or memory over 85% or a disk over 90% is WARN; CPU 90%, memory 95% or a disk 95% is HOT. ## Built from - `mods/vitals/` with `mod.json` `{"place":"none","title":"Vitals","overlay":{"kind":"window","key":"vitals","keep":true}}`. It's a panel when a layout puts it in a block: no `props().overlay`. - `main.js` (the view), `look.js` (colours from `theme()`, icons from `mods/vitals/icons`, byte formatting), `icons/*.svg` (16px, 1.6 stroke), `manifest.json` (version and the mod's own files, for updates). - `sampler.ps1`: started by the mod with `Start-Process -WindowStyle Hidden` in pwsh, else Windows PowerShell, `-NoProfile -NonInteractive -ExecutionPolicy Bypass -File sampler.ps1 -Dir %LOCALAPPDATA%\herdr-vitals-win`. It holds `System.Diagnostics.PerformanceCounter`s open (Processor per core and _Total user/privileged, System queue length, Network Interface bytes), a CIM session for memory and page file, `DriveInfo` for disks, and `nvidia-smi` from System32 or `Program Files\NVIDIA Corporation\NVSMI` every other reading. It writes `now.json` atomically every 2 seconds with a 150-reading CPU history. - The mod writes `heartbeat` in that folder every 10 seconds (`readTextFile` then `writeTextFile` with the read text as expected). The sampler exits 30 seconds after the last heartbeat, or when `sampler.ps1` changes on disk. `sampler.pid` keeps it to one. - A reading older than 8 seconds makes the mod start the sampler (at most every 15 seconds). - Remote machines: the original herdr-vitals release, fetched over `exec(..., { on: machine })` and checked against its checksums. - Updates: the highest `vX.Y.Z` tag from `api.github.com/repos/FoxCreate/herdr-vitals-windows/tags` is the latest version (a branch's raw files are cached for minutes, the tag list isn't). Then `fetch` from `raw.githubusercontent.com/FoxCreate/herdr-vitals-windows/v/mods/vitals/`: its `manifest.json`, then each file it lists. Files are compared with the installed version's tag to find the person's changes; changed ones are saved as `.mine` before being replaced. `main.js` is written last. - Keys (`keys.json`): `global` `ctrl-shift-m` = `mod.open:vitals`; `mod:vitals` `escape` = `vitals.close`. ## Watch out - The sampler path is `mods/vitals/sampler.ps1` and the icon path `mods/vitals/icons`: renaming the folder breaks both. - Windows' CIM queries take seconds in a fresh PowerShell, so the sampler is one long-running process, not one per reading. - Performance counter names are English; other display languages lose CPU and network. - `ctrl+alt` keys are AltGr on Windows; don't bind them. - Paths with apostrophes: the launch command quotes every path PowerShell-style. - The history strip and peaks reset when the sampler restarts. ## Done when - `herdr-app check ~/.config/herdr-app/mods/vitals` passes. - Ctrl+Shift+M opens the window and within 10 seconds the host name, cores, memory and disks show real values. - `%LOCALAPPDATA%\herdr-vitals-win\now.json` updates every 2 seconds while it's open, and the sampler process is gone about 30 seconds after closing it. - On an NVIDIA PC the Graphics section shows a temperature matching `nvidia-smi`. - Update says "Up to date" on the latest version.