euv-core 0.48.0

Core cross-platform runtime for euv featuring arena-based fine-grained reactivity, deterministic layout, flat scene graph, multi-mode rendering, and direct OS platform adapters.
Documentation
use super::*;

/// Immutable content-addressed module or data artifact referenced by a `ReleaseManifest`.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct BlobArtifact {
    /// Stable logical module identifier (e.g. `"page-a"`, `"card"`).
    pub(crate) module_id: String,
    /// Exact pinned implementation version string (e.g. `"1.0.0"`, `"2.0.0"`).
    pub(crate) version: String,
    /// Content-addressed lowercase SHA-256 hex digest.
    pub(crate) sha256: String,
    /// Exact artifact byte size.
    #[get(type(copy))]
    pub(crate) size_bytes: u64,
    /// Artifact delivery classification (`WasmComponent`, `DeclarativeSpec`, or `AssetBundle`).
    #[get(type(copy))]
    pub(crate) kind: ArtifactKind,
    /// Compile-time interface identifier satisfied by this artifact (e.g. `"euv:product-card/v1"`).
    #[new(skip)]
    #[serde(default)]
    pub(crate) interface_id: String,
    /// Interface major version number separate from implementation and state schema versions.
    #[new(skip)]
    #[serde(default)]
    #[get(type(copy))]
    pub(crate) interface_version: u32,
    /// Local UI state schema version independent of interface and implementation versions.
    #[new(skip)]
    #[serde(default)]
    #[get(type(copy))]
    pub(crate) state_schema_version: u32,
    /// Minimum compatible host ABI version.
    #[new(skip)]
    #[serde(default)]
    #[get(type(copy))]
    pub(crate) min_host_abi: u32,
    /// Maximum compatible host ABI version.
    #[new(skip)]
    #[serde(default)]
    #[get(type(copy))]
    pub(crate) max_host_abi: u32,
    /// Capabilities required by this module (e.g. `"storage.local"`, `"net.readonly"`).
    #[new(skip)]
    #[serde(default)]
    pub(crate) required_capabilities: Vec<String>,
    /// Logical entrypoint symbol or handler identifier.
    #[new(skip)]
    #[serde(default)]
    pub(crate) entrypoint: String,
    /// Direct pinned dependency artifact keys (`"module_id@version"`).
    #[new(skip)]
    #[serde(default)]
    pub(crate) dependencies: Vec<String>,
}

/// Per-route pinned transitive dependency graph locking entry and logical slot bindings.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct RouteManifest {
    /// Normalized route path (e.g. `"/route-a"`).
    pub(crate) route: String,
    /// Pinned entry artifact key (`"page-a@1.0.0"`).
    pub(crate) entry_module: String,
    /// Logical slot key to exact pinned artifact key map (`"card"` -> `"card@2.0.0"`).
    #[new(skip)]
    #[serde(default)]
    pub(crate) slot_bindings: BTreeMap<String, String>,
    /// Complete set of SHA-256 blob hashes required by this route's transitive dependency graph.
    #[new(skip)]
    #[serde(default)]
    pub(crate) transitive_hashes: BTreeSet<String>,
}

/// Complete signed release manifest locking every route's transitive dependency graph.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct ReleaseManifest {
    /// Manifest protocol schema version.
    #[get(type(copy))]
    pub(crate) manifest_schema: u32,
    /// Logical project identifier.
    pub(crate) project: String,
    /// Release channel name (e.g. `"prod"`, `"beta"`).
    pub(crate) channel: String,
    /// Compatibility track identifier selected during client/server negotiation.
    pub(crate) track: String,
    /// Strictly monotonic release sequence number (rollbacks always advance this number).
    #[get(type(copy))]
    pub(crate) release_seq: u64,
    /// Optional prior release sequence targeted when this release is a monotonic rollback.
    #[new(skip)]
    #[serde(default)]
    #[get(skip)]
    pub(crate) rollback_of: Option<u64>,
    /// Delivery channel policy governing allowed artifacts (`WasmComponent` vs `DeclarativeData`).
    #[get(type(copy))]
    pub(crate) delivery_mode: DeliveryChannelMode,
    /// Minimum host ABI version compatible with this release.
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) min_host_abi: u32,
    /// Maximum host ABI version compatible with this release.
    #[new(skip)]
    #[get(type(copy))]
    pub(crate) max_host_abi: u32,
    /// Release-level required host capabilities.
    #[new(skip)]
    #[serde(default)]
    pub(crate) required_capabilities: Vec<String>,
    /// Map of pinned artifact keys (`"module_id@version"`) to artifact metadata.
    #[new(skip)]
    #[serde(default)]
    pub(crate) artifacts: BTreeMap<String, BlobArtifact>,
    /// Per-route pinned transitive dependency manifests.
    #[new(skip)]
    #[serde(default)]
    pub(crate) routes: BTreeMap<String, RouteManifest>,
    /// UNIX epoch timestamp in seconds when this release was sealed.
    #[new(skip)]
    #[serde(default)]
    #[get(type(copy))]
    pub(crate) created_at_unix: u64,
    /// HMAC-SHA256 signature over canonical manifest JSON (computed with `signature` empty).
    #[new(skip)]
    #[serde(default)]
    pub(crate) signature: String,
}

/// Minimal SSE notification frame pushed by the Hyperlane server upon pointer swap (zero code/bytes/paths).
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct ReleaseActivatedEvent {
    /// SSE event schema version.
    #[get(type(copy))]
    pub(crate) event_schema: u32,
    /// Logical project identifier.
    pub(crate) project: String,
    /// Release channel name.
    pub(crate) channel: String,
    /// Compatibility track identifier.
    pub(crate) track: String,
    /// Previous active release sequence (`0` on initial release).
    #[get(type(copy))]
    pub(crate) from_release: u64,
    /// Newly activated strictly monotonic release sequence.
    #[get(type(copy))]
    pub(crate) to_release: u64,
    /// Non-authoritative hint listing routes whose pinned graphs changed.
    #[new(skip)]
    #[serde(default)]
    pub(crate) affected_routes: Vec<String>,
    /// SHA-256 digest of the canonical signed target manifest JSON.
    pub(crate) manifest_sha256: String,
}

/// Client compatibility capabilities sent before subscription or manifest fetch.
#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct ClientNegotiation {
    /// Supported dynamic update protocol version.
    #[get(type(copy))]
    pub(crate) protocol_version: u32,
    /// Running host ABI version.
    #[get(type(copy))]
    pub(crate) host_abi: u32,
    /// Allowed channel delivery mode (`WasmComponent` or `DeclarativeData`).
    #[get(type(copy))]
    pub(crate) delivery_mode: DeliveryChannelMode,
    /// Capabilities exposed by this host build.
    #[new(skip)]
    #[serde(default)]
    pub(crate) capabilities: Vec<String>,
    /// Optional preferred compatibility track name.
    #[new(skip)]
    #[serde(default)]
    #[get(skip)]
    pub(crate) preferred_track: Option<String>,
}