feat(chat): livre la CLI custom de chat agent (#147) et corrige Cancel
Implémente la vue chat structurée par cellule agent (toggle TUI/CLI custom, préférence persistée `preferred_view`, reattach live, composer + pièces jointes) avec le socle backend AgentSession/ChatBridge (UserPrompt, cancel_current_turn, routage interrupt_agent, commande cancel_agent_chat). Corrige le bug bloquant relevé par QA : le bouton Cancel de CustomAgentChatView interrompait tout le tour via closeAgentChat au lieu de n'annuler que le tour courant via cancelAgentChat, ce qui tuait la session contrairement au contrat produit validé. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -9,7 +9,7 @@ use app_tauri_lib::dto::{
|
||||
};
|
||||
use app_tauri_lib::events::{DomainEventDto, DOMAIN_EVENT};
|
||||
use application::{CloseTerminalOutput, LayoutOperation, LoadLayoutOutput, OpenTerminalInput};
|
||||
use domain::{Direction, LayoutNode, LayoutTree, LeafCell, NodeId};
|
||||
use domain::{Direction, LayoutNode, LayoutTree, LeafCell, NodeId, PreferredView};
|
||||
|
||||
use application::{AppError, HealthInput};
|
||||
use domain::events::DomainEvent;
|
||||
@ -311,6 +311,7 @@ fn layout_dto_serialises_camelcase_tagged_tree() {
|
||||
conversation_id: None,
|
||||
engine_session_id: None,
|
||||
agent_was_running: false,
|
||||
preferred_view: domain::PreferredView::Tui,
|
||||
});
|
||||
let dto = LayoutDto::from(LoadLayoutOutput {
|
||||
layout_id: domain::LayoutId::new_random(),
|
||||
@ -367,6 +368,26 @@ fn layout_operation_dto_set_session_accepts_null_session() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn layout_operation_dto_set_cell_preferred_view_deserialises() {
|
||||
let json = json!({
|
||||
"type": "setCellPreferredView",
|
||||
"target": nid(1).to_string(),
|
||||
"preferredView": "chat",
|
||||
});
|
||||
let dto: LayoutOperationDto = serde_json::from_value(json).unwrap();
|
||||
match dto.into_operation().unwrap() {
|
||||
LayoutOperation::SetCellPreferredView {
|
||||
target,
|
||||
preferred_view,
|
||||
} => {
|
||||
assert_eq!(target, nid(1));
|
||||
assert_eq!(preferred_view, PreferredView::Chat);
|
||||
}
|
||||
other => panic!("expected SetCellPreferredView, got {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn layout_operation_dto_resize_carries_weights() {
|
||||
let json = json!({
|
||||
@ -413,6 +434,7 @@ fn layout_dto_round_trips_a_split_tree_shape() {
|
||||
conversation_id: None,
|
||||
engine_session_id: None,
|
||||
agent_was_running: false,
|
||||
preferred_view: domain::PreferredView::Tui,
|
||||
})
|
||||
.split(
|
||||
nid(1),
|
||||
@ -424,6 +446,7 @@ fn layout_dto_round_trips_a_split_tree_shape() {
|
||||
conversation_id: None,
|
||||
engine_session_id: None,
|
||||
agent_was_running: false,
|
||||
preferred_view: domain::PreferredView::Tui,
|
||||
},
|
||||
nid(9),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user