update branch
This commit is contained in:
parent
781133b3e9
commit
2bfdf5e7f2
2 changed files with 34 additions and 43 deletions
57
.gitignore
vendored
57
.gitignore
vendored
|
|
@ -1,49 +1,40 @@
|
||||||
```
|
```
|
||||||
# Go build artifacts
|
# Compiled and binary files
|
||||||
|
*.pyc
|
||||||
|
__pycache__/
|
||||||
*.o
|
*.o
|
||||||
*.a
|
*.obj
|
||||||
*.so
|
|
||||||
*.dylib
|
|
||||||
*.dll
|
|
||||||
*.exe
|
*.exe
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.a
|
||||||
*.out
|
*.out
|
||||||
|
|
||||||
# Go cache and tools
|
|
||||||
go.sum
|
|
||||||
*.mod
|
|
||||||
*.mod~
|
|
||||||
*.info
|
|
||||||
coverage.out
|
|
||||||
profile.out
|
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
vendor/
|
node_modules/
|
||||||
|
venv/
|
||||||
# Logs
|
.venv/
|
||||||
*.log
|
|
||||||
|
|
||||||
# Environment
|
|
||||||
.env
|
.env
|
||||||
.env.local
|
.env.local
|
||||||
.env.*
|
*.env.*
|
||||||
|
|
||||||
|
# Build artifacts
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
target/
|
||||||
|
.mypy_cache/
|
||||||
|
.pytest_cache/
|
||||||
|
coverage/
|
||||||
|
htmlcov/
|
||||||
|
*.log
|
||||||
|
*.tmp
|
||||||
|
*.swp
|
||||||
|
|
||||||
# Editors
|
# Editors
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
*.swp
|
|
||||||
*.swo
|
|
||||||
|
|
||||||
# OS
|
# System
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
# Build directories
|
|
||||||
bin/
|
|
||||||
_dist/
|
|
||||||
_output/
|
|
||||||
|
|
||||||
# Test coverage
|
|
||||||
coverage/
|
|
||||||
htmlcov/
|
|
||||||
.coverage
|
|
||||||
```
|
```
|
||||||
|
|
@ -218,7 +218,7 @@ func (e *Evaluator) compileRules() error {
|
||||||
compiled.ToolPatterns = append(compiled.ToolPatterns, re)
|
compiled.ToolPatterns = append(compiled.ToolPatterns, re)
|
||||||
} else {
|
} else {
|
||||||
logger.WarnCF("policy", "Invalid tool pattern in rule", map[string]any{
|
logger.WarnCF("policy", "Invalid tool pattern in rule", map[string]any{
|
||||||
"rule_id": rule.Rule.ID,
|
"rule_id": rule.ID,
|
||||||
"pattern": tool,
|
"pattern": tool,
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
})
|
})
|
||||||
|
|
@ -231,7 +231,7 @@ func (e *Evaluator) compileRules() error {
|
||||||
compiled.IntentPatterns = append(compiled.IntentPatterns, re)
|
compiled.IntentPatterns = append(compiled.IntentPatterns, re)
|
||||||
} else {
|
} else {
|
||||||
logger.WarnCF("policy", "Invalid intent pattern in rule", map[string]any{
|
logger.WarnCF("policy", "Invalid intent pattern in rule", map[string]any{
|
||||||
"rule_id": rule.Rule.ID,
|
"rule_id": rule.ID,
|
||||||
"pattern": intent,
|
"pattern": intent,
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
})
|
})
|
||||||
|
|
@ -376,15 +376,15 @@ func (e *Evaluator) evaluateIntentInternal(intent Intent) PolicyResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply rule action
|
// Apply rule action
|
||||||
switch rule.Rule.Action {
|
switch rule.Action {
|
||||||
case "allow":
|
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":
|
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":
|
case "require_approval":
|
||||||
return PolicyResult{
|
return PolicyResult{
|
||||||
Allowed: false,
|
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},
|
Data: map[string]interface{}{"requires_approval": true},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -562,15 +562,15 @@ func (e *Evaluator) evaluateToolCallInternal(toolCall ToolCall) PolicyResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply rule action
|
// Apply rule action
|
||||||
switch rule.Rule.Action {
|
switch rule.Action {
|
||||||
case "allow":
|
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":
|
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":
|
case "require_approval":
|
||||||
return PolicyResult{
|
return PolicyResult{
|
||||||
Allowed: false,
|
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},
|
Data: map[string]interface{}{"requires_approval": true},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue