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
//! The **orphaned-mail state** (bl-ace6): a delivered message nobody is
//! answering — and, when the last driver left words behind, why.
//!
//! The §7.3 wound beside this covers a driver that died *inside a step*.
//! The gap it left is the driver that died **before creating one**: the
//! ordinary 2nd..Nth message of a conversation is driven by a child
//! *lernie* launched (ARCH §2.11 — never a yog spawn, so no §8.1 sink),
//! and when that driver errors out at the boundary — an unpaired-tail
//! decline, a lease fault, a crashed launch — the deposit has already
//! landed, `ops.jsonl` says `exit 0`, the steps tree is unchanged, and
//! the transcript simply stops. STORIES INV-2 (no swallowed errors) is
//! the invariant that state violates.
//!
//! The **state** is two observations, both already derived, nothing
//! stored (§5.1 #13):
//!
//! - **The newest transcript entry is delivered mail** — a
//! `messages/NNN-<sender>.md`. Committed tool results and model output
//! are `.json`; only mail ends `.md` (ARCH §2.3 *Origins*).
//! - **Nobody is driving** — the agent's lock is free (§3.5). Delivery
//! only ever happens under a driver's lock and the driver holds that
//! lock through the model call, so on a healthy branch this pair
//! exists only for the relaunch gap — which is why the banner rides
//! the same grace window the wound does (bl-90bf), and a send whose
//! driver simply has not been seen yet never alarms.
//!
//! The **reason** is the tail of `steps/<agent>/driver.log` — where
//! lernie binds every launched driver's stderr (lernie 0.0.9, its
//! bl-55f9; the file yog pinned that release for and then never read).
//! It is append-only across launches, so its content is never the
//! trigger — a stale line from a healed crash must not alarm — only the
//! diagnosis, read exactly when the state holds (a healthy conversation
//! pays no syscall for it).
//!
//! Like the wound, this is not a new stored fact and not a new agent
//! state: the badge vocabulary is untouched (the ■ stopped ruling and
//! attention's rest-not-wound rule both stand — bl-d816 tracks whether
//! they ever should not), and everything here is re-derived per reading.
use Path;
use driven;
use crateAgentState;
/// The sentence yog renders for this class — the §7.3 rendered fact.
pub const ORPHANED_MAIL: &str = "a delivered message has no driver";
/// What the banner adds when `driver.log` has nothing to quote — the
/// honest end of the trail, said outright (the wound's own discipline).
const MUTE: &str = "and driver.log has no words — nothing on disk says why";
/// How the banner introduces the captured bytes. It names the **file**:
/// an operator who wants more than the tail must be told where the
/// whole of it lives.
const SPOKE: &str = "the last driver's words (driver.log):";
/// The §11 banner's leading mark — never the only carrier (§11 glyph
/// doctrine); the sentence beside it states the fact in words.
const ALARM: &str = "⚠";
/// The orphaned-mail state **and its reason** — the [`super::Wound`]
/// shape, for the wound's own reason: an orphan with nothing to say is
/// a real, distinct answer, and `Some("")` would be one fact with two
/// encodings.
/// Derive the state for one agent. The `driver.log` read is gated on
/// the predicate, and both bounds on how much of it is read are the
/// wound's own borrows: [`crate::opslog::detached::captured`] for how
/// much of a capture file yog ever reads,
/// [`crate::opslog::rows::stderr_tail`] for how much a surface says.
pub
/// Whether the newest `messages/` entry is delivered mail (`.md`) —
/// the transcript's own naming rule (ARCH §2.3: order lives in the
/// zero-padded filename, mail is the one `.md` origin). An absent or
/// empty directory has no tail and is never an orphan.