# stackpatrol-core

Shared types and protocol definitions for the [StackPatrol](https://stackpatrol.dev) CLI and control plane.

**Built by [Ali Hesari](https://x.com/alihesari)** — follow on X for build notes and ship updates as we drive toward v1.

> **You almost certainly don't want to depend on this crate directly.** It only exists to keep the public CLI ([`stackpatrol`](https://crates.io/crates/stackpatrol)) and the private control-plane backend speaking the same wire format. If you're trying to monitor a server, install [`stackpatrol`](https://crates.io/crates/stackpatrol) — it pulls this crate in automatically.

## What's in here

- `event::Event` — tagged enum describing every event the CLI can emit (`Heartbeat`, `ServiceDown`, `ResourceCritical`, etc.). Serialized as JSON with `#[serde(tag = "kind")]`.
- `event::EventEnvelope` — the wrapper the CLI POSTs to the control plane: server identity + timestamp + `Event`.
- `token::validate` — the `sp_live_…` token shape used to authenticate a server with the control plane.

No I/O, no async runtime, no HTTP client. Just types.

## Stability

Pre-release. The wire format will change between minor versions until v1 (target: 2026-07). Adding or renaming an `Event` variant is a breaking change for anything deserializing these payloads.

## Links

- Repo: <https://github.com/stackpatrol/stackpatrol>
- CLI: <https://crates.io/crates/stackpatrol>
- Site: <https://stackpatrol.dev>

## License

[MIT](https://github.com/stackpatrol/stackpatrol/blob/main/LICENSE).
