diff --git a/cli.py b/cli.py index af8ac4efc..73f83c7d5 100755 --- a/cli.py +++ b/cli.py @@ -3678,6 +3678,18 @@ class HermesCLI: self._handle_stop_command() elif canonical == "background": self._handle_background_command(cmd_original) + elif canonical == "queue": + if not self._agent_running: + _cprint(" /queue only works while Hermes is busy. Just type your message normally.") + else: + # Extract prompt after "/queue " or "/q " + parts = cmd_original.split(None, 1) + payload = parts[1].strip() if len(parts) > 1 else "" + if not payload: + _cprint(" Usage: /queue ") + else: + self._pending_input.put(payload) + _cprint(f" Queued for the next turn: {payload[:80]}{'...' if len(payload) > 80 else ''}") elif canonical == "skin": self._handle_skin_command(cmd_original) elif canonical == "voice": diff --git a/gateway/run.py b/gateway/run.py index 3b8cfc707..954738748 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -1369,6 +1369,23 @@ class GatewayRunner: del self._running_agents[_quick_key] return await self._handle_reset_command(event) + # /queue — queue without interrupting + if event.get_command() in ("queue", "q"): + queued_text = event.get_command_args().strip() + if not queued_text: + return "Usage: /queue " + adapter = self.adapters.get(source.platform) + if adapter: + from gateway.platforms.base import MessageEvent as _ME, MessageType as _MT + queued_event = _ME( + text=queued_text, + message_type=_MT.TEXT, + source=event.source, + message_id=event.message_id, + ) + adapter._pending_messages[_quick_key] = queued_event + return "Queued for the next turn." + if event.message_type == MessageType.PHOTO: logger.debug("PRIORITY photo follow-up for session %s — queueing without interrupt", _quick_key[:20]) adapter = self.adapters.get(source.platform) diff --git a/hermes_cli/commands.py b/hermes_cli/commands.py index 036faf948..1c687f6d3 100644 --- a/hermes_cli/commands.py +++ b/hermes_cli/commands.py @@ -67,6 +67,8 @@ COMMAND_REGISTRY: list[CommandDef] = [ gateway_only=True), CommandDef("background", "Run a prompt in the background", "Session", aliases=("bg",), args_hint=""), + CommandDef("queue", "Queue a prompt for the next turn (doesn't interrupt)", "Session", + aliases=("q",), args_hint=""), CommandDef("status", "Show session info", "Session", gateway_only=True), CommandDef("sethome", "Set this chat as the home channel", "Session",