mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-02 13:22:11 +03:00
* fix(reasoning): sanitize streamed K3 think tags * refactor(stream): move think-tag helpers into thinkTagParser leaf module open-sse/utils/stream.ts is frozen at 2887 lines with zero headroom, and the kimi-coding-apikey think-tag handling added here pushed it to 2951. The parsing half of that work has no SSE dependency, so it moves to thinkTagParser.ts (an unfrozen leaf): the open-tag lookahead predicate and the end-of-stream flush delta assembly. stream.ts keeps only the SSE envelope - enqueue, payload collection, logging. Getting back under the frozen ceiling needed more than just the PR's own added lines, since even the fully self-gating helpers still cost a handful of call-site lines stream.ts has zero room for. Along the way this also deduplicates a synthetic chat-completion-chunk literal that was copy-pasted three times in stream.ts (textual tool-call flush, think-tag flush, terminal finish_reason synthesis) into one buildSyntheticChatChunk() in streamHelpers.ts - pure DRY, no behavior change. Behavior is unchanged: same tests, same counts. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: rinseaid <rinseaid@rinseaid.net> Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com> Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>