generated from nhcarrigan/template
feat: expose effort level setting in UI (#269)
Adds `--effort <level>` CLI flag support with a dropdown selector in the config sidebar. Valid options are low, medium, high, xhigh (Opus 4.7 only), and max.
This commit is contained in:
@@ -70,6 +70,11 @@ pub struct ClaudeStartOptions {
|
|||||||
/// Sets `ANTHROPIC_CUSTOM_MODEL_OPTION` env var for custom model providers (v2.1.81+).
|
/// Sets `ANTHROPIC_CUSTOM_MODEL_OPTION` env var for custom model providers (v2.1.81+).
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub custom_model_option: Option<String>,
|
pub custom_model_option: Option<String>,
|
||||||
|
|
||||||
|
/// Passes `--effort <level>` to set the effort level (v2.1.111+).
|
||||||
|
/// Valid values: "low", "medium", "high", "xhigh" (Opus 4.7 only), "max". None uses CLI default.
|
||||||
|
#[serde(default)]
|
||||||
|
pub effort_level: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
@@ -236,6 +241,11 @@ pub struct HikariConfig {
|
|||||||
/// Sets `ANTHROPIC_CUSTOM_MODEL_OPTION` env var for custom model providers (v2.1.81+).
|
/// Sets `ANTHROPIC_CUSTOM_MODEL_OPTION` env var for custom model providers (v2.1.81+).
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub custom_model_option: Option<String>,
|
pub custom_model_option: Option<String>,
|
||||||
|
|
||||||
|
/// Passes `--effort <level>` to set the effort level (v2.1.111+).
|
||||||
|
/// Valid values: "low", "medium", "high", "xhigh" (Opus 4.7 only), "max". None uses CLI default.
|
||||||
|
#[serde(default)]
|
||||||
|
pub effort_level: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HikariConfig {
|
impl Default for HikariConfig {
|
||||||
@@ -291,6 +301,7 @@ impl Default for HikariConfig {
|
|||||||
bare_mode: false,
|
bare_mode: false,
|
||||||
show_clear_context_on_plan_accept: true,
|
show_clear_context_on_plan_accept: true,
|
||||||
custom_model_option: None,
|
custom_model_option: None,
|
||||||
|
effort_level: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -508,6 +519,7 @@ mod tests {
|
|||||||
bare_mode: false,
|
bare_mode: false,
|
||||||
show_clear_context_on_plan_accept: true,
|
show_clear_context_on_plan_accept: true,
|
||||||
custom_model_option: None,
|
custom_model_option: None,
|
||||||
|
effort_level: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let json = serde_json::to_string(&config).unwrap();
|
let json = serde_json::to_string(&config).unwrap();
|
||||||
|
|||||||
@@ -308,6 +308,14 @@ impl WslBridge {
|
|||||||
cmd.arg("--bare");
|
cmd.arg("--bare");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add effort level if specified (v2.1.111+)
|
||||||
|
if let Some(ref level) = options.effort_level {
|
||||||
|
if !level.is_empty() {
|
||||||
|
cmd.arg("--effort");
|
||||||
|
cmd.arg(level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Pass combined settings via --settings flag if any settings are specified
|
// Pass combined settings via --settings flag if any settings are specified
|
||||||
{
|
{
|
||||||
let has_memory_dir = options
|
let has_memory_dir = options
|
||||||
@@ -532,6 +540,13 @@ impl WslBridge {
|
|||||||
claude_cmd.push_str(" --bare");
|
claude_cmd.push_str(" --bare");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add effort level if specified (v2.1.111+)
|
||||||
|
if let Some(ref level) = options.effort_level {
|
||||||
|
if !level.is_empty() {
|
||||||
|
claude_cmd.push_str(&format!(" --effort {}", level));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Pass combined settings via --settings flag if any settings are specified
|
// Pass combined settings via --settings flag if any settings are specified
|
||||||
{
|
{
|
||||||
let has_memory_dir = options
|
let has_memory_dir = options
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ async function changeDirectory(path: string): Promise<void> {
|
|||||||
bare_mode: config.bare_mode ?? false,
|
bare_mode: config.bare_mode ?? false,
|
||||||
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
||||||
custom_model_option: config.custom_model_option || null,
|
custom_model_option: config.custom_model_option || null,
|
||||||
|
effort_level: config.effort_level || null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -164,6 +165,7 @@ async function startNewConversation(): Promise<void> {
|
|||||||
bare_mode: config.bare_mode ?? false,
|
bare_mode: config.bare_mode ?? false,
|
||||||
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
||||||
custom_model_option: config.custom_model_option || null,
|
custom_model_option: config.custom_model_option || null,
|
||||||
|
effort_level: config.effort_level || null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
task_loop_auto_commit: false,
|
task_loop_auto_commit: false,
|
||||||
task_loop_commit_prefix: "feat",
|
task_loop_commit_prefix: "feat",
|
||||||
task_loop_include_summary: false,
|
task_loop_include_summary: false,
|
||||||
|
effort_level: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
let showCustomThemeEditor = $state(false);
|
let showCustomThemeEditor = $state(false);
|
||||||
@@ -716,6 +717,29 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Effort Level -->
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="block text-sm text-[var(--text-primary)] mb-1" for="effort-level"
|
||||||
|
>Effort level</label
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
id="effort-level"
|
||||||
|
bind:value={config.effort_level}
|
||||||
|
class="w-full px-3 py-2 rounded border border-[var(--border-color)] bg-[var(--bg-primary)] text-[var(--text-primary)] text-sm focus:outline-none focus:ring-1 focus:ring-[var(--accent-primary)]"
|
||||||
|
>
|
||||||
|
<option value={null}>Default (CLI decides)</option>
|
||||||
|
<option value="low">Low</option>
|
||||||
|
<option value="medium">Medium</option>
|
||||||
|
<option value="high">High</option>
|
||||||
|
<option value="xhigh">Extra High (Opus 4.7 only)</option>
|
||||||
|
<option value="max">Max</option>
|
||||||
|
</select>
|
||||||
|
<p class="text-xs text-[var(--text-tertiary)] mt-1">
|
||||||
|
Passes <code class="font-mono">--effort</code> to tune speed vs. intelligence. Requires Claude
|
||||||
|
Code v2.1.111+.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Bare Mode -->
|
<!-- Bare Mode -->
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label class="flex items-center gap-3 cursor-pointer">
|
<label class="flex items-center gap-3 cursor-pointer">
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
bare_mode: config.bare_mode ?? false,
|
bare_mode: config.bare_mode ?? false,
|
||||||
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
||||||
custom_model_option: config.custom_model_option || null,
|
custom_model_option: config.custom_model_option || null,
|
||||||
|
effort_level: config.effort_level || null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -412,6 +412,7 @@ User: ${formattedMessage}`;
|
|||||||
bare_mode: config.bare_mode ?? false,
|
bare_mode: config.bare_mode ?? false,
|
||||||
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
||||||
custom_model_option: config.custom_model_option || null,
|
custom_model_option: config.custom_model_option || null,
|
||||||
|
effort_level: config.effort_level || null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,7 @@
|
|||||||
bare_mode: config.bare_mode ?? false,
|
bare_mode: config.bare_mode ?? false,
|
||||||
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
||||||
custom_model_option: config.custom_model_option || null,
|
custom_model_option: config.custom_model_option || null,
|
||||||
|
effort_level: config.effort_level || null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,7 @@
|
|||||||
bare_mode: false,
|
bare_mode: false,
|
||||||
show_clear_context_on_plan_accept: true,
|
show_clear_context_on_plan_accept: true,
|
||||||
custom_model_option: null,
|
custom_model_option: null,
|
||||||
|
effort_level: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
let streamerModeActive = $state(false);
|
let streamerModeActive = $state(false);
|
||||||
@@ -189,6 +190,7 @@
|
|||||||
show_clear_context_on_plan_accept:
|
show_clear_context_on_plan_accept:
|
||||||
currentConfig.show_clear_context_on_plan_accept ?? true,
|
currentConfig.show_clear_context_on_plan_accept ?? true,
|
||||||
custom_model_option: currentConfig.custom_model_option || null,
|
custom_model_option: currentConfig.custom_model_option || null,
|
||||||
|
effort_level: currentConfig.effort_level || null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -357,6 +359,7 @@
|
|||||||
show_clear_context_on_plan_accept:
|
show_clear_context_on_plan_accept:
|
||||||
currentConfig.show_clear_context_on_plan_accept ?? true,
|
currentConfig.show_clear_context_on_plan_accept ?? true,
|
||||||
custom_model_option: currentConfig.custom_model_option || null,
|
custom_model_option: currentConfig.custom_model_option || null,
|
||||||
|
effort_level: currentConfig.effort_level || null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -228,6 +228,7 @@
|
|||||||
bare_mode: cfg.bare_mode ?? false,
|
bare_mode: cfg.bare_mode ?? false,
|
||||||
show_clear_context_on_plan_accept: cfg.show_clear_context_on_plan_accept ?? true,
|
show_clear_context_on_plan_accept: cfg.show_clear_context_on_plan_accept ?? true,
|
||||||
custom_model_option: cfg.custom_model_option || null,
|
custom_model_option: cfg.custom_model_option || null,
|
||||||
|
effort_level: cfg.effort_level || null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -118,6 +118,7 @@
|
|||||||
bare_mode: config.bare_mode ?? false,
|
bare_mode: config.bare_mode ?? false,
|
||||||
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
show_clear_context_on_plan_accept: config.show_clear_context_on_plan_accept ?? true,
|
||||||
custom_model_option: config.custom_model_option || null,
|
custom_model_option: config.custom_model_option || null,
|
||||||
|
effort_level: config.effort_level || null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ describe("config store", () => {
|
|||||||
bare_mode: false,
|
bare_mode: false,
|
||||||
show_clear_context_on_plan_accept: true,
|
show_clear_context_on_plan_accept: true,
|
||||||
custom_model_option: null,
|
custom_model_option: null,
|
||||||
|
effort_level: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(config.model).toBe("claude-sonnet-4");
|
expect(config.model).toBe("claude-sonnet-4");
|
||||||
@@ -297,6 +298,7 @@ describe("config store", () => {
|
|||||||
bare_mode: false,
|
bare_mode: false,
|
||||||
show_clear_context_on_plan_accept: true,
|
show_clear_context_on_plan_accept: true,
|
||||||
custom_model_option: null,
|
custom_model_option: null,
|
||||||
|
effort_level: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(config.model).toBeNull();
|
expect(config.model).toBeNull();
|
||||||
@@ -920,6 +922,7 @@ describe("config store", () => {
|
|||||||
bare_mode: false,
|
bare_mode: false,
|
||||||
show_clear_context_on_plan_accept: true,
|
show_clear_context_on_plan_accept: true,
|
||||||
custom_model_option: null,
|
custom_model_option: null,
|
||||||
|
effort_level: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const mockInvokeImpl = vi.mocked(invoke);
|
const mockInvokeImpl = vi.mocked(invoke);
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ export interface HikariConfig {
|
|||||||
show_clear_context_on_plan_accept: boolean;
|
show_clear_context_on_plan_accept: boolean;
|
||||||
// Custom model option env var (v2.1.81+)
|
// Custom model option env var (v2.1.81+)
|
||||||
custom_model_option: string | null;
|
custom_model_option: string | null;
|
||||||
|
// Effort level for Claude Code (v2.1.111+) — null means use CLI default
|
||||||
|
effort_level: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultConfig: HikariConfig = {
|
const defaultConfig: HikariConfig = {
|
||||||
@@ -161,6 +163,7 @@ const defaultConfig: HikariConfig = {
|
|||||||
bare_mode: false,
|
bare_mode: false,
|
||||||
show_clear_context_on_plan_accept: true,
|
show_clear_context_on_plan_accept: true,
|
||||||
custom_model_option: null,
|
custom_model_option: null,
|
||||||
|
effort_level: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
function createConfigStore() {
|
function createConfigStore() {
|
||||||
|
|||||||
Reference in New Issue
Block a user