Skip to main content

eval_magic/adapters/codex/
mod.rs

1//! Codex harness support.
2//!
3//! The declarative half of this harness lives in `harnesses/codex.toml`
4//! (including the write-guard data rendered by the generic engine in
5//! [`crate::adapters::guard`]); this module tree keeps only the code-backed
6//! capability the descriptor references: `item.completed` event-stream
7//! parsing ([`transcript`]).
8
9pub mod transcript;
10
11#[cfg(test)]
12mod tests {
13    use crate::adapters::adapter_for;
14    use crate::core::Harness;
15
16    #[test]
17    fn codex_parse_cli_events_delegates_to_events_parser() {
18        use serde_json::json;
19        let dir = tempfile::TempDir::new().unwrap();
20        let path = dir.path().join("codex-events.jsonl");
21        let line = json!({"type": "item.completed", "item": {"id": "i1", "type": "command_execution", "command": "bun test", "output": "ok"}});
22        std::fs::write(&path, format!("{line}\n")).unwrap();
23
24        let inv = adapter_for(Harness::resolve("codex").unwrap())
25            .parse_cli_events(&path)
26            .unwrap();
27        assert_eq!(inv.len(), 1);
28        assert_eq!(inv[0].name, "command_execution");
29    }
30}