feat(cli): commande /profile + sélection de profil avec reset de session confirmé — #164 (QA verte)
Ajoute /profile comme commande slash first-class dont la sémantique de reset
de session reste explicite et testable, séparée de la palette générique :
- domain + application: /profile est enregistrée et renvoie un effet
SlashCommandEffect::ProfileSwitch { session_id }. La commande ne reset pas
directement : elle délègue l'effet au frontend pour imposer une confirmation.
- frontend (CustomAgentChatView): à l'exécution de /profile, ouverture d'un
popup de sélection de profil informant que la validation reset la session,
avec confirmation explicite (confirmedReset) requise avant changeAgentProfile.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -244,13 +244,17 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profile_is_known_but_not_executable_yet() {
|
||||
let err = ExecuteSlashCommand::new(SlashCommandRegistry::new())
|
||||
fn profile_returns_profile_switch_effect() {
|
||||
let sid = session();
|
||||
let out = ExecuteSlashCommand::new(SlashCommandRegistry::new())
|
||||
.execute(ExecuteSlashCommandInput {
|
||||
name: "/profile".to_owned(),
|
||||
session_id: Some(session()),
|
||||
session_id: Some(sid),
|
||||
})
|
||||
.unwrap_err();
|
||||
assert!(matches!(err, AppError::Invalid(message) if message.contains("unavailable")));
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
out.effect,
|
||||
SlashCommandEffect::ProfileSwitch { session_id: sid }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,9 +133,7 @@ pub fn native_slash_commands() -> Vec<SlashCommand> {
|
||||
"/profile",
|
||||
"Changer le profil de l'agent",
|
||||
true,
|
||||
SlashCommandAvailability::Unavailable {
|
||||
reason: "La selection de profil est livree par le ticket #164".to_owned(),
|
||||
},
|
||||
SlashCommandAvailability::Available,
|
||||
SlashCommandSource::Native,
|
||||
Some(NativeSlashCommand::Profile),
|
||||
)
|
||||
@ -180,7 +178,7 @@ mod tests {
|
||||
assert_eq!(names, vec!["/help", "/clean", "/profile"]);
|
||||
assert!(commands[0].availability.is_available());
|
||||
assert!(commands[1].availability.is_available());
|
||||
assert!(!commands[2].availability.is_available());
|
||||
assert!(commands[2].availability.is_available());
|
||||
assert!(commands[2].requires_confirmation);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user