Skip to main content

graphrt_bundle/
manifest.rs

1//! The `bundle.json` manifest.
2
3use std::collections::BTreeMap;
4
5use serde::{Deserialize, Serialize};
6
7/// Current bundle format version.
8pub const BUNDLE_FORMAT_VERSION: u32 = 1;
9/// Path of the manifest inside the archive.
10pub const MANIFEST_PATH: &str = "bundle.json";
11/// Path of the optional signature inside the archive.
12pub const SIGNATURE_PATH: &str = "bundle.sig";
13
14/// Bundle manifest.
15#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
16pub struct BundleManifest {
17    pub format_version: u32,
18    pub name: String,
19    pub version: String,
20    #[serde(default, skip_serializing_if = "String::is_empty")]
21    pub description: String,
22    /// Creation time (RFC 3339, UTC).
23    pub created_at: String,
24    /// Workflow run by default (a path listed in `workflows`).
25    pub entry: String,
26    /// Workflow documents in the bundle.
27    pub workflows: Vec<String>,
28    #[serde(default)]
29    pub requires: Requires,
30    /// SHA-256 (hex) of every file except the manifest and signature.
31    pub files: BTreeMap<String, String>,
32}
33
34/// What a host needs to run the bundle.
35#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
36pub struct Requires {
37    /// Semver requirement on the graphrt runtime version (e.g. `>=0.1`).
38    #[serde(default, skip_serializing_if = "String::is_empty")]
39    pub graphrt: String,
40    /// Node kinds used by the workflows (built-in or plugin).
41    #[serde(default)]
42    pub node_kinds: Vec<String>,
43    /// Plugins shipped in the bundle.
44    #[serde(default)]
45    pub plugins: Vec<PluginRef>,
46    /// Model providers referenced by the workflows.
47    #[serde(default)]
48    pub providers: Vec<String>,
49    /// Environment variables declared by the workflows (names only, never values).
50    #[serde(default)]
51    pub env: Vec<String>,
52}
53
54/// A plugin shipped in the bundle (under `plugins/<name>/`).
55#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
56pub struct PluginRef {
57    pub name: String,
58    #[serde(default)]
59    pub version: String,
60    /// `wasm`, `process` or `http`.
61    pub runtime: String,
62    /// Whether the plugin runs on every host (only WebAssembly plugins do).
63    pub portable: bool,
64    /// SHA-256 of the plugin manifest file.
65    pub sha256: String,
66}