Versions in this module Expand all Collapse all v0 v0.2.0 Jul 14, 2026 Changes in this version + const HaltExitCode + type ActiveHookInfo struct + CancelFunc context.CancelFunc + Context context.Context + Event types.HookEvent + HookID string + StartTime time.Time + type AggregateResult struct + Context string + Decision Decision + Halt bool + HookCount int + Hooks []HookInfo + Reason string + UpdatedInput string + type Decision int + const DecisionAllow + const DecisionDeny + const DecisionNone + func (d Decision) String() string + type Executor struct + func NewExecutor(registry *Registry) *Executor + func (e *Executor) Execute(ctx context.Context, event types.HookEvent, data map[string]any) ([]types.HookResult, error) + func (e *Executor) ExecuteAsync(ctx context.Context, event types.HookEvent, data map[string]any) + func (e *Executor) ExecuteFirst(ctx context.Context, event types.HookEvent, data map[string]any) *types.HookResult + func (e *Executor) IsEnabled() bool + func (e *Executor) SetEnabled(enabled bool) + func (e *Executor) SetTimeout(timeout time.Duration) + type HookConfig struct + Command string + Matcher string + Timeout int + type HookHandler = types.HookHandler + type HookInfo struct + Decision string + Halt bool + InputRewrite bool + Matcher string + Name string + Reason string + type HookLifecycleConfig struct + CleanupInterval time.Duration + DefaultHookLifetime time.Duration + EnableAutoCleanup bool + EnablePerformanceTracking bool + ExecutionTimeout time.Duration + HookTimeoutManager *HookTimeoutManager + MaxExecutionRetries int + func DefaultHookLifecycleConfig() *HookLifecycleConfig + type HookLifecycleEvent struct + Error error + EventType string + HookID string + Metadata map[string]interface{} + Timestamp time.Time + type HookLifecycleManager struct + func NewHookLifecycleManager(registry *Registry) *HookLifecycleManager + func NewHookLifecycleManagerWithConfig(registry *Registry, config *HookLifecycleConfig) *HookLifecycleManager + func (m *HookLifecycleManager) ExecuteHook(ctx context.Context, hook HookRegistration, progress types.HookProgress) error + func (m *HookLifecycleManager) GetActiveHooks() map[string]*ActiveHookInfo + func (m *HookLifecycleManager) GetConfig() *HookLifecycleConfig + func (m *HookLifecycleManager) GetHookState(hookID string) (HookState, error) + func (m *HookLifecycleManager) GetLifecycleEvents() <-chan HookLifecycleEvent + func (m *HookLifecycleManager) GetMetrics() HookMetrics + func (m *HookLifecycleManager) PauseHook(hookID string) error + func (m *HookLifecycleManager) RegisterHook(hook HookRegistration) error + func (m *HookLifecycleManager) RemoveHook(hookID string) error + func (m *HookLifecycleManager) ResumeHook(hookID string) error + func (m *HookLifecycleManager) Shutdown() + func (m *HookLifecycleManager) UpdateConfig(config *HookLifecycleConfig) + func (m *HookLifecycleManager) WaitShutdown() + type HookMetadata struct + Decision string + Halt bool + HookCount int + Hooks []HookInfo + InputRewrite bool + Reason string + type HookMetrics struct + AverageExecutionTime time.Duration + FailedExecutions int64 + MaxExecutionTime time.Duration + MinExecutionTime time.Duration + SuccessfulExecutions int64 + TotalExecutionTime time.Duration + TotalExecutions int64 + type HookRegistration struct + CreatedAt time.Time + ErrorCount int + Event types.HookEvent + ExecCount int + Handler HookHandler + ID string + IsPermanent bool + LastError error + LastExecuted time.Time + MaxLifetime time.Duration + Metadata map[string]any + Priority int + State HookState + type HookResult struct + Context string + Decision Decision + Halt bool + Reason string + UpdatedInput string + type HookState string + const HookStateActive + const HookStateDead + const HookStateInactive + const HookStatePaused + type HookTimeoutEvent struct + HookID string + Timeout time.Duration + Timestamp time.Time + type HookTimeoutInfo struct + CancelFunc context.CancelFunc + Context context.Context + Expired bool + ExpiredTime time.Time + HookID string + StartTime time.Time + Timeout time.Duration + type HookTimeoutManager struct + func NewHookTimeoutManager() *HookTimeoutManager + func NewHookTimeoutManagerWithTimeout(defaultTimeout time.Duration) *HookTimeoutManager + func (m *HookTimeoutManager) CheckTimeout(hookID string) bool + func (m *HookTimeoutManager) ClearAllTimeouts() + func (m *HookTimeoutManager) ClearExpiredTimeouts() int + func (m *HookTimeoutManager) GetActiveCount() int + func (m *HookTimeoutManager) GetActiveTimeouts() map[string]*HookTimeoutInfo + func (m *HookTimeoutManager) GetDefaultTimeout() time.Duration + func (m *HookTimeoutManager) GetExpiredCount() int + func (m *HookTimeoutManager) GetExpiredTimeouts() map[string]*HookTimeoutInfo + func (m *HookTimeoutManager) GetTimeoutEvents() <-chan HookTimeoutEvent + func (m *HookTimeoutManager) GetTimeoutInfo(hookID string) (*HookTimeoutInfo, error) + func (m *HookTimeoutManager) SetDefaultTimeout(timeout time.Duration) + func (m *HookTimeoutManager) Shutdown() + func (m *HookTimeoutManager) StartTimeout(parentCtx context.Context, hookID string, timeout time.Duration) (context.Context, context.CancelFunc) + func (m *HookTimeoutManager) StopTimeout(hookID string) + type Registry struct + func NewRegistry() *Registry + func (r *Registry) Add(hook HookRegistration) + func (r *Registry) CleanupDeadHooks() int + func (r *Registry) CleanupExpiredHooks() int + func (r *Registry) Clear(event types.HookEvent) + func (r *Registry) Count(event types.HookEvent) int + func (r *Registry) Get(event types.HookEvent) []HookRegistration + func (r *Registry) GetActiveHooks(event types.HookEvent) []HookRegistration + func (r *Registry) GetHook(id string) (*HookRegistration, error) + func (r *Registry) GetHookStats() map[string]interface{} + func (r *Registry) GetHooksByState(state HookState) []HookRegistration + func (r *Registry) HasHooks(event types.HookEvent) bool + func (r *Registry) List() map[types.HookEvent][]HookRegistration + func (r *Registry) PauseHook(id string) error + func (r *Registry) RecordHookExecution(id string, err error) error + func (r *Registry) Remove(id string) + func (r *Registry) ResumeHook(id string) error + func (r *Registry) SetHookState(id string, state HookState) error + type Runner struct + func NewRunner(cfgs []HookConfig, cwd, projectDir string) *Runner + func (r *Runner) Run(ctx context.Context, sessionID, toolName, toolInputJSON string) (AggregateResult, error)