MCPcopy Create free account
hub / github.com/github/gh-aw / isCodexJsonlFormat

Function isCodexJsonlFormat

actions/setup/js/parse_codex_log.cjs:306–321  ·  view source on GitHub ↗

* Detects whether the log is in the Codex experimental JSONL event format. * Newer Codex CLI versions (e.g. 0.141+) emit a stream of JSON objects such as * `{"type":"thread.started",...}`, `{"type":"turn.completed",...}` and * `{"type":"item.completed","item":{"type":"agent_message",...}}` instea

(lines)

Source from the content-addressed store, hash-verified

304 * @returns {boolean} True if at least one Codex JSONL event line is present
305 */
306function isCodexJsonlFormat(lines) {
307 for (const line of lines) {
308 const trimmed = line.trim();
309 if (!trimmed.startsWith("{")) continue;
310 let event;
311 try {
312 event = JSON.parse(trimmed);
313 } catch {
314 continue;
315 }
316 if (event && typeof event === "object" && typeof event.type === "string" && /^(thread|turn|item)\./.test(event.type)) {
317 return true;
318 }
319 }
320 return false;
321}
322
323/**
324 * Parse the Codex experimental JSONL event stream into the shared logEntries model.

Callers 2

parseCodexLogFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected