Synced from monorepo
Synced from monorepo Changes: - Cache growing transcripts on the messages backend - Tell the model when a wait was clamped instead of re-inviting it - Stop the stationarity nudge from claiming results are identical - Deliver the stationarity nudge after the tool result - Run auth provider commands through the platform shell (fixes Windows) - Keep monitor tool stdout short and prescriptive - Use UUIDs for analytics event insert IDs - Stop crashing at startup when the host runs out of threads - Delete the current session from within the session - Add project forking-settings toggle (backend and deploy-time control) - Reap a session’s bash and background commands when it closes - Reap a session’s hook child processes when it closes - Track coding-data consent decisions - Fail open the access gate to stop false CLI paywalls - Ship Agent Dashboard user guide - Enable doom-loop recovery by default - Kill agent children and the idle inhibitor when the parent process dies - Fix multi-process credential wipe and orphaned session log writers Source-Revision: 6372e41d828b8a6ee82c29e01a69e27ec895cca9
This commit is contained in:
parent
5da6962e4a
commit
500129c714
89 changed files with 3841 additions and 771 deletions
31
crates/codegen/xai-grok-pager/src/slash/commands/delete.rs
Normal file
31
crates/codegen/xai-grok-pager/src/slash/commands/delete.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
//! `/delete` — delete this session's history and return home.
|
||||
|
||||
use crate::app::actions::Action;
|
||||
use crate::slash::command::{CommandExecCtx, CommandResult, SlashCommand};
|
||||
|
||||
pub struct DeleteCommand;
|
||||
|
||||
impl SlashCommand for DeleteCommand {
|
||||
fn name(&self) -> &str {
|
||||
"delete"
|
||||
}
|
||||
|
||||
fn description(&self) -> &str {
|
||||
"Delete this session and return home"
|
||||
}
|
||||
|
||||
fn session_scoped(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"/delete"
|
||||
}
|
||||
|
||||
fn run(&self, ctx: &mut CommandExecCtx, _args: &str) -> CommandResult {
|
||||
if ctx.session_id.is_none() {
|
||||
return CommandResult::Error("No active session to delete".into());
|
||||
}
|
||||
CommandResult::Action(Action::DeleteCurrentSession)
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ pub mod context;
|
|||
pub mod copy;
|
||||
pub mod dashboard;
|
||||
pub mod debug;
|
||||
pub mod delete;
|
||||
pub mod docs;
|
||||
pub mod doctor;
|
||||
pub mod edit_prompt;
|
||||
|
|
@ -81,6 +82,7 @@ pub fn builtin_commands() -> Vec<Arc<dyn SlashCommand>> {
|
|||
Arc::new(help::HelpCommand),
|
||||
Arc::new(docs::DocsCommand),
|
||||
Arc::new(home::HomeCommand),
|
||||
Arc::new(delete::DeleteCommand),
|
||||
Arc::new(new::NewCommand),
|
||||
Arc::new(fork::ForkCommand),
|
||||
Arc::new(compact::CompactCommand),
|
||||
|
|
@ -263,6 +265,7 @@ mod tests {
|
|||
"cost",
|
||||
"dashboard",
|
||||
"debug",
|
||||
"delete",
|
||||
"docs",
|
||||
"doctor",
|
||||
"edit-prompt",
|
||||
|
|
@ -397,6 +400,19 @@ mod tests {
|
|||
assert!(matches!(result, CommandResult::Action(Action::ExitSession)));
|
||||
}
|
||||
#[test]
|
||||
fn delete_requires_session_and_dispatches() {
|
||||
let models = ModelState::default();
|
||||
let cmd = delete::DeleteCommand;
|
||||
let mut ctx = make_ctx(&models);
|
||||
assert!(matches!(cmd.run(&mut ctx, ""), CommandResult::Error(_)));
|
||||
let session_id = acp::SessionId::new("sess-delete");
|
||||
ctx.session_id = Some(&session_id);
|
||||
assert!(matches!(
|
||||
cmd.run(&mut ctx, ""),
|
||||
CommandResult::Action(Action::DeleteCurrentSession)
|
||||
));
|
||||
}
|
||||
#[test]
|
||||
fn view_plan_returns_show_plan_action() {
|
||||
let models = ModelState::default();
|
||||
let mut ctx = make_ctx(&models);
|
||||
|
|
|
|||
Loading…
Reference in a new issue