feat(cli): add 'box tmux' domain to manage headless sessions with auto-logging

This commit is contained in:
operator
2026-10-05 16:27:19 +00:00
parent 4e512a0742
commit 1809a1a8e2
+17
View File
@@ -3220,6 +3220,15 @@ def cmd_swarm_prune(args):
except Exception:
sys.stdout.write(res.stdout)
def cmd_tmux_dispatch(args):
"""Bridge 'box tmux' commands directly to bin/muse-tmux.py."""
tmux_bin = str(BIN_DIR / "muse-tmux.py")
subcmd = args.tmux_action or "list"
cmd = [sys.executable, tmux_bin, subcmd] + (args.tmux_args or [])
res = subprocess.run(cmd)
sys.exit(res.returncode)
def build_parser():
common = argparse.ArgumentParser(add_help=False)
common.add_argument("--json", action="store_true", help="Output machine-readable JSON")
@@ -3637,6 +3646,12 @@ def build_parser():
p_sub_spawn.add_argument("prompt", help="Task prompt for the subagent")
p_sub_spawn.add_argument("--wait", type=int, default=30, help="Seconds to wait for subagent response")
# Domain: TMUX (Headless background tmux sessions with automatic logging)
p_tmux = subparsers.add_parser("tmux", parents=[common], help="Manage headless background tmux sessions on /tmp/tmux-muse.sock")
p_tmux.add_argument("tmux_action", nargs="?", default="list", choices=["list", "ls", "new", "send", "send-keys", "capture", "cap", "tail", "kill", "prune", "attach"], help="tmux action (default: list)")
p_tmux.add_argument("tmux_args", nargs=argparse.REMAINDER, help="Arguments passed directly to muse-tmux.py")
# Domain: muse (fast headless gateway via muse-cli-node with isolated per-node Cloudflare WARP egress)
p_muse = subparsers.add_parser("muse", parents=[common], help="Direct headless gateway client (muse-cli-node)")
p_muse.add_argument("node", choices=VALID_NODES, help="Target agent node")
@@ -3836,6 +3851,8 @@ def main():
if args.domain == "subagent":
args.action = "subagent"
cmd_deploy(args)
elif args.domain == "tmux":
cmd_tmux_dispatch(args)
elif args.domain == "muse":
cmd = [str(BIN_DIR / "muse-cli-node"), args.node] + (args.muse_args or [])
res = subprocess.run(cmd)