//! Bento's concrete event payload, carried on the generic //! [`ops_core::eventbus`] bus. Flat `kind`-tagged so it serializes to the wire //! shape the TUI parses (`{"kind":"step_start", ...}`). use crate::domain::{AppId, Status, Step, StepRunId, Target, Version}; use ops_core::eventbus; use serde::{Deserialize, Serialize}; pub type EventEnvelope = eventbus::EventEnvelope; pub type EventTx = eventbus::EventTx; pub fn channel() -> EventTx { eventbus::channel() } pub fn emit(tx: &EventTx, event: Event) { eventbus::emit(tx, event) } #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] #[serde(tag = "kind", rename_all = "snake_case")] pub enum Event { /// A `/build` was accepted. BuildRequested { app: AppId, version: Version, targets: Vec }, /// A previous in-flight run for this `(app, target)` was aborted because a /// newer request arrived. TargetAborted { app: AppId, target: Target }, TargetStart { app: AppId, version: Version, target: Target }, StepStart { run_id: StepRunId, app: AppId, version: Version, target: Target, step: Step }, /// A chunk of merged stdout+stderr from the step currently running. /// `run_id` ties back to the `StepStart`; `seq` is a per-run monotonic /// counter; `text` is UTF-8-lossy and NOT line-aligned. The on-disk log is /// the byte-exact source. StepLogChunk { run_id: StepRunId, seq: u32, text: String }, StepDone { run_id: StepRunId, app: AppId, target: Target, step: Step, status: Status }, TargetOk { app: AppId, version: Version, target: Target, artifacts: Vec }, TargetFailed { app: AppId, version: Version, target: Target, step: Step, error: String }, /// Notarization is the one flaky, network-bound step; retries are surfaced. NotarizeRetry { app: AppId, target: Target, attempt: u32, reason: String }, ArtifactCollected { app: AppId, target: Target, path: String, bytes: i64 }, PublishOk { app: AppId, target: Target, channel: String }, PublishFailed { app: AppId, target: Target, channel: String, error: String }, }