codexgo

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

README

codex-app-server-go

A typed Go client for the Codex app-server v2 JSON-RPC protocol — drive AI coding agents from Go.

Go Reference Go Report Card License Go version Protocol

What's Implemented

Subsystem Covered Status
Core / Initialize 1/1 ✅
Thread 20/22 ✅ start · resume · fork · list · read · archive · unarchive · set-name · rollback · loaded-list · compact · goal-set/get/clear · metadata-update · unsubscribe · delete · inject-items · shell-command · approve-guardian
Turn 3/4 ✅ start · steer · interrupt
Account / Login 3/4 ✅ api-key · chatgpt · device-code · get-account · cancel-login
Models 2/2 ✅ list · provider-capabilities
Review 1/1 ✅ review/start
Config CRUD 3/3 ✅ read · value-write · batch-write
Skills 3/3 ✅ list · config-write · extra-roots-set
Experimental features 2/2 ✅ list · enablement-set
Hooks (server-side) 1/1 ✅ list
Command exec (PTY) 4/4 ✅ exec · write · resize · terminate + streaming
Transports — ✅ stdio · WebSocket · 🚧 HTTP+SSE (WIP) · retry/reconnect

Server → client notifications: 65 of 68 typed-decoded.

Install

go get github.com/zealbase/codex-app-server-go
import codexgo "github.com/zealbase/codex-app-server-go"

Version: v0.2.0 · Protocol: Codex app-server v2 · Go: 1.25+

How to Use

Local binary (stdio)
cmd := exec.Command("codex", "app-server", "--stdio")
stdout, _ := cmd.StdoutPipe()
stdin, _ := cmd.StdinPipe()
_ = cmd.Start()

client, _ := codexgo.New(codexgo.WithStdioTransport(stdout, stdin))
defer client.Close()

ctx := context.Background()
_, _ = client.Initialize(ctx, codexgo.InitializeRequest{
    ClientInfo:   codexgo.ClientInfo{Name: "my-tool", Version: "0.1.0"},
    Capabilities: codexgo.Capabilities{ExperimentalAPI: true},
})

thread, _ := client.StartThread(ctx, codexgo.WithThreadModel("claude-opus-4-8"))
defer thread.Close()

result, _ := thread.Run(ctx, "Summarize this repo in one sentence.")
fmt.Println(result.FinalAgentText())
Remote server (WebSocket)
dialCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()

client, _ := codexgo.New(
    codexgo.WithWSBearerToken("my-api-key"),
    codexgo.WithWSTransport(dialCtx, "ws://codex-server.example.com"),
)
defer client.Close()
thread, _ := client.StartThread(ctx, codexgo.WithThreadModel("claude-opus-4-8"))
Streaming
ch, _ := thread.RunStreamed(ctx, "Explain this codebase.")
for delta := range ch {
    fmt.Print(delta.Text)
}
Structured output
sub := client.Events(); defer sub.Close()
turn, _ := client.TurnStart(ctx, codexgo.TurnStartRequest{
    ThreadID:     thread.ID(),
    Input:        "Return {\"answer\":\"PONG\",\"n\":42} as JSON.",
    OutputSchema: schemaJSON,
})
var out struct{ Answer string; N int }
_, _ = client.WaitForStructuredOutput(ctx, thread.ID(), turn.ID, &out)

Full Protocol Coverage

Verified against codex-cli 0.142.0 · schema sha256 935c753c…

Axis Covered Total %
RPC request methods 43 84 51%
Server notifications (typed-decoded) 65 68 ~96%
Full message surface ~108 152 ~71%

RPC by group:

Group Covered Total %
Thread 20 22 91%
Turn 3 4 75%
Account 3 4 75%
Core + Review 2 2 100%
Models 2 2 100%
Config CRUD 3 3 100%
Skills 3 3 100%
Experimental 2 2 100%
Hooks 1 1 100%
Command exec (PTY) 4 4 100%
Filesystem 0 10 0%
Plugins / marketplace 0 14 0%
Misc 0 7 0%
MCP lifecycle 0 4 0%
Remote control 0 2 0%

See gen/conformance-report.md for the full method-by-method breakdown.

Documentation

Protocol reference

This client targets the Codex app-server v2 JSON-RPC schema. The canonical schema is produced by the Codex binary itself:

codex app-server generate-json-schema --out <dir>

A pinned copy ships at internal/protocol/schema/codex_app_server_protocol.v2.schemas.json. Upstream protocol source: openai/codex — codex-rs/app-server-protocol/.

License

Licensed under the Apache License, Version 2.0, consistent with upstream Codex. See LICENSE for the full text.

Documentation

Overview

Package codexgo provides a compact client for the Codex app-server.

Index

Constants

View Source
const (
	ApprovalDecisionAccept                        = "accept"
	ApprovalDecisionAcceptForSession              = "acceptForSession"
	ApprovalDecisionAcceptWithExecPolicyAmendment = "acceptWithExecpolicyAmendment"
	ApprovalDecisionApplyNetworkPolicyAmendment   = "applyNetworkPolicyAmendment"
	ApprovalDecisionDecline                       = "decline"
	ApprovalDecisionCancel                        = "cancel"

	FileChangeApprovalDecisionAccept           = "accept"
	FileChangeApprovalDecisionAcceptForSession = "acceptForSession"
	FileChangeApprovalDecisionDecline          = "decline"
	FileChangeApprovalDecisionCancel           = "cancel"
)
View Source
const (
	ThreadGoalStatusActive        = schematypes.ThreadGoalStatusActive
	ThreadGoalStatusPaused        = schematypes.ThreadGoalStatusPaused
	ThreadGoalStatusBlocked       = schematypes.ThreadGoalStatusBlocked
	ThreadGoalStatusUsageLimited  = schematypes.ThreadGoalStatusUsageLimited
	ThreadGoalStatusBudgetLimited = schematypes.ThreadGoalStatusBudgetLimited
	ThreadGoalStatusComplete      = schematypes.ThreadGoalStatusComplete
)
View Source
const (
	ThreadStatusNotLoaded   = protocol.ThreadStatusNotLoaded
	ThreadStatusIdle        = protocol.ThreadStatusIdle
	ThreadStatusSystemError = protocol.ThreadStatusSystemError
	ThreadStatusActive      = protocol.ThreadStatusActive
)
View Source
const (
	ThreadActiveFlagWaitingOnApproval  = protocol.ThreadActiveFlagWaitingOnApproval
	ThreadActiveFlagWaitingOnUserInput = protocol.ThreadActiveFlagWaitingOnUserInput
)
View Source
const (
	TurnStatusCompleted   = protocol.TurnStatusCompleted
	TurnStatusInterrupted = protocol.TurnStatusInterrupted
	TurnStatusFailed      = protocol.TurnStatusFailed
	TurnStatusInProgress  = protocol.TurnStatusInProgress
)
View Source
const (
	TurnItemsViewNotLoaded = protocol.TurnItemsViewNotLoaded
	TurnItemsViewSummary   = protocol.TurnItemsViewSummary
	TurnItemsViewFull      = protocol.TurnItemsViewFull
)
View Source
const (
	ItemKindUserMessage         = protocol.ItemKindUserMessage
	ItemKindHookPrompt          = protocol.ItemKindHookPrompt
	ItemKindAgentMessage        = protocol.ItemKindAgentMessage
	ItemKindPlan                = protocol.ItemKindPlan
	ItemKindReasoning           = protocol.ItemKindReasoning
	ItemKindCommandExecution    = protocol.ItemKindCommandExecution
	ItemKindFileChange          = protocol.ItemKindFileChange
	ItemKindMCPToolCall         = protocol.ItemKindMCPToolCall
	ItemKindDynamicToolCall     = protocol.ItemKindDynamicToolCall
	ItemKindCollabAgentToolCall = protocol.ItemKindCollabAgentToolCall
	ItemKindSubAgentActivity    = protocol.ItemKindSubAgentActivity
	ItemKindWebSearch           = protocol.ItemKindWebSearch
	ItemKindImageView           = protocol.ItemKindImageView
	ItemKindSleep               = protocol.ItemKindSleep
	ItemKindImageGeneration     = protocol.ItemKindImageGeneration
	ItemKindEnteredReviewMode   = protocol.ItemKindEnteredReviewMode
	ItemKindExitedReviewMode    = protocol.ItemKindExitedReviewMode
	ItemKindContextCompaction   = protocol.ItemKindContextCompaction
)

Variables

This section is empty.

Functions

func FindBinary

func FindBinary() (string, error)

FindBinary returns the path to the codex binary, searching in order:

  1. CODEX_BIN env var (nharness convention)
  2. CODEX_CLI_PATH env var (official Python SDK convention)
  3. exec.LookPath("codex") in the system PATH

func IsHttpConnectionFailed

func IsHttpConnectionFailed(err error) bool

IsHttpConnectionFailed reports whether err is a connection failure.

func IsInternalServerError

func IsInternalServerError(err error) bool

IsInternalServerError reports whether err is an HTTP 500 from Codex.

func IsRateLimited

func IsRateLimited(err error) bool

IsRateLimited reports whether err is an HTTP 429 rate-limit error from Codex.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized reports whether err is an HTTP 401 authentication error.

func StreamText

func StreamText(ctx context.Context, ch <-chan ThreadEvent, w io.Writer) error

StreamText reads ThreadEvents from ch and writes agent message text deltas to w. It returns when ch is closed or ctx is done. Useful for printing streaming responses to a terminal or HTTP response writer.

Types

type AccountInfo

