Documentation
¶
Overview ¶
Package cursor provides typed views over native Cursor hook payloads (IDE, cursor-agent CLI, and cloud agents). Unknown fields land in Extra.
Note the input-shape quirks the unified layer normalizes: tool_input is an object on preToolUse but a JSON-encoded string on MCP events (quirk #5), and MCP events omit tool_use_id (quirk #3). These views hand you the wire truth; use the unified ToolCall for the normalized form.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AfterFileEditInput ¶
type AfterFileEditInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
FilePath string `json:"file_path"`
Edits json.RawMessage `json:"edits"`
Extra map[string]json.RawMessage `json:"-"`
}
AfterFileEditInput is the native afterFileEdit payload.
func AfterFileEdit ¶
func AfterFileEdit(e *agenthooks.Event) (*AfterFileEditInput, bool)
type AfterMCPExecutionInput ¶
type AfterMCPExecutionInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
ToolName string `json:"tool_name"`
ToolInput json.RawMessage `json:"tool_input"`
ToolResponse json.RawMessage `json:"tool_response"`
MCPServerName string `json:"mcp_server_name"`
URL string `json:"url"`
Command string `json:"command"`
Extra map[string]json.RawMessage `json:"-"`
}
AfterMCPExecutionInput is the native afterMCPExecution payload.
func AfterMCPExecution ¶
func AfterMCPExecution(e *agenthooks.Event) (*AfterMCPExecutionInput, bool)
type AfterShellExecutionInput ¶
type AfterShellExecutionInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
Command string `json:"command"`
Output json.RawMessage `json:"output"`
ExitCode *int `json:"exit_code"`
Extra map[string]json.RawMessage `json:"-"`
}
AfterShellExecutionInput is the native afterShellExecution payload.
func AfterShellExecution ¶
func AfterShellExecution(e *agenthooks.Event) (*AfterShellExecutionInput, bool)
type BeforeMCPExecutionInput ¶
type BeforeMCPExecutionInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
ToolName string `json:"tool_name"`
ToolInput json.RawMessage `json:"tool_input"`
MCPServerName string `json:"mcp_server_name"`
URL string `json:"url"`
Command string `json:"command"`
Extra map[string]json.RawMessage `json:"-"`
}
BeforeMCPExecutionInput is the native beforeMCPExecution payload. ToolInput arrives as a JSON-encoded string (quirk #5) and ToolUseID is typically absent (quirk #3).
func BeforeMCPExecution ¶
func BeforeMCPExecution(e *agenthooks.Event) (*BeforeMCPExecutionInput, bool)
type BeforeReadFileInput ¶
type BeforeReadFileInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
FilePath string `json:"file_path"`
Extra map[string]json.RawMessage `json:"-"`
}
BeforeReadFileInput is the native beforeReadFile payload (allow/deny only).
func BeforeReadFile ¶
func BeforeReadFile(e *agenthooks.Event) (*BeforeReadFileInput, bool)
type BeforeShellExecutionInput ¶
type BeforeShellExecutionInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
UserEmail string `json:"user_email"`
Command string `json:"command"`
CWD string `json:"cwd"`
Extra map[string]json.RawMessage `json:"-"`
}
BeforeShellExecutionInput is the native beforeShellExecution payload.
func BeforeShellExecution ¶
func BeforeShellExecution(e *agenthooks.Event) (*BeforeShellExecutionInput, bool)
type BeforeSubmitPromptInput ¶
type BeforeSubmitPromptInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
Prompt string `json:"prompt"`
Attachments json.RawMessage `json:"attachments"`
Extra map[string]json.RawMessage `json:"-"`
}
BeforeSubmitPromptInput is the native beforeSubmitPrompt payload.
func BeforeSubmitPrompt ¶
func BeforeSubmitPrompt(e *agenthooks.Event) (*BeforeSubmitPromptInput, bool)
type PostToolUseInput ¶
type PostToolUseInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
ToolName string `json:"tool_name"`
ToolInput json.RawMessage `json:"tool_input"`
ToolUseID string `json:"tool_use_id"`
ToolResponse json.RawMessage `json:"tool_response"`
Extra map[string]json.RawMessage `json:"-"`
}
PostToolUseInput is the native postToolUse payload.
func PostToolUse ¶
func PostToolUse(e *agenthooks.Event) (*PostToolUseInput, bool)
type PreToolUseInput ¶
type PreToolUseInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
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 (generic form; fires in addition to the specific shell/MCP events for the same call, quirk #2).
func PreToolUse ¶
func PreToolUse(e *agenthooks.Event) (*PreToolUseInput, bool)
type SessionStartInput ¶
type SessionStartInput struct {
ConversationID string `json:"conversation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
UserEmail string `json:"user_email"`
Model string `json:"model"`
Extra map[string]json.RawMessage `json:"-"`
}
SessionStartInput is the native sessionStart / sessionEnd payload.
func SessionEnd ¶
func SessionEnd(e *agenthooks.Event) (*SessionStartInput, bool)
func SessionStart ¶
func SessionStart(e *agenthooks.Event) (*SessionStartInput, bool)
type StopInput ¶
type StopInput struct {
ConversationID string `json:"conversation_id"`
GenerationID string `json:"generation_id"`
HookEventName string `json:"hook_event_name"`
WorkspaceRoots []string `json:"workspace_roots"`
Status string `json:"status"`
LoopCount int `json:"loop_count"`
Extra map[string]json.RawMessage `json:"-"`
}
StopInput is the native stop / subagentStop payload.
func SubagentStop ¶
func SubagentStop(e *agenthooks.Event) (*StopInput, bool)