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:
@@ -58,17 +58,16 @@ impl ConsentManager {
|
||||
/// Load consent records from vault storage
|
||||
pub fn from_vault(vault: &Arc<std::sync::Mutex<VaultHandle>>) -> Self {
|
||||
let guard = vault.lock().expect("Vault mutex poisoned");
|
||||
if let Some(consent_data) = guard.settings().get("consent_records") {
|
||||
if let Ok(permanent_records) =
|
||||
if let Some(consent_data) = guard.settings().get("consent_records")
|
||||
&& let Ok(permanent_records) =
|
||||
serde_json::from_value::<HashMap<String, ConsentRecord>>(consent_data.clone())
|
||||
{
|
||||
return Self {
|
||||
permanent_records,
|
||||
session_records: HashMap::new(),
|
||||
once_records: HashMap::new(),
|
||||
pending_requests: HashMap::new(),
|
||||
};
|
||||
}
|
||||
{
|
||||
return Self {
|
||||
permanent_records,
|
||||
session_records: HashMap::new(),
|
||||
once_records: HashMap::new(),
|
||||
pending_requests: HashMap::new(),
|
||||
};
|
||||
}
|
||||
Self::default()
|
||||
}
|
||||
@@ -91,17 +90,17 @@ impl ConsentManager {
|
||||
endpoints: Vec<String>,
|
||||
) -> Result<ConsentScope> {
|
||||
// Check if already granted permanently
|
||||
if let Some(existing) = self.permanent_records.get(tool_name) {
|
||||
if existing.scope == ConsentScope::Permanent {
|
||||
return Ok(ConsentScope::Permanent);
|
||||
}
|
||||
if let Some(existing) = self.permanent_records.get(tool_name)
|
||||
&& existing.scope == ConsentScope::Permanent
|
||||
{
|
||||
return Ok(ConsentScope::Permanent);
|
||||
}
|
||||
|
||||
// Check if granted for session
|
||||
if let Some(existing) = self.session_records.get(tool_name) {
|
||||
if existing.scope == ConsentScope::Session {
|
||||
return Ok(ConsentScope::Session);
|
||||
}
|
||||
if let Some(existing) = self.session_records.get(tool_name)
|
||||
&& existing.scope == ConsentScope::Session
|
||||
{
|
||||
return Ok(ConsentScope::Session);
|
||||
}
|
||||
|
||||
// Check if request is already pending (prevent duplicate prompts)
|
||||
|
||||
Reference in New Issue
Block a user