type AccountInfo struct {
	Type     string   `json:"type"`
	Email    string   `json:"email,omitempty"`
	PlanType PlanType `json:"planType,omitempty"`
}

AccountInfo describes the currently authenticated account. The fields present depend on Type: "chatgpt" accounts carry Email and PlanType, while "apiKey" and "amazonBedrock" accounts only carry Type.

type AccountRateLimitsUpdatedEvent

type AccountRateLimitsUpdatedEvent struct {
	RateLimits json.RawMessage `json:"rateLimits,omitempty"`
}

type AccountReadResult

type AccountReadResult struct {
	Account            *AccountInfo `json:"account,omitempty"`
	RequiresOpenAIAuth bool         `json:"requiresOpenaiAuth"`
}

AccountReadResult is the response to account/read.

type AccountUpdatedEvent

type AccountUpdatedEvent struct {
	AuthMode string `json:"authMode,omitempty"`
	PlanType string `json:"planType,omitempty"`
}

type AppListUpdatedEvent

type AppListUpdatedEvent struct {
	Data json.RawMessage `json:"data,omitempty"`
}

type ApprovalDecision

type ApprovalDecision = protocol.ApprovalDecision

type ApprovalMode

type ApprovalMode string

ApprovalMode is a typed approval policy for turns and threads. The string values match the wire values the app-server expects for approvalPolicy.

const (
	ApprovalModeDenyAll    ApprovalMode = "deny_all"
	ApprovalModeAutoReview ApprovalMode = "auto_review"
	ApprovalModeOnRequest  ApprovalMode = "on-request"
	ApprovalModeNever      ApprovalMode = "never"
)

type AuthMode

type AuthMode string

AuthMode is the authentication mode for OpenAI-backed providers.

const (
	AuthModeAPIKey  AuthMode = "apikey"
	AuthModeChatGPT AuthMode = "chatgpt"
)

type CancelLoginStatus

type CancelLoginStatus string

CancelLoginStatus is the outcome of canceling an interactive login attempt.

const (
	CancelLoginStatusCanceled CancelLoginStatus = "canceled"
	CancelLoginStatusNotFound CancelLoginStatus = "notFound"
)

type Capabilities

type Capabilities = schematypes.Capabilities

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Client, error)

func (*Client) AccountRead

func (c *Client) AccountRead(ctx context.Context) (AccountReadResult, error)

AccountRead returns the currently authenticated account, if any.

func (*Client) Call

func (c *Client) Call(ctx context.Context, method string, params, result any) error

Call makes a raw JSON-RPC call and decodes the result into result. Exposed for integration tests that need to probe the binary's raw response format.

func (*Client) Close

func (c *Client) Close() error

func (*Client) CommandExec

func (c *Client) CommandExec(ctx context.Context, req CommandExecRequest) (CommandExecResult, error)

CommandExec starts an interactive command. For streaming runs subscribe to CommandExecOutputDeltaEvent via Events() before calling, then drive the process with the returned handle.

func (*Client) CommandExecHandle

func (c *Client) CommandExecHandle(processID string) *CommandExecHandle

CommandExecHandle returns a handle for driving the process with the given ID.

func (*Client) CommandExecResize

func (c *Client) CommandExecResize(ctx context.Context, req CommandExecResizeRequest) error

CommandExecResize resizes a running process's PTY.

func (*Client) CommandExecTerminate

func (c *Client) CommandExecTerminate(ctx context.Context, req CommandExecTerminateRequest) error

CommandExecTerminate terminates a running process.

func (*Client) CommandExecWrite

func (c *Client) CommandExecWrite(ctx context.Context, req CommandExecWriteRequest) error

CommandExecWrite writes stdin to (or closes stdin of) a running process.

func (*Client) ConfigBatchWrite

func (c *Client) ConfigBatchWrite(ctx context.Context, req ConfigBatchWriteRequest) error

ConfigBatchWrite applies a batch of configuration edits.

func (*Client) ConfigRead

func (c *Client) ConfigRead(ctx context.Context, req ConfigReadRequest) (ConfigReadResult, error)

ConfigRead returns the effective configuration. When IncludeLayers is set the per-layer breakdown and value origins are included.

func (*Client) ConfigValueWrite

func (c *Client) ConfigValueWrite(ctx context.Context, req ConfigValueWriteRequest) error

ConfigValueWrite writes a single configuration value at the given key path.

func (*Client) Events

func (c *Client) Events() *EventSubscription

func (*Client) ExperimentalFeatureEnablementSet

ExperimentalFeatureEnablementSet enables or disables experimental features.

func (*Client) ExperimentalFeatureList

ExperimentalFeatureList returns a page of experimental features.

func (*Client) HooksList

func (c *Client) HooksList(ctx context.Context, req HooksListRequest) (HooksListResult, error)

HooksList returns the configured lifecycle hooks discoverable from the given working directories.

func (*Client) Initialize

func (c *Client) Initialize(ctx context.Context, req InitializeRequest) (InitializeResult, error)

func (*Client) LoginAPIKey

func (c *Client) LoginAPIKey(ctx context.Context, apiKey string) error

LoginAPIKey authenticates the account with an OpenAI API key. This is a synchronous login: it completes as soon as the RPC returns successfully.

func (*Client) LoginChatGPT

func (c *Client) LoginChatGPT(ctx context.Context) (*LoginHandle, error)

LoginChatGPT begins a browser-based ChatGPT OAuth login. It returns a LoginHandle whose AuthURL the caller should open in a browser; call handle.Wait to block until the login completes.

func (*Client) LoginDeviceCode

func (c *Client) LoginDeviceCode(ctx context.Context) (*LoginHandle, error)

LoginDeviceCode begins a device-code ChatGPT login. It returns a LoginHandle whose VerificationURL and UserCode the caller should present to the user; call handle.Wait to block until the login completes.

func (*Client) Logout

func (c *Client) Logout(ctx context.Context) error

Logout clears the stored credentials for the current account.

func (*Client) ModelList

func (c *Client) ModelList(ctx context.Context, includeHidden bool) ([]ModelInfo, error)

ModelList returns the full model catalog from the server. When includeHidden is true, hidden models are included. Results are not cached.

func (*Client) ModelProviderCapabilitiesRead

func (c *Client) ModelProviderCapabilitiesRead(ctx context.Context) (ModelProviderCapabilities, error)

ModelProviderCapabilitiesRead returns the capabilities the active model provider supports (namespaced tools, image generation, web search).

func (*Client) Models

func (c *Client) Models(ctx context.Context) ([]string, error)

Models returns the sorted list of model IDs supported by the connected server. It is a convenience wrapper over ModelList that excludes hidden models and returns IDs only.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping verifies the transport is responsive by listing threads with a limit of 1. Returns nil if the server responds within ctx's deadline, or an error otherwise.

func (*Client) ResumeThread

func (c *Client) ResumeThread(ctx context.Context, threadID string, opts ...ThreadOption) (*SessionThread, error)

ResumeThread reconnects to an existing thread by ID and returns a stateful SessionThread.

func (*Client) ReviewStart

func (c *Client) ReviewStart(ctx context.Context, req ReviewStartRequest) error

func (*Client) SetApprovalPolicy

func (c *Client) SetApprovalPolicy(ctx context.Context, policy string) error

SetApprovalPolicy sends a config/update request that changes the approval policy.

func (*Client) SetModel

func (c *Client) SetModel(ctx context.Context, model string) error

SetModel sends a config/update request that changes the active model.

func (*Client) SetSandbox

func (c *Client) SetSandbox(ctx context.Context, sandbox string) error

SetSandbox sends a config/update request that changes the sandbox policy.

func (*Client) SkillsConfigWrite

func (c *Client) SkillsConfigWrite(ctx context.Context, req SkillsConfigWriteRequest) (SkillsConfigWriteResult, error)

SkillsConfigWrite enables or disables a skill (by name or path) and returns the effective enabled state.

func (*Client) SkillsExtraRootsSet

func (c *Client) SkillsExtraRootsSet(ctx context.Context, req SkillsExtraRootsSetRequest) error

SkillsExtraRootsSet sets additional filesystem roots scanned for skills.

func (*Client) SkillsList

func (c *Client) SkillsList(ctx context.Context, req SkillsListRequest) (SkillsListResult, error)

SkillsList lists skills discoverable from the given working directories.

func (*Client) StartThread

func (c *Client) StartThread(ctx context.Context, opts ...ThreadOption) (*SessionThread, error)

StartThread creates a new session thread on the server and returns a stateful SessionThread that can be used to run turns.

func (*Client) ThreadApproveGuardianDeniedAction

func (c *Client) ThreadApproveGuardianDeniedAction(ctx context.Context, req ThreadApproveGuardianDeniedActionRequest) error

ThreadApproveGuardianDeniedAction approves a guardian-denied action.

func (*Client) ThreadArchive

func (c *Client) ThreadArchive(ctx context.Context, req ThreadArchiveRequest) error

func (*Client) ThreadDelete

func (c *Client) ThreadDelete(ctx context.Context, req ThreadDeleteRequest) error

ThreadDelete deletes a thread and its rollout history.

func (*Client) ThreadFork

func (c *Client) ThreadFork(ctx context.Context, req ThreadForkRequest) (Thread, error)

func (*Client) ThreadGoalClear

func (c *Client) ThreadGoalClear(ctx context.Context, req ThreadGoalClearRequest) error

ThreadGoalClear removes the persisted goal for a thread.

func (*Client) ThreadGoalGet

func (c *Client) ThreadGoalGet(ctx context.Context, req ThreadGoalGetRequest) (ThreadGoal, error)

