pub mod clock_rng;
pub mod composite;
pub mod coordination;
pub mod gates;
pub mod lifecycle;
pub mod peers;
pub mod structural;
pub mod sync;
pub mod telemetry;
pub mod triggers;
use bb_runtime::bus::{OpError, OpErrorKind};
use bb_runtime::slot_value::SlotValue;
use bb_runtime::syscall::values::BytesValue;
pub(crate) fn first_input_optional_bytes(
op_name: &str,
inputs: &[(&str, &dyn SlotValue)],
) -> Result<Option<Vec<u8>>, OpError> {
let Some((slot_name, value)) = inputs.first() else {
return Ok(None);
};
let Some(bytes) = value.as_any().downcast_ref::<BytesValue>() else {
return Err(OpError {
kind: OpErrorKind::TypeMismatch,
reason: "expected_bytes",
detail: format!("{op_name}: input '{slot_name}' is not BytesValue"),
});
};
Ok(Some(bytes.0.clone()))
}