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
//! `whoami` reach: which lane this is, who its parent is, what is live around it, and - for
//! one named target - which channel would carry a message and what the sender would be told.
//!
//! WHY it lives beside the channel rather than inside `whoami.rs`: every answer here is decided
//! by the three readers the send path already uses - the receiver probe, the settings cascade
//! and the policy table. A second copy of any of them would drift into a prediction that
//! `csift send` does not actually make, which is worse than no prediction at all. `whoami` keeps
//! the identity resolution it has always done and hands the lane it resolved to this module.
//!
//! Nothing here writes. A prediction is a read of disk plus the pure policy table, so `whoami`
//! stays safe to run from a hook, and asking "would this reach?" never queues a message.
//!
//! Two honesty rules run through the whole module. A lane's state is read from its own tail and
//! a pid probe, never from the harness's internal state, so an agent prediction says so in one
//! sentence and names its fallback. And the peer surface publishes ids, kinds and states only:
//! a description, an agent type or a name read as a role is context one lane can use to boss
//! another, and the census exists to answer "who is alive", not "who should obey whom".
//!
//! Layout:
//! - [`facts`] the lane probe and the `self` / `parent` / `topology` section builders
//! - [`predict`] the `--to` reach prediction: the send context, the gates, the slot census
//! - [`peers`] the registry read, the live-lane census and the not-a-lane answer
//! - [`render`] the text and JSON projections of all four
use HashSet;
use ;
use ;
use json;
use ;
use ;
use ;
use ;
use crateOutputFormat;
use crate;
use crate;
use cratetext;
pub use *;
pub use *;
pub use *;
pub use *;
/// The env key whose value enables agent teams. The same key the send path reads; it is spelled
/// again here rather than shared because the send module keeps it private, and one of the two
/// spellings changing without the other would show up immediately as a gate verdict that
/// disagrees between `whoami --to` and `csift send` on the same tree.
const TEAMS_ENV: &str = "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS";
/// The sentence every AGENT prediction carries. csift reads a lane's tail and probes a pid; the
/// harness's own view of that lane lives in process memory csift cannot see, so the prediction
/// is an inference and says which carrier remains when the inference is wrong.
const INFERENCE_NOTE: &str = "prediction is an inference from the transcript tail and a pid \
probe, not the harness's own state";
/// The reach prediction for one target, and the facts it was decided from.
pub