Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

1.1 KB
Raw Blame
import { expect, it } from "vitest";
import { contextWindowFor } from "../context-budget.ts";
import { foldBackstop } from "../host/conversation-compaction.ts";
import { autoCompactWindow } from "./claude.ts";
import { endpointModelCatalog } from "./claude-model-extras.ts";

it.each(["claude/claude-haiku-5-5[1m]", "claude/claude-sonnet-5-5[1m]", "claude-haiku-5-5[1m]"])(
  "folds a non-Opus [1m] Claude model below the 200K window Claude Code compacts at (%s)", (model) => {
    const nativeCompactAt = Number(autoCompactWindow({}, model));
    expect(nativeCompactAt).toBe(200_000);
    expect(foldBackstop(contextWindowFor(model, endpointModelCatalog([model]) ?? undefined), nativeCompactAt)).toBe(190_000);
  });

it("reads a gateway model's window from its catalog instead of the 128K default", () => {
  const model = "workbuddy/deepseek-v4.1-flash[1m]";
  expect(contextWindowFor(model, endpointModelCatalog([model]) ?? undefined)).toBe(128_000);
  expect(contextWindowFor(model, endpointModelCatalog([model], { [model]: 1_000_000 }) ?? undefined)).toBe(1_000_000);
});