feat(agent): add full codex agent support (v4.2.0)
- Implement CodexAdapter in lib_py/agents/adapters/codex.py with safe flags and TUI readiness - Extend create_session, resume_session, stop_session, and reconcile for codex CLI - Support codex agent delegation and loop integration across all multi-agent skills - Add unit, component, and contract test suites for codex integration - Verify all 462 tests passing cleanly
This commit is contained in:
1 parent
de0a9c2e81
commit
76f10b2096
45 files changed
+2045
-276
No files matched your search
+34
-3
@@ -550,7 +550,8 @@ elif cmd1 == "agent":
|
||||
"agy": f"Antigravity Ready in {resolved_cwd}",
|
||||
"hermes": f"Hermes Ready in {resolved_cwd}",
|
||||
"grok": f"Grok Ready in {resolved_cwd}",
|
||||
"opencode": f"OpenCode Ready in {resolved_cwd}"
|
||||
"opencode": f"OpenCode Ready in {resolved_cwd}",
|
||||
"codex": f"Codex Ready in {resolved_cwd}"
|
||||
}.get(agent_type, f"Ready in {resolved_cwd}")
|
||||
|
||||
agents = state.get("agents", {})
|
||||
@@ -581,7 +582,8 @@ elif cmd1 == "agent":
|
||||
"agy": "agy_conversation_id_own",
|
||||
"hermes": "hermes_conversation_id_own",
|
||||
"grok": "grok_session_id_own",
|
||||
"opencode": "opencode_session_id_own"
|
||||
"opencode": "opencode_session_id_own",
|
||||
"codex": "codex_session_id_own"
|
||||
}
|
||||
own_key = own_key_map.get(agent_type)
|
||||
if own_key:
|
||||
@@ -642,6 +644,21 @@ elif cmd1 == "agent":
|
||||
conn.execute("INSERT OR REPLACE INTO session (id, directory, time_created, cwd, created_at) VALUES (?, ?, ?, ?, ?)", (session_uuid, ws_abs, now_ms, ws_abs, time.time()))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
elif agent_type == "codex":
|
||||
codex_home = os.environ.get("CODEX_HOME", os.path.join(home_dir, ".codex"))
|
||||
os.makedirs(codex_home, exist_ok=True)
|
||||
db_path = os.path.join(codex_home, "state_5.sqlite")
|
||||
conn = sqlite3.connect(db_path)
|
||||
conn.execute("CREATE TABLE IF NOT EXISTS threads (id TEXT PRIMARY KEY, cwd TEXT, rollout_path TEXT, created_at INTEGER, updated_at INTEGER)")
|
||||
sessions_dir = os.path.join(codex_home, "sessions", "2026", "09", "05")
|
||||
os.makedirs(sessions_dir, exist_ok=True)
|
||||
rollout_file = os.path.join(sessions_dir, f"rollout-001-{session_uuid}.jsonl")
|
||||
now_ts = int(time.time())
|
||||
with open(rollout_file, "w") as rf:
|
||||
rf.write(json.dumps({"payload": {"cwd": ws_abs, "id": session_uuid}}) + "\\\\n")
|
||||
conn.execute("INSERT OR REPLACE INTO threads (id, cwd, rollout_path, created_at, updated_at) VALUES (?, ?, ?, ?, ?)", (session_uuid, ws_abs, rollout_file, now_ts, now_ts))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
state["agents"] = agents
|
||||
save_state()
|
||||
@@ -989,7 +1006,21 @@ sys.exit(0)
|
||||
""")
|
||||
opencode_bin.chmod(0o755)
|
||||
|
||||
# 6. uuidgen mock to guarantee isolated creation UUIDs
|
||||
# 6. codex mock
|
||||
codex_bin = bin_dir / "codex"
|
||||
codex_bin.write_text("""#!/usr/bin/env python3
|
||||
import sys, os
|
||||
args = sys.argv[1:]
|
||||
if len(args) >= 1 and args[0] == "--version":
|
||||
print("codex 0.1.0")
|
||||
sys.exit(0)
|
||||
if len(args) >= 1 and args[0] == "delete":
|
||||
sys.exit(0)
|
||||
sys.exit(0)
|
||||
""")
|
||||
codex_bin.chmod(0o755)
|
||||
|
||||
# 7. uuidgen mock to guarantee isolated creation UUIDs
|
||||
uuidgen_bin = bin_dir / "uuidgen"
|
||||
uuidgen_bin.write_text("""#!/usr/bin/env python3
|
||||
import uuid
|
||||
|
||||
Reference in new issue
Block a user