Dashboard › opencode-lore › Distillation
01740a07-5426-4bb7-859f-e55c7208e39e["lore_tm_v1_KSBvbRtpyKnY6OVO4yskEkaDky0qmffmyaIE7LjjBLs","lore_tm_v1_xHUfX632zEb-GbfWWFxUUHasdzb107m3WGttcZ-WeGY","lore_tm_v1_cfeppzYZNJR1pLOxogrVMWVfODNINNs3-ZP5GQ8Tb-k","lore_tm_v1_ZUX0wvPONNMyiJRQaBh26eacBiiuiM67HArwG9lXfnQ","lore_tm_v1_mEcqi71y9qrl2J6uyGXuSvLkhCPaVlnFPLuuJQYDPz0","lore_tm_v1_-MHnQACkd0YWgpkP3R0XzZM9t2ALAo-4CCR_bdPc5D8","lore_tm_v1_OzS01U6SPVIRlgQwDFcs0BYDJFON7FoWf-24FjV2k5Y"]
Date: Sep 16, 2026
parseSSEStream() in packages/gateway/src/stream/anthropic.ts:150-204 accepts maxEventBytes, maxFrames, shared frameCounter, inactivityMs, signal, requireEventTerminator, maxTotalBytes, and fatalUtf8. It defaults maxEventBytes to 4 * 1024 * 1024 and maxFrames to DEFAULT_MAX_SSE_FRAMES; rejects a frame limit that is not a non-negative safe integer; increments frameCounter.count for each frame; and throws SSEStreamLimitError("SSE stream exceeded ${maxFrames} frame limit") when the request-wide count exceeds the limit.parseSSEStream() uses TextDecoder("utf-8", { fatal: opts.fatalUtf8, ignoreBOM: true }); its parser owns initial BOM removal and byte accounting, including BOMs split across transport chunks.parseSSEStream() supports event: <type> followed by data: <json>, multiple data: lines joined with \n, blank-line event delimiters, and default event type "message" when no event: line precedes data. Its delimiter scan retains the last 3 characters because the longest delimiter is 4 characters.0, negative, empty, and non-numeric values—must fall back to the default and never disable retries. The regression test is falls back to default for 0, negative, empty, and non-numeric (never disables retries) in packages/gateway/test/llm-adapter.test.ts:663.never returns negative for tiny windows in packages/gateway/test/compaction.test.ts:881.treats missing cache fields as zero at line 402, with the defensive invariant documented at line 408.counts failed continuation bytes against the request-wide stream limit in packages/gateway/test/openai-responses-recall-aware-stream.test.ts:1847-1893 makes the first follow-up emit created("resp_retry_limit_dropped", "gpt-5.6-terra") and then fail with Error("socket reset"); a second follow-up contains recovered after budget. With maxStreamBytes set to the recovered stream’s encoded byte length plus 1, the test requires exactly 2 follow-ups, output containing PUBLIC_RECALL_ERROR, output excluding recovered after budget, and failure category ["resource_limit"].counts failed continuation frames against the request-wide frame limit in packages/gateway/test/openai-responses-recall-aware-stream.test.ts:1895-1946 establishes a request-wide frame budget: the principal consumes 5 frames, the failed continuation consumes 1 frame, and maxSSEFrames: 6 prevents the retried continuation from emitting its first frame. It requires exactly 2 follow-ups, output containing PUBLIC_RECALL_ERROR, output excluding recovered after frames, and failure category ["resource_limit"].normalizeCodexDataEvent() in packages/gateway/src/stream/openai-responses.ts:1480-1528 resolves a Codex event’s output index from output_index, item_id, a sole unbound item of the matching kind, or nextResponsesOutputIndex(). It rejects disagreement between a provided index and the index already bound to item_id, missing/ambiguous identity resolution, attempts to create over a raw item, and item-kind changes; it writes the normalized index back to parsed.output_index.normalizeCodexItemEvent() in packages/gateway/src/stream/openai-responses.ts:1530-1624 validates response.output_item.added and response.output_item.done, reconciles parsed.item_id with item.id, resolves or allocates an output index, rejects duplicate added events and conflicting type/identity reuse, synthesizes an added event for a done-only item after deleting content from the seed, reconciles final item fields, binds item IDs and function-call call_id values, and writes the normalized index to parsed.output_index.validateCodexOutputItem() is defined in packages/gateway/src/stream/openai-responses.ts:1303.