Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
refactor(agent-tools): keep consent and copy internals private
thinhlpg62db50e05107
diff --git a/src-tauri/plugins/tauri-plugin-agent-tools/src/consent.rs b/src-tauri/plugins/tauri-plugin-agent-tools/src/consent.rsindex 92d7d0c24..74e331456 100644--- a/src-tauri/plugins/tauri-plugin-agent-tools/src/consent.rs+++ b/src-tauri/plugins/tauri-plugin-agent-tools/src/consent.rs@@ -27,7 +27,7 @@ use serde::{Deserialize, Serialize};/// Server-name prefix of the tools an extension contributes. An MCP server the/// user named this way is never trusted whole: that trust would also cover the/// real extension's tools.-pub const EXTENSION_SERVER_PREFIX: &str = "ext:";+const EXTENSION_SERVER_PREFIX: &str = "ext:";/// Who serves a tool, as the caller resolved it when the call arrived.#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]@@ -125,7 +125,7 @@ pub struct ConsentStore {/// The name a grant is recorded under. A tool with a server is keyed by it as/// well, so a grant never covers a same-named tool of another server; MCP keys/// carry an `mcp:` namespace so no extension can spell one.-pub fn grant_key(tool: &str, server: Option<&str>, origin: ToolOrigin) -> String {+fn grant_key(tool: &str, server: Option<&str>, origin: ToolOrigin) -> String {match (server, origin) {(None, _) => tool.to_string(),(Some(server), ToolOrigin::Extension) => format!("{server}/{tool}"),diff --git a/src-tauri/plugins/tauri-plugin-agent-tools/src/workspace.rs b/src-tauri/plugins/tauri-plugin-agent-tools/src/workspace.rsindex a6ed7838f..6a34aa40f 100644--- a/src-tauri/plugins/tauri-plugin-agent-tools/src/workspace.rs+++ b/src-tauri/plugins/tauri-plugin-agent-tools/src/workspace.rs@@ -1530,7 +1530,7 @@ const COPY_MARKER_PREFIX: &str = ".copied-";/// How long a copied workspace is protected from the thread sweep while no/// thread lists it. The Cowork migration copies before it commits thread.json,/// and may still be running when the startup sweep reads the thread list.-pub const COPY_GRACE: std::time::Duration = std::time::Duration::from_secs(24 * 60 * 60);+const COPY_GRACE: std::time::Duration = std::time::Duration::from_secs(24 * 60 * 60);fn copy_staging_dir(jan_data_folder: &Path, id: &str) -> Result<PathBuf, String> {Ok(threads_dir(jan_data_folder).join(format!("{COPY_STAGING_PREFIX}{}", thread_segment(id)?)))