pub struct ConsentManager { /* private fields */ }Expand description
Implementations§
Source§impl ConsentManager
impl ConsentManager
Sourcepub fn new() -> ConsentManager
pub fn new() -> ConsentManager
Create a new consent manager, resolving the default path under
dirs::config_dir()/oxicode/mcp-consent.json.
Sourcepub fn with_path(persist_path: PathBuf) -> ConsentManager
pub fn with_path(persist_path: PathBuf) -> ConsentManager
Create a manager with a custom file path (used by tests).
Sourcepub fn load(&self) -> Result<(), Error>
pub fn load(&self) -> Result<(), Error>
Load decisions from disk. Missing file is not an error.
Sourcepub fn check(&self, name: &str) -> ConsentState
pub fn check(&self, name: &str) -> ConsentState
Look up the consent for a given name. Defaults to Allow.
Sourcepub fn check_spawn_consent(&self, name: &str) -> ConsentState
pub fn check_spawn_consent(&self, name: &str) -> ConsentState
Spawn-path consent check. Unknown servers return Ask (the caller
treats Ask and Deny identically: deny the spawn and surface
McpError::ConsentDenied). This is deliberately a separate
default from check so the per-tool gate at
direct_tool.rs (which only blocks Deny) is unaffected.
Sourcepub fn decide(&self, name: &str, state: ConsentState) -> Result<(), Error>
pub fn decide(&self, name: &str, state: ConsentState) -> Result<(), Error>
Persist a consent decision. name is a tool or server name.
Ask is normalized to Deny — it is a transient runtime signal,
never a stored state (see the module docs). Callers that resolve
Ask interactively must pass the resolved Allow/Deny here.
Sourcepub fn trust(&self, name: &str) -> Result<(), Error>
pub fn trust(&self, name: &str) -> Result<(), Error>
Trust a server (persist Allow). Convenience wrapper around
decide. Used by oxicode mcp trust <server>.
Sourcepub fn untrust(&self, name: &str) -> Result<(), Error>
pub fn untrust(&self, name: &str) -> Result<(), Error>
Revoke trust for a server (persist Deny). Convenience wrapper
around decide. Used by oxicode mcp untrust <server>.
Sourcepub fn all_decisions(&self) -> HashMap<String, ConsentState>
pub fn all_decisions(&self) -> HashMap<String, ConsentState>
All current decisions (for the TUI dashboard).