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

1.8 KB
Raw Blame
import test from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname, join } from "node:path";

// #5449: Muse Spark Web (Meta AI) migrated its default session cookie from the retired
// `abra_sess` to `ecto_1_sess` (see META_AI_DEFAULT_COOKIE), but two user-facing strings still
// named the old cookie — the provider form hint and one auth-failure message — telling users to
// paste a cookie that no longer exists. These guards keep the copy aligned with the live cookie.

const __dirname = dirname(fileURLToPath(import.meta.url));
const root = join(__dirname, "..", "..");

const webCookie = readFileSync(
  join(root, "src", "shared", "constants", "providers", "web-cookie.ts"),
  "utf8"
);
const executor = readFileSync(join(root, "open-sse", "executors", "muse-spark-web.ts"), "utf8");

test("provider form hint points at the live ecto_1_sess cookie, not retired abra_sess", () => {
  // #9502: the hint now names BOTH the ecto_1_sess cookie and the ecto1: WS auth
  // token; the live-cookie-name guard (ecto_1_sess present, retired abra_sess
  // absent) still holds.
  assert.ok(webCookie.includes("ecto_1_sess"), "muse-spark authHint must name ecto_1_sess");
  assert.ok(
    !/Paste your abra_sess/.test(webCookie),
    "muse-spark authHint must not name the retired abra_sess cookie"
  );
});

test("auth-failure message names the live ecto_1_sess cookie, not retired abra_sess", () => {
  assert.ok(
    !executor.includes("meta.ai abra_sess cookie may be missing"),
    "the 401 message must not name the retired abra_sess cookie"
  );
  assert.ok(
    executor.includes("meta.ai ecto_1_sess cookie may be missing"),
    "the 401 message must name the live ecto_1_sess cookie"
  );
});