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
//! Where one runtime's commands run, and what environment they carry.
//!
//! Two rules live here, in this order, and the order is the point.
//!
//! **The environment first.** Mentra deliberately clears the ambient process
//! environment before running a model command. A host can still need to attach
//! non-secret execution context — a task identity, a registry directory —
//! without exporting it process-wide, so this executor adds exactly the pairs
//! the runtime builder was given. Merged before routing, because what a
//! command carries is a fact about *this runtime* rather than about where the
//! command lands: a target that received a different environment from the
//! local executor would be a second thing to keep in step, and nobody would
//! notice the day they drifted.
//!
//! **Then the destination.** ADR-0021 made *where a command runs* a dimension
//! of a `spawn` call rather than a second tool, and this is the one place that
//! dimension is acted on: `None` is mentra's local executor, and a name is the
//! executor the host registered under it
//! ([`RuntimeBuilder::with_command_target`](crate::RuntimeBuilder::with_command_target)).
//! basis ships no executors and writes none — what a target can reach is
//! whatever the host's own code can reach, and basis never describes it as
//! anything else (ADR-0013, and `docs/targets.md`).
//!
//! A request whose target nothing serves is an error and never a local run.
//! That direction is not a preference: a command a host addressed to a build
//! machine, silently executing here instead, is the one failure mode a target
//! exists to prevent. mentra's own [`LocalRuntimeExecutor`] takes the same
//! ruling for the same reason.
//!
//! Runtime-scoped since ADR-0018 moved the executor with the rest of the
//! process knobs: on a shared runtime every workspace's commands see the same
//! pairs and reach the same targets, and a host that wants two workspaces to
//! differ gives each its own runtime via
//! [`WorkspaceBuilder::with_runtime_builder`](crate::WorkspaceBuilder::with_runtime_builder).
use ;
use async_trait;
use ;
/// The names a runtime routes on, and what each one resolves to.
///
/// A `BTreeMap` so the set a model is told about, and the set a refusal lists,
/// are in one order on every build rather than in whatever order a hash seed
/// produced.
pub type CommandTargets = ;
pub
/// What a request naming an unregistered target is answered with.
///
/// `spawn` refuses such a call twice before it can reach here — in the
/// authorization preview and again in `execute_mut` — so this is the floor
/// under a host driving mentra's runtime directly, or under a `SpawnTool`
/// built with names its runtime does not serve. It names the set for the same
/// reason those refusals do: a reader who cannot see the registered names
/// cannot tell a typo from a missing registration.