gemini

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package gemini provides typed views over native Gemini CLI hook payloads. Gemini is Claude-inspired with renamed events (PreToolUse→BeforeTool, Stop→AfterAgent) plus a timestamp on every payload and model-level hooks Claude lacks. Unknown fields land in Extra.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterAgentInput

type AfterAgentInput struct {
	SessionID     string                     `json:"session_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	Extra         map[string]json.RawMessage `json:"-"`
}

AfterAgentInput is the native AfterAgent payload.

func AfterAgent

func AfterAgent(e *agenthooks.Event) (*AfterAgentInput, bool)

type AfterModelInput

type AfterModelInput struct {
	SessionID     string                     `json:"session_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	Response      json.RawMessage            `json:"response"`
	Extra         map[string]json.RawMessage `json:"-"`
}

AfterModelInput is the native AfterModel payload. Fires per streamed chunk.

func AfterModel

func AfterModel(e *agenthooks.Event) (*AfterModelInput, bool)

type AfterToolInput

type AfterToolInput struct {
	SessionID     string                     `json:"session_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	ToolName      string                     `json:"tool_name"`
	ToolInput     json.RawMessage            `json:"tool_input"`
	ToolCallID    string                     `json:"tool_call_id"`
	ToolResponse  json.RawMessage            `json:"tool_response"`
	MCPContext    *MCPToolContext            `json:"mcp_context"`
	Extra         map[string]json.RawMessage `json:"-"`
}

AfterToolInput is the native AfterTool payload. Failures ride tool_response.error rather than a dedicated event (§4.1).

func AfterTool

func AfterTool(e *agenthooks.Event) (*AfterToolInput, bool)

type BeforeAgentInput

type BeforeAgentInput struct {
	SessionID     string                     `json:"session_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	Prompt        string                     `json:"prompt"`
	Extra         map[string]json.RawMessage `json:"-"`
}

BeforeAgentInput is the native BeforeAgent payload.

func BeforeAgent

func BeforeAgent(e *agenthooks.Event) (*BeforeAgentInput, bool)

type BeforeModelInput

type BeforeModelInput struct {
	SessionID     string                     `json:"session_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	Request       json.RawMessage            `json:"request"`
	Extra         map[string]json.RawMessage `json:"-"`
}

BeforeModelInput is the native BeforeModel / BeforeToolSelection payload (model-level hooks Claude lacks; hot path, experimental in the unified layer, §12.3).

func BeforeModel

func BeforeModel(e *agenthooks.Event) (*BeforeModelInput, bool)

func BeforeToolSelection

func BeforeToolSelection(e *agenthooks.Event) (*BeforeModelInput, bool)

type BeforeToolInput

type BeforeToolInput struct {
	SessionID     string                     `json:"session_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	ToolName      string                     `json:"tool_name"`
	ToolInput     json.RawMessage            `json:"tool_input"`
	ToolCallID    string                     `json:"tool_call_id"`
	MCPContext    *MCPToolContext            `json:"mcp_context"`
	Extra         map[string]json.RawMessage `json:"-"`
}

BeforeToolInput is the native BeforeTool payload.

func BeforeTool

func BeforeTool(e *agenthooks.Event) (*BeforeToolInput, bool)

type MCPToolContext added in v0.3.0

type MCPToolContext struct {
	ServerName string   `json:"server_name"`
	ToolName   string   `json:"tool_name"`
	Command    string   `json:"command"`
	Args       []string `json:"args"`
	CWD        string   `json:"cwd"`
	URL        string   `json:"url"`
	TCP        string   `json:"tcp"`
}

MCPToolContext is the exact MCP identity and non-sensitive transport metadata Gemini includes on BeforeTool and AfterTool payloads.

type NotificationInput

type NotificationInput struct {
	SessionID     string                     `json:"session_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	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 PreCompressInput

type PreCompressInput struct {
	SessionID     string                     `json:"session_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	Trigger       string                     `json:"trigger"`
	Extra         map[string]json.RawMessage `json:"-"`
}

PreCompressInput is the native PreCompress payload.

func PreCompress

func PreCompress(e *agenthooks.Event) (*PreCompressInput, bool)

type SessionEndInput

type SessionEndInput struct {
	SessionID     string                     `json:"session_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	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"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Timestamp     string                     `json:"timestamp"`
	Source        string                     `json:"source"`
	Extra         map[string]json.RawMessage `json:"-"`
}

SessionStartInput is the native SessionStart payload. Note the open upstream regression where SessionStart may not fire (§1).

func SessionStart

func SessionStart(e *agenthooks.Event) (*SessionStartInput, bool)

Jump to

Keyboard shortcuts

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