Skip to content

Commit 6ed98e3

Browse files
authored
fix: knowledge tool permission (#2501)
1 parent c37751f commit 6ed98e3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

crates/chat-cli/src/cli/chat/tools/knowledge.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ use super::{
1313
InvokeOutput,
1414
OutputKind,
1515
};
16+
use crate::cli::agent::{
17+
Agent,
18+
PermissionEvalResult,
19+
};
1620
use crate::database::settings::Setting;
1721
use crate::os::Os;
1822
use crate::util::knowledge_store::KnowledgeStore;
@@ -472,6 +476,15 @@ impl Knowledge {
472476
})
473477
}
474478

479+
pub fn eval_perm(&self, agent: &Agent) -> PermissionEvalResult {
480+
_ = self;
481+
if agent.allowed_tools.contains("knowledge") {
482+
PermissionEvalResult::Allow
483+
} else {
484+
PermissionEvalResult::Ask
485+
}
486+
}
487+
475488
/// Format status data for display (UI rendering responsibility)
476489
fn format_status_display(status: &semantic_search_client::SystemStatus) -> String {
477490
let mut status_lines = Vec::new();

crates/chat-cli/src/cli/chat/tools/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl Tool {
102102
Tool::Custom(custom_tool) => custom_tool.eval_perm(agent),
103103
Tool::GhIssue(_) => PermissionEvalResult::Allow,
104104
Tool::Thinking(_) => PermissionEvalResult::Allow,
105-
Tool::Knowledge(_) => PermissionEvalResult::Ask,
105+
Tool::Knowledge(knowledge) => knowledge.eval_perm(agent),
106106
}
107107
}
108108

0 commit comments

Comments
 (0)