Documentation
¶
Overview ¶
Package codexcli provides an AI provider that invokes the OpenAI Codex CLI as a subprocess, reusing the user's ChatGPT Plus/Pro subscription.
Index ¶
- Constants
- func ExtractResult(output []byte) (string, error)
- type Client
- func (c *Client) GetMaxTokens() int
- func (c *Client) GetModel() string
- func (c *Client) SendMessage(ctx context.Context, message string) (string, error)
- func (c *Client) SendMessageWithHistory(ctx context.Context, messages []types.Message) (string, error)
- func (c *Client) SendMessageWithSystemPromptAndTools(ctx context.Context, systemPrompt string, atmosMemory string, ...) (*types.Response, error)
- func (c *Client) SendMessageWithTools(_ context.Context, _ string, _ []tools.Tool) (*types.Response, error)
- func (c *Client) SendMessageWithToolsAndHistory(_ context.Context, _ []types.Message, _ []tools.Tool) (*types.Response, error)
Constants ¶
const ( // ProviderName is the name of this provider for configuration lookup. ProviderName = "codex-cli" // DefaultBinary is the default binary name for Codex CLI. DefaultBinary = "codex" )
Variables ¶
This section is empty.
Functions ¶
func ExtractResult ¶
ExtractResult parses JSONL output and extracts the final text response. Codex CLI emits JSONL events. The response text is in "item.completed" events where item.type is "agent_message" (text in item.text directly) or "message" (text in item.content[].text array).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client invokes the OpenAI Codex CLI in non-interactive mode.
func NewClient ¶
func NewClient(atmosConfig *schema.AtmosConfiguration) (*Client, error)
NewClient creates a new Codex CLI client from Atmos configuration.
func (*Client) GetMaxTokens ¶
GetMaxTokens returns 0 — managed by Codex CLI internally.
func (*Client) SendMessage ¶
SendMessage sends a prompt to Codex CLI and returns the response.
func (*Client) SendMessageWithHistory ¶
func (c *Client) SendMessageWithHistory(ctx context.Context, messages []types.Message) (string, error)
SendMessageWithHistory concatenates history into a single prompt.
func (*Client) SendMessageWithSystemPromptAndTools ¶
func (c *Client) SendMessageWithSystemPromptAndTools( ctx context.Context, systemPrompt string, atmosMemory string, messages []types.Message, _ []tools.Tool, ) (*types.Response, error)
SendMessageWithSystemPromptAndTools sends with system prompt prepended.