Documentation
¶
Index ¶
- func EvalCondition(cond dsl.Condition, ctx *EvalContext) bool
- func GetDenyList(name string) []string
- func ListDenyLists() []string
- func LoadDenyLists() map[string][]string
- func MatchesDenyList(command string, lists map[string][]string, listName string) bool
- type ActionContext
- type ActionResult
- type EvalContext
- type ExecResult
- type Executor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvalCondition ¶
func EvalCondition(cond dsl.Condition, ctx *EvalContext) bool
EvalCondition evaluates a condition against the given context. Returns true if the condition is met (actions should fire).
func GetDenyList ¶
GetDenyList returns the patterns for a named deny list.
func ListDenyLists ¶
func ListDenyLists() []string
ListDenyLists returns the names of all available deny lists.
func LoadDenyLists ¶
LoadDenyLists loads all deny lists: built-in embedded + custom from disk.
Types ¶
type ActionContext ¶
type ActionContext struct {
DB *state.DB
GetAdapter func(name string) (adapters.Adapter, error)
SessionID string
HookEvent string
RuleID string
Input *hookio.HookInput
PrunerFunc func(tier string) error
}
ActionContext provides dependencies for action execution.
type ActionResult ¶
type ActionResult struct {
Output *hookio.HookOutput
ActionTaken string
ShouldBlock bool
Error error
}
ActionResult is the outcome of executing an action.
func ExecuteAction ¶
func ExecuteAction(ctx context.Context, action dsl.Action, actx *ActionContext) *ActionResult
ExecuteAction runs a single action and returns the result.
type EvalContext ¶
type EvalContext struct {
Input *hookio.HookInput
SessionStart time.Time // when the session started
LastPrompt time.Time // last user interaction time
Now time.Time
DenyLists map[string][]string // deny list name → patterns
BurnRate float64 // current token burn rate (tokens/min)
Model string // model identifier for the current session
ContextSize int // current context token count
ContextUsage float64 // percentage of context window filled (0–100)
ErrorType string // error_type from StopFailure events
TaskStatus string // task_status from TaskCompleted events
}
EvalContext provides the data needed to evaluate conditions.
type ExecResult ¶
type ExecResult struct {
Output *hookio.HookOutput
ActionsTaken []string
Blocked bool
Error error
DurationMs int
}
ExecResult is the outcome of executing a rule.
type Executor ¶
type Executor struct {
DB *state.DB
GetAdapter func(name string) (adapters.Adapter, error)
DenyLists map[string][]string
}
Executor orchestrates the full hook execution pipeline.
func (*Executor) Execute ¶
func (e *Executor) Execute(ctx context.Context, rule *state.Rule, input *hookio.HookInput) *ExecResult
Execute runs a rule against hook input.
func (*Executor) ExecuteSystemHook ¶
func (e *Executor) ExecuteSystemHook(name string, input *hookio.HookInput) *ExecResult
ExecuteSystemHook handles system hooks (session tracking, prompt tracking).