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
//! `tm wait` — the sanctioned in-turn wait primitive (#5843).
//!
//! Why: an agent has no guard-compliant way to wait for a long-running
//! background operation. Foreground `sleep` is rejected, and the harness
//! auto-backgrounds a foreground call near ~120s, so an agent that needs to
//! wait an hour ends its turn and loses the work. `tm wait` polls a CONDITION
//! instead of sleeping, and returns before the harness ceiling with a
//! machine-readable "still pending — re-run me" line, so the wait spans as
//! many invocations as the condition needs while every single invocation stays
//! inside the ceiling.
//! What: [`WaitFor`] selects the verb (`run`/`file`/`check`); [`WaitArgs`]
//! carries the per-verb selector plus the budget knobs (`--timeout`,
//! `--interval`, `--slice`).
//! Test: `cli_parses_wait_*` in `tests_behavior_a_tests.rs`; the semantics live in
//! `commands::wait`.
use PathBuf;
/// Which condition `tm wait` polls.
///
/// Why: three conditions cover every wait an agent actually needs — a
/// background process finishing, a sentinel file appearing, and a PR's checks
/// settling. Typing it as a clap `ValueEnum` rejects anything else at parse
/// time rather than at poll time.
/// What: `Run` (a PID or file-backed job handle), `File` (existence, or a
/// literal substring in the file), `Check` (GitHub PR checks settling).
/// Test: `cli_parses_wait_for_run`, `cli_parses_wait_for_file`,
/// `cli_parses_wait_for_check`.
pub
/// Flags for `tm wait`.
///
/// Why: a struct variant keeps the ten-flag surface out of `Command` (500-SLOC
/// production cap) and lets `commands::wait` take one value instead of ten
/// positional parameters.
/// What: the verb (`--for`), the per-verb selectors, and the three budget
/// knobs. `--timeout` is the HARD ceiling across every re-run; `--slice` is how
/// long a SINGLE invocation may block before returning "pending"; `--interval`
/// is the poll spacing, floored per verb so a wait cannot become a blind-poll
/// storm.
/// Test: `cli_parses_wait_*` in `tests_behavior_a_tests.rs`.
pub