|
|
@@ -57,6 +57,12 @@ const SLASH_COMMAND_SPECS: &[SlashCommandSpec] = &[
|
|
|
argument_hint: None,
|
|
|
resume_supported: true,
|
|
|
},
|
|
|
+ SlashCommandSpec {
|
|
|
+ name: "thinking",
|
|
|
+ summary: "Show or toggle extended thinking",
|
|
|
+ argument_hint: Some("[on|off]"),
|
|
|
+ resume_supported: false,
|
|
|
+ },
|
|
|
SlashCommandSpec {
|
|
|
name: "model",
|
|
|
summary: "Show or switch the active model",
|
|
|
@@ -84,7 +90,7 @@ const SLASH_COMMAND_SPECS: &[SlashCommandSpec] = &[
|
|
|
SlashCommandSpec {
|
|
|
name: "resume",
|
|
|
summary: "Load a saved session into the REPL",
|
|
|
- argument_hint: Some("<session-id-or-path>"),
|
|
|
+ argument_hint: Some("<session-path>"),
|
|
|
resume_supported: false,
|
|
|
},
|
|
|
SlashCommandSpec {
|
|
|
@@ -129,12 +135,6 @@ const SLASH_COMMAND_SPECS: &[SlashCommandSpec] = &[
|
|
|
argument_hint: Some("[list|switch <session-id>]"),
|
|
|
resume_supported: false,
|
|
|
},
|
|
|
- SlashCommandSpec {
|
|
|
- name: "sessions",
|
|
|
- summary: "List recent managed local sessions",
|
|
|
- argument_hint: None,
|
|
|
- resume_supported: false,
|
|
|
- },
|
|
|
];
|
|
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
|
@@ -142,6 +142,9 @@ pub enum SlashCommand {
|
|
|
Help,
|
|
|
Status,
|
|
|
Compact,
|
|
|
+ Thinking {
|
|
|
+ enabled: Option<bool>,
|
|
|
+ },
|
|
|
Model {
|
|
|
model: Option<String>,
|
|
|
},
|
|
|
@@ -169,7 +172,6 @@ pub enum SlashCommand {
|
|
|
action: Option<String>,
|
|
|
target: Option<String>,
|
|
|
},
|
|
|
- Sessions,
|
|
|
Unknown(String),
|
|
|
}
|
|
|
|
|
|
@@ -187,6 +189,13 @@ impl SlashCommand {
|
|
|
"help" => Self::Help,
|
|
|
"status" => Self::Status,
|
|
|
"compact" => Self::Compact,
|
|
|
+ "thinking" => Self::Thinking {
|
|
|
+ enabled: match parts.next() {
|
|
|
+ Some("on") => Some(true),
|
|
|
+ Some("off") => Some(false),
|
|
|
+ Some(_) | None => None,
|
|
|
+ },
|
|
|
+ },
|
|
|
"model" => Self::Model {
|
|
|
model: parts.next().map(ToOwned::to_owned),
|
|
|
},
|
|
|
@@ -214,7 +223,6 @@ impl SlashCommand {
|
|
|
action: parts.next().map(ToOwned::to_owned),
|
|
|
target: parts.next().map(ToOwned::to_owned),
|
|
|
},
|
|
|
- "sessions" => Self::Sessions,
|
|
|
other => Self::Unknown(other.to_string()),
|
|
|
})
|
|
|
}
|
|
|
@@ -287,6 +295,7 @@ pub fn handle_slash_command(
|
|
|
session: session.clone(),
|
|
|
}),
|
|
|
SlashCommand::Status
|
|
|
+ | SlashCommand::Thinking { .. }
|
|
|
| SlashCommand::Model { .. }
|
|
|
| SlashCommand::Permissions { .. }
|
|
|
| SlashCommand::Clear { .. }
|
|
|
@@ -299,7 +308,6 @@ pub fn handle_slash_command(
|
|
|
| SlashCommand::Version
|
|
|
| SlashCommand::Export { .. }
|
|
|
| SlashCommand::Session { .. }
|
|
|
- | SlashCommand::Sessions
|
|
|
| SlashCommand::Unknown(_) => None,
|
|
|
}
|
|
|
}
|
|
|
@@ -316,6 +324,22 @@ mod tests {
|
|
|
fn parses_supported_slash_commands() {
|
|
|
assert_eq!(SlashCommand::parse("/help"), Some(SlashCommand::Help));
|
|
|
assert_eq!(SlashCommand::parse(" /status "), Some(SlashCommand::Status));
|
|
|
+ assert_eq!(
|
|
|
+ SlashCommand::parse("/thinking on"),
|
|
|
+ Some(SlashCommand::Thinking {
|
|
|
+ enabled: Some(true),
|
|
|
+ })
|
|
|
+ );
|
|
|
+ assert_eq!(
|
|
|
+ SlashCommand::parse("/thinking off"),
|
|
|
+ Some(SlashCommand::Thinking {
|
|
|
+ enabled: Some(false),
|
|
|
+ })
|
|
|
+ );
|
|
|
+ assert_eq!(
|
|
|
+ SlashCommand::parse("/thinking"),
|
|
|
+ Some(SlashCommand::Thinking { enabled: None })
|
|
|
+ );
|
|
|
assert_eq!(
|
|
|
SlashCommand::parse("/model claude-opus"),
|
|
|
Some(SlashCommand::Model {
|
|
|
@@ -374,10 +398,6 @@ mod tests {
|
|
|
target: Some("abc123".to_string())
|
|
|
})
|
|
|
);
|
|
|
- assert_eq!(
|
|
|
- SlashCommand::parse("/sessions"),
|
|
|
- Some(SlashCommand::Sessions)
|
|
|
- );
|
|
|
}
|
|
|
|
|
|
#[test]
|
|
|
@@ -387,11 +407,12 @@ mod tests {
|
|
|
assert!(help.contains("/help"));
|
|
|
assert!(help.contains("/status"));
|
|
|
assert!(help.contains("/compact"));
|
|
|
+ assert!(help.contains("/thinking [on|off]"));
|
|
|
assert!(help.contains("/model [model]"));
|
|
|
assert!(help.contains("/permissions [read-only|workspace-write|danger-full-access]"));
|
|
|
assert!(help.contains("/clear [--confirm]"));
|
|
|
assert!(help.contains("/cost"));
|
|
|
- assert!(help.contains("/resume <session-id-or-path>"));
|
|
|
+ assert!(help.contains("/resume <session-path>"));
|
|
|
assert!(help.contains("/config [env|hooks|model]"));
|
|
|
assert!(help.contains("/memory"));
|
|
|
assert!(help.contains("/init"));
|
|
|
@@ -399,7 +420,6 @@ mod tests {
|
|
|
assert!(help.contains("/version"));
|
|
|
assert!(help.contains("/export [file]"));
|
|
|
assert!(help.contains("/session [list|switch <session-id>]"));
|
|
|
- assert!(help.contains("/sessions"));
|
|
|
assert_eq!(slash_command_specs().len(), 16);
|
|
|
assert_eq!(resume_supported_slash_commands().len(), 11);
|
|
|
}
|
|
|
@@ -418,7 +438,6 @@ mod tests {
|
|
|
text: "recent".to_string(),
|
|
|
}]),
|
|
|
],
|
|
|
- metadata: None,
|
|
|
};
|
|
|
|
|
|
let result = handle_slash_command(
|
|
|
@@ -449,6 +468,9 @@ mod tests {
|
|
|
let session = Session::new();
|
|
|
assert!(handle_slash_command("/unknown", &session, CompactionConfig::default()).is_none());
|
|
|
assert!(handle_slash_command("/status", &session, CompactionConfig::default()).is_none());
|
|
|
+ assert!(
|
|
|
+ handle_slash_command("/thinking on", &session, CompactionConfig::default()).is_none()
|
|
|
+ );
|
|
|
assert!(
|
|
|
handle_slash_command("/model claude", &session, CompactionConfig::default()).is_none()
|
|
|
);
|
|
|
@@ -483,6 +505,5 @@ mod tests {
|
|
|
assert!(
|
|
|
handle_slash_command("/session list", &session, CompactionConfig::default()).is_none()
|
|
|
);
|
|
|
- assert!(handle_slash_command("/sessions", &session, CompactionConfig::default()).is_none());
|
|
|
}
|
|
|
}
|