codex

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 24 Imported by: 0

README

codex

ACP bridge for the Codex CLI. Spawn launches codex app-server and translates its JSON-RPC notifications into ACP session updates.

Protocol reference

https://learn.chatgpt.com/docs/app-server

The app-server surface is what this package speaks: initialize, thread/start, turn/start, and the item/* and turn/* notification streams handled in events.go.

Plans

This bridge does not emit ACP plan_update. Codex 0.152.1 produces no plan item even when explicitly asked to use a plan tool, and turn/plan/updated is documented as carrying empty item arrays — clients are directed to item/* as the authoritative source. A plan item, if one ever arrives, is surfaced as agent text and offered to the client via requestPlanImplementation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, opts Options, in io.Reader, out io.Writer, logger *slog.Logger) error

Types

type Agent

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

func Spawn

func Spawn(ctx context.Context, opts Options) (*Agent, error)

func (*Agent) Cancel

func (a *Agent) Cancel(ctx context.Context, params acp.CancelNotification) error

func (*Agent) Close

func (a *Agent) Close() error

func (*Agent) CloseSession

func (a *Agent) CloseSession(ctx context.Context, params acp.CloseSessionRequest) (acp.CloseSessionResponse, error)

func (*Agent) Done

func (a *Agent) Done() <-chan struct{}

func (*Agent) Initialize

func (*Agent) ListSessions

func (a *Agent) ListSessions(ctx context.Context, params acp.ListSessionsRequest) (acp.ListSessionsResponse, error)

func (*Agent) LoadSession

func (a *Agent) LoadSession(ctx context.Context, params acp.LoadSessionRequest) (acp.LoadSessionResponse, error)

func (*Agent) Logout added in v0.8.5

func (*Agent) NewSession

func (a *Agent) NewSession(ctx context.Context, params acp.NewSessionRequest) (acp.NewSessionResponse, error)

func (*Agent) Prompt

func (a *Agent) Prompt(ctx context.Context, params acp.PromptRequest) (acp.PromptResponse, error)

func (*Agent) ResumeSession

func (a *Agent) ResumeSession(ctx context.Context, params acp.ResumeSessionRequest) (acp.ResumeSessionResponse, error)

func (*Agent) SetAgentConnection

func (a *Agent) SetAgentConnection(conn *acp.AgentSideConnection)

func (*Agent) SetSessionMode

func (*Agent) Steer added in v0.10.9

func (a *Agent) Steer(ctx context.Context, sessionID acp.SessionId, prompt []acp.ContentBlock, messageID string) error

func (*Agent) UnstableDeleteSession added in v0.8.5

func (*Agent) UnstableForkSession added in v0.15.8

type Options

type Options struct {
	Model string

	Effort string

	Path string
	Dir  string
	Env  []string

	ExtraArgs []string

	Stderr io.Writer
}

Jump to

Keyboard shortcuts

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