ThreadGoalGet returns the persisted goal for a thread, or a zero ThreadGoal when none is set.

func (*Client) ThreadGoalSet

func (c *Client) ThreadGoalSet(ctx context.Context, req ThreadGoalSetRequest) (ThreadGoal, error)

ThreadGoalSet creates or updates the persisted goal for a thread.

func (*Client) ThreadInjectItems

func (c *Client) ThreadInjectItems(ctx context.Context, req ThreadInjectItemsRequest) error

ThreadInjectItems injects items into a thread's history.

func (*Client) ThreadList

func (c *Client) ThreadList(ctx context.Context, req ThreadListRequest) ([]Thread, error)

func (*Client) ThreadLoadedList

func (c *Client) ThreadLoadedList(ctx context.Context) ([]string, error)

ThreadLoadedList returns the IDs of threads currently loaded in the server's memory. Newly started threads appear here before they are persisted to disk.

func (*Client) ThreadMetadataUpdate

ThreadMetadataUpdate patches a thread's stored metadata (e.g. Git info).

func (*Client) ThreadRead

func (c *Client) ThreadRead(ctx context.Context, req ThreadReadRequest) (Thread, error)

func (*Client) ThreadResume

func (c *Client) ThreadResume(ctx context.Context, req ThreadResumeRequest) (Thread, error)

func (*Client) ThreadRollback

func (c *Client) ThreadRollback(ctx context.Context, req ThreadRollbackRequest) error

func (*Client) ThreadSetName

func (c *Client) ThreadSetName(ctx context.Context, req ThreadSetNameRequest) error

func (*Client) ThreadShellCommand

func (c *Client) ThreadShellCommand(ctx context.Context, req ThreadShellCommandRequest) error

ThreadShellCommand runs a shell command string in the thread's shell.

func (*Client) ThreadStart

func (c *Client) ThreadStart(ctx context.Context, req ThreadStartRequest) (Thread, error)

func (*Client) ThreadUnarchive

func (c *Client) ThreadUnarchive(ctx context.Context, req ThreadUnarchiveRequest) error

func (*Client) ThreadUnsubscribe

func (c *Client) ThreadUnsubscribe(ctx context.Context, req ThreadUnsubscribeRequest) (ThreadUnsubscribeResult, error)

ThreadUnsubscribe stops event delivery for a thread on this connection.

func (*Client) TurnDiff

func (c *Client) TurnDiff(ctx context.Context, req TurnDiffRequest) (TurnDiffResult, error)

func (*Client) TurnInterrupt

func (c *Client) TurnInterrupt(ctx context.Context, req TurnInterruptRequest) error

func (*Client) TurnRead

func (c *Client) TurnRead(ctx context.Context, threadID, turnID string) (Turn, error)

TurnRead returns the current state of a turn by ID. For a completed turn it includes items and usage; use WaitForFinalAgentMessage to wait until completion when the turn may still be in progress.

func (*Client) TurnStart

func (c *Client) TurnStart(ctx context.Context, req TurnStartRequest) (Turn, error)

func (*Client) TurnSteer

func (c *Client) TurnSteer(ctx context.Context, req TurnSteerRequest) error

func (*Client) WaitForFinalAgentMessage

func (c *Client) WaitForFinalAgentMessage(ctx context.Context, threadID, turnID string) (string, error)

func (*Client) WaitForStructuredOutput

func (c *Client) WaitForStructuredOutput(ctx context.Context, threadID, turnID string, out any) (Turn, error)

func (*Client) WaitForTurn

func (c *Client) WaitForTurn(ctx context.Context, threadID, turnID string) (Turn, error)

type ClientInfo

type ClientInfo = schematypes.ClientInfo

type CodexError

type CodexError struct {
	RPCCode        int
	RPCMessage     string
	ErrorType      string // codexErrorInfo.type  e.g. "HttpConnectionFailed"
	HTTPStatusCode int    // codexErrorInfo.httpStatusCode e.g. 429
	AdditionalInfo string // additionalDetails
}

CodexError wraps an RPCError and exposes the structured codexErrorInfo payload.

func AsCodexError

func AsCodexError(err error) (*CodexError, bool)

AsCodexError unwraps err into a *CodexError if the underlying cause is a transport.RPCError that carries a codexErrorInfo payload.

func (*CodexError) Error

func (e *CodexError) Error() string

type CommandExecHandle

type CommandExecHandle struct {
	// contains filtered or unexported fields
}

CommandExecHandle is a convenience wrapper binding a processId to the write/resize/terminate operations for an interactive command.

func (*CommandExecHandle) CloseStdin

func (h *CommandExecHandle) CloseStdin(ctx context.Context) error

CloseStdin closes the process's stdin.

func (*CommandExecHandle) ProcessID

func (h *CommandExecHandle) ProcessID() string

ProcessID returns the bound process ID.

func (*CommandExecHandle) Resize

func (h *CommandExecHandle) Resize(ctx context.Context, cols, rows int) error

Resize resizes the process's PTY.

func (*CommandExecHandle) Terminate

func (h *CommandExecHandle) Terminate(ctx context.Context) error

Terminate terminates the process.

func (*CommandExecHandle) Write

func (h *CommandExecHandle) Write(ctx context.Context, deltaBase64 string) error

Write sends stdin bytes (base64-encoded) to the process.

type CommandExecOutputDeltaEvent

type CommandExecOutputDeltaEvent struct {
	ProcessID   string `json:"processId,omitempty"`
	Stream      string `json:"stream,omitempty"`
	DeltaBase64 string `json:"deltaBase64,omitempty"`
	CapReached  bool   `json:"capReached,omitempty"`
}

CommandExecOutputDeltaEvent is a streaming output chunk from an interactive command/exec process (the command/exec/outputDelta notification). DeltaBase64 is the base64-encoded output for the given stream ("stdout" or "stderr").

type CommandExecRequest

type CommandExecRequest struct {
	Command            []string                 `json:"command"`
	CWD                string                   `json:"cwd,omitempty"`
	Env                map[string]string        `json:"env,omitempty"`
	TTY                bool                     `json:"tty,omitempty"`
	Size               *CommandExecTerminalSize `json:"size,omitempty"`
	StreamStdin        bool                     `json:"streamStdin,omitempty"`
	StreamStdoutStderr bool                     `json:"streamStdoutStderr,omitempty"`
	TimeoutMs          int                      `json:"timeoutMs,omitempty"`
	DisableTimeout     bool                     `json:"disableTimeout,omitempty"`
	OutputBytesCap     int                      `json:"outputBytesCap,omitempty"`
	DisableOutputCap   bool                     `json:"disableOutputCap,omitempty"`
	ProcessID          string                   `json:"processId,omitempty"`
	SandboxPolicy      json.RawMessage          `json:"sandboxPolicy,omitempty"`
}

CommandExecRequest starts an interactive command execution. Command is the argv slice. When ProcessID is empty the server assigns one (returned via the handle); pass an existing ProcessID to attach. SandboxPolicy is passed through as raw JSON.

type CommandExecResizeRequest

type CommandExecResizeRequest struct {
	ProcessID string                  `json:"processId"`
	Size      CommandExecTerminalSize `json:"size"`
}

CommandExecResizeRequest resizes a running process's PTY.

type CommandExecResult

type CommandExecResult struct {
	ExitCode int    `json:"exitCode"`
	Stdout   string `json:"stdout"`
	Stderr   string `json:"stderr"`
}

CommandExecResult is the terminal result of a (non-streaming) command exec.

type CommandExecTerminalSize

type CommandExecTerminalSize struct {
	Cols int `json:"cols"`
	Rows int `json:"rows"`
}

CommandExecTerminalSize is a PTY size in character cells.

type CommandExecTerminateRequest

type CommandExecTerminateRequest struct {
	ProcessID string `json:"processId"`
}

CommandExecTerminateRequest terminates a running process.

type CommandExecWriteRequest

type CommandExecWriteRequest struct {
	ProcessID   string `json:"processId"`
	DeltaBase64 string `json:"deltaBase64,omitempty"`
	CloseStdin  bool   `json:"closeStdin,omitempty"`
}

CommandExecWriteRequest writes stdin bytes (base64) to a running process, or closes its stdin.

type CommandExecutionApprovalRequest

type CommandExecutionApprovalRequest = protocol.CommandExecutionApprovalRequest

type CommandExecutionApprovalResult

type CommandExecutionApprovalResult = protocol.CommandExecutionApprovalResponse

type CommandExecutionPayload

type CommandExecutionPayload struct {
	Command  string `json:"command"`
	ExitCode *int   `json:"exitCode,omitempty"`
	Stdout   string `json:"stdout,omitempty"`
	Stderr   string `json:"stderr,omitempty"`
}

CommandExecutionPayload is the decoded payload for an ItemKindCommandExecution item.

func ItemAsCommandExecution

func ItemAsCommandExecution(item Item) *CommandExecutionPayload

ItemAsCommandExecution attempts to decode the item payload as a CommandExecutionPayload. Returns nil if the item is not a commandExecution or decoding fails.

type ConfigBatchWriteRequest

type ConfigBatchWriteRequest struct {
	FilePath         string          `json:"filePath,omitempty"`
	Edits            json.RawMessage `json:"edits"`
	ExpectedVersion  string          `json:"expectedVersion,omitempty"`
	ReloadUserConfig bool            `json:"reloadUserConfig,omitempty"`
}

ConfigBatchWriteRequest applies multiple edits atomically. Edits is the raw JSON array of edit objects as defined by the protocol.

type ConfigReadRequest

