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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
//! The command-line surface: every subcommand and its arguments.
use std::{collections::BTreeSet, path::PathBuf};
use crate::execution_mode::ModeRequest;
use crate::{config, message};
use anyhow::{Result, bail};
use brgr_protocol::{AttemptId, EvidenceSpec, TaskId, TaskSpec};
use clap::{Args, Parser, Subcommand};
use config::WorkerPlacement;
#[derive(Parser)]
#[command(name = "brgr", version, about = "Durable local agent task bridge")]
pub(crate) struct Cli {
/// Control home holding the private registry, store, and worktrees.
#[arg(long, global = true, env = "BRGR_HOME")]
pub(crate) home: Option<PathBuf>,
/// Emit one machine-readable JSON receipt instead of human output.
#[arg(long, global = true)]
pub(crate) json: bool,
/// Exact calling harness session, for commands executed by a shared daemon.
/// `--as` is the short form: it keeps the session near the front of the
/// command line Codex prints, where a narrow pane still shows it.
#[arg(long, global = true, alias = "as")]
pub(crate) owner_session: Option<String>,
/// Exact source Herdr pane. Its session is verified before use.
#[arg(long, global = true)]
pub(crate) source_pane: Option<String>,
/// Explicitly run a one-shot process instead of the default native TUI.
#[arg(long, global = true)]
pub(crate) headless: bool,
#[command(subcommand)]
pub(crate) command: Command,
}
#[derive(Subcommand)]
pub(crate) enum Command {
/// Start a bounded fresh run and seal its result for owner review.
Run(RunArgs),
/// Start a new revision of a task without rewriting its prior results.
Revise(ReviseArgs),
/// Show managed tasks, or one task's attempt and result state.
Status {
task: Option<TaskId>,
/// Include the delegation tree beneath the task.
#[arg(long)]
tree: bool,
/// Read without owning the task: skips the owner-session check and
/// changes nothing. It never decides, acknowledges, or applies.
#[arg(long)]
observe: bool,
},
/// Show a task's sealed result, optionally acknowledging a failed one.
Result {
task: TaskId,
#[arg(long)]
ack: bool,
/// Read without owning the task: skips the owner-session check and
/// changes nothing. It cannot be combined with `--ack`.
#[arg(long, conflicts_with = "ack")]
observe: bool,
},
/// Export a sealed result artifact to a file.
Artifact {
#[command(subcommand)]
command: ArtifactCommand,
},
/// Block until a task reaches a terminal result.
Wait {
task: TaskId,
#[arg(long, default_value_t = 3_600)]
timeout_seconds: u64,
},
/// Print one JSON line per state change, question, or result, then exit.
///
/// Reads only. It does not decide, acknowledge, or answer.
Watch {
/// Tasks to follow. A repeated id is watched once.
#[arg(required = true, num_args = 1.., value_name = "TASK")]
tasks: Vec<TaskId>,
#[arg(long, default_value_t = 3_600)]
timeout_seconds: u64,
},
/// Send or list messages between an owner and a managed task.
Message {
#[command(subcommand)]
command: message::MessageCommand,
},
/// Explicit direct conversation between sibling TUI workers.
Debate {
#[command(subcommand)]
command: crate::debate::DebateCommand,
},
/// Send native input to the task's owned TUI, such as an answer to a menu.
Input {
task: TaskId,
#[arg(long, conflicts_with = "key", required_unless_present = "key")]
text: Option<String>,
#[arg(long, conflicts_with = "text", required_unless_present = "text")]
key: Option<String>,
},
/// Stop an owned in-flight run and settle it as a terminal result.
Cancel {
task: TaskId,
/// Also cancel the delegated children beneath the task.
#[arg(long)]
tree: bool,
/// Stop the worker even if this session is not the bound owner.
/// Reaching the control home is the access check; it does not decide
/// the sealed result.
#[arg(long)]
force: bool,
},
/// Claim a task for the current owner session before reading or deciding.
Bind {
task: TaskId,
#[arg(long)]
session: Option<String>,
},
/// Move an owner's head from one session to another.
Head {
#[command(subcommand)]
command: crate::head::HeadCommand,
},
/// Record an explicit acceptance of a task's sealed candidate result.
Accept {
task: TaskId,
#[arg(long, default_value = "acceptance criteria verified")]
reason: String,
/// Also remove the task's worktree when only ignored files (build
/// output, caches) keep it, as `brgr prune --apply --include-ignored`
/// would. Without it such a worktree is kept.
#[arg(long)]
include_ignored: bool,
},
/// Record an explicit rejection with a reason, keeping the result intact.
Reject {
task: TaskId,
#[arg(long)]
reason: String,
/// Also remove the task's worktree when only ignored files (build
/// output, caches) keep it, as `brgr prune --apply --include-ignored`
/// would. Without it such a worktree is kept.
#[arg(long)]
include_ignored: bool,
},
/// Show a candidate's sealed Git diff, or its per-file summary.
Diff {
task: TaskId,
/// Print changed files with added and deleted line counts instead.
#[arg(long)]
stat: bool,
/// Read without owning the task: skips the owner-session check and
/// changes nothing. It never decides, acknowledges, or applies.
#[arg(long)]
observe: bool,
},
/// Integrate a candidate's sealed Git diff into a matching workspace.
Apply {
task: TaskId,
/// Repository root to integrate into: the task's base commit or a
/// commit that descends from it.
#[arg(long)]
workspace: PathBuf,
/// Write the diff instead of only checking that it would apply.
#[arg(long)]
execute: bool,
/// Merge with the target's own changes (`git apply --3way`) when the
/// diff does not apply as is. A conflict is written as standard
/// markers and the command then fails, naming the files to resolve.
#[arg(long = "3way")]
three_way: bool,
},
/// Accept a candidate and integrate its sealed Git diff in one step.
///
/// The diff is checked against the workspace first; if it does not apply
/// (and `--3way` is not given), nothing is decided or written. Then the
/// candidate is accepted, which also acknowledges it, and the diff applied.
Land {
task: TaskId,
/// Repository root to integrate into, as for `apply`.
#[arg(long)]
workspace: PathBuf,
/// Why the candidate is accepted.
#[arg(long)]
reason: String,
/// Merge with the target's own changes, as `apply --3way` does.
#[arg(long = "3way")]
three_way: bool,
/// Also remove the task's worktree when only ignored files (build
/// output, caches) keep it, as `brgr prune --apply --include-ignored`
/// would. Without it such a worktree is kept.
#[arg(long)]
include_ignored: bool,
},
/// Register, contract-test, activate, and inspect local harnesses.
Harness {
#[command(subcommand)]
command: HarnessCommand,
},
/// Install, inspect, or remove brgr-owned Codex integration entries.
Integrate {
#[command(subcommand)]
command: IntegrateCommand,
},
/// Probe every registered harness, the Codex integration, and the store.
Doctor,
/// Show the failures brgr recorded in `brgr_error_issue_memo.md`.
Errors {
#[command(subcommand)]
command: Option<ErrorsCommand>,
},
/// Show or change local brgr configuration.
Config {
#[command(subcommand)]
command: ConfigCommand,
},
/// Herdr plugin entrypoints; these require the brgr plugin host.
Plugin {
#[command(subcommand)]
command: PluginCommand,
},
/// Report, and with --apply remove, settled task worktrees and branches.
Prune {
/// Remove instead of only reporting. Every check still applies.
#[arg(long)]
apply: bool,
/// Also remove a worktree holding ignored files such as `.env` or a
/// build cache. Those are invisible to git's own clean check.
#[arg(long)]
include_ignored: bool,
},
/// Inspect or retry the close of a pane brgr recorded as its own.
Cleanup {
#[command(subcommand)]
command: CleanupCommand,
},
#[command(name = "__supervise", hide = true)]
Supervise { launch: PathBuf },
#[command(name = "__hook", hide = true)]
Hook { event: HookEvent },
/// A harness status line command: records the session's context and plan
/// usage, then runs the status line it replaced, if any.
#[command(name = "__context", hide = true)]
Context {
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
chain: Vec<String>,
},
#[command(name = "__notify", hide = true)]
Notify { task: TaskId },
#[command(name = "__pane-run", hide = true)]
PaneRun(PaneRunArgs),
#[command(name = "__tui-host", hide = true)]
TuiHost { config: PathBuf },
#[command(name = "__session", hide = true)]
Session { task: TaskId },
#[command(name = "__seal-report", hide = true)]
SealReport { task: TaskId, revision: u32 },
/// Publish a managed worker's final answer without modifying source files.
Report {
task: TaskId,
#[arg(long)]
body: String,
},
#[command(name = "__native-result", hide = true)]
NativeResult {
task: TaskId,
revision: u32,
kind: String,
},
#[command(name = "__omp-run", hide = true)]
OmpRun {
#[arg(long)]
prompt_file: PathBuf,
#[arg(long)]
workspace: PathBuf,
#[arg(long)]
task: TaskId,
#[arg(long)]
revision: u32,
#[arg(long)]
launcher: PathBuf,
#[arg(long)]
model: Option<String>,
#[arg(long)]
effort: Option<String>,
#[arg(long)]
keep_pane: bool,
},
}
#[derive(Subcommand)]
pub(crate) enum PluginCommand {
/// Open the read-only task board, or a worktree-bound Codex pane.
Open {
#[arg(long)]
no_focus: bool,
#[arg(long)]
codex: bool,
},
/// Render the read-only task board, refreshing until interrupted.
Board {
#[arg(long)]
once: bool,
},
/// Launch a Codex pane wired to the plugin's binary and host bridge.
Codex,
#[command(hide = true)]
Worker,
}
#[derive(Subcommand)]
pub(crate) enum ConfigCommand {
/// Create configuration and BRGR.md examples without overwriting user files.
Init,
Show,
/// Set a global default or a default for one registered harness.
Set {
key: String,
value: String,
#[arg(long)]
harness: Option<String>,
},
/// Validate calling options against registered harnesses without running a model.
Check,
SetCodexExecutable {
executable: PathBuf,
},
ClearCodexExecutable,
SetWorkerPlacement {
placement: WorkerPlacement,
},
/// Restore the default template used to name worker panes.
ClearPaneNameTemplate,
SetAutoWorkerPane {
#[arg(action = clap::ArgAction::Set)]
enabled: bool,
},
/// Run harnesses as their own TUI in a Herdr pane (true, the default) or
/// headless in print mode (false).
SetPaneMode {
#[arg(action = clap::ArgAction::Set)]
enabled: bool,
},
/// Re-certify a harness automatically when `brgr run` finds its CLI
/// updated (true), or stop and name the command (false, the default).
/// Each re-certification is one paid scratch run, and it trusts the
/// changed binary; brgr warns every time it happens.
SetAutoRecertify {
#[arg(action = clap::ArgAction::Set)]
enabled: bool,
},
/// File a GitHub issue for each failure brgr records, in `OWNER/NAME`.
/// Issue text holds only the redacted error class and counts.
SetIssueReporting {
repo: String,
/// Sightings of one failure before its issue is filed.
#[arg(long, default_value_t = 2)]
min_count: u64,
},
/// Stop filing issues; the memo keeps recording.
ClearIssueReporting,
/// Tell a head, on its next brgr command, to hand its command to another
/// harness once its context or plan usage passes a threshold. brgr only
/// tells; the head runs `brgr head handoff` itself.
SetHandoffCondition {
/// Herdr agent kind that takes over, for example `codex`.
#[arg(long)]
kind: String,
/// Close this head's pane after the handoff.
#[arg(long)]
exit_old: bool,
/// Context window fullness, in percent, that triggers the note.
#[arg(long)]
context_percent: Option<u8>,
/// Plan usage, in percent, of either window that triggers the note.
#[arg(long)]
quota_percent: Option<u8>,
/// Extra argument for the incoming agent, for example `--yolo`.
#[arg(long = "agent-arg", allow_hyphen_values = true)]
agent_args: Vec<String>,
},
/// Stop telling heads to hand off.
ClearHandoffCondition,
}
#[derive(Subcommand)]
pub(crate) enum ErrorsCommand {
/// Print the recorded failures.
List,
/// Print the exact issue text that would be filed, without sending it.
Preview,
/// File the issues now, if issue reporting is on.
File,
}
/// A worker permission level as typed on the command line.
#[derive(Clone, Copy, Debug, Eq, PartialEq, clap::ValueEnum)]
pub(crate) enum PermissionArg {
/// Read and propose; no file changes.
ReadOnly,
/// Edit files in the task workspace; commands still need approval.
Edits,
/// Every tool auto-approved. The default when nothing is capped.
Full,
}
impl From<PermissionArg> for brgr_protocol::PermissionLevel {
fn from(value: PermissionArg) -> Self {
match value {
PermissionArg::ReadOnly => Self::ReadOnly,
PermissionArg::Edits => Self::Edits,
PermissionArg::Full => Self::Full,
}
}
}
#[derive(Subcommand)]
pub(crate) enum ArtifactCommand {
Export {
task: TaskId,
index: usize,
#[arg(long)]
output: PathBuf,
},
}
#[derive(Args)]
pub(crate) struct RunArgs {
pub(crate) objective: String,
/// Select the native pane or one-shot headless route explicitly.
#[arg(long, value_enum)]
pub(crate) mode: Option<ModeRequest>,
#[command(flatten)]
pub(crate) delegation: DelegationArgs,
#[arg(long)]
pub(crate) harness: Option<String>,
/// Ignored: workers always run with full permissions. Kept so old scripts
/// that pass it still run.
#[arg(long, value_enum, hide = true)]
pub(crate) permission: Option<PermissionArg>,
#[arg(long)]
pub(crate) model: Option<String>,
#[arg(long)]
pub(crate) effort: Option<String>,
#[arg(long = "criterion")]
pub(crate) criteria: Vec<String>,
#[arg(long = "scope")]
pub(crate) scopes: Vec<String>,
#[arg(long = "role-instruction")]
pub(crate) role_instructions: Vec<String>,
#[command(flatten)]
pub(crate) capabilities: CapabilityArgs,
#[command(flatten)]
pub(crate) evidence: EvidenceArgs,
#[arg(long)]
pub(crate) deadline_seconds: Option<u64>,
#[arg(long)]
pub(crate) max_children: Option<u8>,
#[arg(long)]
pub(crate) workspace: Option<PathBuf>,
#[arg(long)]
pub(crate) allow_clean_head_snapshot: bool,
#[arg(long = "snapshot-path", conflicts_with = "allow_clean_head_snapshot")]
pub(crate) snapshot_paths: Vec<PathBuf>,
#[arg(long, hide = true)]
pub(crate) foreground: bool,
#[command(flatten)]
pub(crate) keep: RetentionArgs,
}
impl RunArgs {
pub(crate) fn forwards_criteria(&self) -> bool {
!self.criteria.is_empty() || !self.scopes.is_empty() || !self.role_instructions.is_empty()
}
}
/// What a run leaves behind once its result is decided.
#[derive(Args)]
pub(crate) struct RetentionArgs {
/// Keep the worker's pane open after the result is decided.
#[arg(long)]
pub(crate) keep_pane: bool,
/// Keep the task worktree after the result is decided. By default brgr
/// removes it once nothing in it would be lost.
#[arg(long)]
pub(crate) keep_worktree: bool,
}
#[derive(Args)]
pub(crate) struct DelegationArgs {
#[arg(long, requires = "parent_attempt")]
pub(crate) parent_task: Option<TaskId>,
#[arg(long, requires = "parent_task")]
pub(crate) parent_attempt: Option<AttemptId>,
#[arg(long)]
pub(crate) enable_delegation: bool,
}
#[derive(Args)]
pub(crate) struct ReviseArgs {
pub(crate) task: TaskId,
/// Select the native pane or one-shot headless route explicitly.
#[arg(long, value_enum)]
pub(crate) mode: Option<ModeRequest>,
/// Ignored: workers always run with full permissions.
#[arg(long, value_enum, hide = true)]
pub(crate) permission: Option<PermissionArg>,
pub(crate) objective: String,
#[arg(long = "criterion")]
pub(crate) criteria: Vec<String>,
#[arg(long = "scope")]
pub(crate) scopes: Vec<String>,
#[arg(long = "role-instruction")]
pub(crate) role_instructions: Vec<String>,
#[command(flatten)]
pub(crate) capabilities: CapabilityArgs,
#[command(flatten)]
pub(crate) evidence: EvidenceArgs,
#[arg(long)]
pub(crate) max_children: Option<u8>,
/// Repository the revision starts from, at its current HEAD, so work merged
/// since the previous revision is part of its base. Defaults to the
/// repository the task was first checked out from.
#[arg(long)]
pub(crate) workspace: Option<PathBuf>,
#[arg(long)]
pub(crate) allow_clean_head_snapshot: bool,
#[arg(long = "snapshot-path", conflicts_with = "allow_clean_head_snapshot")]
pub(crate) snapshot_paths: Vec<PathBuf>,
#[arg(long, hide = true)]
pub(crate) foreground: bool,
#[command(flatten)]
pub(crate) keep: RetentionArgs,
}
impl ReviseArgs {
pub(crate) fn forwards_criteria(&self) -> bool {
!self.criteria.is_empty() || !self.scopes.is_empty() || !self.role_instructions.is_empty()
}
}
#[derive(Args, Default)]
pub(crate) struct CapabilityArgs {
#[arg(long)]
pub(crate) requires_write: bool,
#[arg(long)]
pub(crate) requires_browser: bool,
#[arg(long = "requires-mcp")]
pub(crate) requires_mcp: Vec<String>,
#[arg(long = "require-capability")]
pub(crate) required: Vec<String>,
}
impl CapabilityArgs {
pub(crate) fn required_names(&self) -> Result<Vec<String>> {
let mut names = BTreeSet::new();
names.insert("completion".to_owned());
if self.requires_write {
names.insert("workspace_write".to_owned());
}
if self.requires_browser {
names.insert("browser".to_owned());
}
for server in &self.requires_mcp {
names.insert(format!("mcp:{server}"));
}
names.extend(self.required.iter().cloned());
if names.iter().any(|name| {
name.is_empty()
|| name.len() > 128
|| !name.bytes().all(|byte| {
byte.is_ascii_alphanumeric() || matches!(byte, b':' | b'.' | b'_' | b'-')
})
}) {
bail!("required capability names must be bounded ASCII identifiers");
}
Ok(names.into_iter().collect())
}
}
#[derive(Args, Default)]
pub(crate) struct EvidenceArgs {
#[arg(long)]
pub(crate) capture_diff: bool,
#[arg(long)]
pub(crate) capture_logs: bool,
#[arg(long = "evidence-file")]
pub(crate) files: Vec<PathBuf>,
}
impl EvidenceArgs {
pub(crate) fn spec(&self) -> EvidenceSpec {
EvidenceSpec {
capture_diff: self.capture_diff,
capture_logs: self.capture_logs,
base_commit: None,
base_tree: None,
files: self
.files
.iter()
.map(|path| path.to_string_lossy().into_owned())
.collect(),
}
}
pub(crate) fn extend_task(&self, task: &mut TaskSpec) {
task.evidence.capture_diff |= self.capture_diff;
task.evidence.capture_logs |= self.capture_logs;
task.evidence.files.extend(self.spec().files);
task.evidence.files.sort();
task.evidence.files.dedup();
if !task.evidence.is_empty() {
task.artifact_contract.max_bytes =
task.artifact_contract.max_bytes.max(8 * 1024 * 1024);
}
}
pub(crate) fn artifact_limit(&self, base: u64) -> u64 {
if self.spec().is_empty() {
base
} else {
base.max(8 * 1024 * 1024)
}
}
}
#[derive(Clone, Copy, Subcommand)]
pub(crate) enum CleanupCommand {
/// Report whether an owned pane was closed or deliberately retained.
Status { task: TaskId },
/// Retry a pending close of a pane brgr recorded as its own.
Run { task: TaskId },
}
#[derive(Subcommand)]
pub(crate) enum HarnessCommand {
/// Probe, contract-test, scratch-run, and activate one approved executable.
Add(AddHarnessArgs),
/// Print a candidate manifest for an executable without registering it.
Draft { executable: PathBuf },
/// Run the manifest contract test without starting a paid scratch run.
Test {
executable: Option<PathBuf>,
#[arg(long)]
manifest: Option<PathBuf>,
},
/// Activate a contract-tested manifest with an authorized scratch run.
Activate {
executable: Option<PathBuf>,
#[arg(long)]
manifest: Option<PathBuf>,
#[arg(long)]
workspace: PathBuf,
#[arg(long)]
prompt: String,
#[arg(long)]
model: Option<String>,
#[arg(long)]
effort: Option<String>,
},
/// Re-certify a registered harness at its recorded path after the CLI
/// updated. Runs one paid scratch run, like `harness add`.
Recertify {
harness: String,
/// Directory for the scratch run (default: the current directory).
#[arg(long)]
workspace: Option<PathBuf>,
/// Scratch prompt (default: `say ok`).
#[arg(long)]
prompt: Option<String>,
},
/// Report whether one registered harness is still healthy.
Status {
/// Defaults to the configured default harness, else the only one registered.
harness: Option<String>,
},
}
#[derive(Args)]
pub(crate) struct AddHarnessArgs {
pub(crate) executable: PathBuf,
#[arg(long)]
pub(crate) workspace: Option<PathBuf>,
#[arg(long)]
pub(crate) prompt: Option<String>,
#[arg(long)]
pub(crate) model: Option<String>,
#[arg(long)]
pub(crate) effort: Option<String>,
#[arg(long)]
pub(crate) presentation_only: bool,
}
#[derive(Subcommand)]
pub(crate) enum IntegrateCommand {
/// Manage the brgr-owned Codex hooks and skill.
Codex {
#[command(subcommand)]
command: CodexCommand,
},
/// Manage the brgr-owned Claude Code skill and, on request, its status line recorder.
Claude {
#[command(subcommand)]
command: ClaudeCommand,
},
}
#[derive(Subcommand)]
pub(crate) enum ClaudeCommand {
Install {
/// Also put brgr's usage recorder in front of Claude Code's status
/// line, keeping the one you have. This edits `settings.json`, or the
/// file it links to, after saving a copy. Needed for handoff conditions.
#[arg(long)]
context: bool,
},
Status,
Uninstall,
}
#[derive(Subcommand)]
pub(crate) enum CodexCommand {
Install,
Status,
Uninstall,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, clap::ValueEnum)]
pub(crate) enum HookEvent {
SessionStart,
UserPromptSubmit,
Stop,
}
/// Arguments the supervisor passes to the hidden pane-mode runner.
#[derive(Args)]
pub(crate) struct PaneRunArgs {
#[arg(long)]
pub(crate) caller: Option<String>,
#[arg(long)]
pub(crate) native_executable: Option<PathBuf>,
/// The native `OpenCode` host selects this model through a verified session.
#[arg(long)]
pub(crate) opencode_model: Option<String>,
#[arg(long)]
pub(crate) prompt_file: PathBuf,
#[arg(long)]
pub(crate) workspace: PathBuf,
#[arg(long)]
pub(crate) task: TaskId,
#[arg(long)]
pub(crate) revision: u32,
#[arg(long)]
pub(crate) kind: String,
#[arg(long = "agent-arg", allow_hyphen_values = true)]
pub(crate) agent_args: Vec<String>,
#[arg(long)]
pub(crate) keep_pane: bool,
}