Documentation
¶
Index ¶
- func Run(ctx context.Context, codexPath string, opts Options, in io.Reader, ...) error
- type Agent
- func (a *Agent) Authenticate(context.Context, acp.AuthenticateRequest) (acp.AuthenticateResponse, error)
- func (a *Agent) Cancel(ctx context.Context, params acp.CancelNotification) error
- func (a *Agent) Close() error
- func (a *Agent) CloseSession(_ context.Context, params acp.CloseSessionRequest) (acp.CloseSessionResponse, error)
- func (a *Agent) Done() <-chan struct{}
- func (a *Agent) Initialize(ctx context.Context, _ acp.InitializeRequest) (acp.InitializeResponse, error)
- func (a *Agent) ListSessions(ctx context.Context, params acp.ListSessionsRequest) (acp.ListSessionsResponse, error)
- func (a *Agent) LoadSession(ctx context.Context, params acp.LoadSessionRequest) (acp.LoadSessionResponse, error)
- func (a *Agent) NewSession(ctx context.Context, params acp.NewSessionRequest) (acp.NewSessionResponse, error)
- func (a *Agent) Prompt(ctx context.Context, params acp.PromptRequest) (acp.PromptResponse, error)
- func (a *Agent) ResumeSession(ctx context.Context, params acp.ResumeSessionRequest) (acp.ResumeSessionResponse, error)
- func (a *Agent) SetAgentConnection(conn *acp.AgentSideConnection)
- func (a *Agent) SetSessionConfigOption(_ context.Context, params acp.SetSessionConfigOptionRequest) (acp.SetSessionConfigOptionResponse, error)
- func (a *Agent) SetSessionMode(_ context.Context, params acp.SetSessionModeRequest) (acp.SetSessionModeResponse, error)
- func (a *Agent) UnstableSetSessionModel(ctx context.Context, params acp.UnstableSetSessionModelRequest) (acp.UnstableSetSessionModelResponse, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent implements acp.Agent for the codex app-server. It manages the long-lived `codex app-server` subprocess transparently (see Spawn) and exposes only ACP session-scoped operations to the host. Embed it in a host process via Spawn or Run — no separate ACP server binary is required.
func Spawn ¶
Spawn starts a `codex app-server` subprocess and returns an Agent that talks to it. Use Agent.Close (or rely on ctx cancellation) to terminate the subprocess. The agent is ready to be wired into an acp.AgentSideConnection via Agent.SetAgentConnection.
codexPath is the path to (or PATH name of) the `codex` binary; empty defaults to "codex".
func (*Agent) Authenticate ¶
func (a *Agent) Authenticate(context.Context, acp.AuthenticateRequest) (acp.AuthenticateResponse, error)
func (*Agent) CloseSession ¶
func (a *Agent) CloseSession(_ context.Context, params acp.CloseSessionRequest) (acp.CloseSessionResponse, error)
func (*Agent) Done ¶
func (a *Agent) Done() <-chan struct{}
Done returns a channel closed when the codex subprocess exits.
func (*Agent) Initialize ¶
func (a *Agent) Initialize(ctx context.Context, _ acp.InitializeRequest) (acp.InitializeResponse, error)
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) 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) SetSessionConfigOption ¶
func (a *Agent) SetSessionConfigOption(_ context.Context, params acp.SetSessionConfigOptionRequest) (acp.SetSessionConfigOptionResponse, error)
func (*Agent) SetSessionMode ¶
func (a *Agent) SetSessionMode(_ context.Context, params acp.SetSessionModeRequest) (acp.SetSessionModeResponse, error)
func (*Agent) UnstableSetSessionModel ¶
func (a *Agent) UnstableSetSessionModel(ctx context.Context, params acp.UnstableSetSessionModelRequest) (acp.UnstableSetSessionModelResponse, error)
type Options ¶
type Options struct {
// Model is the default model id used for new sessions. Empty / "default"
// defers to codex's configured default.
Model string
// Effort is the default reasoning effort applied to new sessions.
// Empty / "default" disables the override.
Effort string
// Env is the environment for the `codex app-server` subprocess. nil
// means inherit the parent process env. To layer Wingman routing on
// top, callers can pass
// `pkg/external/codex.BuildEnv(os.Environ(), cfg)`.
Env []string
// ExtraArgs are extra CLI args prefixed before `app-server`. Use this
// for top-level codex flags such as the `--config` pairs returned by
// `pkg/external/codex.BuildArgs`.
ExtraArgs []string
}
Options configures the codex subprocess and the Agent's defaults for new sessions.