Documentation
¶
Overview ¶
Package claudecode provides complete typed views over native Claude Code hook payloads. The unified layer in the root package is convenience; this typed native layer is the fidelity guarantee: every struct captures unrecognized JSON keys in Extra, so provider drift never drops data.
Structs are maintained against the Claude Code hooks documentation with golden fixtures (DESIGN.md §10).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileChangedInput ¶
type FileChangedInput struct {
SessionID string `json:"session_id"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
FilePath string `json:"file_path"`
Extra map[string]json.RawMessage `json:"-"`
}
FileChangedInput is the native FileChanged payload.
func FileChanged ¶
func FileChanged(e *agenthooks.Event) (*FileChangedInput, bool)
type NotificationInput ¶
type NotificationInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
Message string `json:"message"`
Extra map[string]json.RawMessage `json:"-"`
}
NotificationInput is the native Notification payload.
func Notification ¶
func Notification(e *agenthooks.Event) (*NotificationInput, bool)
type PermissionRequestInput ¶
type PermissionRequestInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
PermissionMode string `json:"permission_mode"`
ToolName string `json:"tool_name"`
ToolInput json.RawMessage `json:"tool_input"`
ToolUseID string `json:"tool_use_id"`
Extra map[string]json.RawMessage `json:"-"`
}
PermissionRequestInput is the native PermissionRequest payload.
func PermissionRequest ¶
func PermissionRequest(e *agenthooks.Event) (*PermissionRequestInput, bool)
type PostToolUseInput ¶
type PostToolUseInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
PermissionMode string `json:"permission_mode"`
ToolName string `json:"tool_name"`
ToolInput json.RawMessage `json:"tool_input"`
ToolUseID string `json:"tool_use_id"`
ToolResponse json.RawMessage `json:"tool_response"`
ToolError string `json:"tool_error"`
Extra map[string]json.RawMessage `json:"-"`
}
PostToolUseInput is the native PostToolUse payload (and, with the failure fields set, PostToolUseFailure).
func PostToolUse ¶
func PostToolUse(e *agenthooks.Event) (*PostToolUseInput, bool)
func PostToolUseFailure ¶
func PostToolUseFailure(e *agenthooks.Event) (*PostToolUseInput, bool)
type PreCompactInput ¶
type PreCompactInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
Trigger string `json:"trigger"`
CustomInstructions string `json:"custom_instructions"`
Extra map[string]json.RawMessage `json:"-"`
}
PreCompactInput is the native PreCompact / PostCompact payload.
func PostCompact ¶
func PostCompact(e *agenthooks.Event) (*PreCompactInput, bool)
func PreCompact ¶
func PreCompact(e *agenthooks.Event) (*PreCompactInput, bool)
type PreToolUseInput ¶
type PreToolUseInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
PermissionMode string `json:"permission_mode"`
ToolName string `json:"tool_name"`
ToolInput json.RawMessage `json:"tool_input"`
ToolUseID string `json:"tool_use_id"`
Extra map[string]json.RawMessage `json:"-"`
}
PreToolUseInput is the native PreToolUse payload.
func PreToolUse ¶
func PreToolUse(e *agenthooks.Event) (*PreToolUseInput, bool)
type SessionEndInput ¶
type SessionEndInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
Reason string `json:"reason"`
Extra map[string]json.RawMessage `json:"-"`
}
SessionEndInput is the native SessionEnd payload.
func SessionEnd ¶
func SessionEnd(e *agenthooks.Event) (*SessionEndInput, bool)
type SessionStartInput ¶
type SessionStartInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
Source string `json:"source"`
Extra map[string]json.RawMessage `json:"-"`
}
SessionStartInput is the native SessionStart payload.
func SessionStart ¶
func SessionStart(e *agenthooks.Event) (*SessionStartInput, bool)
type StopInput ¶
type StopInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
StopHookActive bool `json:"stop_hook_active"`
AgentID string `json:"agent_id"`
AgentType string `json:"agent_type"`
Extra map[string]json.RawMessage `json:"-"`
}
StopInput is the native Stop / SubagentStop payload.
func SubagentStop ¶
func SubagentStop(e *agenthooks.Event) (*StopInput, bool)
type UserPromptSubmitInput ¶
type UserPromptSubmitInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
CWD string `json:"cwd"`
HookEventName string `json:"hook_event_name"`
PermissionMode string `json:"permission_mode"`
Prompt string `json:"prompt"`
PromptID string `json:"prompt_id"`
Extra map[string]json.RawMessage `json:"-"`
}
UserPromptSubmitInput is the native UserPromptSubmit payload.
func UserPromptSubmit ¶
func UserPromptSubmit(e *agenthooks.Event) (*UserPromptSubmitInput, bool)