type ConfigReadRequest struct {
	CWD           string `json:"cwd,omitempty"`
	IncludeLayers bool   `json:"includeLayers,omitempty"`
}

ConfigReadRequest reads the effective config (optionally with layer breakdown).

type ConfigReadResult

type ConfigReadResult struct {
	Config  json.RawMessage `json:"config"`
	Layers  json.RawMessage `json:"layers,omitempty"`
	Origins json.RawMessage `json:"origins,omitempty"`
}

ConfigReadResult holds the resolved config. The nested config, layers, and origins documents are passed through as raw JSON; decode them as needed.

type ConfigValueWriteRequest

type ConfigValueWriteRequest struct {
	FilePath        string          `json:"filePath,omitempty"`
	KeyPath         string          `json:"keyPath"`
	Value           json.RawMessage `json:"value"`
	MergeStrategy   MergeStrategy   `json:"mergeStrategy,omitempty"`
	ExpectedVersion string          `json:"expectedVersion,omitempty"`
}

ConfigValueWriteRequest writes a single value at a dotted key path.

type ConfigWarningEvent

type ConfigWarningEvent struct {
	Summary string          `json:"summary"`
	Details string          `json:"details,omitempty"`
	Path    string          `json:"path,omitempty"`
	Range   json.RawMessage `json:"range,omitempty"`
}

type DeprecationNoticeEvent

type DeprecationNoticeEvent struct {
	Summary string `json:"summary"`
	Details string `json:"details,omitempty"`
}

type Dispatcher

type Dispatcher struct {
	// Exec handles "item/commandExecution/requestApproval" requests.
	// If nil, such requests are denied.
	Exec ExecApprovalHandler

	// File handles "item/fileChange/requestApproval" requests.
	// If nil, such requests are denied.
	File FileApprovalHandler

	// DynamicTool handles "item/tool/call" server-initiated requests.
	// If nil, dynamic tool calls are answered with an empty content array.
	DynamicTool DynamicToolHandler

	// MCP handles "item/mcp/requestApproval" requests.
	// If nil, such requests are declined.
	MCP MCPApprovalHandler

	// Fallback is consulted for any request method not matched by the above.
	// If nil, unmatched requests return ErrUnsupportedServerRequest.
	Fallback RequestHandler
}

Dispatcher routes incoming server requests to specialised handlers by method. Any method not handled by a registered handler is denied with a default response.

Dispatcher implements RequestHandler so it can be passed to WithRequestHandler.

func (*Dispatcher) HandleServerRequest

func (d *Dispatcher) HandleServerRequest(ctx context.Context, req ServerRequest) (ServerResponse, error)

HandleServerRequest implements RequestHandler.

type DynamicToolCallRequest

type DynamicToolCallRequest struct {
	ToolName  string          `json:"toolName"`
	ToolInput json.RawMessage `json:"input"`
	ThreadID  string          `json:"threadId"`
	TurnID    string          `json:"turnId"`
	ItemID    string          `json:"itemId"`
}

DynamicToolCallRequest is the payload for an "item/tool/call" server-initiated request.

type DynamicToolCallResult

type DynamicToolCallResult struct {
	Content []json.RawMessage `json:"content"`
}

DynamicToolCallResult is the response to a DynamicToolCallRequest.

type DynamicToolHandler

type DynamicToolHandler interface {
	HandleDynamicToolCall(ctx context.Context, req DynamicToolCallRequest) (DynamicToolCallResult, error)
}

DynamicToolHandler handles dynamic tool call requests from the server.

type ErrorEvent

type ErrorEvent = protocol.ErrorEvent

type Event

type Event struct {
	Method string
	Raw    json.RawMessage
	Value  any
}

Event is one server-push notification emitted by the app-server. Value is a concrete typed event struct when the method is recognized.

func (Event) Decode

func (e Event) Decode(v any) error

Decode unmarshals the raw notification payload into v.

type EventSubscription

type EventSubscription struct {
	// contains filtered or unexported fields
}

func (*EventSubscription) C

func (s *EventSubscription) C() <-chan Event

func (*EventSubscription) Close

func (s *EventSubscription) Close()

type ExecApprovalHandler

type ExecApprovalHandler interface {
	HandleCommandExecutionApproval(context.Context, CommandExecutionApprovalRequest) (CommandExecutionApprovalResult, error)
}

ExecApprovalHandler handles command-execution approval requests.

type ExperimentalFeature

type ExperimentalFeature struct {
	Name           string          `json:"name"`
	DisplayName    string          `json:"displayName,omitempty"`
	Description    string          `json:"description,omitempty"`
	Announcement   string          `json:"announcement,omitempty"`
	Enabled        bool            `json:"enabled"`
	DefaultEnabled bool            `json:"defaultEnabled"`
	Stage          json.RawMessage `json:"stage,omitempty"`
}

ExperimentalFeature describes a single experimental feature flag.

type ExperimentalFeatureEnablementSetRequest

type ExperimentalFeatureEnablementSetRequest struct {
	Enablement map[string]bool `json:"enablement"`
}

ExperimentalFeatureEnablementSetRequest sets enablement for one or more features, keyed by feature name.

type ExperimentalFeatureEnablementSetResult

type ExperimentalFeatureEnablementSetResult struct {
	Enablement map[string]bool `json:"enablement"`
}

ExperimentalFeatureEnablementSetResult reports the resulting enablement map.

type ExperimentalFeatureListRequest

type ExperimentalFeatureListRequest struct {
	ThreadID string `json:"threadId,omitempty"`
	Cursor   string `json:"cursor,omitempty"`
	Limit    int    `json:"limit,omitempty"`
}

ExperimentalFeatureListRequest lists experimental features. Cursor/Limit drive pagination; an empty NextCursor in the result indicates the final page.

type ExperimentalFeatureListResult

type ExperimentalFeatureListResult struct {
	Data       []ExperimentalFeature `json:"data"`
	NextCursor string                `json:"nextCursor,omitempty"`
}

ExperimentalFeatureListResult is a page of experimental features.

type ExternalAgentConfigImportCompletedEvent

type ExternalAgentConfigImportCompletedEvent struct {
	ImportID        string          `json:"importId"`
	ItemTypeResults json.RawMessage `json:"itemTypeResults,omitempty"`
}

type ExternalAgentConfigImportProgressEvent

type ExternalAgentConfigImportProgressEvent struct {
	ImportID        string          `json:"importId"`
	ItemTypeResults json.RawMessage `json:"itemTypeResults,omitempty"`
}

type FileApprovalHandler

type FileApprovalHandler interface {
	HandleFileChangeApproval(context.Context, FileChangeApprovalRequest) (FileChangeApprovalResult, error)
}

FileApprovalHandler handles file-change approval requests.

type FileChangeApprovalRequest

type FileChangeApprovalRequest = protocol.FileChangeApprovalRequest

type FileChangeApprovalResult

type FileChangeApprovalResult = protocol.FileChangeApprovalResponse

type FileChangePayload

type FileChangePayload struct {
	FilePath   string `json:"filePath"`
	ChangeType string `json:"changeType"` // "create", "modify", "delete"
	Diff       string `json:"diff,omitempty"`
	NewContent string `json:"newContent,omitempty"`
	OldContent string `json:"oldContent,omitempty"`
}

FileChangePayload is the decoded payload for an ItemKindFileChange item.

func ItemAsFileChange

func ItemAsFileChange(item Item) *FileChangePayload

ItemAsFileChange attempts to decode the item payload as a FileChangePayload. Returns nil if the item is not a fileChange or decoding fails.

type FsChangedEvent

type FsChangedEvent struct {
	WatchID      string   `json:"watchId"`
	ChangedPaths []string `json:"changedPaths,omitempty"`
}

type GuardianWarningEvent

type GuardianWarningEvent struct {
	ThreadID string `json:"threadId"`
	Message  string `json:"message"`
}

type HookCompletedEvent

type HookCompletedEvent struct {
	ThreadID string          `json:"threadId"`
	TurnID   string          `json:"turnId,omitempty"`
	Run      json.RawMessage `json:"run,omitempty"`
}

type HookStartedEvent

type HookStartedEvent struct {
	ThreadID string          `json:"threadId"`
	TurnID   string          `json:"turnId,omitempty"`
	Run      json.RawMessage `json:"run,omitempty"`
}

type HooksListRequest

type HooksListRequest struct {
	CWDs []string `json:"cwds,omitempty"`
}

HooksListRequest lists configured lifecycle hooks for the given working directories. This is the server-side hooks/list RPC and is distinct from the client-side hook bridge (internal/hookbridge).

type HooksListResult

type HooksListResult struct {
	Data json.RawMessage `json:"data"`
}

HooksListResult holds the hooks listing. Data is passed through as raw JSON (an array of per-cwd hook entries) for forward compatibility.

type InitializeRequest

type InitializeRequest = schematypes.InitializeRequest

type InitializeResult

type InitializeResult = schematypes.InitializeResult

type Item

type Item = protocol.Item

type ItemAgentMessageDeltaEvent

type ItemAgentMessageDeltaEvent struct {
	ThreadID string          `json:"threadId,omitempty"`
	TurnID   string          `json:"turnId,omitempty"`
	ItemID   string          `json:"itemId,omitempty"`
	Delta    json.RawMessage `json:"delta,omitempty"`
	Text     string          `json:"text,omitempty"`
}

type ItemAutoApprovalReviewCompletedEvent

type ItemAutoApprovalReviewCompletedEvent struct {
	ThreadID string `json:"threadId,omitempty"`
	TurnID   string `json:"turnId,omitempty"`
	ItemID   string `json:"itemId,omitempty"`
}

