Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/klaus/__tests__/thinking.test.ts

Raw
import { describe, expect, it } from "vitest";
import { klausThinkingConfig } from "../src/agent-sdk";

describe("Klaus thinking configuration", () => {
	it("disables thinking when Pi requests none", () => {
		expect(
			klausThinkingConfig({
				modelId: "claude-opus-5",
				thinking: undefined,
				thinkingBudget: 16384,
			}),
		).toEqual({ type: "disabled" });
	});

	it("keeps adaptive models adaptive even with a Pi thinking budget", () => {
		expect(
			klausThinkingConfig({
				modelId: "claude-opus-5",
				thinking: "high",
				thinkingBudget: 16384,
			}),
		).toEqual({ type: "adaptive" });
		expect(
			klausThinkingConfig({
				modelId: "claude-fable-5-1",
				thinking: "xhigh",
				thinkingBudget: 16384,
			}),
		).toEqual({ type: "adaptive" });
		expect(
			klausThinkingConfig({
				modelId: "claude-sonnet-5",
				thinking: "medium",
			}),
		).toEqual({ type: "adaptive" });
	});

	it("pins budget-based models to fixed budgets", () => {
		expect(
			klausThinkingConfig({
				modelId: "claude-haiku-4-5",
				thinking: "medium",
				thinkingBudget: 8192,
			}),
		).toEqual({ type: "enabled", budgetTokens: 8192 });
	});

	it("falls back to klaus default budgets for haiku", () => {
		expect(
			klausThinkingConfig({
				modelId: "claude-haiku-4-5",
				thinking: "high",
			}),
		).toEqual({ type: "enabled", budgetTokens: 16384 });
		expect(
			klausThinkingConfig({
				modelId: "claude-haiku-4-5",
				thinking: "minimal",
			}),
		).toEqual({ type: "enabled", budgetTokens: 1024 });
	});
});