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
//! Who answers a VT query on a pane — the Relay→Host transition.
//!
//! ## Why this is a type and not a behaviour change
//!
//! A running program can ASK the terminal things: "where is the cursor?"
//! (`CSI 6n`), "what are you?" (`CSI c`). Exactly one participant may
//! answer. Two answers is not a cosmetic bug — the second reply arrives on
//! the PTY as if the operator had typed it, so a shell sees a line of
//! garbage like `^[[24;80R` injected into its input.
//!
//! Today tear is a **relay**: it passes query bytes through to whatever
//! terminal is attached, and mado answers from its own parser. That is
//! pinned by `tear-core`'s espelho conformance rows, whose header states it
//! outright — *"`feed()` has no write-back surface at all, so it cannot
//! answer `ESC[6n` itself … the host duty lives one layer DOWN."*
//!
//! [`SHUKEN`](https://github.com/pleme-io/tear/blob/main/docs/SHUKEN.md)
//! changes that. Once `PaneGrid` is the sole VT authority, mado has no
//! parser and *cannot* answer — so if tear also does not, nothing does, and
//! every program that probes the terminal hangs waiting for a reply that no
//! longer exists. Prompt libraries using CPR and DA-based capability
//! detection are the common casualties.
//!
//! So the role must move Relay → Host. But it cannot move *today*, because
//! mado still parses: tear answering now would mean BOTH answer. This enum
//! is that transition made explicit and typed, defaulting to the shipped
//! behaviour, per ★★ MODULARIZE, DON'T DELETE — the relay path is
//! configured off, never removed.
use ;
/// Which participant answers VT queries for a pane.
/// What tear advertises about itself when it is the [`HostRole::Host`].
///
/// ## These constants are a PROMISE, not a copy
///
/// A DA reply is a capability advertisement: a program reads it and then
/// *uses* what it claims. So each field here has to be true of tear's own
/// renderer, and the temptation to paste mado's constants is a trap.
///
/// mado advertises `\x1b[?62;4;22c`. The `4` means **sixel**, and mado's own
/// comment notes it was added "since the decode path landed". tear has no
/// sixel: `GridState` implements no `hook`/`put`/`unhook`, so a DCS image
/// payload is swallowed by vte's default no-op. Advertising `4` would tell
/// every program on the system to send image data tear cannot draw.
///
/// So tear advertises VT220 + ANSI colour and nothing it cannot honour.
/// **When graphics land in `PaneGrid`, this constant moves in the same
/// commit** — that coupling is the point of it living beside the role.
;