refactor(open-sse): DRY SSE primitives into utils/sseConstants.js

Gom SSE_DONE + SSE_HEADERS + SSE_HEADERS_NO_BUFFER vào 1 file không
phụ thuộc (tránh kéo usageDb vào executor). Áp cho kiro, cursor, qoder,
github, commandcode, perplexity-web, grok-web. Byte-for-byte verified
(headers/DONE giữ nguyên; biến thể no-buffer dùng const riêng).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
decolua
2026-06-13 21:42:59 +07:00
co-authored by Cursor
parent 0a8d92a6ba
commit 6ee4555821
9 changed files with 42 additions and 25 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import { openaiResponsesToOpenAIResponse } from "../translator/response/openai-r
import { initState } from "../translator/index.js";
import { parseSSELine, formatSSE } from "../utils/streamHelpers.js";
import { proxyAwareFetch } from "../utils/proxyFetch.js";
import { SSE_DONE } from "../utils/sseConstants.js";
import crypto from "crypto";
export class GithubExecutor extends BaseExecutor {
@@ -244,7 +245,7 @@ export class GithubExecutor extends BaseExecutor {
if (!parsed) continue;
if (parsed.done && stream === true) {
controller.enqueue(new TextEncoder().encode("data: [DONE]\n\n"));
controller.enqueue(new TextEncoder().encode(SSE_DONE));
continue;
}