type ItemAutoApprovalReviewStartedEvent

type ItemAutoApprovalReviewStartedEvent struct {
	ThreadID string `json:"threadId,omitempty"`
	TurnID   string `json:"turnId,omitempty"`
	ItemID   string `json:"itemId,omitempty"`
}

type ItemCommandExecutionOutputDeltaEvent

type ItemCommandExecutionOutputDeltaEvent struct {
	ThreadID string `json:"threadId,omitempty"`
	TurnID   string `json:"turnId,omitempty"`
	ItemID   string `json:"itemId,omitempty"`
	Stream   string `json:"stream,omitempty"`
	Output   string `json:"output,omitempty"`
	Delta    string `json:"delta,omitempty"`
}

type ItemCompletedEvent

type ItemCompletedEvent = protocol.ItemCompletedEvent

type ItemFileChangeOutputDeltaEvent

type ItemFileChangeOutputDeltaEvent struct {
	ThreadID string `json:"threadId,omitempty"`
	TurnID   string `json:"turnId,omitempty"`
	ItemID   string `json:"itemId,omitempty"`
	Output   string `json:"output,omitempty"`
	Delta    string `json:"delta,omitempty"`
}

type ItemFileChangePatchUpdatedEvent

type ItemFileChangePatchUpdatedEvent struct {
	ThreadID string          `json:"threadId,omitempty"`
	TurnID   string          `json:"turnId,omitempty"`
	ItemID   string          `json:"itemId,omitempty"`
	Patch    json.RawMessage `json:"patch,omitempty"`
}

type ItemKind

type ItemKind = protocol.ItemKind

type ItemPlanDeltaEvent

type ItemPlanDeltaEvent struct {
	ThreadID string          `json:"threadId,omitempty"`
	TurnID   string          `json:"turnId,omitempty"`
	ItemID   string          `json:"itemId,omitempty"`
	Delta    json.RawMessage `json:"delta,omitempty"`
	Text     string          `json:"text,omitempty"`
}

type ItemReasoningSummaryPartAddedEvent

type ItemReasoningSummaryPartAddedEvent struct {
	ThreadID string          `json:"threadId,omitempty"`
	TurnID   string          `json:"turnId,omitempty"`
	ItemID   string          `json:"itemId,omitempty"`
	Part     json.RawMessage `json:"part,omitempty"`
}

type ItemReasoningSummaryTextDeltaEvent

type ItemReasoningSummaryTextDeltaEvent struct {
	ThreadID string `json:"threadId,omitempty"`
	TurnID   string `json:"turnId,omitempty"`
	ItemID   string `json:"itemId,omitempty"`
	Text     string `json:"text,omitempty"`
}

type ItemReasoningTextDeltaEvent

type ItemReasoningTextDeltaEvent struct {
	ThreadID string `json:"threadId,omitempty"`
	TurnID   string `json:"turnId,omitempty"`
	ItemID   string `json:"itemId,omitempty"`
	Text     string `json:"text,omitempty"`
}

type ItemStartedEvent

type ItemStartedEvent = protocol.ItemStartedEvent

type ItemUpdatedEvent

type ItemUpdatedEvent = protocol.ItemUpdatedEvent

type LoginCompleted

type LoginCompleted struct {
	Success bool   `json:"success"`
	LoginID string `json:"loginId,omitempty"`
	Error   string `json:"error,omitempty"`
}

LoginCompleted is the payload of the account/login/completed notification.

type LoginHandle

type LoginHandle struct {

	// Type is the login flavor: "chatgpt" or "chatgptDeviceCode".
	Type string
	// LoginID identifies this attempt; it matches the loginId in the
	// account/login/completed notification.
	LoginID string
	// AuthURL is the browser OAuth URL (chatgpt logins only).
	AuthURL string
	// VerificationURL is the device-code verification URL (device-code logins only).
	VerificationURL string
	// UserCode is the one-time code the user enters (device-code logins only).
	UserCode string
	// contains filtered or unexported fields
}

LoginHandle represents an in-flight interactive login attempt (ChatGPT OAuth or device code). The caller surfaces the URL/code fields to the user, then calls Wait to block until the matching account/login/completed notification arrives, or Cancel to abandon the attempt.

func (*LoginHandle) Cancel

Cancel abandons this interactive login attempt.

func (*LoginHandle) Wait

Wait blocks until this login attempt completes (or ctx is done). It returns the completion payload; a failed login has Success=false and a non-empty Error.

type MCPApprovalHandler

type MCPApprovalHandler interface {
	HandleMCPToolCallApproval(ctx context.Context, req MCPToolCallApprovalRequest) (MCPToolCallApprovalResponse, error)
}

MCPApprovalHandler handles MCP tool call approval requests.

type MCPToolCallApprovalRequest

type MCPToolCallApprovalRequest = protocol.MCPToolCallApprovalRequest

type MCPToolCallApprovalResponse

type MCPToolCallApprovalResponse = protocol.MCPToolCallApprovalResponse

type McpServerOauthLoginCompletedEvent

type McpServerOauthLoginCompletedEvent struct {
	Name    string `json:"name"`
	Success bool   `json:"success,omitempty"`
	Error   string `json:"error,omitempty"`
}

type McpServerStatusUpdatedEvent

type McpServerStatusUpdatedEvent struct {
	ThreadID string `json:"threadId,omitempty"`
	Name     string `json:"name"`
	Status   string `json:"status,omitempty"`
	Error    string `json:"error,omitempty"`
}

type McpToolCallProgressEvent

type McpToolCallProgressEvent struct {
	ThreadID string `json:"threadId"`
	TurnID   string `json:"turnId"`
	ItemID   string `json:"itemId"`
	Message  string `json:"message,omitempty"`
}

type MergeStrategy

type MergeStrategy string

MergeStrategy controls how ConfigValueWrite merges a value into an existing key.

const (
	// MergeStrategyReplace overwrites the existing value at the key path.
	MergeStrategyReplace MergeStrategy = "replace"
	// MergeStrategyUpsert merges into the existing value (e.g. table merge).
	MergeStrategyUpsert MergeStrategy = "upsert"
)

type ModelInfo

type ModelInfo struct {
	ID          string `json:"id"`
	Model       string `json:"model"`
	DisplayName string `json:"displayName"`
	Description string `json:"description"`
	Hidden      bool   `json:"hidden"`
	IsDefault   bool   `json:"isDefault"`
}

ModelInfo describes a single model entry from the server's model/list RPC.

type ModelProviderCapabilities

type ModelProviderCapabilities struct {
	NamespaceTools  bool `json:"namespaceTools"`
	ImageGeneration bool `json:"imageGeneration"`
	WebSearch       bool `json:"webSearch"`
}

ModelProviderCapabilities reports which provider-backed capabilities are available for the current session.

type ModelReroutedEvent

type ModelReroutedEvent struct {
	ThreadID  string          `json:"threadId"`
	TurnID    string          `json:"turnId"`
	FromModel string          `json:"fromModel"`
	ToModel   string          `json:"toModel"`
	Reason    json.RawMessage `json:"reason,omitempty"`
}

type ModelVerificationEvent

type ModelVerificationEvent struct {
	ThreadID      string          `json:"threadId"`
	TurnID        string          `json:"turnId"`
	Verifications json.RawMessage `json:"verifications,omitempty"`
}

type Option

type Option func(*clientConfig) error

func WithApprovalHandler

func WithApprovalHandler(handler ApprovalHandler) Option

func WithAutoLogin

func WithAutoLogin(apiKey string) Option

WithAutoLogin authenticates the client with an OpenAI API key inside New(), immediately after the initialize handshake. It only takes effect when the client also performs auto-initialization (i.e. a real transport is wired up via WithTransport / WithStdioProcess / WithHTTPTransport / WithWSTransport).

func WithHTTPAPIKey

func WithHTTPAPIKey(key string) Option

WithHTTPAPIKey sets "X-API-Key: <key>" on HTTP transports constructed via WithHTTPTransport. It has no effect on a transport supplied through WithTransport.

func WithHTTPBearerToken

func WithHTTPBearerToken(token string) Option

WithHTTPBearerToken sets "Authorization: Bearer <token>" on HTTP transports constructed via WithHTTPTransport. It has no effect on a transport supplied through WithTransport.

func WithHTTPTransport

func WithHTTPTransport(baseURL string) Option

WithHTTPTransport constructs an HTTP transport targeting baseURL, applying any auth configured via WithHTTPBearerToken / WithHTTPAPIKey. Any retry policy configured via WithRetry is applied in New() regardless of option ordering.

WIP: The Codex app-server speaks WebSocket only. This HTTP+SSE transport requires the ws-http-bridge sidecar (plugins/codex-server/ws-http-bridge) in front of the server; without it, requests fail with HTTP 405. Prefer WithWSTransport for direct connections until the bridge is generally deployed.

func WithMaxThreads

func WithMaxThreads(n int) Option

WithMaxThreads sets the maximum number of concurrent live SessionThreads. Default is 64. Pass 0 to use the default; pass -1 for unlimited.

func WithProcessDir

func WithProcessDir(dir string) Option

WithProcessDir sets the working directory for the subprocess spawned by WithStdioProcess. If empty, the current process's working directory is used.

func WithProcessEnv

func WithProcessEnv(key, value string) Option

WithProcessEnv appends key=value to the subprocess environment. Only applies when used with WithStdioProcess. May be called multiple times; each call appends one variable.

func WithReconnectingHTTPTransport

func WithReconnectingHTTPTransport(baseURL string) Option

