Documentation
¶
Overview ¶
Package codexcontract centralizes Codex CLI protocol constants.
The Codex CLI evolves quickly; keeping flags and event type strings here makes compatibility updates localized.
Index ¶
Constants ¶
const ( EventThreadStarted = "thread.started" EventTurnStarted = "turn.started" EventTurnCompleted = "turn.completed" EventTurnFailed = "turn.failed" EventItemStarted = "item.started" EventItemUpdated = "item.updated" EventItemCompleted = "item.completed" EventError = "error" // Legacy/compat event types seen in older wrappers or test fakes. EventContent = "content" EventText = "text" EventAssistant = "assistant" EventMessage = "message" EventToolCall = "tool_call" EventDone = "done" EventComplete = "complete" EventEnd = "end" EventUsage = "usage" EventSession = "session" EventResult = "result" )
Canonical JSONL event types from codex exec --json.
const ( ItemAgentMessage = "agent_message" ItemReasoning = "reasoning" )
Item types we can interpret in headless mode.
const ( CommandExec = "exec" CommandResume = "resume" FlagJSON = "--json" FlagModel = "--model" FlagSandbox = "--sandbox" FlagAskForApproval = "--ask-for-approval" FlagFullAuto = "--full-auto" FlagYolo = "--yolo" FlagDangerouslyBypassApprovalsSandbox = "--dangerously-bypass-approvals-and-sandbox" FlagCD = "--cd" FlagAddDir = "--add-dir" FlagImage = "--image" FlagSearch = "--search" FlagProfile = "--profile" FlagLocalProvider = "--local-provider" FlagConfig = "-c" FlagSkipGitRepoCheck = "--skip-git-repo-check" FlagOutputSchema = "--output-schema" FlagOutputLastMessage = "--output-last-message" FlagAll = "--all" FlagOSS = "--oss" FlagEnable = "--enable" FlagDisable = "--disable" FlagColor = "--color" FlagVersion = "--version" )
Codex CLI commands and flags used by this library.
const TestedCLIVersion = "0.98.0"
TestedCLIVersion is the Codex CLI version this package was validated against.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLIVersion ¶
CLIVersion represents a parsed semver-like CLI version.
func CheckVersion ¶
func CheckVersion(codexPath string) *CLIVersion
CheckVersion detects CLI version and logs compatibility warnings.
func DetectCLIVersion ¶
func DetectCLIVersion(codexPath string) (*CLIVersion, error)
DetectCLIVersion runs codex --version and parses the result.
func MustParseVersion ¶
func MustParseVersion(s string) *CLIVersion
MustParseVersion parses a version and panics on invalid input.
func ParseVersion ¶
func ParseVersion(s string) (*CLIVersion, error)
ParseVersion parses versions like "0.34.1".
func (*CLIVersion) Compare ¶
func (v *CLIVersion) Compare(other *CLIVersion) int
Compare returns -1 when v < other, 0 when equal, and 1 when v > other.
func (*CLIVersion) IsNewerThan ¶
func (v *CLIVersion) IsNewerThan(other *CLIVersion) bool
IsNewerThan reports whether v is newer than other.
func (*CLIVersion) WarnIfUntested ¶
func (v *CLIVersion) WarnIfUntested()
WarnIfUntested warns when runtime CLI is newer than tested version.