update branch

This commit is contained in:
qwen.ai[bot] 2026-04-13 23:31:59 +00:00
parent 781133b3e9
commit 2bfdf5e7f2
2 changed files with 34 additions and 43 deletions

57
.gitignore vendored
View file

@ -1,49 +1,40 @@
```
# Go build artifacts
# Compiled and binary files
*.pyc
__pycache__/
*.o
*.a
*.so
*.dylib
*.dll
*.obj
*.exe
*.dll
*.so
*.a
*.out
# Go cache and tools
go.sum
*.mod
*.mod~
*.info
coverage.out
profile.out
# Dependencies
vendor/
# Logs
*.log
# Environment
node_modules/
venv/
.venv/
.env
.env.local
.env.*
*.env.*
# Build artifacts
dist/
build/
target/
.mypy_cache/
.pytest_cache/
coverage/
htmlcov/
*.log
*.tmp
*.swp
# Editors
.vscode/
.idea/
*.swp
*.swo
# OS
# System
.DS_Store
Thumbs.db
# Build directories
bin/
_dist/
_output/
# Test coverage
coverage/
htmlcov/
.coverage
```

View file

@ -218,7 +218,7 @@ func (e *Evaluator) compileRules() error {
compiled.ToolPatterns = append(compiled.ToolPatterns, re)
} else {
logger.WarnCF("policy", "Invalid tool pattern in rule", map[string]any{
"rule_id": rule.Rule.ID,
"rule_id": rule.ID,
"pattern": tool,
"error": err.Error(),
})
@ -231,7 +231,7 @@ func (e *Evaluator) compileRules() error {
compiled.IntentPatterns = append(compiled.IntentPatterns, re)
} else {
logger.WarnCF("policy", "Invalid intent pattern in rule", map[string]any{
"rule_id": rule.Rule.ID,
"rule_id": rule.ID,
"pattern": intent,
"error": err.Error(),
})
@ -376,15 +376,15 @@ func (e *Evaluator) evaluateIntentInternal(intent Intent) PolicyResult {
}
// Apply rule action
switch rule.Rule.Action {
switch rule.Action {
case "allow":
return PolicyResult{Allowed: true, Reason: fmt.Sprintf("rule %q allows this intent", rule.Rule.ID)}
return PolicyResult{Allowed: true, Reason: fmt.Sprintf("rule %q allows this intent", rule.ID)}
case "deny":
return PolicyResult{Allowed: false, Reason: fmt.Sprintf("rule %q denies this intent", rule.Rule.ID)}
return PolicyResult{Allowed: false, Reason: fmt.Sprintf("rule %q denies this intent", rule.ID)}
case "require_approval":
return PolicyResult{
Allowed: false,
Reason: fmt.Sprintf("rule %q requires approval for this intent", rule.Rule.ID),
Reason: fmt.Sprintf("rule %q requires approval for this intent", rule.ID),
Data: map[string]interface{}{"requires_approval": true},
}
}
@ -562,15 +562,15 @@ func (e *Evaluator) evaluateToolCallInternal(toolCall ToolCall) PolicyResult {
}
// Apply rule action
switch rule.Rule.Action {
switch rule.Action {
case "allow":
return PolicyResult{Allowed: true, Reason: fmt.Sprintf("rule %q allows this tool", rule.Rule.ID)}
return PolicyResult{Allowed: true, Reason: fmt.Sprintf("rule %q allows this tool", rule.ID)}
case "deny":
return PolicyResult{Allowed: false, Reason: fmt.Sprintf("rule %q denies this tool", rule.Rule.ID)}
return PolicyResult{Allowed: false, Reason: fmt.Sprintf("rule %q denies this tool", rule.ID)}
case "require_approval":
return PolicyResult{
Allowed: false,
Reason: fmt.Sprintf("rule %q requires approval for this tool", rule.Rule.ID),
Reason: fmt.Sprintf("rule %q requires approval for this tool", rule.ID),
Data: map[string]interface{}{"requires_approval": true},
}
}