//! Vocabulary hive-c0re's job queue shares with its clients: where a job //! came from ([`Source`]), what a permission change carries //! ([`PermPayload`]), and the scheduler's lifecycle [`State`]. //! //! **The typed `DagView`/`NodeView` projection that used to live here is //! gone.** One graph is served one way now — `hive_jobq_wire`'s generic //! `GraphNode`, over the `QueueNodes` socket request and //! `GET /api/jobq/graph` — so there is no second shape to keep in //! agreement with the first. Queue internals (node kinds, edges, //! scheduling) live in `hive-c0re::job_queue`. //! Semantics: `docs/coordinator.md::Job queue`. use serde::{Deserialize, Serialize}; /// Where the submit request originated — drives the "why" chip on the /// dashboard. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] pub enum Source { /// Operator action (dashboard button, CLI, manager tool). Manual, /// Meta-update cascade rebuild (grown into the meta-update DAG). MetaUpdate, /// Boot-time submission (the boot sweep DAG + boot reconciles). AutoUpdate, /// Crash recovery path (future use). CrashRecover, /// Operator approved a pending `Approval` row; `approval_id` on /// the DAG points back at the source row. Approval, } impl Source { #[must_use] pub fn as_str(self) -> &'static str { match self { Source::Manual => "manual", Source::MetaUpdate => "meta_update", Source::AutoUpdate => "auto_update", Source::CrashRecover => "crash_recover", Source::Approval => "approval", } } } pub use hive_jobq::State; /// Kind-specific payload for `Template::PermChange` DAGs. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] pub enum PermPayload { /// Set the tool groups for one agent (`tool-groups.json`). ToolGroups { groups: Vec }, /// Set the capabilities for one agent (`capabilities.json`). Capabilities { caps: Vec }, /// Set both perm-types in one entry — the batch /// `POST /api/permissions` path. `None` leaves that file untouched; /// present fields commit together and rebuild once. Combined { groups: Option>, caps: Option>, }, } /// Node id. Carries the scheduler crate's globally-monotonic node id /// (`hive_jobq::NodeId`) verbatim on the wire — unique across all DAGs, not /// just within one. Consumers treat it opaquely (grouping + dep matching), /// so the widening from the old dag-local `u32` is transparent. pub type NodeId = u64;