Documentation
¶
Index ¶
- func Check(event string, he config.HookEntry) error
- type Decision
- type EventType
- type Payload
- type Runner
- func (r *Runner) PostToolUse() agentcore.ToolMiddleware
- func (r *Runner) PreToolUse() agentcore.ToolMiddleware
- func (r *Runner) RunNotification(message string)
- func (r *Runner) RunSessionEnd()
- func (r *Runner) RunSessionStart()
- func (r *Runner) RunUserPromptSubmit(ctx context.Context, prompt string) (Decision, error)
- func (r *Runner) Set(cfg config.HooksConfig)
- type Validation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decision ¶
type Decision struct {
AdditionalContext string
UpdatedInput json.RawMessage
}
Decision is what passing hooks add to a call or prompt; a block is returned as an error instead.
type Payload ¶
type Payload struct {
Event EventType `json:"event"`
Tool string `json:"tool,omitempty"`
Args json.RawMessage `json:"args,omitempty"`
Output json.RawMessage `json:"output,omitempty"`
IsError bool `json:"is_error,omitempty"`
Message string `json:"message,omitempty"`
Prompt string `json:"prompt,omitempty"` // UserPromptSubmit
}
Payload is the JSON written to the hook command's stdin.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner runs hooks without asking: only hooks the user wrote or agreed to reach it.
func New ¶
New has no hooks until Set. Prompt hooks call model each time they run, so they follow model switches.
func (*Runner) PostToolUse ¶
func (r *Runner) PostToolUse() agentcore.ToolMiddleware
PostToolUse passes the result text to the hooks as a JSON string.
func (*Runner) PreToolUse ¶
func (r *Runner) PreToolUse() agentcore.ToolMiddleware
PreToolUse runs before the permission check, so rewritten arguments are what gets checked and run.
func (*Runner) RunNotification ¶
func (*Runner) RunSessionEnd ¶
func (r *Runner) RunSessionEnd()
func (*Runner) RunSessionStart ¶
func (r *Runner) RunSessionStart()
func (*Runner) RunUserPromptSubmit ¶
func (*Runner) Set ¶
func (r *Runner) Set(cfg config.HooksConfig)
type Validation ¶
type Validation struct {
// contains filtered or unexported fields
}
Validation runs the PostStopValidation hooks when a run that changed the repository would stop, and sends the agent back once to fix a failure.
func NewValidation ¶
func NewValidation(r *Runner) *Validation
Click to show internal directories.
Click to hide internal directories.