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:
@ -344,6 +344,7 @@ fn progress_entity_key(progress: &ReplyProgressDto) -> Option<String> {
|
||||
fn reply_chunk_bytes(chunk: &ReplyChunk) -> usize {
|
||||
match chunk {
|
||||
ReplyChunk::UserPrompt {
|
||||
at_ms: _,
|
||||
text,
|
||||
attachments,
|
||||
attachment_refs,
|
||||
@ -360,8 +361,8 @@ fn reply_chunk_bytes(chunk: &ReplyChunk) -> usize {
|
||||
})
|
||||
.sum::<usize>()
|
||||
}
|
||||
ReplyChunk::TextDelta { text } => text.len(),
|
||||
ReplyChunk::ToolActivity { label } => label.len(),
|
||||
ReplyChunk::TextDelta { text, .. } => text.len(),
|
||||
ReplyChunk::ToolActivity { label, .. } => label.len(),
|
||||
ReplyChunk::Progress { progress } => {
|
||||
progress.label.len()
|
||||
+ progress.text.as_ref().map_or(0, String::len)
|
||||
@ -369,8 +370,8 @@ fn reply_chunk_bytes(chunk: &ReplyChunk) -> usize {
|
||||
+ progress.native_event.as_ref().map_or(0, String::len)
|
||||
+ progress.tool_name.as_ref().map_or(0, String::len)
|
||||
}
|
||||
ReplyChunk::Final { content } => content.len(),
|
||||
ReplyChunk::Error { message } => message.len(),
|
||||
ReplyChunk::Final { content, .. } => content.len(),
|
||||
ReplyChunk::Error { message, .. } => message.len(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,40 +387,57 @@ fn reply_chunk_bytes(chunk: &ReplyChunk) -> usize {
|
||||
/// too. Every content-bearing event still maps to exactly one chunk.
|
||||
#[must_use]
|
||||
pub fn chunk_from_event(event: ReplyEvent) -> Option<ReplyChunk> {
|
||||
chunk_from_event_at(event, None)
|
||||
}
|
||||
|
||||
/// Maps a domain reply event while preserving the backend acceptance time.
|
||||
#[must_use]
|
||||
pub fn chunk_from_event_at(event: ReplyEvent, at_ms: Option<u64>) -> Option<ReplyChunk> {
|
||||
match event {
|
||||
ReplyEvent::Progress { progress } => Some(ReplyChunk::Progress {
|
||||
progress: progress.into(),
|
||||
}),
|
||||
ReplyEvent::TextDelta { text } => Some(ReplyChunk::TextDelta { text }),
|
||||
ReplyEvent::Progress { progress } => {
|
||||
let mut progress: ReplyProgressDto = progress.into();
|
||||
progress.occurred_at_ms = at_ms;
|
||||
Some(ReplyChunk::Progress { progress })
|
||||
}
|
||||
ReplyEvent::TextDelta { text } => Some(ReplyChunk::TextDelta { text, at_ms }),
|
||||
ReplyEvent::ToolActivity { label } => Some(ReplyChunk::Progress {
|
||||
progress: ReplyProgress::new(
|
||||
ReplyProgressSource::ProviderNative,
|
||||
ReplyProgressKind::Tool,
|
||||
ReplyProgressStage::Info,
|
||||
label.clone(),
|
||||
)
|
||||
.with_tool_name(label)
|
||||
.into(),
|
||||
progress: {
|
||||
let mut progress: ReplyProgressDto = ReplyProgress::new(
|
||||
ReplyProgressSource::ProviderNative,
|
||||
ReplyProgressKind::Tool,
|
||||
ReplyProgressStage::Info,
|
||||
label.clone(),
|
||||
)
|
||||
.with_tool_name(label)
|
||||
.into();
|
||||
progress.occurred_at_ms = at_ms;
|
||||
progress
|
||||
},
|
||||
}),
|
||||
ReplyEvent::Error { message } => Some(ReplyChunk::Error { message }),
|
||||
ReplyEvent::Error { message } => Some(ReplyChunk::Error { message, at_ms }),
|
||||
ReplyEvent::Final { content } => {
|
||||
if content.trim().is_empty() {
|
||||
Some(ReplyChunk::Error {
|
||||
message: "Réponse vide du modèle.".to_owned(),
|
||||
at_ms,
|
||||
})
|
||||
} else {
|
||||
Some(ReplyChunk::Final { content })
|
||||
Some(ReplyChunk::Final { content, at_ms })
|
||||
}
|
||||
}
|
||||
ReplyEvent::Announcement { text } => Some(ReplyChunk::Progress {
|
||||
progress: ReplyProgress::new(
|
||||
ReplyProgressSource::ProviderNative,
|
||||
ReplyProgressKind::Message,
|
||||
ReplyProgressStage::Delta,
|
||||
"message intermédiaire",
|
||||
)
|
||||
.with_text(text)
|
||||
.into(),
|
||||
progress: {
|
||||
let mut progress: ReplyProgressDto = ReplyProgress::new(
|
||||
ReplyProgressSource::ProviderNative,
|
||||
ReplyProgressKind::Message,
|
||||
ReplyProgressStage::Delta,
|
||||
"message intermédiaire",
|
||||
)
|
||||
.with_text(text)
|
||||
.into();
|
||||
progress.occurred_at_ms = at_ms;
|
||||
progress
|
||||
},
|
||||
}),
|
||||
ReplyEvent::Heartbeat => None,
|
||||
ReplyEvent::RateLimited { .. } => None,
|
||||
@ -432,5 +450,20 @@ pub fn chunk_from_event(event: ReplyEvent) -> Option<ReplyChunk> {
|
||||
pub fn unfinished_turn_chunk() -> ReplyChunk {
|
||||
ReplyChunk::Error {
|
||||
message: MODEL_RESPONSE_NOT_FINALIZED_MESSAGE.to_owned(),
|
||||
at_ms: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Assigns an acceptance timestamp to a transport-created chunk.
|
||||
#[must_use]
|
||||
pub fn with_chunk_timestamp(mut chunk: ReplyChunk, at_ms: Option<u64>) -> ReplyChunk {
|
||||
match &mut chunk {
|
||||
ReplyChunk::UserPrompt { at_ms: value, .. }
|
||||
| ReplyChunk::TextDelta { at_ms: value, .. }
|
||||
| ReplyChunk::ToolActivity { at_ms: value, .. }
|
||||
| ReplyChunk::Final { at_ms: value, .. }
|
||||
| ReplyChunk::Error { at_ms: value, .. } => *value = at_ms,
|
||||
ReplyChunk::Progress { progress } => progress.occurred_at_ms = at_ms,
|
||||
}
|
||||
chunk
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user