kcode-codex-runtime 0.1.0

Safe Codex CLI generation, web search, and model catalog runtime
Documentation
# kcode-codex-runtime Agent Integration Reference

`kcode-codex-runtime` is a standalone asynchronous Rust 2024 library for an
authenticated Codex CLI. It owns catalog discovery and sanitization, ChatGPT
login validation, prompt-boundary verification, safe process configuration,
generation, continuation, JSONL normalization, and Codex-native web search.
The integrating application owns secrets/login provisioning, HTTP routes,
authorization, cancellation identifiers, application model selection, search
mode policy, logging, and persistence.

```rust,no_run
use kcode_codex_runtime::{
    CatalogCache, Codex, CodexConfig, GenerationRequest, Result,
};

async fn generate(prompt: String) -> Result<String> {
    let config = CodexConfig::new("gpt-5.6-sol");
    let cache = CatalogCache::new("codex-safe");
    let codex = Codex::open(config, cache).await?;
    Ok(codex
        .generate(GenerationRequest::new(prompt, "gpt-5.6-sol"))
        .await?
        .answer)
}
```

`Codex::open` requires the configured launcher to report a ChatGPT login. API
key environment variables are removed from every child process. It loads a
sanitized model catalog and verifies that ordinary generation presents only
the exact caller-supplied prompt item at the supported debug boundary.

`generate` accepts an exact prompt, model, reasoning effort, optional UUID
thread ID, optional ephemeral-session behavior, and timeout. It returns the
final assistant message, Codex thread ID, and typed usage. Dropping the future
kills the child process.

`web_search` runs a fresh ephemeral turn with native web search as the only
enabled tool. The request selects a model, reasoning effort, search-context
size, focused or thorough research depth, and timeout. The response contains
the answer, usage, and every deduplicated HTTP(S) link found in the answer; the
library imposes no caller-specified source-count limit.

The literal root package version in `Cargo.toml` is canonical. No parallel
version file is required. Keep generated build output outside the managed
library directory.