WithReconnectingHTTPTransport is like WithHTTPTransport but the SSE connection is automatically re-established if it drops. Any retry policy configured via WithRetry is applied in New() regardless of option ordering.

WIP: shares the HTTP+SSE transport that requires the ws-http-bridge sidecar. See WithHTTPTransport for details.

func WithReconnectingWSTransport

func WithReconnectingWSTransport(ctx context.Context, url string) Option

WithReconnectingWSTransport is like WithWSTransport but automatically re-dials if the WebSocket connection drops. Any retry policy configured via WithRetry is applied in New() regardless of option ordering.

func WithRequestHandler

func WithRequestHandler(handler RequestHandler) Option

func WithRetry

func WithRetry(cfg transport.RetryConfig) Option

WithRetry records a retry policy applied when an HTTP/WS transport is constructed via WithHTTPTransport / WithWSTransport. A zero-value cfg uses DefaultRetryConfig(). Ordering relative to WithHTTPTransport / WithWSTransport does not matter; the policy is applied in New().

func WithStdioProcess

func WithStdioProcess(binaryPath string, args ...string) Option

WithStdioProcess spawns binaryPath with args as a managed subprocess and wires its stdin/stdout to a StdioTransport. The process is shut down (EOF → SIGTERM → SIGKILL) when the Client is closed.

func WithStdioTransport

func WithStdioTransport(stdin io.ReadCloser, stdout io.WriteCloser) Option

func WithTransport

func WithTransport(t Transport) Option

func WithWSAPIKey

func WithWSAPIKey(key string) Option

WithWSAPIKey sets "X-API-Key: <key>" on WebSocket transports constructed via WithWSTransport. It has no effect on a transport supplied through WithTransport.

func WithWSBearerToken

func WithWSBearerToken(token string) Option

WithWSBearerToken sets "Authorization: Bearer <token>" on WebSocket transports constructed via WithWSTransport. It has no effect on a transport supplied through WithTransport.

func WithWSTransport

func WithWSTransport(ctx context.Context, url string) Option

WithWSTransport dials a WebSocket transport at url, applying any auth configured via WithWSBearerToken / WithWSAPIKey. Any retry policy configured via WithRetry is applied in New() regardless of option ordering.

type PermissionsApprovalRequest

type PermissionsApprovalRequest = protocol.PermissionsApprovalRequest

type PermissionsApprovalResult

type PermissionsApprovalResult = protocol.PermissionsApprovalResponse

type PlanType

type PlanType string

PlanType is the ChatGPT subscription plan associated with an account.

const (
	PlanTypeFree                        PlanType = "free"
	PlanTypeGo                          PlanType = "go"
	PlanTypePlus                        PlanType = "plus"
	PlanTypePro                         PlanType = "pro"
	PlanTypeProLite                     PlanType = "prolite"
	PlanTypeTeam                        PlanType = "team"
	PlanTypeSelfServeBusinessUsageBased PlanType = "self_serve_business_usage_based"
	PlanTypeBusiness                    PlanType = "business"
	PlanTypeEnterpriseCBPUsageBased     PlanType = "enterprise_cbp_usage_based"
	PlanTypeEnterprise                  PlanType = "enterprise"
	PlanTypeEdu                         PlanType = "edu"
	PlanTypeUnknown                     PlanType = "unknown"
)

type ProcessExitedEvent

type ProcessExitedEvent struct {
	ProcessHandle    string `json:"processHandle"`
	ExitCode         int    `json:"exitCode"`
	Stdout           string `json:"stdout,omitempty"`
	StdoutCapReached bool   `json:"stdoutCapReached,omitempty"`
	Stderr           string `json:"stderr,omitempty"`
	StderrCapReached bool   `json:"stderrCapReached,omitempty"`
}

type ProcessOutputDeltaEvent

type ProcessOutputDeltaEvent struct {
	ProcessHandle string `json:"processHandle"`
	Stream        string `json:"stream,omitempty"`
	DeltaBase64   string `json:"deltaBase64,omitempty"`
	CapReached    bool   `json:"capReached,omitempty"`
}

type RawNotificationEvent

type RawNotificationEvent struct {
	ThreadID string `json:"threadId,omitempty"`
	TurnID   string `json:"turnId,omitempty"`
	ItemID   string `json:"itemId,omitempty"`
}

type RawResponseItemCompletedEvent

type RawResponseItemCompletedEvent struct {
	ThreadID string          `json:"threadId"`
	TurnID   string          `json:"turnId"`
	Item     json.RawMessage `json:"item,omitempty"`
}

type RemoteControlStatusChangedEvent

type RemoteControlStatusChangedEvent struct {
	Status         string `json:"status,omitempty"`
	ServerName     string `json:"serverName,omitempty"`
	InstallationID string `json:"installationId,omitempty"`
	EnvironmentID  string `json:"environmentId,omitempty"`
}

type RequestHandler

type RequestHandler interface {
	HandleServerRequest(context.Context, ServerRequest) (ServerResponse, error)
}

type RequestHandlerFunc

type RequestHandlerFunc func(context.Context, ServerRequest) (ServerResponse, error)

func (RequestHandlerFunc) HandleServerRequest

func (f RequestHandlerFunc) HandleServerRequest(ctx context.Context, req ServerRequest) (ServerResponse, error)

type ReviewStartRequest

type ReviewStartRequest = schematypes.ReviewStartRequest

type SandboxMode

type SandboxMode string

SandboxMode is a typed sandbox policy for turns. The string values match the wire values the app-server expects for sandboxPolicy.

const (
	SandboxReadOnly       SandboxMode = "read-only"
	SandboxWorkspaceWrite SandboxMode = "workspace-write"
	SandboxFullAccess     SandboxMode = "danger-full-access"
)

type ServerRequest

type ServerRequest = protocol.ServerRequest

type ServerRequestResolvedEvent

type ServerRequestResolvedEvent = protocol.ServerRequestResolvedEvent

type ServerResponse

type ServerResponse = protocol.ServerResponse

type SessionThread

type SessionThread struct {
	// contains filtered or unexported fields
}

SessionThread represents a live, stateful session on the Codex app-server. Use Client.StartThread / Client.ResumeThread to obtain one.

func (*SessionThread) Archive

func (t *SessionThread) Archive(ctx context.Context) error

Archive marks this thread as archived.

func (*SessionThread) ClearGoal

func (t *SessionThread) ClearGoal(ctx context.Context) error

ClearGoal removes the persisted goal for this thread.

func (*SessionThread) Close

func (t *SessionThread) Close()

Close releases the semaphore slot held by this SessionThread, allowing a new thread to be started if the client is at its maxThreads limit. Close is idempotent and safe to call from multiple goroutines.

func (*SessionThread) Compact

func (t *SessionThread) Compact(ctx context.Context) error

Compact sends a thread/compact request to trigger context compaction.

func (*SessionThread) Fork

func (t *SessionThread) Fork(ctx context.Context, turnID string, opts ...ThreadOption) (*SessionThread, error)

Fork creates a new thread branching from this thread at the given turnID. If turnID is empty the server forks from the latest turn.

func (*SessionThread) GetGoal

func (t *SessionThread) GetGoal(ctx context.Context) (ThreadGoal, error)

GetGoal returns the persisted goal for this thread, or a zero ThreadGoal when none is set.

func (*SessionThread) GitDiff

func (t *SessionThread) GitDiff(ctx context.Context, turnID string) (string, error)

GitDiff requests the diff for the latest (or specified) turn on this thread. Returns the unified diff string.

func (*SessionThread) ID

func (t *SessionThread) ID() string

ID returns the thread's persistent ID.

func (*SessionThread) Interrupt

func (t *SessionThread) Interrupt(ctx context.Context, turnID string) error

Interrupt sends a turn/interrupt for the given turnID.

func (*SessionThread) Rollback

func (t *SessionThread) Rollback(ctx context.Context, turnIDs []string) error

Rollback removes the specified turns from this thread's history.

func (*SessionThread) Run

func (t *SessionThread) Run(ctx context.Context, input string, opts ...TurnOption) (*TurnResult, error)

Run executes a prompt synchronously and returns the completed TurnResult. It blocks until the turn reaches a terminal state (completed/failed/interrupted) or ctx is cancelled.

The subscription to server events is established before TurnStart is called so that item/completed and turn/completed notifications are never missed, even on fast (mock) servers where events fire before TurnStart returns.

func (*SessionThread) RunStreamed

func (t *SessionThread) RunStreamed(ctx context.Context, input string, opts ...TurnOption) (<-chan ThreadEvent, error)

RunStreamed executes a prompt and streams events over the returned channel. The channel is closed when the turn completes or errors. The caller must drain the channel to avoid blocking the event broker.

Concurrency: RunStreamed acquires an internal turn mutex that prevents two turns from running concurrently on the same SessionThread. The mutex is held for the entire stream duration and is released only when the goroutine exits — either because a terminal event (turn/completed or error) was received, or because ctx was cancelled. Callers MUST cancel the context (or fully drain the channel until it is closed) to ensure the lock is released if they stop consuming events before the stream ends.

func (*SessionThread) SetGoal

func (t *SessionThread) SetGoal(ctx context.Context, goal string) error

SetGoal creates or updates the persisted goal (objective) for this thread.

func (*SessionThread) SetName

func (t *SessionThread) SetName(ctx context.Context, name string) error

SetName sets the display name for this thread.

func (*SessionThread) Steer

func (t *SessionThread) Steer(ctx context.Context, turnID, input string) error

Steer sends additional input to an in-progress turn (mid-turn steering). Only valid while a turn is active. Does not require the turn mutex because steering is sent to an already-running turn, not starting a new one.

