feat: add xhigh thinking level support for gpt-5.2 and gpt-5.2-codex

- Add XHIGH_MODELS constant and getAvailableThinkingLevels() to AgentSession
- Update ThinkingSelectorComponent to accept availableLevels parameter
- Both shift+tab cycling and /thinking command now show xhigh for supported models
- Update types.ts documentation to list supported models
This commit is contained in:
theBucky 2025-12-19 10:54:34 +08:00 committed by Mario Zechner
parent b24a2ec037
commit 4f981d8ebc
4 changed files with 52 additions and 16 deletions

View file

@ -98,6 +98,19 @@ export interface SessionStats {
cost: number;
}
// ============================================================================
// Constants
// ============================================================================
/** Models that support xhigh thinking level */
const XHIGH_MODELS = ["gpt-5.1-codex-max", "gpt-5.2", "gpt-5.2-codex"];
/** Standard thinking levels */
const THINKING_LEVELS: ThinkingLevel[] = ["off", "minimal", "low", "medium", "high"];
/** Thinking levels including xhigh (for supported models) */
const THINKING_LEVELS_WITH_XHIGH: ThinkingLevel[] = ["off", "minimal", "low", "medium", "high", "xhigh"];
// ============================================================================
// AgentSession Class
// ============================================================================
@ -637,12 +650,7 @@ export class AgentSession {
cycleThinkingLevel(): ThinkingLevel | null {
if (!this.supportsThinking()) return null;
const modelId = this.model?.id || "";
const supportsXhigh = modelId.includes("codex-max");
const levels: ThinkingLevel[] = supportsXhigh
? ["off", "minimal", "low", "medium", "high", "xhigh"]
: ["off", "minimal", "low", "medium", "high"];
const levels = this.getAvailableThinkingLevels();
const currentIndex = levels.indexOf(this.thinkingLevel);
const nextIndex = (currentIndex + 1) % levels.length;
const nextLevel = levels[nextIndex];
@ -651,6 +659,21 @@ export class AgentSession {
return nextLevel;
}
/**
* Get available thinking levels for current model.
*/
getAvailableThinkingLevels(): ThinkingLevel[] {
return this.supportsXhighThinking() ? THINKING_LEVELS_WITH_XHIGH : THINKING_LEVELS;
}
/**
* Check if current model supports xhigh thinking level.
*/
supportsXhighThinking(): boolean {
const modelId = this.model?.id || "";
return XHIGH_MODELS.some((m) => modelId === m || modelId.endsWith(`/${m}`));
}
/**
* Check if current model supports thinking/reasoning.
*/