Files
EJClaw/apps/dashboard/src/settings-options.ts
Eyejoker fd3145e2a7 feat: refresh dashboard settings UX and Codex feature toggles (#153)
* feat: refresh dashboard settings UX and Codex feature toggles

Improve settings/tasks mobile layout, model effort validation by agent type, and preset models for GPT 5.5 and Opus 4.7. Store Codex fast mode and goals in config.toml with Claude fastMode session sync and updated docs for Codex 0.133.

Co-authored-by: Cursor <cursoragent@cursor.com>

* style: apply pre-commit formatting after dashboard settings commit

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-23 12:18:42 +09:00

71 lines
1.8 KiB
TypeScript

export const PRESET_MODELS = {
codex: ['gpt-5.5', 'gpt-5.5-pro', 'gpt-5.4', 'gpt-5.3-codex'],
claude: ['claude-opus-4-7', 'claude-opus-4-6', 'claude-sonnet-4-6'],
} as const;
export type AgentType = 'claude-code' | 'codex';
export const CODEX_EFFORT_VALUES = [
'',
'low',
'medium',
'high',
'xhigh',
'max',
] as const;
export const CLAUDE_EFFORT_VALUES = [
'',
'low',
'medium',
'high',
'max',
] as const;
/** @deprecated Use agent-specific lists via effortValuesForAgent */
export const EFFORT_VALUES = CODEX_EFFORT_VALUES;
export type EffortValue = (typeof CODEX_EFFORT_VALUES)[number];
export function effortValuesForAgent(
agentType: AgentType,
): readonly EffortValue[] {
return agentType === 'claude-code'
? CLAUDE_EFFORT_VALUES
: CODEX_EFFORT_VALUES;
}
export function isEffortSupported(
agentType: AgentType | null | undefined,
effort: string,
): boolean {
if (!effort) return true;
if (!agentType) return true;
return effortValuesForAgent(agentType).includes(effort as EffortValue);
}
export function formatEffortOption(
value: EffortValue,
localizedLabel: string,
): string {
if (value === '') return localizedLabel;
return `${localizedLabel} (${value})`;
}
export function buildModelOptions(current: string): string[] {
const presets = [...PRESET_MODELS.codex, ...PRESET_MODELS.claude];
const trimmed = current.trim();
if (!trimmed || presets.includes(trimmed as (typeof presets)[number])) {
return [...presets];
}
return [trimmed, ...presets.filter((model) => model !== trimmed)];
}
export function isPresetModel(model: string): boolean {
const trimmed = model.trim();
return (
(PRESET_MODELS.codex as readonly string[]).includes(trimmed) ||
(PRESET_MODELS.claude as readonly string[]).includes(trimmed)
);
}