Parses Codex command execution events into Bash tool calls and emits them.
// Source: https://github.com/clawbench-dev/clawbench | License: MIT | Copyright 2025 xulongzhe
// Provided via justclaw.it.com; keep this notice with the code.
package ai
// parseCodexToolStart extracts a tool_use ToolCall (Done=false) from a Codex item.started event.
// Returns nil if the message does not contain a command_execution item.
func parseCodexToolStart(msg *CodexStreamMessage) *ToolCall {
if msg.Item == nil || msg.Item.Type != "command_execution" {
return nil
}
input := execCommandJSON(msg.Item.Command)
return &ToolCall{
Name: "Bash",
ID: msg.Item.ID,
Input: input,
Done: false,
}
}
// parseCodexToolComplete extracts a tool_use ToolCall (Done=true) from a Codex item.completed event.
// Returns nil if the message does not contain a command_execution item.
f
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key