grok-build-upstream-mirror/crates/codegen/xai-grok-pager/src/slash/commands/queue.rs
grokkybara[bot] 3af4d5d398 Synced from monorepo
Synced from monorepo

Changes:
- Shell: accept target response id on rewind execute
- Shell: stamp response id on chat user message chunks
- Worktree: optional rebuild and stale git registration cleanup in auto-GC
- Worktree: kind-aware auto-GC TTLs and config knobs
- Worktree: macOS process CWD scan and Unix PID liveness for GC guards
- Worktree: automatic throttled GC on startup (Linux age-based; non-Linux dead-only)
- Pager: add `[ui].combine_queued_prompts` to batch queued follow-ups
- Shell: stop overwriting user skills
- Tools: read markdown in `skills/` directories untruncated
- `/usage` shows per-session token and dollar usage in the TUI
- Security: prompt on environment-dumping `ps` variants
- Security: always-safe `kubectl` no longer runs arbitrary kubeconfig credential plugins without permission
- Tools: make scheduler deletion durable
- Shell: add relocation storage primitives
- Shell: give side model calls their own conversation ids
- Fix five workflow-runtime bugs (budget, pause, cancel, reconnect)
- Security: peel `env -S` / `--split-string` operands in the Bash permission gate (managed deny/ask)
- Pager: expose doctor in the TUI
- Security: block unauthorized RCE via abused safe commands
- Pager idle watcher cue: "1 subagent still running" instead of "watching · 1 subagent"
- Security: block `rg --pre` arbitrary code execution in auto-mode
- Voice: diagnose silent-mic failures (macOS permission) and add doctor/terminal-setup Voice section
- App builder deployer: `allow_forking` and `show_built_with_grok`
- Pager: stop stacking duplicate "Worked for" markers on parked turns
- Shell: support `max` as a distinct reasoning effort tier
- Tools: serialize background `/loop` fires on the whole work unit
- Shell: add working-directory relocation state primitives
- Proto: `ClientToolResult` and `ChatConfig` client-side tools
- Shell: model providers
- Chat: select App Builder product on the Build path
- Shell: attach author identity to feedback when the deployment opts in
- Doctor: fix for SSH wrap setup
- Workflow authoring skills: create-workflow and import-claude-workflow docs
- Add read-only grok doctor
- Sandbox: apply Landlock without a controlling TTY
- Pager: recover image paste over grok wrap on headless remotes
- Pager: make actions screen-mode aware
- Shell: resume sessions when the working directory moves
- Pager: centralize terminal diagnostics
- Workspace: gate inline shell file access
- Pager: centralize terminal probes
- Pager: edit minimal prompts in an external editor
- Pager: standardize backgrounding on Ctrl+B
- Shell: recap rides the parent turn's prompt cache
- Tools: add scheduler lifecycle version clock

Source-Revision: 0f4d7c91b8b2b408333f6de1e8a76cb8eaa71899
2026-07-21 18:10:23 +00:00

91 lines
2.8 KiB
Rust

//! `/queue` -- list the queued prompts as a committed system block.
//!
//! Minimal mode has no interactive `QueuePane`, so `/queue` is the way to
//! inspect what's waiting behind the running turn. It works in every
//! render mode. The dispatcher (`dispatch_show_queue`) reads the merged
//! server + local queue and commits a read-only list; editing the queue is
//! out of scope here (use the queue pane in the full TUI).
use crate::app::actions::Action;
use crate::slash::command::{CommandExecCtx, CommandResult, SlashCommand};
/// List the queued prompts.
pub struct QueueCommand;
impl SlashCommand for QueueCommand {
fn name(&self) -> &str {
"queue"
}
fn description(&self) -> &str {
"List the prompts queued behind the running turn"
}
fn session_scoped(&self) -> bool {
true
}
fn usage(&self) -> &str {
"/queue"
}
fn run(&self, ctx: &mut CommandExecCtx, _args: &str) -> CommandResult {
if ctx.session_id.is_none() {
return CommandResult::Error("No active session".to_string());
}
CommandResult::Action(Action::ShowQueue)
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::acp::model_state::ModelState;
use crate::app::bundle::BundleState;
use crate::settings::PagerLocalSnapshot;
static DEFAULT_BUNDLE_STATE: BundleState = BundleState {
has_cache: false,
version: String::new(),
personas: Vec::new(),
roles: Vec::new(),
agents: Vec::new(),
skills: Vec::new(),
persona_details: Vec::new(),
role_details: Vec::new(),
};
fn ctx_with_session(models: &ModelState, sid: Option<&agent_client_protocol::SessionId>) {
let mut ctx = CommandExecCtx {
models,
session_id: sid,
bundle_state: &DEFAULT_BUNDLE_STATE,
screen_mode: crate::app::ScreenMode::Minimal,
billing_surface_visible: true,
pager_state: PagerLocalSnapshot::default(),
};
match (QueueCommand.run(&mut ctx, ""), sid.is_some()) {
(CommandResult::Action(Action::ShowQueue), true) => {}
(CommandResult::Error(msg), false) => assert!(msg.contains("No active session")),
(other, has) => panic!("unexpected result {other:?} for has_session={has}"),
}
}
#[test]
fn no_session_errors() {
let models = ModelState::default();
ctx_with_session(&models, None);
}
#[test]
fn with_session_dispatches_show_queue() {
let models = ModelState::default();
let sid = agent_client_protocol::SessionId::from("s1".to_string());
ctx_with_session(&models, Some(&sid));
}
#[test]
fn available_in_minimal_by_default() {
assert!(QueueCommand.available_in_minimal());
}
}