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
//! Unified, effect-separated protocol abstraction shared by `native` and `browser`.
//!
//! Design: *functional core, imperative shell*. A protocol author writes only a **pure**
//! state transition over its **own** typed events and effects; all IO is performed by the
//! extension's own [`Interpret`] shell, which is handed a namespace-scoped capability
//! ([`Scope`]) — `send`/`inject` confined to the interpreter's own namespace.
//!
//! Notation (used throughout the doc-comments here):
//!
//! ```text
//! decode : Wire ⇀ Event
//! step : (Ctx S, Event) → Transition (S, Effect) where Transition (S,E) ≅ (S, [E])
//! ```
//!
//! The effect algebra is **not** global: each extension defines `Protocol::Effect` and the
//! interpreter that runs it. The core owns no `Effect` enum — adding an extension never
//! touches the core, and a protocol can only emit its own effects (no global command bus).
//!
//! `step` is pure (no IO, clocks, globals) and total over well-typed events; the decode
//! boundary makes "undecodable/foreign input" an explicit [`Reject`] instead of a silent
//! no-op. The abstraction is identical on both targets; the sole divergence is the `Send` /
//! `?Send` bound, isolated in [`rings_runtime::MaybeSendSync`].
//!
//! ## Module layout
//!
//! - `envelope` — the wire [`Envelope`].
//! - `protocol` — the pure core: [`Wire`]/[`Reject`] (decode boundary), [`Ctx`],
//! [`Transition`], and the [`Protocol`] trait.
//! - `interpret` — the per-extension imperative shell ([`Interpret`]).
//! - `delegation` — the namespaces whose protocols delegate their admission through
//! [`Protocol::delegates_admission`] (#888).
//! - `registry` — the scoped capability [`Scope`] handed to shells, plus the router-internal
//! `Core` / `Handler` and the namespace registry ([`Extensions`]).
pub use Envelope;
pub use Interpret;
pub use Ctx;
pub use LinkFact;
// Router internals — not part of the extension-author API (which is `Protocol` / `Interpret` /
// `Scope` / `Transition` / …). Crate-visible only, so the old ambient `Core` surface
// cannot be used to bypass the scoped-capability boundary. `Handler`/`DynHandler` stay private
// to `registry` (the erased router ABI; protocol authors never name them).
pub use Protocol;
pub use Reject;
pub use Transition;
pub use Wire;
pub use Core;
pub use EffectScope;
pub use Extensions;
pub use Route;
pub use Scope;