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
parent 0a8d92a6ba
commit 6ee4555821
9 changed files with 42 additions and 25 deletions

View File

@@ -6,7 +6,10 @@ import { parseSSELine, hasValuableContent, fixInvalidId, formatSSE } from "./str
import { getOpenAIResponsesEventName, isOpenAIResponsesTerminalEvent, formatIncompleteOpenAIResponsesStreamFailure } from "./responsesStreamHelpers.js";
import { dbg, isDebugEnabled } from "./debugLog.js";
import { SSE_DONE, SSE_HEADERS, SSE_HEADERS_NO_BUFFER } from "./sseConstants.js";
export { COLORS, formatSSE };
export { SSE_DONE, SSE_HEADERS, SSE_HEADERS_NO_BUFFER };
// sharedEncoder is stateless — safe to share across streams
const sharedEncoder = new TextEncoder();