Expand description
Implementation of toolpath-convo traits for Codex sessions.
The hard part is mapping Codex’s streaming event model onto
toolpath_convo::Turn, which is message-shaped. The approach:
- Walk the rollout lines in order.
response_item.messagecreates a newTurn. Role/content are mapped straightforwardly;developerbecomesRole::System.response_item.reasoningis buffered and attached to the next assistant turn’sthinkingfield.response_item.function_call/custom_tool_callattach to the current turn (or a synthetic carrier if no message preceded them) asToolInvocationentries. Output is back-filled when we see the matching*_outputbycall_id.event_msg.exec_command_endenriches the already-emitted tool invocation with the exit code / stdout / stderr.event_msg.patch_apply_endis captured on the current turn’sextra["codex"]["patch_changes"]— the derive layer consumes it for file-artifact sibling changes.event_msg.token_countpopulatesTurn.token_usageon the next assistant turn emitted.- Everything else (
task_started,task_complete,turn_context,user_message/agent_messageduplicates, unknown events) lands inConversationView.eventsas a typedConversationEvent.
Structs§
- Codex
Convo - Provider for Codex sessions.
Functions§
- to_turn
- Convert one rollout line to a “best-effort”
Turn, if it carries one. Used by consumers who want per-line processing without the cross-line assembly thatto_viewdoes. - to_view
- Convert a parsed Codex
Sessionto the provider-agnosticConversationViewshape. - tool_
category - Classify a Codex tool name into toolpath’s category ontology.