MCPcopy Create free account
hub / github.com/anomalyco/opencode-bench / logTurnItems

Function logTurnItems

src/agents/codex.ts:31–52  ·  view source on GitHub ↗
(items: ThreadItem[], options: Agent.RunOptions)

Source from the content-addressed store, hash-verified

29}
30
31function logTurnItems(items: ThreadItem[], options: Agent.RunOptions): void {
32 for (const item of items) {
33 try {
34 process.stdout.write(`${options.logger.format(JSON.stringify(item))}\n`);
35 } catch (error) {
36 const sanitizedItem =
37 item.type === "command_execution"
38 ? { ...item, aggregated_output: "<omitted>" }
39 : item;
40 process.stdout.write(
41 `${options.logger.format(JSON.stringify(sanitizedItem))}\n`,
42 );
43 if (error instanceof Error) {
44 process.stderr.write(
45 `${options.logger.format(
46 `Failed to serialize Codex item: ${error.message}`,
47 )}\n`,
48 );
49 }
50 }
51 }
52}
53
54function getOrCreateThread(model: string, cwd: string): Thread {
55 const key = sessionKey(model, cwd);

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected