codex

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Method string          `json:"method"`
	Params json.RawMessage `json:"params"`
}

Event is a notification forwarded to SSE subscribers.

type Message

type Message struct {
	Method string          `json:"method,omitempty"`
	ID     *int64          `json:"id,omitempty"`
	Params json.RawMessage `json:"params,omitempty"`
	Result json.RawMessage `json:"result,omitempty"`
	Error  *RPCError       `json:"error,omitempty"`
}

Message is a JSON-RPC 2.0 message on the wire.

type Process

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

Process manages a codex app-server subprocess via stdio JSON-RPC.

func New

func New(logDir string) *Process

New creates a process manager. The subprocess is started lazily. logDir specifies where to write per-session JSONL event logs. Empty disables logging.

func (*Process) Close

func (p *Process) Close() error

Close shuts down the codex process and flushes log files.

func (*Process) InterruptTurn

func (p *Process) InterruptTurn(threadID, turnID string) error

InterruptTurn cancels the active turn.

func (*Process) IsThreadInitialized

func (p *Process) IsThreadInitialized(threadID string) bool

IsThreadInitialized returns true if the thread has had its first turn.

func (*Process) MarkThreadInitialized

func (p *Process) MarkThreadInitialized(threadID string)

MarkThreadInitialized marks a thread as having received its first turn.

func (*Process) StartThread

func (p *Process) StartThread(cwd, model string) (string, error)

StartThread creates a new codex thread.

func (*Process) StartTurn

func (p *Process) StartTurn(threadID string, input []map[string]any, effort string) error

StartTurn sends a user message to an existing thread. effort controls reasoning intensity ("low", "medium", "high"); empty means server default.

func (*Process) Subscribe

func (p *Process) Subscribe(threadID string) chan *Event

Subscribe returns a channel that receives events for the given thread.

func (*Process) Unsubscribe

func (p *Process) Unsubscribe(threadID string, ch chan *Event)

Unsubscribe removes a subscriber channel for a thread.

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

RPCError is a JSON-RPC error object.

func (*RPCError) Error

func (e *RPCError) Error() string

Jump to

Keyboard shortcuts

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