1pub use phoxal_runtime_contract::identity::ParticipantArtifactId;
17
18mod path;
19pub use path::{BundlePath, BundlePathError, DigestError, Sha256Digest};
20mod asset;
21pub use asset::{AssetIndex, AssetRecord, ParticipantAssets};
22mod reader;
23pub use reader::{ParticipantBundle, ParticipantRuntimeInputs, RuntimeBundle};
24mod error;
25pub use error::{BundleError, DocumentError, SelectionError};
26mod writer;
27pub use writer::BundleWriter;
28mod fs;
29pub(crate) use fs::{
30 BundleRoot, copy_executable_source, create_staging_root, ensure_staging_directory,
31 open_bundle_file, open_executable_source, prepare_publish_parent, publish_staging_root,
32 read_and_verify, read_runtime_document, reject_existing_target, require_layout_directories,
33 validate_layout, write_new_file,
34};
35mod artifact;
36pub use artifact::{BinaryReference, BinarySource};
37mod participant;
38pub use participant::RuntimeParticipant;
39mod document;
40pub use document::{ParticipantClock, Runtime, RuntimeDocument};
41
42pub const RUNTIME_SCHEMA: &str = "phoxal/runtime-bundle/v0";
44pub const RUNTIME_FILE: &str = "runtime.json";
46pub const ASSETS_DIR: &str = "assets";
48pub const BIN_DIR: &str = "bin";
50pub use phoxal_runtime_contract::metadata::MAX_RUNTIME_PARTICIPANTS;
51#[cfg(test)]
52mod bundle_boundary_tests;
53
54#[doc(hidden)]
65pub mod __compat {
66 use phoxal_runtime_contract::contract_surface::{ContractRecord, ContractSurface};
67 use phoxal_runtime_contract::wire_schema::DescribeWire;
68
69 use crate::{RUNTIME_SCHEMA, RuntimeDocument};
70
71 #[must_use]
73 pub fn contract_surface() -> String {
74 ContractSurface::new([ContractRecord::document(
75 "RuntimeDocument",
76 RUNTIME_SCHEMA,
77 RuntimeDocument::wire_schema(),
78 )])
79 .canonical_json()
80 }
81
82 #[cfg(test)]
83 mod tests {
84 use super::contract_surface;
85
86 #[test]
90 fn the_surface_names_the_runtime_document_and_the_model_it_embeds() {
91 let rendered = contract_surface();
92 serde_json::from_str::<serde_json::Value>(&rendered).expect("the surface is JSON");
93 assert_eq!(contract_surface(), rendered);
94 for expected in [
95 r#""tag":"phoxal/runtime-bundle/v0""#,
96 r#""name":"RuntimeDocument""#,
97 r#""name":"participants""#,
99 r#""name":"artifacts""#,
100 r#""name":"config_schema""#,
101 r#""name":"Robot""#,
102 r#""name":"Structure""#,
103 r#""name":"component_instances""#,
104 ] {
105 assert!(
106 rendered.contains(expected),
107 "{expected} missing: {rendered}"
108 );
109 }
110 }
111 }
112}