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
//! **The reply vocabulary**: the typed half the window paints from (yog's
//! `docs/REMOTE.md` §3, §8, §8.1, §9.7; DESIGN §4.9).
//!
//! [`envelope`](crate::envelope) reads three things out of a gesture — that it
//! is one, which workspace it names, whether the last frame said ok — and that
//! is enough to route and to exit. It is not enough to **paint**. A window
//! draws a roster row, a conversation, a transcript step; those are typed
//! answers, and this module is the seat's reading of them.
//!
//! **It is reimplemented, not shared, and that is a ruling** (REMOTE §8:
//! *"what the seat reimplements is this document … no shared protocol crate
//! was created and none should be"*). REMOTE is the versioned authority all
//! four components implement against; a crate holding the wire would make it
//! the authority for three of them and a dependency for the fourth. So the
//! spellings below are read off REMOTE and off the encoders it governs, and
//! where this module and that document disagree, one of them is a bug.
//!
//! **It decodes only what it paints.** The engine's reply surface is forty-odd
//! kinds and most of them belong to panes that do not exist here. Twenty-six
//! do
//! not: the roster, the conversation list, one workspace's role tuning, the
//! transcript, the live tail, the conversation's records pair — the steps its
//! loop took and what its worktree holds — its spine pair, the operable
//! commits and the config commit governing them — the decision queue and the receipt
//! that raises a row onto it, the window's own three reads — the engine's verb
//! table, what a needle found and the trail — the ball pane's four — the
//! world's binding table, the fleet board, one wall's own balls and the branch
//! it tracks them on — the login pane's three — the provider
//! table, what one row offers and a sign-in run — a captured run, the detached
//! advance's receipt, the start family's two — the staged body and the minted
//! name — and a new box's material. A kind nothing renders is a kind
//! nobody has to carry, and the compiler of the window is what pulls in the
//! next one — see [`Reply`] for the roster of what is here and DESIGN §4.9
//! for what is not.
//!
//! # The decode policy, stated once
//!
//! Every reader below obeys these four rungs, and each type's own doc says
//! where it spends them. The posture is deliberate per rung rather than
//! "strict" or "tolerant" wholesale, because the two failures are not
//! symmetric: guessing at a malformed answer paints a claim nobody made, and
//! refusing a whole listing over one unrecognised word drops a hundred rows to
//! avoid painting one.
//!
//! 1. **Shape refuses.** A frame that is not an object, a required field that
//! is missing, and a field of the wrong JSON type each answer
//! [`Read::Unreadable`], naming the field. A seat cannot paint what it
//! cannot read.
//! 2. **An unknown reply `kind` refuses, naming it.** That is REMOTE §3's own
//! rule — *"the strict decode already refuses an unknown one in band,
//! naming it, which is the boundary correcting itself rather than two
//! protocols meeting"* — and it is why a new kind is **not** a protocol
//! bump. The refusal is a value, never a panic, and the window paints it
//! where the pane's content would have been: a visible row, never a silent
//! drop.
//! 3. **An unknown *token* inside a row does not refuse.** A state, a tone, a
//! classification, a block kind: each decodes to that field's own `Unknown`
//! arm carrying the word **verbatim**, and the row paints with the word
//! where the badge would be. Refusing here would spend rung 2's remedy on a
//! listing that is otherwise entirely readable. Defaulting to a known
//! neighbour is what is actually forbidden: a token painted as a word it is
//! not is a lie, where a token painted as itself is merely unstyled.
//! 4. **An unknown *field* is ignored, structurally.** Every reader indexes by
//! key, so a field the engine added rides through untouched. That is the
//! other half of REMOTE §3's rule that a new field is not a bump, and it is
//! the one tolerance this reader gets for free.
//!
//! # Replaying a conformance corpus
//!
//! The readers take a [`Value`] and answer a [`Read`], with no socket and no
//! state between calls, so anything that can produce a reply frame can be
//! replayed through them. `corpus/` is that harness's fixture set today —
//! hand-built from the shapes REMOTE's encoders write — and it is arranged as
//! three directories by expected outcome precisely so a corpus yog emits
//! later (yog bl-32cb) drops into it as files rather than as code.
//! `corpus/README.md` is the drop-in contract.
/// The balls themselves: the binding table, one wall's own, and its branch.
/// The fleet board: every live ball in its column, and the loops running them.
/// The machines registered in one workspace, and what each one offers.
/// One config file's bytes, and the settings its schema found in them.
/// The conversation list one workspace answers with.
/// A new box's material, and the envelope a camera carries it in.
/// The strict field readers every decoder below shares.
pub
/// What one conversation's worktree holds.
/// Which config commit a conversation resolves its policy from.
/// The engine's own verb table, which is also the parity roster's source.
/// The census of what an engine can answer, and the captured run.
/// The config lineages one workspace holds.
/// One sign-in run, as the engine streams it.
/// Every action that crossed the engine's boundary, and where its alarm stands.
/// What a wall can sign in to, and what one row is offering.
/// The decision queue: what is asking for the operator, anywhere.
/// The conversation's spine: its operable commits, and the cards off them.
/// Reading one frame: the dispatch off `kind`, and the refusal that wears none.
/// What one workspace's roles are set to, and how each is tuned.
/// The workspace roster — the window's altitude-0 chrome.
/// Text found across the balls, workspaces and conversations an engine sees.
/// What a ball has cost, and what the sum is over.
/// The start family's two receipts.
/// The steps one conversation's loop has taken.
/// The live tail's fold.
/// The conversation itself.
pub use ;
pub use read;
/// The field every reply carries, and the only one a refusal shares with an
/// answer.
const OK: &str = "ok";
/// The discriminant. **Its absence is the refusal**, and that is load-bearing:
/// [`OK`] cannot be the discriminant, because a captured run spells its own
/// verdict there — a `bl close` that failed the gate is `ok: false` and is an
/// answer, not a refusal.
const KIND: &str = "kind";
/// The refusal's own text — the engine's sentence about why nothing happened.
const ERROR: &str = "error";
/// **What one reply frame turned out to be.** Three outcomes rather than a
/// nested `Result`, because the window paints three different things and the
/// distinction is the whole product of this module:
///
/// - an answer it draws,
/// - a refusal it shows in the engine's own words,
/// - bytes it could not read, which is a statement about *this seat* and
/// carries this seat's own sentence.
///
/// Nothing here is a panic path and nothing is a silent drop: every frame that
/// arrives becomes one of the three, and all three are paintable.
///
/// **Not `Eq`**, because [`start::Prepared`] carries the body it must hand back
/// verbatim and arbitrary JSON is not `Eq`. Nothing in this crate keys on a
/// reply, so the equality given up is one no caller spends.