refactor(core): remove provider module, migrate to LLMProvider, add client mode handling, improve serialization error handling, update workspace edition, and clean up conditionals and imports

This commit is contained in:
2025-10-12 12:38:55 +02:00
parent c2f5ccea3b
commit 7851af14a9
63 changed files with 2221 additions and 1236 deletions

View File

@@ -1,6 +1,6 @@
use crate::mode::ModeConfig;
use crate::provider::ProviderConfig;
use crate::ProviderConfig;
use crate::Result;
use crate::mode::ModeConfig;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fs;
@@ -120,13 +120,13 @@ impl Config {
.and_then(|value| value.as_str())
.unwrap_or("0.0.0")
.to_string();
if let Some(agent_table) = parsed.get("agent").and_then(|value| value.as_table()) {
if agent_table.contains_key("max_tool_calls") {
log::warn!(
"Configuration option agent.max_tool_calls is deprecated and ignored. \
The agent now uses agent.max_iterations."
);
}
if let Some(agent_table) = parsed.get("agent").and_then(|value| value.as_table())
&& agent_table.contains_key("max_tool_calls")
{
log::warn!(
"Configuration option agent.max_tool_calls is deprecated and ignored. \
The agent now uses agent.max_iterations."
);
}
let mut config: Config = parsed
.try_into()
@@ -180,10 +180,10 @@ impl Config {
&'a self,
models: &'a [crate::types::ModelInfo],
) -> Option<&'a str> {
if let Some(model) = self.general.default_model.as_deref() {
if models.iter().any(|m| m.id == model || m.name == model) {
return Some(model);
}
if let Some(model) = self.general.default_model.as_deref()
&& models.iter().any(|m| m.id == model || m.name == model)
{
return Some(model);
}
if let Some(first) = models.first() {
@@ -963,9 +963,10 @@ mod tests {
#[cfg(target_os = "macos")]
{
// macOS should use ~/Library/Application Support
assert!(path
.to_string_lossy()
.contains("Library/Application Support"));
assert!(
path.to_string_lossy()
.contains("Library/Application Support")
);
}
println!("Config conversation path: {}", path.display());