Skip to main content

agentmux_bashwrap/
exec_args.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4//! The arguments of `agentmux-bashwrap exec`, also built by prefix mode for a
5//! call it runs (`prefix.rs`). Moved out of `bash_wrap.rs`, which runs the call.
6
7use clap::Parser;
8
9/// CLI args for `exec`. `command` carried as base64 to sidestep every
10/// quoting concern in the shell that invokes us.
11#[derive(Parser, Debug)]
12pub struct Args {
13    /// Tool-use id from Claude's `tool_use` event; threaded back as
14    /// the MPS subject suffix so the frontend correlates chunks with
15    /// the matching ToolNode.
16    #[arg(long)]
17    pub tool_id: String,
18
19    /// URL-safe base64 (no padding) of the original command string.
20    #[arg(long)]
21    pub b64_cmd: String,
22
23    /// Optional block id — used as the `block:<id>` MPS scope so
24    /// chunks only reach subscribers watching this block. When
25    /// omitted, chunks publish unscoped.
26    #[arg(long)]
27    pub block_id: Option<String>,
28
29    /// True when the CLI's own Bash tool call was made with
30    /// `run_in_background: true` (threaded through by
31    /// `hook.rs::build_response` from the PreToolUse payload's
32    /// `tool_input.run_in_background`). A declared-background task may
33    /// legitimately produce zero output forever (a GUI window, a dev
34    /// server once its logs go quiet) — the idle-kill heuristic exists for
35    /// commands that SHOULD exit and are stuck, not for this class. See
36    /// `bash_wrap::effective_idle_timeout`, issue #2491, and
37    /// docs/retro/RETRO_TASK_DEV_IDLE_KILL_FALSE_POSITIVE_2026_07_31.md.
38    #[arg(long, default_value_t = false)]
39    pub declared_background: bool,
40
41    /// The Claude Code subagent that made the call (the PreToolUse
42    /// payload's `agent_id`); absent for the main conversation. Its working
43    /// directory is kept apart from the main agent's, so a subagent's `cd`
44    /// never moves where the main agent's next command runs
45    /// (`CwdState::load`).
46    #[arg(long)]
47    pub agent: Option<String>,
48
49    /// Set by prefix mode when two agents ran the very same command at once
50    /// and this call's agent can't be told: no agent's saved directory is
51    /// used or written (`cwd_state::CwdState::for_call`).
52    #[arg(skip)]
53    pub agent_unknown: bool,
54}