The-Agency/lib/src/permissions/bash/bash_classifier.dart

43 lines
1.5 KiB
Dart

// Bash classifier stub — mirrors the external (non-ant) build of bashClassifier.ts.
// The ML-based Haiku classifier is ant-only and completely dead in public builds.
// All functions here return empty / disabled results so the permission flow
// short-circuits the classifier branches without removing them.
/// Result of a bash command classification check.
class ClassifierResult {
final bool matches;
final String confidence; // 'high' | 'low'
final String reason;
final String? matchedDescription;
const ClassifierResult({
required this.matches,
required this.confidence,
required this.reason,
this.matchedDescription,
});
}
/// Always false in external builds.
bool isClassifierPermissionsEnabled() => false;
/// Stub context type used by the public-facing description getters.
/// The real implementation takes a ToolPermissionContext; callers pass whatever
/// context object they have, so we just accept dynamic here.
List<String> getBashPromptAllowDescriptions(dynamic context) => const [];
List<String> getBashPromptDenyDescriptions(dynamic context) => const [];
List<String> getBashPromptAskDescriptions(dynamic context) => const [];
/// Always returns { matches: false, confidence: 'high' } in external builds.
Future<ClassifierResult> classifyBashCommand(
String command,
String cwd,
List<String> descriptions,
String behavior,
) async {
return const ClassifierResult(
matches: false,
confidence: 'high',
reason: 'This feature is disabled',
);
}