feat(responses): respect client streaming preference + string input support (#121)

- Remove forced stream=true from responsesHandler
- Add stream-to-JSON converter for non-streaming clients (Codex)
- Accept string input in Responses API (normalize to array)
- Codex SSE header fallback for missing Content-Type
- Refactor: extract shared normalizeResponsesInput()

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
apeltekci
2026-02-15 11:47:55 +07:00
committed by decolua
co-authored by Claude Sonnet 4.5 Cursor
parent 202fee714b
commit ac7cedd27e
7 changed files with 263 additions and 26 deletions
+5
View File
@@ -1,6 +1,7 @@
import { BaseExecutor } from "./base.js";
import { CODEX_DEFAULT_INSTRUCTIONS } from "../config/codexInstructions.js";
import { PROVIDERS } from "../config/constants.js";
import { normalizeResponsesInput } from "../translator/helpers/responsesApiHelper.js";
/**
* Codex Executor - handles OpenAI Codex API (Responses API format)
@@ -24,6 +25,10 @@ export class CodexExecutor extends BaseExecutor {
* Transform request before sending - inject default instructions if missing
*/
transformRequest(model, body, stream, credentials) {
// Convert string input to array format (Codex API requires input as array)
const normalized = normalizeResponsesInput(body.input);
if (normalized) body.input = normalized;
// Ensure input is present and non-empty (Codex API rejects empty input)
if (!body.input || (Array.isArray(body.input) && body.input.length === 0)) {
body.input = [{ type: "message", role: "user", content: [{ type: "input_text", text: "..." }] }];