1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
//! # bytesandbrains
//!
//! Composable building blocks for decentralized + federated machine
//! learning. Facade crate re-exporting `bb-ir`, `bb-dsl`,
//! `bb-compiler`, `bb-runtime`, `bb-ops`, and `bb-derive`. See
//! [`docs/`](https://github.com/Bytes-Brains/private/tree/main/docs)
//! for the canonical spec.
// bb-derive emits `::bytesandbrains::…` paths; this enables that
// resolution inside the facade crate itself.
extern crate self as bytesandbrains;
// --- bb-ir foundation re-exports ---------------------------------
/// Prost-generated proto bindings (ONNX + `bb.core`).
pub use proto;
/// Polymorphic type system — hierarchical `TypeNode` tree
/// resolved at compile time by the bb-compiler's TypeSolver.
pub use types;
/// Wire codec contract + canonical `TypeNode` statics
/// (`TYPE_TENSOR_F32`, `TYPE_TRIGGER`, `TYPE_PEER_ID`, …).
pub use wire;
/// Tensor and Scalar abstractions. Backends implement.
pub use tensor;
/// Universal slot value trait. Re-exports `bb_ir::slot_value` plus
/// engine-side carriers (`BackendTensorCarrier`) that bypass the
/// serde-driven blanket impl.
pub use slot_value;
/// `ErasedComponent` + `AnyComponent` traits + foundation
/// polymorphism plumbing (`ComponentPackage`, `RestoreError`,
/// `SerializeFn`, `RestoreFn`).
pub use component;
/// Stable `(domain, op_type)` + attribute-name string constants for
/// every framework syscall - the IR contract between bb-compiler +
/// bb-runtime.
pub use syscall_ids;
/// Peer-class metadata stamps (`SELF_CLASS`, `PEER_CLASS_KEY`,
/// `HOME_CLASS_KEY`).
pub use peer_class;
/// Framework attribute-key string constants (`BACKEND_SUBGRAPH_BODY_ATTR`,
/// `WIRE_TRANSPORT_KEY`, …). Re-exported so proc-macro emission
/// reaches them without users depending on `bb-ir` directly.
pub use keys;
/// `bincode` re-export for proc-macro emission sites
/// (`#[derive(bb::Concrete)]` serialize/restore).
pub use bincode;
/// `inventory` re-export for proc-macro emission sites
/// (`#[derive(bb::<Role>)]`, `register_op!`, `register_protocol!`).
pub use inventory;
// --- bb-runtime engine-internal type re-exports ------------------
/// Identity newtypes. Engine-internal IDs (`NodeSiteId`, `OpRef`,
/// `ExecId`, `CommandId`, `ComponentRef`) live here; wire/compiler
/// IDs (`PeerId`, `RequestId`, `OpsetId`, `ComponentTag`) come from
/// `bb-ir` re-exported through this module.
pub use ids;
/// Atomic dispatch declaration types + `DispatchResult`. Catalog
/// declarations stay in `bb-ir`; `DispatchResult` carries
/// `CommandId` and so lives here.
pub use atomic;
/// `CompletionHandle` for async Contract methods.
pub use completion;
// --- bb-dsl authoring re-exports ---------------------------------
/// The `Module` trait. `Module::build()` returns a recorded
/// `ModelProto` that `Compiler` consumes.
pub use module;
/// `Graph` recording context.
pub use graph;
/// Non-generic `Output` handle threaded through DSL method chains.
pub use output;
/// User-facing Contract traits (`Index`, `Aggregator`, `Model`,
/// `Codec`, `DataSource`, `PeerSelector`, `Backend`,
/// `Protocol`).
pub use contracts;
/// `ConcreteComponent` polymorphism contract + the
/// `ComponentHandle` fn-pointer-capture wrapper.
pub use concrete;
/// Role-method dispatch slot placeholders (`BackendSlot`,
/// `IndexSlot`, `ModelSlot`, …). Module fields are typed against
/// these; the compiler binds them to concrete implementations.
pub use placeholders;
/// Concrete `Aggregator` implementations the framework ships
/// (e.g. `FedAvg`).
pub use aggregators;
/// Concrete `Protocol` implementations the framework ships
/// (e.g. `GlobalRegistryClient`, `GlobalRegistryServer`).
pub use protocols;
/// Concrete `Backend` implementations the framework ships
/// (`CpuBackend` + the `execute_graph` walker that drives a
/// `GraphProto` through it).
pub use backends;
/// `RecordedModule` — the DSL → Compiler hand-off produced by
/// `Graph::finish()`.
pub use recorded;
// --- bb-compiler pipeline re-exports -----------------------------
/// The compiler driver, `CompilerStage` trait, canonical pass list.
pub use bb_compiler as compiler;
// --- bb-runtime engine re-exports --------------------------------
/// Typed in-Node event bus.
pub use bus;
/// The sans-IO Engine state machine.
pub use engine;
/// Per-poll execution-state bundle owned by `Engine.exec`.
pub use exec_state;
/// `WireEnvelope` codec; per-type decoders register through
/// `bb_ir::slot_value::register_type_node!`.
pub use envelope;
/// Public error taxonomies.
pub use errors;
/// Framework primitives bundled into every `RuntimeResourceRef`.
pub use framework;
/// Lock-free MPMC ingress queue.
pub use ingress;
/// Public `Node` + lazy build chain.
pub use node;
/// Global inventory-collected registry for custom ops + concrete
/// components. Proc-macros emit `::bytesandbrains::registry::*`
/// paths into this namespace.
pub use registry;
/// The `<Role>Runtime` role traits.
pub use roles;
/// Runtime resource handle + `ComponentTimerKind`.
pub use runtime;
/// `NodeSnapshot`.
pub use snapshot;
/// `ai.bytesandbrains.syscall v1` opset (runtime-side
/// dispatch + DSL-side helpers).
pub use syscall;
/// Optional OpenTelemetry layer constructors for the engine's
/// `tracing::` spans.
pub use telemetry;
/// Test-only components, gated behind the `test-components` feature.
/// Thread-local `try_reserve_exact` fault-injection seam. Exposed
/// under `test-components` so integration tests in `tests/` drive
/// the same seam as crate-internal sibling tests.
pub use fallible;
/// Concrete components the framework ships (syscalls, wire
/// transport, backends, role implementations, protocols). See the
/// `bb_ops` crate docs for the per-component authoring contract.
pub use bb_ops as ops;
// --- bb-derive macro re-exports ----------------------------------
/// `register_op!{}` proc-macro re-exported from `bb-derive`.
pub use register_op;
/// `register_protocol!{}` proc-macro re-exported from `bb-derive`.
pub use register_protocol;
/// `#[derive(bb::Aggregator)]` — bridges a Contract impl to
/// `AggregatorRuntime`.
pub use Aggregator;
/// `#[derive(bb::Backend)]` — bridges a Contract impl to
/// `BackendRuntime` and emits the `ai.onnx v1` opset declaration.
pub use Backend;
/// `#[derive(bb::Codec)]` — bridges a Contract impl to
/// `CodecRuntime`.
pub use Codec;
/// `#[derive(bb::Concrete)]` — emits the `ConcreteComponent`
/// + `AnyComponent` bridge and the `inventory::submit!` entry.
pub use Concrete;
/// `#[derive(bb::DataSource)]` — bridges a Contract impl to
/// `DataSourceRuntime`.
pub use DataSource;
/// `#[derive(bb::Index)]` — bridges a Contract impl to
/// `IndexRuntime`.
pub use Index;
/// `#[derive(bb::Model)]` — bridges a Contract impl to
/// `ModelRuntime`.
pub use Model;
/// `#[derive(bb::PeerSelector)]` — bridges a Contract impl to
/// `PeerSelectorRuntime`.
pub use PeerSelector;
// --- Convenience top-level re-exports ----------------------------
// Authoring surface.
pub use Graph;
pub use Module;
pub use Output;
pub use GenericSlotSpec;
// Module recording-time error.
pub use BuildError;
// Node lifecycle.
pub use ;
pub use ;
pub use ;
// Compile + install entry points.
pub use Compiler;
pub use ;
// Identity + addressing.
pub use PeerId;
pub use Address;
// User-facing Contract traits.
pub use ;
// Library-level syscall sugar.
pub use ;
// Value-type metadata.
pub use ;
// Errors.
pub use ;
// Snapshot.
pub use ;
/// Canonical authoring surface in a single import.
///
/// `use bytesandbrains::prelude::*;` covers `Module` + `Graph`,
/// `install` + `Compiler`, the Contract traits + matching derives,
/// `Node` + lifecycle types, and identity types. Reach into
/// sub-modules (`ops`, `placeholders`, `protocols`, `contracts`,
/// `completion`, …) for surfaces the prelude omits.