gglib_core/
settings_update.rs1use serde::{Deserialize, Serialize};
12
13use crate::domain::{InferenceConfig, InferenceProfile};
14
15use super::{Device, LoopGuardMode, RemotePairing, RemoteServe};
16
17#[derive(Debug, Clone, Default, Serialize, Deserialize)]
24pub struct SettingsUpdate {
25 pub default_download_path: Option<Option<String>>,
26 pub default_context_size: Option<Option<u64>>,
27 pub proxy_port: Option<Option<u16>>,
28 pub llama_base_port: Option<Option<u16>>,
29 pub max_download_queue_size: Option<Option<u32>>,
30 pub show_memory_fit_indicators: Option<Option<bool>>,
31 pub max_tool_iterations: Option<Option<u32>>,
32 pub max_stagnation_steps: Option<Option<u32>>,
33 pub default_model_id: Option<Option<i64>>,
34 pub inference_defaults: Option<Option<InferenceConfig>>,
35 pub inference_profiles: Option<Option<Vec<InferenceProfile>>>,
36 pub setup_completed: Option<Option<bool>>,
37 pub title_generation_prompt: Option<Option<String>>,
38 pub bind_host: Option<Option<String>>,
39 pub share_lan: Option<Option<bool>>,
40 pub proxy_api_key: Option<Option<String>>,
41 pub trust_client_sampling: Option<Option<bool>>,
42 pub loop_guard_mode: Option<Option<LoopGuardMode>>,
47 pub proxy_loop_detection: Option<Option<bool>>,
50 pub tool_call_repair: Option<Option<bool>>,
51 pub agentic_sampling: Option<Option<bool>>,
53 pub proxy_autostart: Option<Option<bool>>,
54 pub close_to_tray: Option<Option<bool>>,
55 pub start_at_login: Option<Option<bool>>,
56 pub remote_pairing: Option<Option<RemotePairing>>,
59 pub remote_enabled: Option<Option<bool>>,
61 pub remote_serve: Option<Option<RemoteServe>>,
63 pub remote_devices: Option<Option<Vec<Device>>>,
65}
66
67#[derive(Debug, Clone, thiserror::Error)]
69pub enum SettingsError {
70 #[error("Context size must be between 512 and 1,000,000, got {0}")]
71 InvalidContextSize(u64),
72
73 #[error("Port should be >= 1024 (privileged ports require root), got {0}")]
74 InvalidPort(u16),
75
76 #[error("Max download queue size must be between 1 and 50, got {0}")]
77 InvalidQueueSize(u32),
78
79 #[error("Download path cannot be empty")]
80 EmptyDownloadPath,
81
82 #[error("Invalid inference parameter: {0}")]
83 InvalidInferenceConfig(String),
84
85 #[error("Invalid inference profile: {0}")]
86 InvalidInferenceProfile(String),
87
88 #[error("Bind host must be an IP address (e.g. 127.0.0.1 or 0.0.0.0), got '{0}'")]
89 InvalidBindHost(String),
90
91 #[error("Proxy API key cannot be blank — clear it instead to disable authentication")]
92 BlankProxyApiKey,
93
94 #[error("Remote API key cannot be blank — clear the pairing instead to forget it")]
95 BlankRemoteApiKey,
96
97 #[error("Remote ticket cannot be blank — clear the pairing instead to forget it")]
98 BlankRemoteTicket,
99
100 #[error("Device id {0:?} must be 1-64 of ASCII letters, digits, '.', '_' or '-'")]
102 InvalidDeviceId(String),
103}