codex

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PromptMD string

Functions

This section is empty.

Types

type Codex

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

Codex implements agent.Agent by spawning codex mcp-server subprocesses.

func New

func New(ctx context.Context, opts ...Option) (*Codex, error)

New creates a new Codex agent.

func (*Codex) ActiveSessions

func (c *Codex) ActiveSessions() []string

func (*Codex) CLICommands

func (c *Codex) CLICommands() []string

func (*Codex) Close

func (c *Codex) Close(userID string) error

Close terminates a user's session without clearing userFlags or threadId file.

func (*Codex) CloseAll

func (c *Codex) CloseAll() error

CloseAll terminates all sessions.

func (*Codex) Control

func (c *Codex) Control(_ context.Context, userID string, action types.Action) (bool, error)

Control handles user actions (confirm/deny for approvals).

func (*Codex) Name

func (c *Codex) Name() string

func (*Codex) RawInput

func (c *Codex) RawInput(_ context.Context, _ string, _ string) error

RawInput is not supported by Codex (no terminal passthrough).

func (*Codex) RespawnSession

func (c *Codex) RespawnSession(_ context.Context, userID, workDir, _ string) (bool, error)

RespawnSession switches the user's session to a different working directory. resumeOpt is ignored — codex threadId is process-local and cannot survive respawn.

func (*Codex) Restart

func (c *Codex) Restart(_ context.Context, userID string, flags map[string]string) (bool, error)

Restart updates the session's approval policy without killing the process. approval-policy and sandbox are per-call parameters, so no process restart needed.

func (*Codex) Send

func (c *Codex) Send(ctx context.Context, userID string, msg agent.Message) error

Send sends a message to the user's Codex session.

func (*Codex) Subscribe

func (c *Codex) Subscribe(userID string) <-chan *agent.Response

Subscribe returns the response channel for a user.

type Option

type Option func(*Codex)

Option configures a Codex agent.

func WithCodexCmd

func WithCodexCmd(cmd string) Option

WithCodexCmd sets the path to the codex CLI binary.

func WithInitPrompt

func WithInitPrompt(content string) Option

WithInitPrompt sets the init prompt content written to each session workdir.

func WithModel

func WithModel(model string) Option

WithModel sets the model for Codex.

func WithRuntime

func WithRuntime(rt runtime.Runtime) Option

WithRuntime sets the runtime container (tmux, screen, etc.).

func WithWorkDir

func WithWorkDir(dir string) Option

WithWorkDir sets the base working directory for sessions.

Jump to

Keyboard shortcuts

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