mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat(web): align Claude effort options with Claude Code --effort levels (#731)
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`).
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { describe, expect, test } from 'bun:test'
|
||||
import { CLAUDE_EFFORT_LABELS, CLAUDE_EFFORT_LEVELS } from './effort'
|
||||
|
||||
describe('Claude effort constants', () => {
|
||||
test('exposes the Claude Code --effort levels in ascending order', () => {
|
||||
expect(CLAUDE_EFFORT_LEVELS).toEqual(['low', 'medium', 'high', 'xhigh', 'max'])
|
||||
})
|
||||
|
||||
test('every CLAUDE_EFFORT_LEVEL has a label', () => {
|
||||
for (const level of CLAUDE_EFFORT_LEVELS) {
|
||||
expect(CLAUDE_EFFORT_LABELS[level]).toBeDefined()
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
// Effort levels Claude Code's `--effort` flag accepts, in ascending order.
|
||||
// "auto"/null is hapi's sentinel for omitting --effort (model default), not a level here.
|
||||
export const CLAUDE_EFFORT_LABELS = {
|
||||
low: 'Low',
|
||||
medium: 'Medium',
|
||||
high: 'High',
|
||||
xhigh: 'XHigh',
|
||||
max: 'Max'
|
||||
} as const
|
||||
|
||||
export type ClaudeEffortLevel = keyof typeof CLAUDE_EFFORT_LABELS
|
||||
export const CLAUDE_EFFORT_LEVELS = Object.keys(CLAUDE_EFFORT_LABELS) as ClaudeEffortLevel[]
|
||||
@@ -1,6 +1,7 @@
|
||||
export * from './apiTypes'
|
||||
export * from './messages'
|
||||
export * from './buildInfo'
|
||||
export * from './effort'
|
||||
export * from './flavors'
|
||||
export * from './models'
|
||||
export * from './modes'
|
||||
|
||||
Reference in New Issue
Block a user