func (*SessionThread) SteerInputs

func (t *SessionThread) SteerInputs(ctx context.Context, turnID string, inputs ...TurnInput) error

SteerInputs sends typed multi-part input to an in-progress turn, mirroring Steer but accepting TurnInput items instead of a plain string.

func (*SessionThread) Unarchive

func (t *SessionThread) Unarchive(ctx context.Context) error

Unarchive restores this thread from archived state.

type SkillErrorInfo

type SkillErrorInfo = schematypes.SkillErrorInfo

SkillErrorInfo describes a skill discovery error.

type SkillMetadata

type SkillMetadata = schematypes.SkillMetadata

SkillMetadata describes a single discovered skill.

type SkillsChangedEvent

type SkillsChangedEvent struct {
	Cursor       string `json:"cursor,omitempty"`
	Limit        int    `json:"limit,omitempty"`
	ThreadID     string `json:"threadId,omitempty"`
	ForceRefetch bool   `json:"forceRefetch,omitempty"`
}

type SkillsConfigWriteRequest

type SkillsConfigWriteRequest = schematypes.SkillsConfigWriteParams

type SkillsConfigWriteResult

type SkillsConfigWriteResult = schematypes.SkillsConfigWriteResponse

type SkillsExtraRootsSetRequest

type SkillsExtraRootsSetRequest = schematypes.SkillsExtraRootsSetParams

type SkillsListEntry

type SkillsListEntry = schematypes.SkillsListEntry

SkillsListEntry is the per-cwd skills listing.

type SkillsListRequest

type SkillsListRequest = schematypes.SkillsListParams

type SkillsListResult

type SkillsListResult = schematypes.SkillsListResponse

type TerminalInteractionEvent

type TerminalInteractionEvent struct {
	ThreadID  string `json:"threadId"`
	TurnID    string `json:"turnId"`
	ItemID    string `json:"itemId"`
	ProcessID string `json:"processId"`
	Stdin     string `json:"stdin,omitempty"`
}

type Thread

type Thread = protocol.Thread

type ThreadActiveFlag

type ThreadActiveFlag = protocol.ThreadActiveFlag

type ThreadApproveGuardianDeniedActionRequest

type ThreadApproveGuardianDeniedActionRequest struct {
	ThreadID string          `json:"threadId"`
	Event    json.RawMessage `json:"event"`
}

ThreadApproveGuardianDeniedActionRequest approves an action the guardian reviewer denied. Event is the raw guardian event payload.

type ThreadArchiveRequest

type ThreadArchiveRequest = schematypes.ThreadArchiveRequest

type ThreadArchivedEvent

type ThreadArchivedEvent = protocol.ThreadArchivedEvent

type ThreadClosedEvent

type ThreadClosedEvent = protocol.ThreadClosedEvent

type ThreadCompactedEvent

type ThreadCompactedEvent struct {
	ThreadID string `json:"threadId"`
	TurnID   string `json:"turnId"`
}

ThreadCompactedEvent is the thread/compacted (context compaction) notification.

type ThreadDeleteRequest

type ThreadDeleteRequest struct {
	ThreadID string `json:"threadId"`
}

ThreadDeleteRequest deletes a thread and its rollout history.

type ThreadDeletedEvent

type ThreadDeletedEvent struct {
	ThreadID string `json:"threadId"`
}

type ThreadEvent

type ThreadEvent struct {
	Kind string
	Raw  any
}

ThreadEvent wraps any event that can appear on the streaming channel returned by SessionThread.RunStreamed.

Kind is the JSON-RPC notification method name (e.g. "turn/started"). Raw holds the concrete typed event value (one of the *Event structs in this package); callers can type-switch on Raw to access strongly-typed fields.

type ThreadForkRequest

type ThreadForkRequest = schematypes.ThreadForkRequest

type ThreadGoal

type ThreadGoal = schematypes.ThreadGoal

type ThreadGoalClearRequest

type ThreadGoalClearRequest = schematypes.ThreadGoalClearParams

type ThreadGoalClearedEvent

type ThreadGoalClearedEvent = protocol.ThreadGoalClearedEvent

type ThreadGoalGetRequest

type ThreadGoalGetRequest = schematypes.ThreadGoalGetParams

type ThreadGoalSetRequest

type ThreadGoalSetRequest = schematypes.ThreadGoalSetParams

type ThreadGoalSetResult

type ThreadGoalSetResult = schematypes.ThreadGoalSetResponse

type ThreadGoalStatus

type ThreadGoalStatus = schematypes.ThreadGoalStatus

type ThreadGoalUpdatedEvent

type ThreadGoalUpdatedEvent = protocol.ThreadGoalUpdatedEvent

type ThreadInjectItemsRequest

type ThreadInjectItemsRequest struct {
	ThreadID string            `json:"threadId"`
	Items    []json.RawMessage `json:"items"`
}

ThreadInjectItemsRequest injects raw items into a thread's history. Each item is the raw JSON of a thread item as defined by the protocol.

type ThreadListRequest

type ThreadListRequest = schematypes.ThreadListRequest

type ThreadMetadataGitInfo

type ThreadMetadataGitInfo struct {
	Branch    *string `json:"branch,omitempty"`
	OriginURL *string `json:"originUrl,omitempty"`
	Sha       *string `json:"sha,omitempty"`
}

ThreadMetadataGitInfo patches stored Git metadata for a thread. A nil field is left unchanged; set a pointer to an empty string to clear it.

type ThreadMetadataUpdateRequest

type ThreadMetadataUpdateRequest struct {
	ThreadID string                 `json:"threadId"`
	GitInfo  *ThreadMetadataGitInfo `json:"gitInfo,omitempty"`
}

ThreadMetadataUpdateRequest patches a thread's stored metadata.

type ThreadMetadataUpdateResult

type ThreadMetadataUpdateResult struct {
	Thread Thread `json:"thread"`
}

ThreadMetadataUpdateResult holds the updated thread.

type ThreadNameUpdatedEvent

type ThreadNameUpdatedEvent struct {
	ThreadID   string `json:"threadId"`
	ThreadName string `json:"threadName,omitempty"`
}

type ThreadOption

type ThreadOption func(*threadConfig)

ThreadOption is a functional option for configuring a new or resumed thread.

func WithInitialInput

func WithInitialInput(input string) ThreadOption

WithInitialInput sets a prompt to run immediately after the thread starts. If set, StartThread / ResumeThread return only after the first turn completes.

func WithThreadApprovalMode

func WithThreadApprovalMode(mode ApprovalMode) ThreadOption

WithThreadApprovalMode sets a typed approval policy when starting a thread.

func WithThreadApprovalPolicy

func WithThreadApprovalPolicy(policy string) ThreadOption

WithThreadApprovalPolicy sets the approval policy when starting a thread.

func WithThreadCWD

func WithThreadCWD(cwd string) ThreadOption

WithThreadCWD sets the working directory when starting a thread.

func WithThreadEphemeral

func WithThreadEphemeral(ephemeral bool) ThreadOption

WithThreadEphemeral marks the thread as ephemeral.

func WithThreadModel

func WithThreadModel(model string) ThreadOption

WithThreadModel sets the model when starting a thread.

type ThreadReadRequest

type ThreadReadRequest = schematypes.ThreadReadRequest

type ThreadRealtimeClosedEvent

type ThreadRealtimeClosedEvent struct {
	ThreadID string `json:"threadId"`
	Reason   string `json:"reason,omitempty"`
}

type ThreadRealtimeErrorEvent

type ThreadRealtimeErrorEvent struct {
	ThreadID string `json:"threadId"`
	Message  string `json:"message"`
}

type ThreadRealtimeItemAddedEvent

type ThreadRealtimeItemAddedEvent struct {
	ThreadID string          `json:"threadId"`
	Item     json.RawMessage `json:"item,omitempty"`
}

type ThreadRealtimeOutputAudioDeltaEvent

type ThreadRealtimeOutputAudioDeltaEvent struct {
	ThreadID string          `json:"threadId"`
	Audio    json.RawMessage `json:"audio,omitempty"`
}

type ThreadRealtimeSdpEvent

type ThreadRealtimeSdpEvent struct {
	ThreadID string `json:"threadId"`
	SDP      string `json:"sdp"`
}

type ThreadRealtimeStartedEvent

type ThreadRealtimeStartedEvent struct {
	ThreadID          string `json:"threadId"`
	RealtimeSessionID string `json:"realtimeSessionId,omitempty"`
	Version           string `json:"version,omitempty"`
}

type ThreadRealtimeTranscriptDeltaEvent

type ThreadRealtimeTranscriptDeltaEvent struct {
	ThreadID string `json:"threadId"`
	Role     string `json:"role,omitempty"`
	Delta    string `json:"delta,omitempty"`
}

type ThreadRealtimeTranscriptDoneEvent

type ThreadRealtimeTranscriptDoneEvent struct {
	ThreadID string `json:"threadId"`
	Role     string `json:"role,omitempty"`
	Text     string `json:"text,omitempty"`
}

type ThreadResumeRequest

type ThreadResumeRequest = schematypes.ThreadResumeRequest

type ThreadRollbackRequest

type ThreadRollbackRequest = schematypes.ThreadRollbackRequest

type ThreadSetNameRequest

type ThreadSetNameRequest = schematypes.ThreadSetNameRequest

type ThreadSettingsUpdatedEvent

type ThreadSettingsUpdatedEvent struct {
	ThreadID       string          `json:"threadId"`
	ThreadSettings json.RawMessage `json:"threadSettings,omitempty"`
}

