systemprompt_models/bridge/update_policy.rs
1//! The self-update policy a bridge reads from the signed manifest.
2//!
3//! The services manifest sets it under `bridge_policy.auto_update`; the
4//! gateway signs it into the bridge manifest and the bridge obeys it.
5//!
6//! Copyright (c) systemprompt.io — Business Source License 1.1.
7//! See <https://systemprompt.io> for licensing details.
8
9use serde::{Deserialize, Serialize};
10
11/// Whether a bridge updates itself, and how far it is allowed to go on its own.
12///
13/// `Staged` downloads, verifies and swaps the on-disk binary but never restarts
14/// the running process: the next natural launch runs the new version. There is
15/// deliberately no variant that restarts unattended — the fleet-wide brake for
16/// a bad release is `pinned_version` on the release feed, not a client toggle.
17#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
18#[serde(rename_all = "snake_case")]
19pub enum AutoUpdatePolicy {
20 Disabled,
21 #[default]
22 Staged,
23}
24
25impl AutoUpdatePolicy {
26 #[must_use]
27 pub const fn stages(self) -> bool {
28 matches!(self, Self::Staged)
29 }
30}