Skip to main content

Crate ai6_agent_codex

Crate ai6_agent_codex 

Source
Expand description

Codex app-server JSON-RPC implementation of AI6’s AgentHandler contract.

§ai6-agent-codex

Version Rust version License: MPL-2.0 Docs CI

ai6-agent-codex implements AI6’s Guatiao AgentHandler for the Codex app-server JSON-RPC protocol. The daemon supplies a terminal Run; this handler owns Codex initialization, thread start/resume, turn submission and event decoding.

§Features

  • Starts a Codex app-server thread with Mission context and prompt.
  • Resumes using the provider-issued thread identifier, verifies the returned ID, and preserves the Mission working directory.
  • Sends later messages as turns and emits provider events as AI6 AgentEvent values.
  • Reports a usage-limit error, with the reset time of the exhausted quota window, as an AgentEvent of kind limit so AI6 can park the Run instead of failing it.
  • Reports token usage per model request (Codex reports no cost) and names the web-search and tool calls a turn makes.
  • Uses per-process app-server configuration to connect to the AI6 Cable MCP endpoint; the bearer token is read from the launch environment.
  • Answers Codex’s command approval requests with the green ink gate: a push to a protected ref, a merge or a release is declined until a live approval covers it. A file change inside the working directory is accepted, one reaching outside it declined.
  • Marks the working directory an untrusted project unless AI6 allows its settings, so a checkout’s .codex/ config, hooks and rules do not load.
  • Starts an answer-only thread (AgentStart::answer_only, for a Chief of Staff review) in the read-only sandbox, never asking, with web search off and no MCP servers.
  • Before an answer-only or assistant thread starts, switches off every Codex feature but four, renders what the model would be offered (codex debug prompt-input) and refuses to start unless that is exactly the thread’s MCP tools (with scripts, code mode’s exec and wait, and only the expected tools nested in exec); AI6_CODEX_TOOL_CHECK=warn starts it anyway and reports a weakening.

§Installation

The provider library contains its Guatiao entry point and builds as both an ordinary Rust library and a dynamically loadable provider. Build it with cargo build -p ai6-agent-codex from the AI6 workspace root.

§API overview

ModulePurpose
ai6_agent_codexCodexHandler, CodexConfig and app-server JSON-RPC Run implementation

§Development

Run cargo fmt --all --check, cargo test -p ai6-agent-codex, and cargo clippy --workspace --all-targets --all-features -- -D warnings from the AI6 workspace root. Workspace-wide Clippy keeps the AI6 provider dependency’s feature-gated library code in its intended build context.

§License

MPL-2.0. See LICENSE.

Structs§

CodexConfig
Codex app-server AgentHandler configuration.
CodexHandler
Starts and resumes Codex through its app-server protocol.

Constants§

KEPT_FEATURES
Features a restricted thread keeps: how Codex stores its login and reaches its service, none of which offers the model a tool, and incremental_tools. Every other enabled feature is switched off.
RECORD_FORMAT
The format of Codex’s rollout file.
TOOL_CHECK_ENV
The environment variable that chooses what a failed tool check does: strict (the default) refuses to start, warn starts and reports a weakening.

Statics§

guatiao_declares
What this library declares, read by a scanner as data.

Functions§

guatiao_library_entry⚠
The symbol a guatiao host loads this library by.