type ThreadShellCommandRequest

type ThreadShellCommandRequest struct {
	ThreadID string `json:"threadId"`
	Command  string `json:"command"`
}

ThreadShellCommandRequest runs a shell command string in the thread's shell. Unlike CommandExec this preserves shell syntax (pipes, redirects, quoting) and runs unsandboxed with full access.

type ThreadStartRequest

type ThreadStartRequest = schematypes.ThreadStartRequest

type ThreadStartedEvent

type ThreadStartedEvent = protocol.ThreadStartedEvent

type ThreadStatus

type ThreadStatus = protocol.ThreadStatus

type ThreadStatusChangedEvent

type ThreadStatusChangedEvent = protocol.ThreadStatusChangedEvent

type ThreadTokenUsageUpdatedEvent

type ThreadTokenUsageUpdatedEvent = protocol.ThreadTokenUsageUpdatedEvent

type ThreadUnarchiveRequest

type ThreadUnarchiveRequest = schematypes.ThreadUnarchiveRequest

type ThreadUnarchivedEvent

type ThreadUnarchivedEvent = protocol.ThreadUnarchivedEvent

type ThreadUnsubscribeRequest

type ThreadUnsubscribeRequest struct {
	ThreadID string `json:"threadId"`
}

ThreadUnsubscribeRequest stops event delivery for a thread on this connection.

type ThreadUnsubscribeResult

type ThreadUnsubscribeResult struct {
	Status ThreadUnsubscribeStatus `json:"status"`
}

ThreadUnsubscribeResult reports the unsubscribe status.

type ThreadUnsubscribeStatus

type ThreadUnsubscribeStatus string

ThreadUnsubscribeStatus reports the outcome of an unsubscribe request.

const (
	ThreadUnsubscribeStatusNotLoaded     ThreadUnsubscribeStatus = "notLoaded"
	ThreadUnsubscribeStatusNotSubscribed ThreadUnsubscribeStatus = "notSubscribed"
	ThreadUnsubscribeStatusUnsubscribed  ThreadUnsubscribeStatus = "unsubscribed"
)

type TokenUsage

type TokenUsage = protocol.TokenUsage

type Transport

type Transport interface {
	Call(context.Context, string, any, any) error
	Notify(context.Context, string, any) error
	SetRequestHandler(RequestHandler)
	Close() error
}

func NewStdioTransport

func NewStdioTransport(stdin io.ReadCloser, stdout io.WriteCloser) Transport

type Turn

type Turn = protocol.Turn

type TurnCompletedEvent

type TurnCompletedEvent = protocol.TurnCompletedEvent

type TurnDiffRequest

type TurnDiffRequest = schematypes.TurnDiffRequest

type TurnDiffResult

type TurnDiffResult = schematypes.TurnDiffResult

type TurnDiffUpdatedEvent

type TurnDiffUpdatedEvent = protocol.TurnDiffUpdatedEvent

type TurnError

type TurnError = protocol.TurnError

type TurnInput

type TurnInput map[string]any

TurnInput is a single typed input item for a turn or steer request. Construct values with TextInput, ImageInput, LocalImageInput, SkillInput, or MentionInput. Each serializes to the multi-part wire shape the app-server expects.

func ImageInput

func ImageInput(url, mediaType string) TurnInput

ImageInput references a remote image by URL: {"type":"image","url":...}. mediaType is optional; when non-empty it is sent as "mediaType".

func LocalImageInput

func LocalImageInput(path string) (TurnInput, error)

LocalImageInput reads the file at path synchronously, base64-encodes it, and produces an image input carrying a data: URI. The media type is inferred from the file extension, defaulting to application/octet-stream.

func MentionInput

func MentionInput(mentionID, text string) TurnInput

MentionInput references an @mention resource: {"type":"mention","id":...,"text":...}.

func SkillInput

func SkillInput(skillName string) TurnInput

SkillInput references a named skill: {"type":"skill","name":...}.

func TextInput

func TextInput(text string) TurnInput

TextInput wraps a plain text fragment: {"type":"text","text":...}.

type TurnInterruptRequest

type TurnInterruptRequest = schematypes.TurnInterruptRequest

type TurnItemsView

type TurnItemsView = protocol.TurnItemsView

type TurnModerationMetadataEvent

type TurnModerationMetadataEvent struct {
	ThreadID string          `json:"threadId"`
	TurnID   string          `json:"turnId"`
	Metadata json.RawMessage `json:"metadata,omitempty"`
}

type TurnOption

type TurnOption func(*TurnStartRequest)

TurnOption is a functional option that configures a TurnStartRequest.

func WithApprovalMode

func WithApprovalMode(mode ApprovalMode) TurnOption

WithApprovalMode sets a typed approval policy for the turn.

func WithApprovalPolicy

func WithApprovalPolicy(policy string) TurnOption

WithApprovalPolicy sets the approval policy for the turn.

func WithCWD

func WithCWD(cwd string) TurnOption

WithCWD sets the working directory for the turn.

func WithEffort

func WithEffort(effort string) TurnOption

WithEffort sets the effort level for the turn.

func WithInputs

func WithInputs(inputs ...TurnInput) TurnOption

WithInputs sets typed multi-part inputs for the turn, replacing any plain string input. Use TextInput, ImageInput, LocalImageInput, SkillInput, and MentionInput to construct the items.

func WithModel

func WithModel(model string) TurnOption

WithModel sets the model for the turn.

func WithSandbox

func WithSandbox(sandbox string) TurnOption

WithSandbox sets the sandbox policy for the turn.

func WithSandboxMode

func WithSandboxMode(mode SandboxMode) TurnOption

WithSandboxMode sets a typed sandbox policy for the turn.

func WithSkill

func WithSkill(skill string) TurnOption

WithSkill sets a specific skill to invoke for this turn.

type TurnPlanUpdatedEvent

type TurnPlanUpdatedEvent = protocol.TurnPlanUpdatedEvent

type TurnResult

type TurnResult struct {
	// Turn is the final Turn data as returned by the server.
	Turn Turn
	// Items accumulates all items observed during the turn via streaming events.
	Items []Item
	// Usage is the token-usage snapshot from the TurnCompleted event, if present.
	Usage *TokenUsage
	// Error is the structured error from the TurnCompleted event, if any.
	Error *TurnError
	// DeltaText holds agent-message text reconstructed from streaming delta events.
	// It is only set when Items carry no extractable agent text.
	DeltaText string
}

TurnResult holds the outcome of a completed turn.

func (*TurnResult) FinalAgentText

func (r *TurnResult) FinalAgentText() string

FinalAgentText returns the text of the last agent-message item in the result. It searches Items, Turn.Items, and finally DeltaText (reconstructed from streaming delta events). Returns "" if no agent message is found.

type TurnStartRequest

type TurnStartRequest = schematypes.TurnStartRequest

type TurnStartedEvent

type TurnStartedEvent = protocol.TurnStartedEvent

type TurnStatus

type TurnStatus = protocol.TurnStatus

type TurnSteerRequest

type TurnSteerRequest = schematypes.TurnSteerRequest

type UserInputOption

type UserInputOption = protocol.UserInputOption

type UserInputQuestion

type UserInputQuestion = protocol.UserInputQuestion

type UserInputRequest

type UserInputRequest = protocol.UserInputRequest

type UserInputResult

type UserInputResult = protocol.UserInputResult

type WarningEvent

type WarningEvent struct {
	ThreadID string `json:"threadId,omitempty"`
	Message  string `json:"message"`
}

type WindowsSandboxSetupCompletedEvent

type WindowsSandboxSetupCompletedEvent struct {
	Mode    string `json:"mode,omitempty"`
	Success bool   `json:"success,omitempty"`
	Error   string `json:"error,omitempty"`
}

type WindowsWorldWritableWarningEvent

type WindowsWorldWritableWarningEvent struct {
	SamplePaths []string `json:"samplePaths,omitempty"`
	ExtraCount  int      `json:"extraCount,omitempty"`
	FailedScan  bool     `json:"failedScan,omitempty"`
}

Directories

Path Synopsis
cmd
codex-sdk-hook-shim command
codex-sdk-hook-shim bridges a Codex hook invocation to a hookbridge.Listener via a Unix domain socket.
codex-sdk-hook-shim bridges a Codex hook invocation to a hookbridge.Listener via a Unix domain socket.
examples
simple command
simple demonstrates basic usage of the codex-go SDK: finding the codex binary, creating a client, starting a thread, and running a prompt.
simple demonstrates basic usage of the codex-go SDK: finding the codex binary, creating a client, starting a thread, and running a prompt.
internal
hookbridge
Package hookbridge implements a Unix-domain socket server that receives Codex hook callbacks (PreToolUse, PostToolUse, SessionStart) and dispatches them to a registered Go Handler.
Package hookbridge implements a Unix-domain socket server that receives Codex hook callbacks (PreToolUse, PostToolUse, SessionStart) and dispatches them to a registered Go Handler.
jsonx
Package jsonx holds dependency-free helpers for extracting text and JSON candidates from loosely-typed payloads.
Package jsonx holds dependency-free helpers for extracting text and JSON candidates from loosely-typed payloads.
protocol/schema
Code generated from sdk/codex-go/internal/protocol/schema/v2.schema.json.
Code generated from sdk/codex-go/internal/protocol/schema/v2.schema.json.
testutil
Package testutil provides a lightweight mock JSON-RPC 2.0 server for use in SDK integration tests.
Package testutil provides a lightweight mock JSON-RPC 2.0 server for use in SDK integration tests.

Jump to

Keyboard shortcuts

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