hooks

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HookContext

type HookContext struct {
	Prompt   string
	Response string
	Error    string
	ToolName string
}

HookContext carries data available for template substitution in hook commands.

type HookEvent

type HookEvent string

HookEvent identifies the lifecycle point at which a hook runs.

const (
	PreQuery  HookEvent = "pre_query"
	PostQuery HookEvent = "post_query"
	PostTool  HookEvent = "post_tool"
	OnError   HookEvent = "on_error"
)

type HookManager

type HookManager struct {
	// contains filtered or unexported fields
}

HookManager executes shell-based lifecycle hooks.

func NewHookManager

func NewHookManager(cfg config.HooksConfig) *HookManager

NewHookManager creates a HookManager from the given hooks configuration.

func (*HookManager) Run

func (m *HookManager) Run(event HookEvent, ctx HookContext) error

Run executes the hook command for the given event, substituting template variables from ctx. If no command is configured for the event, it returns nil. Errors from hook execution are logged but not returned — hooks must not block the pipeline.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL