Closes the #3110 split — lib.rs is now just the crate doc comment and the pub mod list. journal.rs's new doc comment fixes a pre-existing bug: the old JournalPriority doc text in lib.rs was actually half Capability's doc (a leftover from an earlier reorder that moved the code but not the comment above it).
52 lines
2.1 KiB
Rust
52 lines
2.1 KiB
Rust
//! Scheduled-prompt row shape on the wire, shared by the dashboard and
|
|
//! agent surfaces (mirrors `hive-c0re`'s internal `scheduled_prompts::Schedule`).
|
|
|
|
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Schedule row shape on the wire — mirror of
|
|
/// `scheduled_prompts::Schedule` but in the public crate so the
|
|
/// dashboard and agent surfaces can deserialize without depending
|
|
/// on hive-c0re-internal types. Kept structurally identical to the
|
|
/// in-process type; the conversion is field-by-field in
|
|
/// `manager_server` / `dashboard`.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct WireSchedule {
|
|
pub id: i64,
|
|
pub owner: String,
|
|
pub body: String,
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub interval_seconds: Option<u64>,
|
|
pub next_fire_at_unix: DateTime<Utc>,
|
|
pub created_at_unix: DateTime<Utc>,
|
|
pub source: WireScheduleSource,
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub cancelled_at_unix: Option<DateTime<Utc>>,
|
|
/// Set while the schedule is paused. Worker skips paused rows;
|
|
/// they keep their `next_fire_at_unix` so resuming at any time
|
|
/// fires at the next intended instant (no catch-up clamp needed
|
|
/// — a paused schedule simply slips its next fire).
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub paused_at_unix: Option<DateTime<Utc>>,
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub description: Option<String>,
|
|
pub targets: Vec<WireScheduleTarget>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
|
#[serde(tag = "kind", rename_all = "snake_case")]
|
|
pub enum WireScheduleSource {
|
|
Operator,
|
|
Approval { id: i64 },
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct WireScheduleTarget {
|
|
pub target: String,
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub cancelled_at_unix: Option<DateTime<Utc>>,
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub last_fired_at_unix: Option<DateTime<Utc>>,
|
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
|
pub last_result: Option<String>,
|
|
}
|