Function
extractCallId
(payload: Record<string, unknown>)
Source from the content-addressed store, hash-verified
| 97 | } |
| 98 | |
| 99 | function extractCallId(payload: Record<string, unknown>): string | null { |
| 100 | const candidates = [ |
| 101 | 'call_id', |
| 102 | 'callId', |
| 103 | 'tool_call_id', |
| 104 | 'toolCallId', |
| 105 | 'id' |
| 106 | ]; |
| 107 | |
| 108 | for (const key of candidates) { |
| 109 | const value = payload[key]; |
| 110 | if (typeof value === 'string' && value.length > 0) { |
| 111 | return value; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | return null; |
| 116 | } |
| 117 | |
| 118 | export function convertCodexEvent(rawEvent: unknown): CodexConversionResult | null { |
| 119 | const parsed = CodexSessionEventSchema.safeParse(rawEvent); |
Tested by
no test coverage detected