Skip to main content

ai_agent/utils/permissions/
bash_classifier.rs

1// Source: ~/claudecode/openclaudecode/src/utils/permissions/bashClassifier.ts
2#![allow(dead_code)]
3
4//! Stub for external builds - classifier permissions feature is ANT-ONLY.
5
6pub const PROMPT_PREFIX: &str = "prompt:";
7
8/// Classifier result.
9#[derive(Debug, Clone)]
10pub struct ClassifierResult {
11    pub matches: bool,
12    pub matched_description: Option<String>,
13    pub confidence: ClassifierConfidence,
14    pub reason: String,
15}
16
17/// Classifier confidence level.
18#[derive(Debug, Clone, PartialEq, Eq)]
19pub enum ClassifierConfidence {
20    High,
21    Medium,
22    Low,
23}
24
25/// Classifier behavior.
26#[derive(Debug, Clone, PartialEq, Eq)]
27pub enum ClassifierBehavior {
28    Deny,
29    Ask,
30    Allow,
31}
32
33pub fn extract_prompt_description(_rule_content: Option<&str>) -> Option<String> {
34    None
35}
36
37pub fn create_prompt_rule_content(description: &str) -> String {
38    format!("{} {}", PROMPT_PREFIX, description.trim())
39}
40
41pub fn is_classifier_permissions_enabled() -> bool {
42    false
43}
44
45pub fn get_bash_prompt_deny_descriptions(_context: &()) -> Vec<String> {
46    vec![]
47}
48
49pub fn get_bash_prompt_ask_descriptions(_context: &()) -> Vec<String> {
50    vec![]
51}
52
53pub fn get_bash_prompt_allow_descriptions(_context: &()) -> Vec<String> {
54    vec![]
55}
56
57pub async fn classify_bash_command(
58    _command: &str,
59    _cwd: &str,
60    _descriptions: &[String],
61    _behavior: &ClassifierBehavior,
62    _signal: &tokio::sync::oneshot::Receiver<()>,
63    _is_non_interactive_session: bool,
64) -> ClassifierResult {
65    ClassifierResult {
66        matches: false,
67        matched_description: None,
68        confidence: ClassifierConfidence::High,
69        reason: "This feature is disabled".to_string(),
70    }
71}
72
73pub async fn generate_generic_description(
74    _command: &str,
75    specific_description: Option<String>,
76    _signal: &tokio::sync::oneshot::Receiver<()>,
77) -> Option<String> {
78    specific_description
79}