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
//! **The invocation mailbox** (REMOTE §5, §9 step 7; bl-024b): the engine-side
//! hand-off between an agent's tool call and the machine that runs it.
//!
//! REMOTE §3's routing ruling is that **the ask never inverts**: a tool host
//! rides a follow-class read for its next invocation and posts each capture
//! back as an ordinary act. So the engine never speaks first, and what stands
//! between the two directions is this — a queue per client and a slot per
//! invocation, held in RAM beside the presence refcount ([`super::presence`]).
//!
//! **RAM, for presence's reason exactly.** An invocation in flight is not a
//! fact about the world; it is a fact about this process for the seconds a tool
//! takes to run. Writing it into the world would make a crashed driver's
//! abandoned call durable and put a second, slower bus under a hand-off both
//! ends are already connected to.
//!
//! **Presence is NOT the routing predicate, and that is a finding** (REMOTE §5,
//! amended by bl-024b). §5 imagined an invocation "routed to the client if it
//! is live, refused in-band if not". A tool host holds a connection only while
//! it is *waiting*: it dials per ask (§10), so between polls — and for the
//! whole time it is executing something — it is absent. A presence test would
//! therefore refuse the second call of a busy host, which is the one host that
//! is certainly there. The queue is the predicate instead: an invocation waits
//! in it, and what makes a vanished client visible is the caller's own
//! deadline, in band, never a hang.
//!
//! **This file is the vocabulary; [`slots`] is the map.** Split at §12's
//! per-file budget, on the seam that matters: what a routed invocation *is*
//! (and how it is spelled on the wire) is one subject, and where an in-flight
//! one waits — behind this leg's one lock — is another.
use ;
use crate;
/// Where in-flight invocations live — the map, and the one lock this leg has.
pub
pub use Mailbox;
/// **What a driver asks for**: a client's advertised tool, with the model's own
/// arguments. The client is named because the identity is the *addressee* here
/// — unlike the advertisement, whose identity is the intake's (REMOTE §5.1).
///
/// [`Eq`] is written rather than derived for [`Value`]'s reason
/// ([`Tool`](super::tools::Tool)): the grammar has no `NaN` literal, so a
/// schema or an argument object that came through a JSON decoder cannot hold
/// the one value equality is not reflexive over.
/// **What a tool host is handed**: the engine's handle on this call, and the
/// two facts the far end needs to run it. It carries no client — the read is
/// answered to one identity and a host being told its own name would be a fact
/// it already holds.
/// **What came back**: litany's own tool contract, one for one (its ARCH §3.3)
/// — bytes on stdout, bytes on stderr, the exit code the verdict. Text rather
/// than bytes because a tool result becomes a model message and a model message
/// is text; the executor transcodes at the one place bytes become an answer
/// (`src/wire/host/exec.rs`), so nothing downstream carries an encoding case.
/// One completion, as the act that posts it carries it.
/// **The routing leg's two acts, as one family** (bl-024b) — the
/// [`Monitor`](crate::boundary::Action::Monitor) /
/// [`Fleet`](crate::boundary::Action::Fleet) shape, and for their reason: one
/// subject, one mailbox, one pair of ends. Two variants at the boundary would
/// be two rows in every exhaustive table for a hand-off that is one thing read
/// from both sides.
/// The one sentence an unheld handle earns, said the same way at both readers.
pub
/// A capture as JSON — the **one** spelling, spent by the completing act, by
/// both replies that carry one and by the client-side executor alike.
/// [`capture_value`]'s inverse, strict: an invocation's result is an
/// instruction to a model, so a missing field refuses rather than defaults.
/// The optional subject location (bl-77be), read strictly: absent and null
/// are the ordinary no-location case, and anything but a string refuses —
/// a place a tool will run is an instruction, not an observation.
/// An exit code narrowed to what a process can actually have exited with.
/// One queued invocation as JSON — the follow-class read's row.
/// [`invocation_value`]'s inverse, on the same strict terms.