Versions in this module Expand all Collapse all v0 v0.2.0 Jul 14, 2026 v0.1.0 Jun 22, 2026 Changes in this version + const RuleBehaviorAllow + const RuleBehaviorAsk + const RuleBehaviorDeny + var RuleSourcePriority = map[types.PermissionRuleSource]int + func AddPermissionRulesToSettings(source SettingsSource, rules []PermissionRule) error + func CreateDenialTrackingState() *types.DenialTrackingState + func DeletePermissionRuleFromSettings(source SettingsSource, toolName string, ruleContent string) error + func HandleDenialLimitExceeded(state *types.DenialTrackingState, config *types.DenialLimitConfig, ...) *types.PermissionResult + func IsPermissionDenied(err error) bool + func IsValidRuleBehavior(behavior string) bool + func RecordDenial(state *types.DenialTrackingState) *types.DenialTrackingState + func RecordSuccess(state *types.DenialTrackingState) *types.DenialTrackingState + func ShouldAllowManagedPermissionsOnly() bool + func ShouldFallbackToPrompting(state *types.DenialTrackingState, config *types.DenialLimitConfig) bool + func ShouldShowAlwaysAllowOptions() bool + type Classification struct + Allowed bool + Confidence float64 + Reason string + type Classifier interface + Classify func(ctx context.Context, toolName string, input map[string]any) (Classification, error) + type Engine struct + FailClosed bool + func NewEngine() *Engine + func (e *Engine) AddHook(hook Hook) + func (e *Engine) AddInterfaceHook(hook types.Hook) + func (e *Engine) AddRule(rule PermissionRule) error + func (e *Engine) AddRules(rules []PermissionRule) error + func (e *Engine) CheckPermission(ctx context.Context, pctx *PermissionContext) (types.PermissionResult, error) + func (e *Engine) GetAllRuleSources() []types.PermissionRuleSource + func (e *Engine) GetEffectiveRules() []PermissionRule + func (e *Engine) GetHooks() []Hook + func (e *Engine) GetRuleCountBySource() map[types.PermissionRuleSource]int + func (e *Engine) GetRuleSourcePriority(source types.PermissionRuleSource) int + func (e *Engine) GetRulesBySource(source types.PermissionRuleSource) []PermissionRule + func (e *Engine) IsAutoModeAvailable() bool + func (e *Engine) MergeRulesFromSources(sourceRules map[types.PermissionRuleSource][]PermissionRule) error + func (e *Engine) RemoveHook(name string) + func (e *Engine) RemoveRulesBySource(source types.PermissionRuleSource) + func (e *Engine) RunPostPermissionHooks(ctx context.Context, pctx *PermissionContext, result *types.PermissionResult) error + func (e *Engine) SetAdvancedClassifier(classifier auto.AdvancedClassifierInterface) + func (e *Engine) SetClassifier(classifier Classifier) + func (e *Engine) UpdateRules(update types.PermissionUpdate) error + type Hook struct + Handler HookHandler + ID string + Priority int + Stage types.HookStage + type HookAdapter struct + func NewHookAdapter(hook Hook) *HookAdapter + func (a *HookAdapter) Execute(ctx context.Context, stage types.HookStage, toolName string, ...) types.HookResult + func (a *HookAdapter) Name() string + func (a *HookAdapter) Priority() int + type HookHandler func(ctx context.Context, pctx *PermissionContext) (types.PermissionResult, error) + type Integrator struct + func NewIntegrator(engine *Engine) *Integrator + func (i *Integrator) AutoModeAvailable() bool + func (i *Integrator) BatchCheckToolUses(ctx context.Context, toolUses []types.ToolUseContent, ...) ([]types.PermissionResult, error) + func (i *Integrator) CanUseTool(sessionID types.SessionID, turnID types.TurnID, mode types.PermissionMode) types.CanUseToolFn + func (i *Integrator) CheckToolUse(ctx context.Context, toolUse types.ToolUseContent, toolDef tool.Definition, ...) (types.PermissionResult, error) + func (i *Integrator) FilterAllowedToolUses(ctx context.Context, toolUses []types.ToolUseContent, ...) ([]types.ToolUseContent, []types.PermissionResult, error) + func (i *Integrator) PermissionMiddleware(sessionID types.SessionID, turnID types.TurnID, mode types.PermissionMode) func(ctx context.Context, toolName string, toolInput map[string]any) error + func (i *Integrator) Resolver(sessionID types.SessionID, turnID types.TurnID, mode types.PermissionMode) types.PermissionResolver + func (i *Integrator) ResolverWithContext(sessionID types.SessionID, turnID types.TurnID, ...) types.PermissionResolver + func (i *Integrator) SetAutoModeProviderClient(apiClient *providers.Client, model types.ModelIdentifier) + func (i *Integrator) SetPromptFn(fn types.PromptFn) + type PermissionContext struct + Additional map[string]any + ExecutionMode string + Intent types.ToolPermissionIntent + IsBypassPermissionsModeAvailable bool + IsConcurrent bool + IsToolRunningInSandbox bool + Mode types.PermissionMode + SessionID types.SessionID + ShouldAvoidPermissionPrompts bool + Stage types.ToolPermissionStage + Tool tool.Tool + ToolDefinition *tool.Definition + ToolInput map[string]any + ToolName string + ToolUseID string + TurnID types.TurnID + type PermissionDeniedError struct + Reason string + ToolName string + func (e *PermissionDeniedError) Error() string + type PermissionRule struct + Behavior types.PermissionBehavior + Pattern string + Priority int + Reason string + Source types.PermissionRuleSource + Value PermissionRuleValue + func LoadRulesFromDisk() ([]PermissionRule, error) + func NewDefaultRules() []PermissionRule + type PermissionRuleValue struct + RuleContent string + ToolName string + type SettingsJSON struct + AllowManagedPermissionRulesOnly bool + PermissionRules []StoredPermissionRule + type SettingsSource string + const SourceCliArg + const SourceLocalSettings + const SourceManagedSettings + const SourceProjectSettings + const SourceUserSettings + type StoredPermissionRule struct + Behavior string + Pattern string + RuleContent string + ToolName string