Files
plane-agentd/agentd/executors/codex.py
T
jj.wang 9535122c99 Plane client, transports and executor adapters
Plane: paginated issue/comment/state/label/member access, one client per
terminal identity. Transports: local (setsid-detached runner) and warpgate-ssh
(win10-ps.sh / win10-put.sh relay, schtasks launch, taskkill on timeout).
Executors share a runner shape (prompt.md, exit.txt marker) with codex,
claude-code and shell adapters for last message and thread id.
2026-10-21 07:04:32 +00:00

24 lines
1010 B
Python

"""Codex CLI: `codex exec --json ... -o last.md -` (stdin prompt), resume with `codex exec resume <thread>`.
Thread id comes from the `thread.started` event in events.jsonl; the last message from last.md."""
import json
from .base import ExecResult, RunnerExecutor
class CodexExecutor(RunnerExecutor):
stdout_name = "events.jsonl"
def collect(self, handle):
t, d = self.transport, handle["run_dir"]
last = t.read_text(t.join(d, "last.md")) or ""
thread = handle.get("thread_id")
line = t.grep_first(t.join(d, "events.jsonl"), "thread.started")
if line:
try:
thread = json.loads(line).get("thread_id") or thread
except ValueError:
pass
tail = (self.stderr_tail(handle) + "\n" + t.tail(t.join(d, "events.jsonl"), 1)[-600:]).strip()
return ExecResult(last.strip(), self.exit_code(handle), thread,
self.logs(handle, "events.jsonl", "stderr.txt", "last.md"), tail)