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//! capabilities the descriptor references: `item.completed` event-stream
7//! parsing ([`transcript`]) and live-skill shadow detection ([`skill_shadow`]).
8
9pub mod skill_shadow;
10pub mod transcript;
11
12#[cfg(test)]
13mod tests {
14    use crate::adapters::adapter_for;
15    use crate::core::Harness;
16
17    #[test]
18    fn codex_parse_cli_events_delegates_to_events_parser() {
19        use serde_json::json;
20        let dir = tempfile::TempDir::new().unwrap();
21        let path = dir.path().join("codex-events.jsonl");
22        let line = json!({"type": "item.completed", "item": {"id": "i1", "type": "command_execution", "command": "bun test", "output": "ok"}});
23        std::fs::write(&path, format!("{line}\n")).unwrap();
24
25        let inv = adapter_for(Harness::resolve("codex").unwrap())
26            .parse_cli_events(&path)
27            .unwrap();
28        assert_eq!(inv.len(), 1);
29        assert_eq!(inv[0].name, "command_execution");
30    }
31}