Files
oh-my-pi/packages/ai/test/openai-codex-include.test.ts
T
can1357 8e3e0ebf9e feat: introduced Effort enum and ThinkingConfig for model-aware reasoning
- Introduced Effort enum and ThinkingConfig metadata for per-model reasoning capabilities with min/max effort levels.
- Migrated thinking level API from string-based ThinkingLevel to structured Effort enum across agent and AI packages.
- Added model-thinking module with effort mapping, policy application, and semantic versioning utilities for provider-specific thinking modes.
- Removed supportsXhigh() function and replaced effort clamping with model-aware validation using ThinkingConfig metadata.
- Expanded models.json with thinking configuration objects for 50+ models including Claude, Gemini, and OpenAI variants.
- Added Python analysis scripts for edit tool usage patterns and tool invocation stream processing.
2026-03-06 12:35:01 +01:00

42 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import { enrichModelThinking } from "@oh-my-pi/pi-ai/model-thinking";
import { type RequestBody, transformRequestBody } from "@oh-my-pi/pi-ai/providers/openai-codex/request-transformer";
import type { Model } from "@oh-my-pi/pi-ai/types";
function createCodexModel(id: string): Model<"openai-codex-responses"> {
return enrichModelThinking({
id,
name: id,
api: "openai-codex-responses",
provider: "openai-codex",
baseUrl: "https://api.openai.com/v1",
reasoning: true,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 272000,
maxTokens: 128000,
});
}
describe("openai-codex include handling", () => {
it("always includes reasoning.encrypted_content when caller include is custom", async () => {
const body: RequestBody = {
model: "gpt-5.1-codex",
};
const transformed = await transformRequestBody(body, createCodexModel(body.model), { include: ["foo"] });
expect(transformed.include).toEqual(["foo", "reasoning.encrypted_content"]);
});
it("does not duplicate reasoning.encrypted_content", async () => {
const body: RequestBody = {
model: "gpt-5.1-codex",
};
const transformed = await transformRequestBody(body, createCodexModel(body.model), {
include: ["foo", "reasoning.encrypted_content"],
});
expect(transformed.include).toEqual(["foo", "reasoning.encrypted_content"]);
});
});