Documentation
¶
Overview ¶
Package hooks implements shell hook scripts for serve channels. Hooks are external scripts called before/after tool execution, communicating via JSON on stdin/stdout.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages pre/post tool call hooks.
func NewManager ¶
NewManager creates a hooks manager.
func (*Manager) HasPostHook ¶
HasPostHook returns true if a post_tool_call hook is configured.
func (*Manager) HasPreHook ¶
HasPreHook returns true if a pre_tool_call hook is configured.
type PostToolCallRequest ¶
type PostToolCallRequest struct {
Hook string `json:"hook"`
Tool string `json:"tool"`
Args map[string]any `json:"args"`
Result string `json:"result"`
Error string `json:"error,omitempty"`
Platform string `json:"platform"`
UserID string `json:"user_id"`
}
PostToolCallRequest is sent to the post_tool_call script via stdin.
type PreToolCallRequest ¶
type PreToolCallRequest struct {
Hook string `json:"hook"`
Tool string `json:"tool"`
Args map[string]any `json:"args"`
Platform string `json:"platform"`
UserID string `json:"user_id"`
}
PreToolCallRequest is sent to the pre_tool_call script via stdin.
type PreToolCallResponse ¶
type PreToolCallResponse struct {
Action string `json:"action"` // "allow" or "block"
Reason string `json:"reason,omitempty"`
}
PreToolCallResponse is read from the pre_tool_call script via stdout.
Click to show internal directories.
Click to hide internal directories.