Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/config/src/provider_defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub(crate) const DEFAULT_ZAI_MODEL: &str = "GLM-5.2";
pub(crate) const ZAI_GLM_5_1_MODEL: &str = "GLM-5.1";
// GLM-5.2 is both the default and a named tier; the alias arm resolves the
// `glm-5.2` spelling to DEFAULT_ZAI_MODEL directly, so this constant is
// referenced only in cfg(test) assertions (see tests.rs).
// referenced only in cfg(test) assertions (see tests.rs). (see #3490)
#[allow(dead_code)]
pub(crate) const ZAI_GLM_5_2_MODEL: &str = "GLM-5.2";
pub(crate) const ZAI_GLM_5_TURBO_MODEL: &str = "GLM-5-Turbo";
Expand Down
2 changes: 1 addition & 1 deletion crates/tui/src/client/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2372,7 +2372,7 @@ pub(super) fn parse_chat_message(payload: &Value) -> Result<MessageResponse> {
// === Streaming Helpers ===

/// Build synthetic stream events from a non-streaming response (used as fallback).
#[allow(dead_code)]
#[allow(dead_code)] // Fallback for non-streaming responses; not yet wired (see #3490)
fn build_stream_events(response: &MessageResponse) -> Vec<StreamEvent> {
let mut events = Vec::new();
let mut index = 0u32;
Expand Down
5 changes: 5 additions & 0 deletions crates/tui/src/commands/groups/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod hf;
mod home;
mod hooks;
mod hotbar;
mod setup;
mod links;
mod model;
mod modeldb;
Expand Down Expand Up @@ -100,6 +101,10 @@ impl CommandGroup for CoreCommands {
hotbar::HotbarCmd::info(),
hotbar::HotbarCmd::execute,
)),
Box::new(FunctionCommand::new(
setup::SetupCmd::info(),
setup::SetupCmd::execute,
)),
Box::new(FunctionCommand::new(
agent::AgentCmd::info(),
agent::AgentCmd::execute,
Expand Down
98 changes: 98 additions & 0 deletions crates/tui/src/commands/groups/core/setup.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
//! `/setup` command — opens the setup summary wizard.

use crate::commands::traits::{CommandInfo, RegisterCommand};
use crate::localization::MessageId;
use crate::tui::app::{App, AppAction};

use super::CommandResult;

pub(in crate::commands) const COMMAND_INFO: CommandInfo = CommandInfo {
name: "setup",
aliases: &["config-summary", "status"],
usage: "/setup",
description_id: MessageId::CmdSetupDescription,
};

pub(in crate::commands) struct SetupCmd;

impl RegisterCommand for SetupCmd {
fn info() -> &'static CommandInfo {
&COMMAND_INFO
}

fn execute(_app: &mut App, arg: Option<&str>) -> CommandResult {
match arg.map(str::trim).filter(|arg| !arg.is_empty()) {
None | Some("summary" | "wizard") => {
CommandResult::action(AppAction::OpenSetupSummary)
}
Some("help" | "?") => CommandResult::message(
"Usage: /setup [summary]\n\n/setup opens the configuration summary wizard.",
),
Some(other) => CommandResult::error(format!(
"Unknown /setup target '{other}'. Use `/setup` or `/setup summary`."
)),
}
}
}

#[cfg(test)]
mod tests {
use super::*;
use crate::config::Config;
use crate::tui::app::TuiOptions;
use std::path::PathBuf;

fn test_app() -> App {
let options = TuiOptions {
model: "deepseek-v4-pro".to_string(),
workspace: PathBuf::from("."),
config_path: None,
config_profile: None,
allow_shell: false,
use_alt_screen: true,
use_mouse_capture: false,
use_bracketed_paste: true,
max_subagents: 1,
skills_dir: PathBuf::from("."),
memory_path: PathBuf::from("memory.md"),
notes_path: PathBuf::from("notes.txt"),
mcp_config_path: PathBuf::from("mcp.json"),
use_memory: false,
start_in_agent_mode: false,
skip_onboarding: true,
yolo: false,
resume_session_id: None,
initial_input: None,
};
App::new(options, &Config::default())
}

#[test]
fn setup_command_opens_summary() {
let mut app = test_app();
let result = SetupCmd::execute(&mut app, None);
assert_eq!(result.action, Some(AppAction::OpenSetupSummary));
}

#[test]
fn setup_summary_alias() {
let mut app = test_app();
let result = SetupCmd::execute(&mut app, Some("summary"));
assert_eq!(result.action, Some(AppAction::OpenSetupSummary));
}

#[test]
fn setup_help_arg() {
let mut app = test_app();
let result = SetupCmd::execute(&mut app, Some("help"));
assert!(!result.is_error);
assert!(result.action.is_none());
}

#[test]
fn setup_unknown_arg() {
let mut app = test_app();
let result = SetupCmd::execute(&mut app, Some("bogus"));
assert!(result.is_error);
}
}
2 changes: 1 addition & 1 deletion crates/tui/src/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ pub fn plan_compaction(
}
}

#[allow(dead_code)]
#[allow(dead_code)] // Internal compaction correctness helper; kept for tool-call pair enforcement (see #3490)
fn enforce_tool_call_pairs(messages: &[Message], pinned_indices: &mut BTreeSet<usize>) {
if pinned_indices.is_empty() {
return;
Expand Down
2 changes: 1 addition & 1 deletion crates/tui/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ pub struct RetryPolicy {
impl RetryPolicy {
/// Compute the backoff delay for a retry attempt.
#[must_use]
#[allow(dead_code)] // used by runtime_api; will be wired into client retry loop
#[allow(dead_code)] // used by runtime_api; will be wired into client retry loop (see #3490)
pub fn delay_for_attempt(&self, attempt: u32) -> std::time::Duration {
let exponent = i32::try_from(attempt).unwrap_or(i32::MAX);
let delay = self.initial_delay * self.exponential_base.powi(exponent);
Expand Down
1 change: 1 addition & 0 deletions crates/tui/src/config_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ pub struct WebConfigSession {
#[derive(Debug)]
pub struct WebConfigSession {
#[allow(dead_code)]
// WebConfigSession receiver; reserved for future event-driven config UI (see #3490)
pub receiver: tokio::sync::mpsc::UnboundedReceiver<WebConfigSessionEvent>,
}

Expand Down
5 changes: 3 additions & 2 deletions crates/tui/src/core/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ pub struct EngineConfig {
pub tools_always_load: HashSet<String>,
/// When true and `/usr/bin/bwrap` is present on Linux, route exec_shell
/// through bubblewrap instead of relying solely on Landlock (#2184).
#[allow(dead_code)] // Wired through ShellManager in follow-up PR
#[allow(dead_code)]
// Wired through ShellManager in follow-up PR (see #3490)
pub prefer_bwrap: bool,
/// Tool override and plugin configuration (`[tools]` table in config.toml).
/// Applied to the per-turn tool registry after built-in tools are registered.
Expand Down Expand Up @@ -487,7 +488,7 @@ impl Default for EngineConfig {
/// `External`, `Preempted`, and `Internal` are reserved for the
/// remaining direct cancellation paths tracked in #1541.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(dead_code)]
#[allow(dead_code)] // CancelReason enum; wired in follow-up for user-facing cancel diagnostics (see #3490)
pub enum CancelReason {
/// User-initiated cancel (Esc, `/cancel`, click cancel on modal).
User,
Expand Down
6 changes: 3 additions & 3 deletions crates/tui/src/core/engine/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,12 @@ pub(super) fn extract_compaction_summary_prompt(
}
}

#[allow(dead_code)] // exposed for future engine-side callers; current call path goes through compaction::estimate_input_tokens_conservative via token_estimate_cache.
#[allow(dead_code)] // exposed for future engine-side callers; current call path goes through compaction::estimate_input_tokens_conservative via token_estimate_cache. (see #3490)
fn estimate_text_tokens_conservative(text: &str) -> usize {
text.chars().count().div_ceil(3)
}

#[allow(dead_code)] // see estimate_text_tokens_conservative above
#[allow(dead_code)] // see estimate_text_tokens_conservative above (see #3490)
fn estimate_system_tokens_conservative(system: Option<&SystemPrompt>) -> usize {
match system {
Some(SystemPrompt::Text(text)) => estimate_text_tokens_conservative(text),
Expand All @@ -553,7 +553,7 @@ fn estimate_system_tokens_conservative(system: Option<&SystemPrompt>) -> usize {
}
}

#[allow(dead_code)] // see estimate_text_tokens_conservative above
#[allow(dead_code)] // see estimate_text_tokens_conservative above (see #3490)
pub(super) fn estimate_input_tokens_conservative(
messages: &[Message],
system: Option<&SystemPrompt>,
Expand Down
2 changes: 1 addition & 1 deletion crates/tui/src/core/engine/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use super::ToolUseState;

// === Types ============================================================

#[allow(dead_code)] // `index` mirrors batch order for diagnostic ergonomics.
#[allow(dead_code)] // `index` mirrors batch order for diagnostic ergonomics. (see #3490)
pub(super) struct ToolExecOutcome {
pub(super) index: usize,
pub(super) id: String,
Expand Down
2 changes: 1 addition & 1 deletion crates/tui/src/core/engine/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl EngineHandle {

/// Check if a request is currently cancelled
#[must_use]
#[allow(dead_code)]
#[allow(dead_code)] // Used by engine tests; wrapper around CancellationToken (see #3490)
pub fn is_cancelled(&self) -> bool {
match self.cancel_token.lock() {
Ok(token) => token.is_cancelled(),
Expand Down
8 changes: 4 additions & 4 deletions crates/tui/src/core/engine/token_estimate_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl TokenEstimateCache {
/// Record a messages-revision bump. The engine calls this whenever
/// `session.messages` is mutated. Calling it with a value smaller than
/// the current value is a no-op (the cache is monotonic).
#[allow(dead_code)] // exposed for future wiring of /clear and reset paths; tests exercise it
#[allow(dead_code)] // exposed for future wiring of /clear and reset paths; tests exercise it (see #3490)
pub fn bump_messages_revision(&mut self, revision: u64) {
if revision > self.messages_revision {
self.messages_revision = revision;
Expand All @@ -106,7 +106,7 @@ impl TokenEstimateCache {
}

/// Forget all cached state. Used by `/clear` and session reset paths.
#[allow(dead_code)] // exposed for future wiring of /clear and reset paths; tests exercise it
#[allow(dead_code)] // exposed for future wiring of /clear and reset paths; tests exercise it (see #3490)
pub fn invalidate(&mut self) {
self.cached_tokens = None;
self.system_fingerprint = 0;
Expand All @@ -116,15 +116,15 @@ impl TokenEstimateCache {
}

/// Returns `(hits, misses)` counters since the last `invalidate` call.
#[allow(dead_code)] // surfaced via /status in a follow-up; tests exercise it
#[allow(dead_code)] // surfaced via /status in a follow-up; tests exercise it (see #3490)
#[must_use]
pub fn stats(&self) -> (u64, u64) {
(self.hits, self.misses)
}

/// Returns the most recent `(revision, tokens)` audit entries, newest
/// first. Bounded by [`AUDIT_RING_CAPACITY`].
#[allow(dead_code)] // surfaced via /status in a follow-up; tests exercise it
#[allow(dead_code)] // surfaced via /status in a follow-up; tests exercise it (see #3490)
#[must_use]
pub fn recent_audit(&self) -> &[(u64, usize)] {
&self.audit_ring
Expand Down
20 changes: 10 additions & 10 deletions crates/tui/src/core/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,39 @@ pub enum Event {
// === Streaming Events ===
/// A new message block has started
MessageStarted {
#[allow(dead_code)]
#[allow(dead_code)] // StreamEvent ContentBlockStart index (see #3490)
index: usize,
},

/// Incremental text content delta
MessageDelta {
#[allow(dead_code)]
#[allow(dead_code)] // StreamEvent ContentBlockDelta index (see #3490)
index: usize,
content: String,
},

/// Message block completed
MessageComplete {
#[allow(dead_code)]
#[allow(dead_code)] // StreamEvent ContentBlockStop index (see #3490)
index: usize,
},

/// Thinking block started
ThinkingStarted {
#[allow(dead_code)]
#[allow(dead_code)] // StreamEvent MessageDelta index (see #3490)
index: usize,
},

/// Incremental thinking content delta
ThinkingDelta {
#[allow(dead_code)]
#[allow(dead_code)] // MCP StreamEvent Ping (see #3490)
index: usize,
content: String,
},

/// Thinking block completed
ThinkingComplete {
#[allow(dead_code)]
#[allow(dead_code)] // StreamEvent internal_error_tx field (see #3490)
index: usize,
},

Expand Down Expand Up @@ -111,10 +111,10 @@ pub enum Event {
auto: bool,
message: String,
/// Number of messages before compaction.
#[allow(dead_code)]
#[allow(dead_code)] // StreamError messages_before (see #3490)
messages_before: Option<usize>,
/// Number of messages after compaction.
#[allow(dead_code)]
#[allow(dead_code)] // StreamError messages_after (see #3490)
messages_after: Option<usize>,
},

Expand Down Expand Up @@ -183,7 +183,7 @@ pub enum Event {
/// An error occurred
Error {
envelope: ErrorEnvelope,
#[allow(dead_code)]
#[allow(dead_code)] // StreamError recoverable flag (see #3490)
recoverable: bool,
},

Expand Down Expand Up @@ -244,7 +244,7 @@ pub enum Event {
},

/// Request user decision after sandbox denial
#[allow(dead_code)]
#[allow(dead_code)] // UserInputDecision ElevationRequired (see #3490)
ElevationRequired {
tool_id: String,
tool_name: String,
Expand Down
4 changes: 2 additions & 2 deletions crates/tui/src/core/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct ProviderRuntimeStatus {
///
/// Chat providers force several runtime/control-plane signals through
/// `role = "user"` for compatibility, so role alone is not authority.
#[allow(dead_code)] // Some origins are reserved for ingestion sites landing after the first gate.
#[allow(dead_code)] // Some origins are reserved for ingestion sites landing after the first gate. (see #3490)
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum UserInputProvenance {
/// Text typed or submitted through the active UI/API input boundary.
Expand Down Expand Up @@ -139,7 +139,7 @@ pub enum Op {
},

/// Cancel the current request
#[allow(dead_code)]
#[allow(dead_code)] // CancelRequest user operation; wired in follow-up (see #3490)
CancelRequest,

/// Approve a tool call that requires permission
Expand Down
2 changes: 1 addition & 1 deletion crates/tui/src/core/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl Session {
/// compaction. Bumps `messages_revision` exactly once even when the new
/// history has a different length, so downstream caches invalidate
/// atomically.
#[allow(dead_code)]
#[allow(dead_code)] // Session resume/compaction API; kept for future callers (see #3490)
pub fn replace_messages(&mut self, messages: Vec<Message>) {
self.messages = messages.into();
self.messages_revision = self.messages_revision.saturating_add(1);
Expand Down
8 changes: 4 additions & 4 deletions crates/tui/src/core/turn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct TurnContext {
pub id: String,

/// When the turn started
#[allow(dead_code)]
#[allow(dead_code)] // TurnMetadata started_at (see #3490)
pub started_at: Instant,

/// Current step in the turn (tool call iteration)
Expand All @@ -38,7 +38,7 @@ pub struct TurnContext {
tool_call_count: usize,

/// Whether the turn has been cancelled
#[allow(dead_code)]
#[allow(dead_code)] // TurnMetadata cancelled flag (see #3490)
pub cancelled: bool,

/// Usage for this turn
Expand Down Expand Up @@ -85,13 +85,13 @@ impl TurnContext {
}

/// Cancel the turn
#[allow(dead_code)]
#[allow(dead_code)] // TurnContext cancel; part of public API (see #3490)
pub fn cancel(&mut self) {
self.cancelled = true;
}

/// Get the elapsed time
#[allow(dead_code)]
#[allow(dead_code)] // TurnContext elapsed; part of public API (see #3490)
pub fn elapsed(&self) -> Duration {
self.started_at.elapsed()
}
Expand Down
Loading
Loading