Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

799 B
Raw Blame
/**
 * Initial translate-mode state for createSSEStream (extracted from stream.ts, which is frozen
 * in the file-size baseline).
 *
 * The signature namespace is the connection id scoped by model family, so a thought signature
 * cached from one family is never replayed to the other on a shared connection (#4136 —
 * Antigravity serves Claude and Gemini on one connection).
 */
import { initState } from "../translator/index.ts";
import { scopeGeminiThoughtSignatureNamespace } from "../services/geminiThoughtSignatureStore.ts";

export function initTranslateStreamState(
  sourceFormat: unknown,
  connectionId: string | null | undefined,
  model: unknown
) {
  return {
    ...initState(sourceFormat),
    signatureNamespace: scopeGeminiThoughtSignatureNamespace(connectionId, model),
  };
}