| 429 | return t4; |
| 430 | } |
| 431 | function cycleEffortLevel(current: EffortLevel, direction: 'left' | 'right', includeMax: boolean): EffortLevel { |
| 432 | const levels: EffortLevel[] = includeMax ? ['low', 'medium', 'high', 'max'] : ['low', 'medium', 'high']; |
| 433 | // If the current level isn't in the cycle (e.g. 'max' after switching to a |
| 434 | // non-Opus model), clamp to 'high'. |
| 435 | const idx = levels.indexOf(current); |
| 436 | const currentIndex = idx !== -1 ? idx : levels.indexOf('high'); |
| 437 | if (direction === 'right') { |
| 438 | return levels[(currentIndex + 1) % levels.length]!; |
| 439 | } else { |
| 440 | return levels[(currentIndex - 1 + levels.length) % levels.length]!; |
| 441 | } |
| 442 | } |
| 443 | function getDefaultEffortLevelForOption(value?: string): EffortLevel { |
| 444 | const resolved = resolveOptionModel(value) ?? getDefaultMainLoopModel(); |
| 445 | const defaultValue = getDefaultEffortForModel(resolved); |