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
//! **yog's tool injection** (REMOTE §5, bl-c907): the object the `yog litany`
//! arm hands litany at `Fx::tool_injection`, so an agent can see this
//! workspace's client machines and drive the tools they advertise.
//!
//! litany's seam (its `docs/DESIGN_TOOL_INJECTION.md`) is **one object carrying
//! both halves** — the definitions prompt assembly and the grant gate read, and
//! the router the executor answers through — so a tool declared and not
//! permitted, or permitted and not declared, is unrepresentable. Since litany
//! 0.0.2 that router is **total**: while an injection is installed it answers
//! every invocation the agent makes, and no binary resolution stands behind it.
//! yog fills it with:
//!
//! - [`clients`] — ONE tool in the stable prefix, always. Its subject is the
//! roster, and `load` is the act that makes a host's tools callable.
//! - [`loaded`] — the agent's durable loaded set, read at every assembly, each
//! entry surfacing as an **individually named** tool. Never a multiplexer:
//! litany's `docs/DESIGN_MCP_BRIDGE.md` §6 ruling binds a host too, so the
//! grant gate, the tool control and any future policy keep seeing one name
//! per capability.
//! - [`engine_act`] — the compactor's procedure pair, which is not a host
//! injection at all: litany injects it from the calling role's own procedure,
//! and since the seam inverted it reaches this router like every other name.
//! Its subject is the conversation, which yog holds, so yog answers it
//! itself, at the engine's own front door (REMOTE §5.4, bl-dfce).
//!
//! **It runs in the driver, and the driver is a child process.** Presence is
//! engine RAM by ruling (REMOTE §5), so the roster is asked for through the
//! deposit inbox REMOTE §3 reserves for the world's own residents ([`ask`]) —
//! no new verb, no new transport, and the same `Query::Clients` every seat
//! reads. [`Injection::tools`], by contrast, touches nothing but disk: a prefix
//! that changed when an engine was slow would be a connectivity-rate fact
//! inside the model's cached context, which is what REMOTE §5 was amended to
//! exclude.
//!
//! **A name that is none of those takes the worktree lane** ([`subject`],
//! REMOTE §5.4, bl-77be as amended by bl-5710): a granted, unqualified name is
//! a workspace-subject attempt — its subject is the conversation's working
//! tree — routed to the ONE registered machine that both advertises the name
//! and consents to workspace-cwd execution, with the conversation's resolved
//! cwd on the invocation. Where no machine consents, the lane's last rung is
//! the engine's own front door for the three names the engine implements
//! ([`subject::performs`]), so a default install writes a file with nothing
//! enrolled; every other name is refused in band, naming the way out.
//!
//! **Adjudication is untouched and still runs first.** `yog tool-control`
//! (DESIGN §8.6) is consulted before the executor routes anything, so a routed
//! invocation is judged exactly as a local one — and litany is honest that what
//! happens on the far machine is beyond the adjudicator's reach (REMOTE §5).
//!
//! **A loaded remote name runs where it lives** (REMOTE §9 step 7, bl-024b).
//! [`remote`] is the driver's end of the routing leg: two ordinary gestures
//! through the same inbox door — one that queues the call in the engine's
//! mailbox and one that polls for what came back — and the far machine's own
//! stdout, stderr and exit code passed through untouched, so the model cannot
//! tell a routed tool from a local one. Only a *transport* failure is a
//! sentence of yog's own, and it is in band and non-zero, which is the shape a
//! vanished endpoint already had to produce (litany's §3.3: *"A vanished
//! endpoint is an in-band error result, never a hang"*).
use ;
use Arc;
use ;
use crate;
/// The deposit round trip a driver asks its engine through.
/// The `clients` tool: the roster, and the act that loads from it.
/// The compactor's procedure pair, performed as engine acts.
/// The agent's durable loaded set.
/// The driver's end of the routing leg (REMOTE §5, bl-024b).
/// The dated observations the tool appends to context.
/// The worktree lane (REMOTE §5.4, bl-77be): a granted, unqualified name
/// routed to the workspace's one consenting machine, with the conversation's
/// working directory on the invocation.
/// The loaded-set root's leaf under yog's state root, and the workspace/agent
/// an answer is about — everything a `clients` op needs beyond the invocation
/// itself.
///
/// It is built per call from [`RoutedCall`]'s own workspace and agent, so the
/// router never depends on what the process was launched to drive.
/// yog's injection, as installed at `Fx::tool_injection`.
/// The `clients` tool's own definition — the one entry in the stable prefix.
/// A [`Result`] in the stdio vocabulary litany's executor already speaks
/// (`docs/DESIGN_TOOL_INJECTION.md` §3.1): a product on stdout at exit 0, or
/// the reason on stderr at exit 1. The model cannot tell this from a local
/// tool, and neither can the transcript.
/// **A loaded remote name, run where it lives** (REMOTE §9 step 7, bl-024b):
/// the routing leg's capture, passed through exactly as it came back — the
/// far machine's own stdout, stderr and exit code, so the model cannot tell a
/// routed tool from a local one and neither can the transcript. A *transport*
/// failure is the in-band refusal [`capture`] spells, which is the shape a
/// vanished endpoint already had to produce (litany's §3.3).