mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
feat: add codex provider via Responses API
This commit is contained in:
committed by
claude-code-best
parent
3cb4828de6
commit
7d4b27c01a
51
src/services/api/codex/__tests__/preflight.test.ts
Normal file
51
src/services/api/codex/__tests__/preflight.test.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { describe, expect, test } from 'bun:test'
|
||||
import { sanitizeCodexRequest } from '../preflight.js'
|
||||
|
||||
describe('sanitizeCodexRequest', () => {
|
||||
test('normalizes function call ids and tool names', () => {
|
||||
const request = sanitizeCodexRequest({
|
||||
model: 'gpt-5.4',
|
||||
input: [
|
||||
{
|
||||
type: 'function_call',
|
||||
call_id: ' tool 1 / weird ',
|
||||
name: ' Read ',
|
||||
arguments: '{}',
|
||||
},
|
||||
] as any,
|
||||
tools: [
|
||||
{
|
||||
type: 'function',
|
||||
name: ' Read ',
|
||||
parameters: null,
|
||||
},
|
||||
] as any,
|
||||
} as any)
|
||||
|
||||
expect(request.input?.[0]).toMatchObject({
|
||||
type: 'function_call',
|
||||
call_id: 'tool_1_weird',
|
||||
name: 'Read',
|
||||
})
|
||||
expect(request.tools?.[0]).toMatchObject({
|
||||
type: 'function',
|
||||
name: 'Read',
|
||||
parameters: {},
|
||||
})
|
||||
})
|
||||
|
||||
test('rejects invalid function_call_output without call_id', () => {
|
||||
expect(() =>
|
||||
sanitizeCodexRequest({
|
||||
model: 'gpt-5.4',
|
||||
input: [
|
||||
{
|
||||
type: 'function_call_output',
|
||||
call_id: ' ',
|
||||
output: 'ok',
|
||||
},
|
||||
] as any,
|
||||
} as any),
|
||||
).toThrow('Codex preflight: function_call_output.call_id is required.')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user