mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
The Claude effort selector (New Session config + in-session composer) only offered auto/medium/high/max, missing `low` and `xhigh` — yet `claude --effort` actually accepts low/medium/high/xhigh/max. Add the two missing levels in both places so the selector faithfully mirrors the CLI. Extract the level list + labels into one shared constant (@hapi/protocol: shared/src/effort.ts, mirroring CLAUDE_MODEL_PRESETS) so the two UIs derive from a single source and can't drift again. No backend change: the effort string is free-form end-to-end through to the --effort flag. ultracode is intentionally excluded — it is a TUI-only /effort session setting, not an --effort value (the CLI rejects `--effort ultracode`).
25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { normalizeClaudeSessionEffort } from './effort'
|
|
|
|
describe('normalizeClaudeSessionEffort', () => {
|
|
it('returns null when effort is missing', () => {
|
|
expect(normalizeClaudeSessionEffort()).toBeNull()
|
|
})
|
|
|
|
it('returns null for auto-like values', () => {
|
|
expect(normalizeClaudeSessionEffort('')).toBeNull()
|
|
expect(normalizeClaudeSessionEffort('auto')).toBeNull()
|
|
expect(normalizeClaudeSessionEffort('default')).toBeNull()
|
|
expect(normalizeClaudeSessionEffort(' AUTO ')).toBeNull()
|
|
})
|
|
|
|
it('normalizes supported effort values', () => {
|
|
expect(normalizeClaudeSessionEffort('low')).toBe('low')
|
|
expect(normalizeClaudeSessionEffort('medium')).toBe('medium')
|
|
expect(normalizeClaudeSessionEffort('high')).toBe('high')
|
|
expect(normalizeClaudeSessionEffort('xhigh')).toBe('xhigh')
|
|
expect(normalizeClaudeSessionEffort('max')).toBe('max')
|
|
expect(normalizeClaudeSessionEffort(' High ')).toBe('high')
|
|
})
|
|
})
|