codex

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package codex provides typed views over native Codex hook payloads.

Codex ships a deliberate Claude dialect and publishes machine-readable JSON schemas in-repo; these structs mirror those schemas (DESIGN.md §3.2) and capture unknown fields in Extra so schema drift never drops data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompactInput

type CompactInput struct {
	SessionID     string                     `json:"session_id"`
	TurnID        string                     `json:"turn_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	Extra         map[string]json.RawMessage `json:"-"`
}

CompactInput is the native PreCompact / PostCompact payload.

func PostCompact

func PostCompact(e *agenthooks.Event) (*CompactInput, bool)

func PreCompact

func PreCompact(e *agenthooks.Event) (*CompactInput, bool)

type NotifyPayload

type NotifyPayload struct {
	Type          string                     `json:"type"`
	TurnID        string                     `json:"turn-id"`
	ThreadID      string                     `json:"thread-id"`
	CWD           string                     `json:"cwd"`
	LastAssistant string                     `json:"last-assistant-message"`
	Extra         map[string]json.RawMessage `json:"-"`
}

NotifyPayload is the legacy `codex notify` argv transport (kebab-case).

type PermissionRequestInput

type PermissionRequestInput struct {
	SessionID     string                     `json:"session_id"`
	TurnID        string                     `json:"turn_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	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"`
	TurnID        string                     `json:"turn_id"`
	CWD           string                     `json:"cwd"`
	HookEventName string                     `json:"hook_event_name"`
	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. Codex folds tool failures into PostToolUse (§4.1) — inspect ToolResponse/Extra for error state.

func PostToolUse

func PostToolUse(e *agenthooks.Event) (*PostToolUseInput, bool)

type PreToolUseInput

type PreToolUseInput struct {
	SessionID      string                     `json:"session_id"`
	TurnID         string                     `json:"turn_id"`
	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 added in v0.2.1

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 added in v0.2.1

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"`
	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"`
	TurnID         string                     `json:"turn_id"`
	CWD            string                     `json:"cwd"`
	HookEventName  string                     `json:"hook_event_name"`
	StopHookActive bool                       `json:"stop_hook_active"`
	Extra          map[string]json.RawMessage `json:"-"`
}

StopInput is the native Stop / SubagentStop payload.

func Stop

func Stop(e *agenthooks.Event) (*StopInput, bool)

func SubagentStop

func SubagentStop(e *agenthooks.Event) (*StopInput, bool)

type UserPromptSubmitInput

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

UserPromptSubmitInput is the native UserPromptSubmit payload.

func UserPromptSubmit

func UserPromptSubmit(e *agenthooks.Event) (*UserPromptSubmitInput, bool)

Jump to

Keyboard shortcuts

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