feat(backend,frontend): lot utilisateur #310 #311 #312 #313 — horodatage conversation, stop agent robuste, préférence terminal par défaut, paramètres projet (QA verte)
- #310: horodatage de tous les messages et événements de conversation visibles — composant partagé EntryTimestamp, timestamps propagés dans le transcript chat, les annonces inter-agent et le viewer de conversation, normalisation côté domain/adapters (conversation_log, paginate). - #311: stop d'agent robuste pour PTY non monté, sessions headless et CLI custom — lifecycle/orchestrator durcis, ponts chat app-tauri/web-server alignés, arrêt fiable sans session orpheline. - #312: préférence globale d'interface terminal par défaut — nouveau store settings (domain/application/infrastructure + tests), DTO et commandes backend, adapter frontend userSettings, panneau TerminalSettings dans les paramètres globaux. - #313: Paramètres du projet — contexte de projet éditable et couleur de thème par projet (ProjectSettingsPanel + projectTheme), teinte des onglets projet, persistance via DTO projet. QA verte (GO QA sur feature/batch-310-311-312-313-chat-stop-prefs-theme) — vérifications Git: git diff --cached --check OK; staging borné à crates/ et frontend/ (74 fichiers, +2105/-531), commit unique de lot conforme à la convention des lots (précédents batch-151/158/159, batch-210/211/212) car les fichiers partagés (dto.rs, commands.rs, CustomAgentChatView) entrelacent les 4 tickets. fichiers .ideai/* (agents/test.md, chat-drafts.json, system-permissions.json, tickets/counter.json, tickets/index.json, tickets/308-313/), attachments/ et scripts/ hors périmètre et préservés en worktree ; aucun push. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -40,13 +40,16 @@ use domain::ports::{
|
||||
ContextInjectionPlan, DirEntry, EventBus, EventStream, ExitStatus, FileSystem, FsError,
|
||||
IdGenerator, MemoryError, MemoryQuery, MemoryRecall, OutputStream, PreparedContext,
|
||||
ProfileStore, ProjectStore, PtyError, PtyHandle, PtyPort, RemotePath, ReplyEvent, ReplyStream,
|
||||
RuntimeError, SessionPlan, SkillStore, SpawnSpec, StoreError,
|
||||
RuntimeError, SessionPlan, SkillStore, SpawnSpec, StoreError, UserSettingsStore,
|
||||
};
|
||||
use domain::profile::{AgentProfile, ContextInjection, StructuredAdapter};
|
||||
use domain::project::{Project, ProjectPath};
|
||||
use domain::remote::RemoteRef;
|
||||
use domain::skill::{Skill, SkillScope};
|
||||
use domain::{MemoryIndexEntry, NodeId, PtySize, SessionId, SessionKind, SkillId};
|
||||
use domain::{
|
||||
DefaultAgentTerminalInterface, IdeaUserSettings, MemoryIndexEntry, NodeId, PtySize, SessionId,
|
||||
SessionKind, SkillId,
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
use application::{
|
||||
@ -772,6 +775,7 @@ fn launch_input(agent_id: AgentId) -> LaunchAgentInput {
|
||||
mcp_runtime: None,
|
||||
allow_structured_alongside_pty: false,
|
||||
require_structured: false,
|
||||
terminal_interface: None,
|
||||
fresh_start: false,
|
||||
managed_temp_exposure: ManagedTempExposureRequest::default(),
|
||||
}
|
||||
@ -858,10 +862,103 @@ fn launch_fixture_with_mode(
|
||||
}
|
||||
}
|
||||
|
||||
struct FixedUserSettings(IdeaUserSettings);
|
||||
|
||||
#[async_trait]
|
||||
impl UserSettingsStore for FixedUserSettings {
|
||||
async fn load(&self) -> Result<IdeaUserSettings, StoreError> {
|
||||
Ok(self.0.clone())
|
||||
}
|
||||
async fn save(&self, _settings: &IdeaUserSettings) -> Result<(), StoreError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct MutableUserSettings(Arc<Mutex<IdeaUserSettings>>);
|
||||
|
||||
#[async_trait]
|
||||
impl UserSettingsStore for MutableUserSettings {
|
||||
async fn load(&self) -> Result<IdeaUserSettings, StoreError> {
|
||||
Ok(self.0.lock().unwrap().clone())
|
||||
}
|
||||
async fn save(&self, settings: &IdeaUserSettings) -> Result<(), StoreError> {
|
||||
*self.0.lock().unwrap() = settings.clone();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn launch_fixture_with_preference(interface: DefaultAgentTerminalInterface) -> LaunchFixture {
|
||||
let mut fixture = launch_fixture_with_mode(
|
||||
structured_profile(pid(9)),
|
||||
FakeFactory::new(500, Some("engine-conv")),
|
||||
StructuredRoutingMode::HumanPtyFallback,
|
||||
);
|
||||
let launch = Arc::try_unwrap(fixture.launch)
|
||||
.ok()
|
||||
.expect("fixture owns its launcher")
|
||||
.with_user_settings(Arc::new(FixedUserSettings(IdeaUserSettings {
|
||||
default_agent_terminal_interface: Some(interface),
|
||||
})));
|
||||
fixture.launch = Arc::new(launch);
|
||||
fixture
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// 1. Routage LaunchAgent : chemin structuré
|
||||
// ===========================================================================
|
||||
|
||||
#[tokio::test]
|
||||
async fn global_idea_cli_preference_applies_to_a_new_human_launch() {
|
||||
let f = launch_fixture_with_preference(DefaultAgentTerminalInterface::IdeaCli);
|
||||
let out = f.launch.execute(launch_input(f.agent.id)).await.unwrap();
|
||||
assert!(out.structured.is_some());
|
||||
assert_eq!(f.factory.start_count(), 1);
|
||||
assert_eq!(f.pty.spawn_count(), 0);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn explicit_native_tui_overrides_the_global_idea_cli_preference() {
|
||||
let f = launch_fixture_with_preference(DefaultAgentTerminalInterface::IdeaCli);
|
||||
let mut input = launch_input(f.agent.id);
|
||||
input.terminal_interface = Some(DefaultAgentTerminalInterface::NativeTui);
|
||||
let out = f.launch.execute(input).await.unwrap();
|
||||
assert!(out.structured.is_none());
|
||||
assert_eq!(f.factory.start_count(), 0);
|
||||
assert_eq!(f.pty.spawn_count(), 1);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn changing_global_preference_does_not_replace_an_existing_terminal() {
|
||||
let mut fixture = launch_fixture_with_mode(
|
||||
structured_profile(pid(9)),
|
||||
FakeFactory::new(500, Some("engine-conv")),
|
||||
StructuredRoutingMode::HumanPtyFallback,
|
||||
);
|
||||
let settings = MutableUserSettings(Arc::new(Mutex::new(IdeaUserSettings::default())));
|
||||
let launch = Arc::try_unwrap(fixture.launch)
|
||||
.ok()
|
||||
.unwrap()
|
||||
.with_user_settings(Arc::new(settings.clone()));
|
||||
fixture.launch = Arc::new(launch);
|
||||
|
||||
let mut input = launch_input(fixture.agent.id);
|
||||
input.node_id = Some(nid(3));
|
||||
let first = fixture.launch.execute(input.clone()).await.unwrap();
|
||||
assert!(first.structured.is_none());
|
||||
settings
|
||||
.save(&IdeaUserSettings {
|
||||
default_agent_terminal_interface: Some(DefaultAgentTerminalInterface::IdeaCli),
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let second = fixture.launch.execute(input).await.unwrap();
|
||||
assert_eq!(second.session.id, first.session.id);
|
||||
assert_eq!(fixture.pty.spawn_count(), 1);
|
||||
assert_eq!(fixture.factory.start_count(), 0);
|
||||
}
|
||||
|
||||
/// Profil structuré + factory câblée ⇒ `factory.start` appelé une fois, session
|
||||
/// enregistrée dans `StructuredSessions`, AUCUN `pty.spawn`, `AgentLaunched` publié,
|
||||
/// `output.structured = Some(descriptor)` avec les bons champs.
|
||||
|
||||
Reference in New Issue
Block a user