hookruntime

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeClaudeEvent

func DecodeClaudeEvent(input []byte, agentName string) (hook.Event, error)

func EncodeClaudeResult

func EncodeClaudeResult(hookEventName string, result hook.Result) ([]byte, error)

func Run

func Run(stdin io.Reader, stdout, stderr io.Writer, codec Codec, sink Sink) int

Types

type ClaudeHookInput

type ClaudeHookInput struct {
	SessionID        string         `json:"session_id"`
	SessionIDAlt     string         `json:"sessionId"`
	HookEventName    string         `json:"hook_event_name"`
	HookEventNameAlt string         `json:"hookEventName"`
	HookEventLegacy  string         `json:"hook_event"`
	ToolName         string         `json:"tool_name"`
	ToolNameAlt      string         `json:"toolName"`
	ToolInput        map[string]any `json:"tool_input"`
	ToolInputAlt     map[string]any `json:"toolInput"`
	ToolResponse     map[string]any `json:"tool_response"`
	ToolResponseAlt  map[string]any `json:"toolResponse"`
	ToolUseID        string         `json:"tool_use_id"`
	ToolUseIDAlt     string         `json:"toolUseId"`
	ToolUseIDUpper   string         `json:"toolUseID"`
	CWD              string         `json:"cwd"`
	PermissionMode   *string        `json:"permission_mode"`
	DurationMs       *int64         `json:"duration_ms"`
	Error            *string        `json:"error"`
	IsInterrupt      *bool          `json:"is_interrupt"`
}

type Codec

type Codec interface {
	DecodeHookEvent([]byte) (hook.Event, error)
	EncodeHookResult(hook.Event, hook.Result) ([]byte, error)
}

type Sink

type Sink interface {
	ProcessHookEvent(hook.Event) (hook.Result, error)
}

type SinkFunc

type SinkFunc func(hook.Event) (hook.Result, error)

func (SinkFunc) ProcessHookEvent

func (f SinkFunc) ProcessHookEvent(event hook.Event) (hook.Result, error)

Jump to

Keyboard shortcuts

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