Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
fix(agent): pass gate context to resolve_decision
thinhlpg85f85efe702f
diff --git a/src-tauri/plugins/tauri-plugin-agent-tools/src/commands.rs b/src-tauri/plugins/tauri-plugin-agent-tools/src/commands.rsindex 5fbd1829e..bdc8ad0b7 100644--- a/src-tauri/plugins/tauri-plugin-agent-tools/src/commands.rs+++ b/src-tauri/plugins/tauri-plugin-agent-tools/src/commands.rs@@ -593,7 +593,6 @@ fn output_sink(mod tests {use super::*;use serde_json::json;-use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::{Arc, Mutex};diff --git a/src-tauri/plugins/tauri-plugin-agent-tools/src/tools/gate.rs b/src-tauri/plugins/tauri-plugin-agent-tools/src/tools/gate.rsindex 9a69e5c89..de72a2bca 100644--- a/src-tauri/plugins/tauri-plugin-agent-tools/src/tools/gate.rs+++ b/src-tauri/plugins/tauri-plugin-agent-tools/src/tools/gate.rs@@ -176,7 +176,6 @@ pub fn resolve_decision(.and_then(|v| v.as_str()).map(|c| command_touches_hidden_jan_path(ctx.project_root, c)).unwrap_or(false);-if hits_hidden || exec_hits_hidden {return Decision::HardDeny(DenyReason::Hidden);}@@ -1011,7 +1010,6 @@ mod tests {#[test]fn an_escaping_read_still_prompts_when_no_root_covers_it() {let root = unique_root();-let repo = unique_root();let elsewhere = unique_root();let roots = vec![repo.clone()];@@ -1027,7 +1025,6 @@ mod tests {&ToolPermissions::new(PermissionDefault::ReadOnly, &[], &[], &[]),&SessionGrants::default(),);-assert_eq!(d, Decision::Prompt(PromptKind::ReadEscape));for d in [&root, &repo, &elsewhere] {let _ = std::fs::remove_dir_all(d);diff --git a/src-tauri/src/core/agent/loop.rs b/src-tauri/src/core/agent/loop.rsindex f3011d9f5..7a10f9446 100644--- a/src-tauri/src/core/agent/loop.rs+++ b/src-tauri/src/core/agent/loop.rs@@ -956,14 +956,16 @@ impl ToolInvoker for CompositeToolInvoker {let decision = resolve_decision(tool,&args,- &self.project_root,- Some(self.scratch_root.as_path()),- // The CLI works *in* the project, so it has no separate- // read-only root to attach.- &[],+ &tauri_plugin_agent_tools::tools::gate::GateContext {+ project_root: &self.project_root,+ scratch: Some(self.scratch_root.as_path()),+ // The CLI works *in* the project, so it has no separate+ // read-only root to attach.+ read_roots: &[],+ hide_jan: self.sandbox,+ },&self.permissions,&snapshot,- self.sandbox,);// Auto-approval suppresses every prompt (sandbox escape, write, exec) but// still honors HardDeny, so the hidden `.jan` invariant (while the shell