- #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>
70 lines
2.1 KiB
Rust
70 lines
2.1 KiB
Rust
//! Machine-local user preferences and project-owned presentation settings.
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Preferred interface when a new human-facing agent terminal is opened.
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub enum DefaultAgentTerminalInterface {
|
|
/// Provider's native interactive terminal UI.
|
|
NativeTui,
|
|
/// IdeA's structured/custom CLI chat surface.
|
|
IdeaCli,
|
|
}
|
|
|
|
/// Global, machine-local IdeA preferences.
|
|
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct IdeaUserSettings {
|
|
/// Default for newly launched human-facing agent terminals.
|
|
#[serde(default)]
|
|
pub default_agent_terminal_interface: Option<DefaultAgentTerminalInterface>,
|
|
}
|
|
|
|
/// Strict project theme colour (`#RRGGBB`).
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(try_from = "String", into = "String")]
|
|
pub struct ThemeColor(String);
|
|
|
|
impl ThemeColor {
|
|
/// Validates and builds a project theme colour.
|
|
pub fn new(value: impl Into<String>) -> Result<Self, String> {
|
|
let value = value.into();
|
|
let valid = value.len() == 7
|
|
&& value.starts_with('#')
|
|
&& value.as_bytes()[1..].iter().all(u8::is_ascii_hexdigit);
|
|
valid
|
|
.then_some(Self(value))
|
|
.ok_or_else(|| "themeColor must match #RRGGBB".to_owned())
|
|
}
|
|
|
|
/// Returns the validated wire representation.
|
|
#[must_use]
|
|
pub fn as_str(&self) -> &str {
|
|
&self.0
|
|
}
|
|
}
|
|
|
|
impl TryFrom<String> for ThemeColor {
|
|
type Error = String;
|
|
|
|
fn try_from(value: String) -> Result<Self, Self::Error> {
|
|
Self::new(value)
|
|
}
|
|
}
|
|
|
|
impl From<ThemeColor> for String {
|
|
fn from(value: ThemeColor) -> Self {
|
|
value.0
|
|
}
|
|
}
|
|
|
|
/// Settings owned by one project and stored below its `.ideai` directory.
|
|
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct ProjectSettings {
|
|
/// Optional visual theme colour; absence keeps the product fallback.
|
|
#[serde(default)]
|
|
pub theme_color: Option<ThemeColor>,
|
|
}
|