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
//! Checked BRIDGE packet runtime for SIM model exchanges.
//!
//! `sim-lib-bridge` is the send/receive guard around the reversible BRIDGE packet
//! codec (`sim-codec-bridge`). It runs packets: validation, capability ceilings,
//! content-addressed request identity, model-request construction, response
//! decoding, the shared frontier engine, and the four profile helpers. It targets
//! [`EvalFabric`](sim_kernel::EvalFabric) and the provider-neutral runner
//! contracts; it does not own transports or model providers.
//!
//! # One checker, both directions
//!
//! There is exactly one receive checker (`rx_check`), and transmit runs it on its
//! own output before anything leaves SIM -- so a peer never bounces a packet its
//! author believed well-formed.
//!
//! ```text
//! TX `bridge_tx` / `run_bridge`:
//! canonicalize -> stamp cid -> assert_roundtrip -> render_model_face
//! -> assert_total_ownership -> rx_check (the self-check gate)
//! -> ModelRequest in EvalRequest.expr -> realize_final
//! RX `bridge_rx` / `bridge_rx_response`:
//! terminal_response_packet (LAST content item) -> decode -> rx_check:
//! move legality + from/to inversion + parent-`Return` reply legality
//! + per-part shape checks -> BridgeReport (accepted, obligations, repair menus)
//! ```
//!
//! `effective_caps` resolves the header ceiling and every acting step runs under
//! `diminish(current, ceiling)`. `verify_warrant` turns a stale-book packet into a
//! `Fetch` obligation instead of a hard failure or a silent accept.
//!
//! # Profiles (helpers over the one packet)
//!
//! - **ASK** -- `ask_packet` / `run_ask` / `run_ask_with_policy`: a typed model
//! call whose arguments are fenced data and whose reply is validated against the
//! declared `Return` shape, with bounded `RepairPolicy` on an `AskFailure`.
//! - **BRIEF** -- `bridge_brief` / `render_brief_sentences`: controlled
//! instruction frames rendered as fluent cited sentences.
//! - **LOOM** -- `validate_weave` / `weave_row_by_row` over `frontier` /
//! `FrontierMenu`: model-authored program bodies, checked row by row against a
//! flat menu, with `LoomObligation`s carrying the valid replacement.
//! - **COLLAB** -- `merge_bridge_replies` / `MergePolicy`: typed reviews, votes,
//! and patches merged by exact parent cid and target path;
//! `receipt_packet_for_report` serializes the report lens back onto the wire.
//!
//! `materialize_given` / `fetch_obligation` implement budgeted context with the
//! `Fetch` affordance; `install_bridge_lib` / `BridgeLib` register the runtime
//! verbs (`bridge/tx`, `bridge/rx`, `bridge/ask`, `bridge/run-ask`,
//! `bridge/brief`, ...). `bridge/run-ask` accepts any object exposing
//! [`EvalFabric`](sim_kernel::EvalFabric), a packet expression, and an optional
//! bounded retry count.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use verify_warrant;
/// Cookbook recipes embedded from this crate's `recipes/` directory.
pub static RECIPES: EmbeddedDir =
include!;