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
//! The bypass activation line: the one visible event when the mode takes
//! effect, in the product's no-euphemism register — the grammar's own word,
//! never "yolo", "danger", or a softened "auto". Emitted at launch, at
//! `/approvals bypass`, and re-printed on resume, always through the
//! existing notice/message paths, so every surface says the same words.
//!
//! The line composes the session's facts (DESIGN §1, §5): the mode's
//! meaning, the interpreter facts — the staged names under the run surface's
//! warning adapted to the session, or the none-staged sentence — and, where
//! the probe refused this host, the same fact the notice seam carries.
use crateinterpreter_warning;
use crateRuntimeConfig;
use cratePROBE_REFUSED_NOTICE;
use crateSessionState;
use crateSessionUniverse;
/// The mode fact: what bypass is, and what it does not touch.
const BYPASS_ON: &str =
"bypass on: every tool call runs without asking; every structural guard still applies.";
/// The host lane's fact: what the lane is when composed — unsandboxed, as
/// the user, their network, their filesystem. Stated on the bypass
/// activation line when the lane composed (DESIGN §5), so the moment of
/// choice carries the exposure, never a softened word.
pub const HOST_LANE_FACT: &str =
"host commands run unsandboxed: as your user, your network, your filesystem.";
/// The interpreter fact when nothing is staged in the trusted config
/// (DESIGN §5, verbatim): the mode's honesty about what it does *not* open.
pub const NO_INTERPRETERS_STAGED: &str =
"no interpreters are staged in [jobs.interpreter] allow, so interpreter calls still refuse.";
/// The session interpreter warning's process-fork clause — **the running
/// platform's own fact**, never a stronger one (U8: the clause previously
/// stated the macOS measurement unconditionally, and on Linux — where
/// nothing in the Landlock + namespace confinement restricts fork
/// (`sandbox/mod.rs`) — it told the user children are refused while they
/// ran). One clause per platform, each saying only what that platform's
/// enforcement does; `pub(crate)` so the run_program approval prompt
/// states the same clause — one wording, no drift.
pub const SESSION_FORK_FACT: &str =
"no process-fork is granted: children an interpreter spawns are refused by the sandbox.";
/// The Linux clause: the confinement bounds the interpreter's reads,
/// writes, exec, and egress, and nothing in it restricts fork — a child
/// runs, under the same bounds as the interpreter itself. The weaker true
/// thing, per the sandbox's own words ("nothing in the Landlock + namespace
/// confinement restricts fork", `sandbox/mod.rs`) — the Linux confinement
/// is itself unverified on any host (`linux.rs`), and the clause claims
/// only the design's absence of a fork restriction, never a denial.
pub const SESSION_FORK_FACT: &str = "nothing in the Linux confinement restricts \
process-fork: children an interpreter spawns run, under the same bounds as the \
interpreter itself.";
/// The clause for a platform with no proven sandbox path: the probe
/// refuses there, so no `run_program` call exists — but the bypass
/// activation line still names staged interpreters, and the clause must
/// not overstate. It claims nothing.
pub const SESSION_FORK_FACT: &str =
"no sandbox on this platform is proven to restrict process-fork.";
/// The activation line for a bypass session: the mode fact, then — when
/// interpreters are staged — the shared warning sentence naming them in the
/// session's wording, or the none-staged sentence instead, and the probe's
/// verdict where it refused. One line per fact: the none-staged sentence
/// starts its own line, so the mode fact's sentence ends and the design's
/// sentence begins — a space joined them once, and "applies. no
/// interpreters" read as a run-on with a lowercase word starting a sentence
/// (U6 defect 3). Both facts keep the design's bytes.
///
/// The host lane's fact rides when the lane composed (DESIGN §5): host
/// commands run unsandboxed — as the user, their network, their filesystem.
/// The denied-names segment rides when the list is non-empty; an empty list
/// keeps today's bytes — no segment at all.
pub
/// The denied-names segment of the activation line: the names the session
/// refuses in every mode, bypass included. Empty when the list is empty —
/// an empty list keeps today's bytes.
pub
/// Whether the session's mode parses to bypass — the one decision every
/// emission site (launch, `/approvals bypass`, resume) consults, so the
/// three cannot drift. An unparseable mode is never bypass.
pub
/// Whether this launch itself activates bypass — a property of the system,
/// not a preference: the journal records a consent, so it records exactly
/// the launches where the user consented to the mode now. A fresh session
/// runs under the mode its launch stated, so bypass there is an activation;
/// a resume whose `--approval-mode` explicitly overrode the persisted mode
/// is a new statement of consent this process made; a resume that merely
/// carries the persisted mode re-prints the activation line for the user
/// (the mode is real again) but consents to nothing new — the record is
/// what made it operative — so nothing is journalled.
pub
/// Whether a mid-session `/approvals bypass` newly activates the mode: the
/// mode was not bypass before the command and is bypass after it. A
/// re-statement over an already-bypass session changes nothing — like
/// `/allow` over an already-granted token, it says so but records no new
/// consent — so nothing is journalled for it.
pub
/// The activation line when the session's mode is bypass, `None` otherwise —
/// the one call every emission site makes (launch, `/approvals bypass`,
/// resume), so the three surfaces cannot drift into different words.
pub