Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat: add per-bot reasoning controls across clients

leepokaibff49180fb6e
diff --git a/apps/android/WhatsNew.md b/apps/android/WhatsNew.md
index 98748716..5b1a3ff8 100644
--- a/apps/android/WhatsNew.md
+++ b/apps/android/WhatsNew.md
@@ -7,6 +7,14 @@ released version's section; a version without one gets the PRs' "What's New: And
else a generic "Bug fixes and improvements" line. Delete old sections.
-->
+## 2.29.0
+
+### zh-Hant
+- Agent、模型、推理強度與 Fast mode 整合成可收合的精簡設定;每個 Bot 可獨立保存推理強度,Default 也會顯示預設值。
+
+### en-US
+- Agent, model, reasoning effort and Fast mode now share compact, expandable settings. Each bot keeps its own effort preference, with the default level shown.
+
## 2.28.0
### zh-Hant
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt b/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt
index c3e7cfaa..0805bc77 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/AgentModelPicker.kt
@@ -1,11 +1,19 @@
package com.codync.android
+import androidx.compose.animation.animateContentSize
+import androidx.compose.animation.Crossfade
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.horizontalScroll
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.heightIn
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
-import androidx.compose.foundation.layout.size
-import androidx.compose.foundation.layout.widthIn
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -16,7 +24,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.codync.android.core.AgentModels
import com.codync.android.core.Bot
@@ -24,13 +31,17 @@ import com.codync.android.core.LinkState
import com.codync.android.design.*
import kotlinx.coroutines.CancellationException
+private enum class PickerStage { Closed, Agents, Models, Settings }
+
/**
* Models come from the selected computer's agent, never a bundled list (iOS `AgentModelPicker`).
* The selected model's settings follow it; Fast mode is its own row while the agent offers it. Without [setFast] (a
* fallback's model), the bot's own session and Fast mode don't apply, so neither shows.
*/
@Composable internal fun AgentModelPicker(state: AppState, load: suspend (String) -> AgentModels, backend: String, selection: String?,
- options: Map<String, String>, fastMode: Boolean, bot: Bot?, choose: (String?, Map<String, String>) -> Unit, setFast: ((Boolean) -> Unit)?) {
+ options: Map<String, String>, fastMode: Boolean, bot: Bot?, choose: (String?, Map<String, String>) -> Unit, setFast: ((Boolean) -> Unit)?,
+ agents: List<Pair<String, String>> = emptyList(), chooseAgent: ((String) -> Unit)? = null,
+ agentDetails: @Composable () -> Unit = {}) {
val online = state.actualConnection is LinkState.Ready
var catalog by remember(backend) { mutableStateOf<AgentModels?>(null) }
var loading by remember(backend) { mutableStateOf(false) }
@@ -46,41 +57,78 @@ import kotlinx.coroutines.CancellationException
catch (error: Exception) { failure = "Couldn't load models: ${error.message ?: "Try again."}" }
finally { loading = false }
}
+ var stage by remember { mutableStateOf(PickerStage.Closed) }
+ var query by remember { mutableStateOf("") }
+ fun open(next: PickerStage) { query = ""; stage = next }
// The agent's own "Default" entry is the same choice as no model.
val agentDefault = catalog?.agentDefault
val value = if (selection == agentDefault?.id) "" else selection.orEmpty()
- val modelOptions = catalog?.models?.firstOrNull { it.id == value }?.options.orEmpty()
- Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
- Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- Text("Model", style = Type.body, color = Palette.text)
- Box(Modifier.weight(1f))
- if (backend != "custom") Box(Modifier.size(36.dp), contentAlignment = Alignment.Center) {
- if (loading) Spinner(12.dp) else IconButton(if (failure == null) "Refresh model list" else "Retry model list", "arrow.clockwise") { retry++ }
+ val selectedModel = catalog?.models?.firstOrNull { it.id == (selection ?: agentDefault?.id ?: catalog?.currentModelId) }
+ val modelOptions = if (value.isNotEmpty() || catalog?.defaultModelOptions == true) selectedModel?.options.orEmpty() else emptyList()
+ val modelChoices = catalog?.options(selection)?.map { it.id.orEmpty() to it.name } ?: listOf("" to "Default")
+ val agentName = agents.firstOrNull { it.first == backend }?.second ?: backend
+ val modelName = if (value.isEmpty()) "Default" else modelChoices.firstOrNull { it.first == value }?.second ?: value
+ val levels = modelOptions.mapNotNull { option -> option.values.firstOrNull { it.id == (options[option.id] ?: option.default) }?.name }
+ val summary = (listOf(agentName, modelName) + levels + if (fastMode) listOf("Fast") else emptyList()).joinToString(" · ")
+ Column(Modifier.fillMaxWidth().animateContentSize(Motion.layoutSize), verticalArrangement = Arrangement.spacedBy(8.dp)) {
+ Row(Modifier.fillMaxWidth().clickable { open(if (stage == PickerStage.Closed) PickerStage.Models else PickerStage.Closed) }.padding(vertical = 8.dp),
+ verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
+ Crossfade(summary, Modifier.weight(1f), animationSpec = Motion.fade(), label = "Agent summary") { text ->
+ Text(text, style = Type.subheadline, color = Palette.text)
+ }
+ Symbol(if (stage == PickerStage.Closed) "chevron.down" else "chevron.up", size = 12.dp, tint = Palette.secondary)
+ }
+ if (stage != PickerStage.Closed) {
+ Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ if (chooseAgent != null) LinkButton(agentName, Modifier.weight(1f)) { open(if (stage == PickerStage.Agents) PickerStage.Settings else PickerStage.Agents) }
+ LinkButton(modelName, Modifier.weight(1f)) { open(if (stage == PickerStage.Models) PickerStage.Settings else PickerStage.Models) }
}
- if (backend == "custom" || (!loading && catalog?.models.isNullOrEmpty())) {
- Box(Modifier.widthIn(max = 180.dp).outline().pill(androidx.compose.ui.graphics.Color.Transparent)) {
- PlainTextField(value, { choose(it.ifEmpty { null }, emptyMap()) }, prompt = "Default", singleLine = true,
- style = Type.body.copy(textAlign = TextAlign.End))
+ agentDetails()
+ if (stage == PickerStage.Agents || stage == PickerStage.Models) {
+ Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(6.dp)) {
+ if (stage == PickerStage.Models && chooseAgent != null) IconButton("Back", "chevron.left") { open(PickerStage.Agents) }
+ Box(Modifier.weight(1f)) { PlainTextField(query, { query = it }, prompt = if (stage == PickerStage.Agents) "Search agents" else "Search models", singleLine = true) }
+ if (loading) Spinner(12.dp) else IconButton("Refresh model list", "arrow.clockwise") { retry++ }
}
- } else {
- val choices = catalog?.options(selection)?.map { it.id.orEmpty() to it.name } ?: listOf("" to "Default")
- ChoicePicker(value, choices, { if (it != value) choose(it.ifEmpty { null }, emptyMap()) }, label = "Model")
+ val choices = (if (stage == PickerStage.Agents) agents else modelChoices).filter { it.second.contains(query, ignoreCase = true) }
+ Column(Modifier.heightIn(max = 180.dp).verticalScroll(rememberScrollState())) {
+ for ((id, name) in choices) Row(Modifier.fillMaxWidth().clickable {
+ if (stage == PickerStage.Agents) { if (id != backend) chooseAgent?.invoke(id); open(PickerStage.Models) }
+ else { if (id != value) choose(id.ifEmpty { null }, emptyMap()); open(PickerStage.Settings) }
+ }.padding(horizontal = 6.dp, vertical = 10.dp), verticalAlignment = Alignment.CenterVertically) {
+ Text(name, Modifier.weight(1f), style = Type.body, color = Palette.text)
+ if (id == if (stage == PickerStage.Agents) backend else value) Symbol("checkmark", size = 12.dp, tint = Palette.text)
+ }
+ if (choices.isEmpty()) Text("No results", style = Type.caption, color = Palette.secondary)
+ }
+ if (stage == PickerStage.Models && (backend == "custom" || (!loading && catalog?.models.isNullOrEmpty())))
+ PlainTextField(value, { choose(it.ifEmpty { null }, emptyMap()) }, prompt = "Default", singleLine = true)
+ }
+ for (option in modelOptions) {
+ if (option.isReasoning) {
+ ReasoningSlider(option, options[option.id]) { level ->
+ choose(selection, if (level == null) options - option.id else options + (option.id to level))
+ }
+ } else {
+ Row(verticalAlignment = Alignment.CenterVertically) {
+ Text(option.name, Modifier.weight(1f), style = Type.caption, color = Palette.secondary)
+ val fallback = option.values.firstOrNull { it.id == option.default }?.name
+ LinkButton("Default" + (fallback?.let { " · $it" } ?: "") + if (options[option.id] == null) " ✓" else "",
+ style = Type.caption) { choose(selection, options - option.id) }
+ }
+ if (option.values.isNotEmpty()) Row(Modifier.horizontalScroll(rememberScrollState())) {
+ SegmentedChoice(options[option.id] ?: option.default.orEmpty(), option.values.map { it.id to it.name },
+ { choose(selection, options + (option.id to it)) }, Modifier.width((option.values.size * 75).dp))
+ }
+ }
+ }
+ selectedModel?.optionsError?.let { Text(it, style = Type.caption, color = Palette.warning) }
+ failure?.let { Text(it, style = Type.caption, color = Palette.warning) }
+ if (setFast != null) {
+ val showsFast = (backend != "custom" && catalog?.fastMode == true) || fastMode || (bot?.backend == backend && bot.fastModeShown)
+ if (showsFast) SwitchRow("Fast mode", bot?.fastModeRefusal.orEmpty(), fastMode, setFast)
+ Text("Changing the model starts a new agent session. Chat history is kept.", style = Type.caption, color = Palette.secondary)
}
- }
- for (option in modelOptions) Row(verticalAlignment = Alignment.CenterVertically) {
- Text(option.name, Modifier.weight(1f), style = Type.body, color = Palette.text)
- val fallback = option.values.firstOrNull { it.id == option.default }?.name
- ChoicePicker(options[option.id].orEmpty(), listOf("" to (fallback?.let { "Default · $it" } ?: "Default")) + option.values.map { it.id to it.name },
- { picked -> choose(selection, if (picked.isEmpty()) options - option.id else options + (option.id to picked)) }, label = option.name)
- }
- val note = failure
- if (backend != "custom" && !loading && note != null) Text(note, style = Type.caption, color = Palette.warning)
- else if (backend != "custom" && !loading && catalog?.models?.isEmpty() == true)
- Text("This agent doesn't advertise a model list. Leave Default or enter a model ID.", style = Type.caption, color = Palette.secondary)
- if (setFast != null) {
- Text("Changing the model starts a new agent session. Chat history is kept.", style = Type.caption, color = Palette.secondary)
- val showsFast = (backend != "custom" && catalog?.fastMode == true) || fastMode || (bot?.backend == backend && bot.fastModeShown)
- if (showsFast) SwitchRow("Fast mode", bot?.fastModeRefusal ?: "Faster replies for more usage, on models that offer it.", fastMode, setFast)
}
}
}
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt b/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt
index 0f4467f1..62c05420 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/BotSettingsForm.kt
@@ -125,23 +125,18 @@ private fun CardRows.computerRow(state: AppState, online: Boolean) = row {
/** The agent, its model and the fallbacks that carry on for it. */
private fun CardRows.agentRows(state: AppState, store: AppStore, draft: BotDraft, change: (BotDraft) -> Unit, bot: Bot?, addFallback: () -> Unit) {
- row {
- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
- val rest = bot?.restOf(draft.backend)
- ValueRow("Agent", detail = rest?.line(RelativeTime.clock(rest.until))) {
- ChoicePicker(draft.backend, agentChoices(state) + ("custom" to "Custom command"),
- { if (it != draft.backend) change(draft.withAgent(it)) }, label = "Agent")
- }
- backends(state).firstOrNull { it.text("id") == draft.backend && !it.available }?.text("installHint")?.takeIf(String::isNotBlank)?.let {
- Text(it, style = Type.caption, color = Palette.warning)
- }
- if (draft.backend == "custom") FieldBox(draft.command.orEmpty(), { change(draft.copy(command = it.ifEmpty { null })) },
- "ACP command, e.g. my-agent --acp", style = Type.callout.monospaced, capitalize = false)
- }
- }
row {
AgentModelPicker(state, store::agentModels, draft.backend, draft.model, draft.modelOptions, draft.fastMode ?: false, bot,
- { model, options -> change(draft.copy(model = model, modelOptions = options)) }, { change(draft.copy(fastMode = it)) })
+ { model, options -> change(draft.copy(model = model, modelOptions = options)) }, { change(draft.copy(fastMode = it)) },
+ agents = agentChoices(state) + ("custom" to "Custom command"),
+ chooseAgent = { if (it != draft.backend) change(draft.withAgent(it)) }) {
+ bot?.restOf(draft.backend)?.let { Text(it.line(RelativeTime.clock(it.until)), style = Type.caption, color = Palette.secondary) }
+ backends(state).firstOrNull { it.text("id") == draft.backend && !it.available }?.text("installHint")?.takeIf(String::isNotBlank)?.let {
+ Text(it, style = Type.caption, color = Palette.warning)
+ }
+ if (draft.backend == "custom") FieldBox(draft.command.orEmpty(), { change(draft.copy(command = it.ifEmpty { null })) },
+ "ACP command, e.g. my-agent --acp", style = Type.callout.monospaced, capitalize = false)
+ }
}
// Only from a host that has fallbacks (its bots say).
val list = draft.fallbacks ?: return
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/FallbackRows.kt b/apps/android/app/src/main/kotlin/com/codync/android/FallbackRows.kt
index 7b5a30bc..e20e99ea 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/FallbackRows.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/FallbackRows.kt
@@ -121,8 +121,7 @@ private fun fallbackChoices(state: AppState, own: String, list: List<Fallback>)
}
Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(20.dp)) {
CardSection {
- row { ValueRow("Agent") { ChoicePicker(backend, choices, { backend = it }, label = "Agent") } }
- row { AgentModelPicker(state, store::agentModels, backend, model, options, false, null, { id, picked -> model = id; options = picked }, null) }
+ row { AgentModelPicker(state, store::agentModels, backend, model, options, false, null, { id, picked -> model = id; options = picked }, null, agents = choices, chooseAgent = { backend = it }) }
}
}
}
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/ReasoningSlider.kt b/apps/android/app/src/main/kotlin/com/codync/android/ReasoningSlider.kt
new file mode 100644
index 00000000..c629c29c
--- /dev/null
+++ b/apps/android/app/src/main/kotlin/com/codync/android/ReasoningSlider.kt
@@ -0,0 +1,78 @@
+package com.codync.android
+
+import androidx.compose.animation.Crossfade
+import androidx.compose.animation.core.animateFloatAsState
+import androidx.compose.foundation.Canvas
+import androidx.compose.foundation.gestures.awaitEachGesture
+import androidx.compose.foundation.gestures.awaitFirstDown
+import androidx.compose.foundation.gestures.drag
+import androidx.compose.foundation.layout.*
+import androidx.compose.material3.Text
+import androidx.compose.runtime.*
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.geometry.CornerRadius
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.input.pointer.pointerInput
+import androidx.compose.ui.semantics.*
+import androidx.compose.ui.unit.dp
+import com.codync.android.core.ModelOption
+import com.codync.android.design.*
+import kotlin.math.roundToInt
+
+/** Discrete reasoning levels from the harness; other model options retain their own controls. */
+@Composable internal fun ReasoningSlider(option: ModelOption, value: String?, choose: (String?) -> Unit) {
+ val index = option.values.indexOfFirst { it.id == (value ?: option.default) }
+ val last = (option.values.size - 1).coerceAtLeast(1)
+ val name = option.values.getOrNull(index)?.name.orEmpty()
+ val chooseCurrent by rememberUpdatedState(choose)
+ val position by animateFloatAsState(index.coerceAtLeast(0).toFloat() / last, Motion.hover(), label = "Reasoning position")
+ val track = Palette.surface
+ val ink = Palette.text
+ val dots = Palette.secondary
+ Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
+ Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ Text(option.name, style = Type.caption, color = Palette.secondary)
+ Box(Modifier.weight(1f), contentAlignment = Alignment.Center) {
+ Crossfade(name, animationSpec = Motion.fade(), label = "Reasoning level") { text ->
+ Text(text, style = Type.subheadline, color = Palette.text)
+ }
+ }
+ LinkButton("Default", style = Type.caption) { choose(null) }
+ Symbol(if (value == null) "checkmark" else "arrow.counterclockwise", size = 10.dp, tint = Palette.secondary)
+ }
+ Canvas(Modifier.fillMaxWidth().height(36.dp)
+ .semantics {
+ contentDescription = option.name
+ stateDescription = name.ifEmpty { "Default" }
+ progressBarRangeInfo = ProgressBarRangeInfo(index.coerceAtLeast(0).toFloat(), 0f..last.toFloat(), (last - 1).coerceAtLeast(0))
+ setProgress { progress ->
+ option.values.getOrNull(progress.roundToInt().coerceIn(0, last))?.let { chooseCurrent(it.id) }
+ true
+ }
+ }
+ .pointerInput(option.id, option.values) {
+ fun pick(x: Float) {
+ val radius = 15.dp.toPx()
+ val travel = (size.width - radius * 2).coerceAtLeast(1f)
+ val stop = (((x - radius) / travel).coerceIn(0f, 1f) * last).roundToInt()
+ option.values.getOrNull(stop)?.let { chooseCurrent(it.id) }
+ }
+ awaitEachGesture {
+ val down = awaitFirstDown()
+ pick(down.position.x)
+ drag(down.id) { change -> pick(change.position.x); change.consume() }
+ }
+ }) {
+ val radius = 15.dp.toPx()
+ val travel = (size.width - radius * 2).coerceAtLeast(0f)
+ val center = size.height / 2
+ val left = position * travel
+ drawRoundRect(track, Offset(0f, center - radius), Size(size.width, radius * 2), CornerRadius(radius))
+ if (index >= 0) drawRoundRect(ink.copy(alpha = .14f), Offset(0f, center - radius), Size(left + radius * 2, radius * 2), CornerRadius(radius))
+ option.values.indices.forEach { stop -> drawCircle(dots, 2.dp.toPx(), Offset(radius + stop.toFloat() / last * travel, center)) }
+ if (index >= 0) drawCircle(ink, radius, Offset(radius + left, center))
+ }
+ }
+}
diff --git a/apps/android/core/src/main/kotlin/com/codync/android/core/AgentSettings.kt b/apps/android/core/src/main/kotlin/com/codync/android/core/AgentSettings.kt
index 87cfe2f0..53ae5348 100644
--- a/apps/android/core/src/main/kotlin/com/codync/android/core/AgentSettings.kt
+++ b/apps/android/core/src/main/kotlin/com/codync/android/core/AgentSettings.kt
@@ -3,11 +3,13 @@ package com.codync.android.core
import kotlinx.serialization.Serializable
/** A model setting (effort, fast…) and the values the agent accepts. */
-@Serializable data class ModelOption(val id: String, val name: String, val values: List<ModelOptionValue> = emptyList(), val default: String? = null)
+@Serializable data class ModelOption(val id: String, val name: String, val values: List<ModelOptionValue> = emptyList(), val default: String? = null, val kind: String? = null) {
+ val isReasoning: Boolean get() = kind == "reasoning" || id in listOf("effort", "reasoning_effort", "reasoning-effort", "thought_level")
+}
@Serializable data class ModelOptionValue(val id: String, val name: String)
-@Serializable data class AgentModel(val id: String, val name: String, val description: String? = null, val options: List<ModelOption>? = null)
+@Serializable data class AgentModel(val id: String, val name: String, val description: String? = null, val options: List<ModelOption>? = null, val optionsError: String? = null)
/** `fastMode`: the agent offers Fast mode (absent on older hosts). */
-@Serializable data class AgentModels(val models: List<AgentModel>, val currentModelId: String? = null, val fastMode: Boolean? = null) {
+@Serializable data class AgentModels(val models: List<AgentModel>, val currentModelId: String? = null, val fastMode: Boolean? = null, val defaultModelOptions: Boolean? = null) {
val agentDefault: AgentModel? get() = models.firstOrNull { it.name.lowercase().startsWith("default") }
fun options(selected: String?): List<ModelChoice> {
val default = agentDefault
diff --git a/apps/android/design/src/main/kotlin/com/codync/android/design/Controls.kt b/apps/android/design/src/main/kotlin/com/codync/android/design/Controls.kt
index d3b0b886..edb56945 100644
--- a/apps/android/design/src/main/kotlin/com/codync/android/design/Controls.kt
+++ b/apps/android/design/src/main/kotlin/com/codync/android/design/Controls.kt
@@ -164,10 +164,10 @@ import com.kyant.shapes.RoundedRectangle
/** Picks one of a few values side by side: the replacement for `.segmented`. */
@Composable fun <T> SegmentedChoice(selection: T, options: List<Pair<T, String>>, select: (T) -> Unit, modifier: Modifier = Modifier) {
BoxWithConstraints(modifier.fillMaxWidth().clip(Capsule()).background(Palette.bubbleUser).padding(3.dp)) {
- val index = options.indexOfFirst { it.first == selection }.coerceAtLeast(0)
+ val index = options.indexOfFirst { it.first == selection }
val segment = (maxWidth - 2.dp * (options.size - 1)) / options.size
val thumb by animateDpAsState((segment + 2.dp) * index, Motion.morph(), label = "Thumb")
- Box(Modifier.offset(x = thumb).width(segment).height(36.dp).clip(Capsule()).background(Palette.background))
+ if (index >= 0) Box(Modifier.offset(x = thumb).width(segment).height(36.dp).clip(Capsule()).background(Palette.background))
Row(horizontalArrangement = Arrangement.spacedBy(2.dp)) {
for ((id, label) in options) {
val on = id == selection
diff --git a/apps/desktop/src/renderer/components/Controls.tsx b/apps/desktop/src/renderer/components/Controls.tsx
index 471804f4..c02981f1 100644
--- a/apps/desktop/src/renderer/components/Controls.tsx
+++ b/apps/desktop/src/renderer/components/Controls.tsx
@@ -121,10 +121,10 @@ export function ChoicePicker<T extends string | number>({ selection, options, on
/** Picks one of a few values side by side: the replacement for `.segmented`. */
export function SegmentedChoice<T extends string>({ selection, options, onChange }: { selection: T; options: { id: T; label: string }[]; onChange: (id: T) => void }) {
const tr = useTr()
- const index = Math.max(0, options.findIndex((o) => o.id === selection))
+ const index = options.findIndex((o) => o.id === selection)
return (
<div className="segmented">
- <div className="segmented-thumb" style={{ width: `calc((100% - 6px - ${(options.length - 1) * 2}px) / ${options.length})`, transform: `translateX(calc(${index} * (100% + 2px)))` }} />
+ {index >= 0 && <div className="segmented-thumb" style={{ width: `calc((100% - 6px - ${(options.length - 1) * 2}px) / ${options.length})`, transform: `translateX(calc(${index} * (100% + 2px)))` }} />}
{options.map((o) => (
<button key={o.id} className={`segmented-option ${o.id === selection ? 'on' : ''}`} onClick={() => onChange(o.id)} aria-pressed={o.id === selection}>
{tr(o.label)}
diff --git a/apps/desktop/src/renderer/lib/prefs.ts b/apps/desktop/src/renderer/lib/prefs.ts
index a2a99947..006f02b1 100644
--- a/apps/desktop/src/renderer/lib/prefs.ts
+++ b/apps/desktop/src/renderer/lib/prefs.ts
@@ -57,7 +57,7 @@ export const prefs = {
textSize: pref('conversationFontSize', DEFAULT_TEXT_SIZE),
sidebarCompact: pref('sidebarCompact', false),
sidebarWidth: pref('desktopSidebarWidth', 266),
- detailsPanelWidth: pref('detailsPanelWidth', 292),
+ detailsPanelWidth: pref('detailsPanelWidth', 400),
hiddenComputers: pref('hiddenComputers', ''),
computerOrder: pref<string[]>('computerOrder', []),
collapsedComputers: pref<string[]>('collapsedComputerSections', []),
diff --git a/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx b/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx
index 6968cd87..9f67a38d 100644
--- a/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx
+++ b/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx
@@ -1,97 +1,109 @@
-import { useEffect, useRef } from 'react'
-import { ChoicePicker, IconButton, Pill, Spinner } from '../../components/Controls'
+import { useState, type ReactNode } from 'react'
+import { IconButton, SegmentedChoice, Spinner } from '../../components/Controls'
+import { Icon } from '../../components/Icon'
import { HStack, Spacer, VStack } from '../../components/Stack'
import { Text } from '../../components/Text'
import type { AgentModelsState } from './agent-models'
import { useTr } from '../../lib/use-language'
+import './agent-picker.css'
+import { isReasoningOption, ReasoningSlider } from './ReasoningSlider'
+type Stage = 'closed' | 'settings' | 'agents' | 'models'
+type Choice = { id: string; label: string; leading?: ReactNode }
-/** The bot's model and its options, from the list `useAgentModels` loaded for its agent. */
-export function AgentModelPicker({ backend, models, selection, onChange, options: chosen, onOptionsChange, sessionNote = true }: {
+/** One compact entry for the harness, model, model options and the bot's Fast mode. */
+export function AgentModelPicker({ backend, models, selection, onChange, options: chosen, onOptionsChange,
+ sessionNote = true, agents = [], onAgentChange, fastControl, fast = false, children }: {
backend: string
models: AgentModelsState
selection: string | null | undefined
onChange: (model: string | null) => void
options: Record<string, string>
onOptionsChange: (options: Record<string, string>) => void
- /** Says that a change starts a new session: true for a bot's own model, not for one it hasn't used yet. */
sessionNote?: boolean
+ agents?: Choice[]
+ onAgentChange?: (id: string) => void
+ fastControl?: ReactNode
+ fast?: boolean
+ children?: ReactNode
}) {
const tr = useTr()
+ const [stage, setStage] = useState<Stage>('closed')
+ const [query, setQuery] = useState('')
const { catalog, loading, failure } = models
- const custom = backend === 'custom'
-
- // A different agent starts on its own default model.
- const lastBackend = useRef(backend)
- useEffect(() => {
- if (lastBackend.current === backend) return
- lastBackend.current = backend
- onChange(null)
- }, [backend, onChange])
-
- // The agent's own "Default (recommended)" entry is the same choice as leaving the model unset,
- // so it folds into the single Default row instead of showing twice.
const agentDefault = catalog?.models.find((m) => m.name.toLowerCase().startsWith('default'))
const available = (catalog?.models ?? []).filter((m) => m.id !== agentDefault?.id)
- const current = available.find((m) => m.id === catalog?.currentModelId)?.name
- const options = [{ id: '', label: agentDefault?.name ?? (current ? `Default · ${current}` : 'Default') }, ...available.map((m) => ({ id: m.id, label: m.name }))]
- if (selection && selection !== agentDefault?.id && !available.some((m) => m.id === selection)) options.push({ id: selection, label: selection })
+ const current = catalog?.models.find((m) => m.id === catalog.currentModelId)
const value = selection === agentDefault?.id ? '' : (selection ?? '')
- const set = (v: string) => onChange(v ? v : null)
- const empty = catalog?.models.length === 0
- const modelOptions = available.find((m) => m.id === value)?.options ?? []
- const setOption = (id: string, v: string) => {
- const { [id]: _, ...rest } = chosen
- onOptionsChange(v ? { ...rest, [id]: v } : rest)
+ const selected = catalog?.models.find((m) => m.id === (value || agentDefault?.id || catalog.currentModelId))
+ const modelOptions = value || catalog?.defaultModelOptions ? selected?.options ?? [] : []
+ const options: Choice[] = [{ id: '', label: agentDefault?.name ?? (current ? `Default · ${current.name}` : 'Default') }, ...available.map((m) => ({ id: m.id, label: m.name }))]
+ if (value && !available.some((m) => m.id === value)) options.push({ id: value, label: value })
+ const agent = agents.find((a) => a.id === backend)
+ const modelName = value ? options.find((o) => o.id === value)?.label ?? value : tr('Default')
+ const summary = modelOptions.map((o) => o.values.find((v) => v.id === (chosen[o.id] ?? o.default))?.name).filter(Boolean).join(' · ')
+ const browse = stage === 'agents' || stage === 'models'
+ const choices = (stage === 'agents' ? agents : options).filter((o) => o.label.toLocaleLowerCase().includes(query.toLocaleLowerCase()))
+ const open = (next: Stage) => { setQuery(''); setStage(next) }
+ const pick = (id: string) => {
+ if (stage === 'agents') {
+ if (id !== backend) onAgentChange?.(id)
+ open('models')
+ } else {
+ if (id !== value) onChange(id || null)
+ open('settings')
+ }
+ }
+ const setOption = (id: string, value?: string) => {
+ const next = { ...chosen }
+ if (value === undefined) delete next[id]
+ else next[id] = value
+ onOptionsChange(next)
}
-
return (
- <VStack gap={6}>
- <HStack gap={8}>
- <Text tone="text" className="model-picker-label">{tr(`Model`)}</Text>
- <Spacer />
- <HStack gap={4} shrink>
- {custom ? null : (
- // Loading and refresh share one fixed slot, so the row never grows for loading.
- <div className="model-picker-slot">
- <div className={`model-picker-refresh ${loading ? 'hidden' : ''}`}>
- <IconButton title={failure ? 'Retry model list' : 'Refresh model list'} icon="arrow.clockwise" disabled={loading} onClick={models.reload} />
- </div>
- {loading ? (
- <HStack align="stretch" className="fade-in" aria-label="Loading available models">
- <Spinner size={12} />
- </HStack>
- ) : null}
- </div>
- )}
- {custom || (!loading && (!catalog || empty)) ? (
- <Pill outlined className="model-picker-pill">
- <input className="model-picker-input" value={value} placeholder="Default" spellCheck={false} onChange={(e) => set(e.target.value)} />
- </Pill>
- ) : (
- <HStack align="stretch" shrink>
- <ChoicePicker selection={value} options={options} onChange={set} />
- </HStack>
- )}
- </HStack>
- </HStack>
- {modelOptions.map((o) => {
- const fallback = o.values.find((v) => v.id === o.default)?.name
- const choices = [{ id: '', label: fallback ? `Default · ${fallback}` : 'Default' }, ...o.values.map((v) => ({ id: v.id, label: v.name }))]
- return (
- <HStack key={o.id} gap={8} className="fade-in">
- <Text tone="text" className="model-picker-label">{o.name}</Text>
- <Spacer />
- <ChoicePicker selection={chosen[o.id] ?? ''} options={choices} onChange={(v) => setOption(o.id, v)} />
+ <VStack gap={8} className="agent-picker">
+ <button className="agent-picker-summary" title={[agent?.label ?? backend, modelName, summary, fast ? tr("Fast") : ""].filter(Boolean).join(" · ")} aria-expanded={stage !== 'closed'} onClick={() => open(stage === 'closed' ? 'models' : 'closed')}>
+ <span className="agent-picker-identity">{agent?.leading}<Text key={backend} className="agent-picker-text-change">{agent?.label ?? backend}</Text></span>
+ <span className="agent-picker-model" title={modelName}><span key={modelName} className="agent-picker-text-change">{modelName}</span></span>
+ {summary && <span className="agent-picker-effort" title={summary}><span key={summary} className="agent-picker-text-change">{summary}</span></span>}
+ {fast && <Icon name="bolt" size={12} title={tr('Fast mode')} />}
+ <Icon name={stage === 'closed' ? 'chevron.down' : 'chevron.up'} size={10} />
+ </button>
+ {stage !== 'closed' && <VStack gap={10} className="agent-picker-panel fade-in">
+ <div className="agent-picker-selectors">
+ {onAgentChange && <button className="agent-picker-choice" title={agent?.label ?? backend} aria-expanded={stage === 'agents'} onClick={() => open(stage === 'agents' ? 'settings' : 'agents')}>{agent?.leading}<Text truncate>{agent?.label ?? backend}</Text><Icon name={stage === 'agents' ? 'chevron.up' : 'chevron.down'} size={10} /></button>}
+ <button className="agent-picker-choice" title={options.find((o) => o.id === value)?.label} aria-expanded={stage === 'models'} onClick={() => open(stage === 'models' ? 'settings' : 'models')}><Text truncate>{modelName}</Text><Icon name={stage === 'models' ? 'chevron.up' : 'chevron.down'} size={10} /></button>
+ </div>
+ {children}
+ {browse && <VStack gap={4}>
+ <HStack gap={6} className="agent-picker-search">
+ {stage === 'models' && onAgentChange ? <IconButton title="Back" icon="chevron.left" onClick={() => open('agents')} /> : <Icon name="magnifyingglass" size={14} />}
+ <input aria-label={tr(stage === 'agents' ? 'Search agents' : 'Search models')} placeholder={tr(stage === 'agents' ? 'Search agents' : 'Search models')} value={query} onChange={(e) => setQuery(e.target.value)} />
+ {loading ? <Spinner size={12} /> : <IconButton title="Refresh model list" icon="arrow.clockwise" onClick={models.reload} />}
</HStack>
- )
- })}
- {!custom && !loading && failure ? (
- <Text size="caption" tone="attention">{failure}</Text>
- ) : !custom && !loading && empty ? (
- <Text size="caption" tone="secondary">{tr(`This agent doesn't advertise a model list. Leave Default or enter a model ID.`)}</Text>
- ) : null}
- {sessionNote ? <Text size="caption" tone="secondary">{tr(`Changing the model starts a new agent session. Chat history is kept.`)}</Text> : null}
+ <div className="agent-picker-list">
+ {choices.map((o) => <button key={o.id} className="agent-picker-item" aria-pressed={o.id === (stage === 'agents' ? backend : value)} onClick={() => pick(o.id)}>
+ {o.leading}<Text className="agent-picker-result-name">{tr(o.label)}</Text><Spacer />{o.id === (stage === 'agents' ? backend : value) && <Icon name="checkmark" size={12} />}
+ </button>)}
+ {!choices.length && <Text size="caption" tone="secondary">{tr('No results')}</Text>}
+ </div>
+ {stage === 'models' && (backend === 'custom' || (!loading && !catalog?.models.length)) && <input className="field-box" aria-label={tr('Model')} placeholder={tr('Default')} value={selection ?? ''} onChange={(e) => onChange(e.target.value || null)} />}
+ </VStack>}
+ {selected?.optionsError && <Text size="caption" tone="attention">{selected.optionsError}</Text>}
+ {failure && <Text size="caption" tone="attention">{failure}</Text>}
+ {modelOptions.map((o) => {
+ if (isReasoningOption(o)) return <ReasoningSlider key={o.id} option={o} value={chosen[o.id]} onChange={(v) => setOption(o.id, v)} onReset={() => setOption(o.id)} />
+ const defaultName = o.values.find((v) => v.id === o.default)?.name
+ return <VStack key={o.id} gap={8} className="agent-picker-setting">
+ <HStack gap={8}><Text size="caption" tone="secondary">{o.name}</Text><Spacer />
+ <button className="agent-picker-default" aria-pressed={chosen[o.id] === undefined} onClick={() => setOption(o.id)}>{tr('Default')}{defaultName ? ` · ${defaultName}` : ''}{chosen[o.id] === undefined ? ' ✓' : ''}</button>
+ </HStack>
+ <div className="agent-picker-options"><SegmentedChoice selection={chosen[o.id] ?? o.default ?? ''} options={o.values.map((v) => ({ id: v.id, label: v.name }))} onChange={(v) => setOption(o.id, v)} /></div>
+ </VStack>
+ })}
+ {fastControl}
+ {sessionNote && <Text size="caption" tone="secondary" className="agent-picker-note">{tr('Changing the model starts a new agent session. Chat history is kept.')}</Text>}
+ </VStack>}
</VStack>
)
}
diff --git a/apps/desktop/src/renderer/views/bots/BotEditorView.tsx b/apps/desktop/src/renderer/views/bots/BotEditorView.tsx
index 7039153f..87d1771e 100644
--- a/apps/desktop/src/renderer/views/bots/BotEditorView.tsx
+++ b/apps/desktop/src/renderer/views/bots/BotEditorView.tsx
@@ -7,7 +7,7 @@ import { CharacterAvatar } from '../../components/Avatar'
import { CardSection, ChoicePicker, DropdownMenu, IconButton, Pill, SearchField, Spinner, ValueRow } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { ModalHeader, Sheet, SheetPage, useDismiss } from '../../components/Overlay'
-import { HStack, IconSlot, VStack } from '../../components/Stack'
+import { HStack, IconSlot } from '../../components/Stack'
import { Text } from '../../components/Text'
import { useStore } from '../../store/context'
import { useAgentModels } from './agent-models'
@@ -137,42 +137,18 @@ function BotSettingsForm({ draft, onChange, error, plugins, part = 'all' }: {
<AutoTextArea className="field-box" value={draft.description} placeholder="e.g. Reviews PRs. Never pushes without asking." minRows={3} maxRows={8} onChange={(v) => set('description', v)} />
</Field>
)
- const model = [
- <AgentModelPicker key="model" backend={draft.backend} models={models} selection={draft.model} onChange={setModel} options={draft.modelOptions ?? {}} onOptionsChange={setModelOptions} />,
- (draft.backend !== 'custom' && models.catalog?.fastMode) || draft.fastMode || (saved?.backend === draft.backend && fastModeShown(saved)) ? (
- // Shown while the agent offers it (its model list, or the bot's own sessions), or while it's on.
- <div key="fast" className="fade-in">
- <SwitchRow
- title="Fast mode"
- detail={(saved && fastModeRefusal(saved)) ?? 'Faster replies for more usage, on models that offer it.'}
- on={draft.fastMode ?? false}
- onChange={(on) => set('fastMode', on)}
- />
- </div>
- ) : null,
- ]
-
const ownRest = saved ? restOf(saved, draft.backend, Date.now()) : null
const agent = (
- <VStack key="agent" gap={8}>
- <ValueRow label="Agent" detail={ownRest ? restLine(ownRest, Date.now()) : null}>
- <ChoicePicker
- selection={draft.backend}
- options={[...backends.map(agentChoice), { id: 'custom', label: 'Custom command', leading: <AgentIcon registry="custom" size={14} /> }]}
- onChange={(id) => onChange((d) => withBackend(d, id))}
- />
- </ValueRow>
- {backend && !backend.available ? <Text size="caption" tone="attention">{backend.installHint}</Text> : null}
- {draft.backend === 'custom' ? (
- <input
- className="field-box fade-in bot-command"
- value={draft.command ?? ''}
- placeholder="ACP command, e.g. my-agent --acp"
- spellCheck={false}
- onChange={(e) => set('command', e.target.value || null)}
- />
- ) : null}
- </VStack>
+ <AgentModelPicker key="agent" backend={draft.backend} models={models} selection={draft.model}
+ onChange={setModel} options={draft.modelOptions ?? {}} onOptionsChange={setModelOptions}
+ agents={[...backends.map(agentChoice), { id: 'custom', label: 'Custom command', leading: <AgentIcon registry="custom" size={14} /> }]}
+ onAgentChange={(id) => onChange((d) => withBackend(d, id))} fast={draft.fastMode ?? false}
+ fastControl={((draft.backend !== 'custom' && models.catalog?.fastMode) || draft.fastMode || (saved?.backend === draft.backend && fastModeShown(saved))) ?
+ <SwitchRow title="Fast mode" detail={saved ? fastModeRefusal(saved) : null} on={draft.fastMode ?? false} onChange={(on) => set('fastMode', on)} /> : null}>
+ {ownRest && <Text size="caption" tone="secondary">{restLine(ownRest, Date.now())}</Text>}
+ {backend && !backend.available && <Text size="caption" tone="attention">{backend.installHint}</Text>}
+ {draft.backend === 'custom' && <input className="field-box bot-command" value={draft.command ?? ''} placeholder="ACP command, e.g. my-agent --acp" spellCheck={false} onChange={(e) => set('command', e.target.value || null)} />}
+ </AgentModelPicker>
)
// While the bot runs on a fallback, the Agent card starts with it.
const step = saved?.agentStep ? <AgentStepBanner key="step" bot={saved} /> : null
@@ -196,7 +172,6 @@ function BotSettingsForm({ draft, onChange, error, plugins, part = 'all' }: {
<CardSection title="Agent">
{step}
{agent}
- {model}
{fallbacks}
</CardSection>
{error ? <Text size="footnote" tone="danger" className="fade-in">{error}</Text> : null}
@@ -234,7 +209,6 @@ function BotSettingsForm({ draft, onChange, error, plugins, part = 'all' }: {
<Text truncate>{store.hostName}</Text>
</ValueRow>
{part === 'all' ? agent : null}
- {part === 'all' ? model : null}
{part === 'all' ? fallbacks : null}
<ValueRow
label="Workspace"
diff --git a/apps/desktop/src/renderer/views/bots/Fallbacks.tsx b/apps/desktop/src/renderer/views/bots/Fallbacks.tsx
index 76e4a8df..19388187 100644
--- a/apps/desktop/src/renderer/views/bots/Fallbacks.tsx
+++ b/apps/desktop/src/renderer/views/bots/Fallbacks.tsx
@@ -2,7 +2,7 @@ import { useState } from 'react'
import { MAX_FALLBACKS, moveFallback, restLine, restOf, stepBanner } from '@shared/fallbacks'
import type { Backend, Bot, BotDraft, Fallback } from '@shared/models'
import { AgentIcon } from '../../components/AgentIcon'
-import { Button, CardForm, CardSection, ChoicePicker, DropdownMenu, IconButton, ValueRow } from '../../components/Controls'
+import { Button, CardForm, CardSection, DropdownMenu, IconButton } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { Dialog, ModalHeader, SheetPage } from '../../components/Overlay'
import { HStack, IconSlot, Spacer, VStack } from '../../components/Stack'
@@ -144,10 +144,7 @@ function AddFallback({ choices, onAdd }: { choices: Backend[]; onAdd: (f: Fallba
<ModalHeader title={tr(`Add fallback`)} trailing={<IconButton title="Add" icon="checkmark" disabled={!backend} onClick={() => onAdd({ backend, model, modelOptions })} />} />
<CardForm>
<CardSection>
- <ValueRow label="Agent">
- <ChoicePicker selection={backend} options={choices.map(agentChoice)} onChange={setBackend} />
- </ValueRow>
- <AgentModelPicker backend={backend} models={models} selection={model} onChange={pickModel} options={modelOptions} onOptionsChange={setModelOptions} sessionNote={false} />
+ <AgentModelPicker backend={backend} models={models} selection={model} onChange={pickModel} options={modelOptions} onOptionsChange={setModelOptions} sessionNote={false} agents={choices.map(agentChoice)} onAgentChange={(id) => { setBackend(id); setModel(null); setModelOptions({}) }} />
</CardSection>
</CardForm>
</SheetPage>
diff --git a/apps/desktop/src/renderer/views/bots/ReasoningSlider.tsx b/apps/desktop/src/renderer/views/bots/ReasoningSlider.tsx
new file mode 100644
index 00000000..4e708cb5
--- /dev/null
+++ b/apps/desktop/src/renderer/views/bots/ReasoningSlider.tsx
@@ -0,0 +1,52 @@
+import { useId, type CSSProperties } from 'react'
+import { Icon } from '../../components/Icon'
+import { useTr } from '../../lib/use-language'
+import type { ModelOption } from './agent-models'
+
+export const isReasoningOption = (option: ModelOption) => option.kind === 'reasoning'
+ || ['effort', 'reasoning_effort', 'reasoning-effort', 'thought_level'].includes(option.id)
+
+/** Discrete agent-advertised levels, with native range keyboard and assistive-technology support. */
+export function ReasoningSlider({ option, value, onChange, onReset }: {
+ option: ModelOption
+ value?: string
+ onChange: (value: string) => void
+ onReset: () => void
+}) {
+ const tr = useTr()
+ const label = useId()
+ const index = option.values.findIndex((v) => v.id === (value ?? option.default))
+ const last = option.values.length - 1
+ const name = index >= 0 ? option.values[index]!.name : ''
+ if (last < 0) return null
+ return <div className="reasoning-control">
+ <div className="reasoning-heading">
+ <span id={label}>{option.name}</span>
+ <strong className="reasoning-value"><span key={name} className="agent-picker-text-change">{name}</span></strong>
+ <button className="agent-picker-default" aria-pressed={value === undefined} onClick={onReset}>
+ {tr('Default')}<Icon name={value === undefined ? 'checkmark' : 'arrow.counterclockwise'} size={10} />
+ </button>
+ </div>
+ <div className={`reasoning-slider${index < 0 ? ' unknown' : ''}`} style={{ '--effort-position': last > 0 ? Math.max(0, index) / last : 0 } as CSSProperties}>
+ <div className="reasoning-track" aria-hidden="true"><div className="reasoning-fill" /></div>
+ <div className="reasoning-stops" aria-hidden="true">{option.values.map((level) => <span key={level.id} title={level.name} />)}</div>
+ <div className="reasoning-thumb" aria-hidden="true" />
+ <input type="range" min={0} max={Math.max(1, last)} step={1} value={Math.max(0, index)}
+ onPointerDown={(event) => {
+ if (index >= 0 && last > 0) return
+ const bounds = event.currentTarget.getBoundingClientRect()
+ const fraction = Math.max(0, Math.min(1, (event.clientX - bounds.left - 15) / Math.max(1, bounds.width - 30)))
+ const level = option.values[Math.round(fraction * last)]
+ if (level) onChange(level.id)
+ }}
+ onKeyDown={(event) => {
+ if ((index < 0 || last === 0) && ['Home', 'ArrowLeft', 'ArrowDown'].includes(event.key)) {
+ event.preventDefault()
+ onChange(option.values[0]!.id)
+ }
+ }}
+ aria-labelledby={label} aria-valuetext={name || tr('Default')}
+ onChange={(event) => { const level = option.values[Number(event.target.value)]; if (level) onChange(level.id) }} />
+ </div>
+ </div>
+}
diff --git a/apps/desktop/src/renderer/views/bots/agent-models.ts b/apps/desktop/src/renderer/views/bots/agent-models.ts
index e34a95bb..9e2345a3 100644
--- a/apps/desktop/src/renderer/views/bots/agent-models.ts
+++ b/apps/desktop/src/renderer/views/bots/agent-models.ts
@@ -8,14 +8,16 @@ export interface ModelOption {
name: string
values: { id: string; name: string }[]
default?: string | null
+ kind?: string
}
/** Model identifiers and display names advertised by the selected computer's ACP agent. */
export interface AgentModels {
- models: { id: string; name: string; description?: string | null; options?: ModelOption[] }[]
+ models: { id: string; name: string; description?: string | null; options?: ModelOption[]; optionsError?: string }[]
currentModelId?: string | null
/** The agent offers Fast mode (absent on older hosts). */
fastMode?: boolean
+ defaultModelOptions?: boolean
}
/** What the agent behind `backend` offers, loaded from the selected computer. */
diff --git a/apps/desktop/src/renderer/views/bots/agent-picker.css b/apps/desktop/src/renderer/views/bots/agent-picker.css
new file mode 100644
index 00000000..f5bcfb7b
--- /dev/null
+++ b/apps/desktop/src/renderer/views/bots/agent-picker.css
@@ -0,0 +1,79 @@
+.agent-picker { min-width: 0; }
+.agent-picker-summary, .agent-picker-choice, .agent-picker-item {
+ display: flex;
+ align-items: center;
+ min-width: 0;
+ color: var(--text);
+ text-align: left;
+ border: 0;
+ background: transparent;
+ border-radius: var(--radius-xs);
+}
+.agent-picker-summary {
+ width: 100%;
+ min-height: 32px;
+ gap: 8px;
+ font-size: var(--text-callout);
+}
+.agent-picker-identity { display: flex; align-items: center; gap: 7px; min-width: 0; max-width: 42%; }
+.agent-picker-identity > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.agent-picker-model { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--secondary); }
+.agent-picker-effort { flex: 0 1 auto; max-width: 24%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-caption); color: var(--secondary); }
+.agent-picker-panel { padding: 4px 0 2px; }
+.agent-picker-selectors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
+.agent-picker-selectors > :only-child { grid-column: 1 / -1; }
+.agent-picker-choice { gap: 6px; padding: 9px 10px; background: var(--surface); font-size: var(--text-callout); }
+.agent-picker-choice > .truncate { flex: 1; }
+.agent-picker-choice[aria-expanded="true"] { background: var(--surface); }
+.agent-picker-search { padding: 3px 8px; min-height: 36px; background: var(--surface); border-radius: var(--radius-xs); }
+.agent-picker-search input { width: 0; flex: 1; min-width: 0; color: var(--text); background: transparent; border: 0; font: inherit; }
+.agent-picker-search:focus-within { background: var(--bubble-agent); }
+.agent-picker-search input:focus-visible { outline: none; }
+.agent-picker-list { max-height: 196px; overflow-y: auto; overscroll-behavior: contain; }
+.agent-picker-item { width: 100%; gap: 8px; min-height: 34px; padding: 8px 10px; }
+.agent-picker-result-name { min-width: 0; overflow-wrap: anywhere; }
+.agent-picker-item[aria-pressed="true"], .agent-picker-item:hover { background: var(--surface); }
+.agent-picker-choice:hover { background: var(--surface); }
+.agent-picker-default { border: 0; background: transparent; color: var(--secondary); font-size: var(--text-caption); padding: 3px 0; }
+.agent-picker-default:hover { color: var(--text); }
+.agent-picker-setting { padding-top: 4px; }
+.agent-picker-options .segmented { width: 100%; }
+.agent-picker-options .segmented-option { min-width: 0; padding-inline: 5px; font-size: var(--text-caption); white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
+.agent-picker-note { line-height: 1.5; overflow-wrap: anywhere; }
+.agent-picker button { transition: background var(--hover), color var(--hover); }
+.agent-picker button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
+
+.reasoning-control { padding-top: 4px; }
+.reasoning-heading { display: flex; align-items: center; gap: 8px; font-size: var(--text-caption); color: var(--secondary); }
+.reasoning-value { flex: 1; min-width: 0; text-align: center; overflow-wrap: anywhere; font-size: var(--text-callout); font-weight: 500; color: var(--text); }
+.reasoning-heading .agent-picker-default { display: flex; align-items: center; gap: 5px; }
+.reasoning-slider { position: relative; height: 36px; margin-top: 6px; }
+.reasoning-track { position: absolute; inset: 3px 0; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface); }
+.reasoning-fill { height: 100%; width: calc(15px + (100% - 30px) * var(--effort-position)); background: color-mix(in srgb, var(--text) 14%, var(--surface)); }
+.reasoning-stops { position: absolute; inset: 0 15px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
+.reasoning-stops > span { width: 4px; height: 4px; border-radius: 50%; background: var(--secondary); }
+.reasoning-slider input { appearance: none; position: absolute; inset: 0; width: 100%; height: 36px; margin: 0; padding: 0; background: transparent; cursor: pointer; }
+.reasoning-slider input::-webkit-slider-runnable-track { height: 36px; background: transparent; }
+.reasoning-slider input::-webkit-slider-thumb { appearance: none; width: 30px; height: 30px; margin-top: 3px; border-radius: 50%; background: var(--text); box-shadow: 0 1px 4px rgb(0 0 0 / .15); }
+.reasoning-slider input:focus-visible { outline: 2px solid var(--secondary); outline-offset: 3px; border-radius: var(--radius-pill); }
+.reasoning-slider.unknown input::-webkit-slider-thumb { opacity: 0; }
+.reasoning-slider.unknown .reasoning-fill { opacity: 0; }
+
+/* Brief feedback for discrete changes; the actual range remains keyboard accessible. */
+.agent-picker-text-change { display: inline-block; animation: agent-picker-text-in 120ms ease-out; }
+@keyframes agent-picker-text-in {
+ from { opacity: .35; transform: translateY(2px); }
+ to { opacity: 1; transform: translateY(0); }
+}
+.reasoning-fill { transition: width var(--hover), opacity var(--hover); }
+.reasoning-thumb {
+ position: absolute; top: 3px; left: calc((100% - 30px) * var(--effort-position));
+ width: 30px; height: 30px; border-radius: 50%; background: var(--text);
+ box-shadow: 0 1px 4px rgb(0 0 0 / .15); pointer-events: none;
+ transition: left var(--hover), opacity var(--hover);
+}
+.reasoning-slider input::-webkit-slider-thumb { opacity: 0; }
+.reasoning-slider.unknown .reasoning-thumb { opacity: 0; }
+@media (prefers-reduced-motion: reduce) {
+ .agent-picker-text-change { animation: none; }
+}
diff --git a/apps/desktop/src/renderer/views/bots/bots.css b/apps/desktop/src/renderer/views/bots/bots.css
index 6469bf4f..56acce2d 100644
--- a/apps/desktop/src/renderer/views/bots/bots.css
+++ b/apps/desktop/src/renderer/views/bots/bots.css
@@ -50,37 +50,6 @@ textarea.field-box {
min-width: 0;
}
-/* The model row and its options (AgentModelPicker). */
-.model-picker-label {
- white-space: nowrap;
-}
-/* Loading and refresh share one fixed slot. */
-.model-picker-slot {
- display: grid;
- place-items: center;
- flex: none;
- width: 28px;
- height: 28px;
-}
-.model-picker-slot > * {
- grid-area: 1 / 1;
-}
-.model-picker-refresh {
- transition: opacity var(--fade);
-}
-.model-picker-refresh.hidden {
- opacity: 0;
- pointer-events: none;
-}
-.model-picker-input {
- width: 142px;
- max-width: 100%;
- min-width: 0;
- text-align: right;
- color: var(--text);
- user-select: text;
-}
-
/* Fallbacks in the Agent card (Fallbacks.tsx). */
.fallback-switch-back {
flex: none;
@@ -376,10 +345,6 @@ button.member-row:hover {
.member-row.removable:focus-within > :last-child {
opacity: 1;
}
-.model-picker-pill {
- min-width: 0;
- max-width: 160px;
-}
.workspace-pill {
gap: 6px;
color: var(--text);
diff --git a/apps/desktop/src/renderer/views/thread/DetailsPanel.tsx b/apps/desktop/src/renderer/views/thread/DetailsPanel.tsx
index 2e0704fd..6c1ec0a2 100644
--- a/apps/desktop/src/renderer/views/thread/DetailsPanel.tsx
+++ b/apps/desktop/src/renderer/views/thread/DetailsPanel.tsx
@@ -85,7 +85,7 @@ function Identity({ bot }: { bot: Bot }) {
const group = isGroup(bot)
return (
<div className="details-identity">
- {group ? <GroupAvatar members={store.members(bot)} size={60} /> : <div className="avatar-frame"><BotAvatar bot={bot} size={60} />{bot.lead ? <LeadAgentBadge size={24} interactive /> : null}</div>}
+ {group ? <GroupAvatar members={store.members(bot)} size={48} /> : <div className="avatar-frame"><BotAvatar bot={bot} size={48} />{bot.lead ? <LeadAgentBadge size={24} interactive /> : null}</div>}
<span className="details-name">{bot.name}</span>
<span className="details-subtitle">
{group ? (
diff --git a/apps/desktop/src/renderer/views/thread/ThreadView.tsx b/apps/desktop/src/renderer/views/thread/ThreadView.tsx
index 24e86612..45370bc3 100644
--- a/apps/desktop/src/renderer/views/thread/ThreadView.tsx
+++ b/apps/desktop/src/renderer/views/thread/ThreadView.tsx
@@ -36,7 +36,7 @@ import './thread.css'
import './composer.css'
import './chat-controls.css'
-const WIDE = 680
+const WIDE = 740
/**
* One endless conversation with a bot or a group chat. Only deliberate messages show here; tool
@@ -98,9 +98,9 @@ export const ThreadView = memo(function ThreadView({ botId }: { botId: string })
}, [])
const panelOpen = wide && showSettings
- squeezeBelow.current = panelOpen ? detailsWidth : 0
+ squeezeBelow.current = panelOpen ? Math.max(360, detailsWidth) : 0
// The side panel's edge drags its width, leaving the conversation at least 380 wide.
- const panelWidth = (w: number) => Math.min(Math.max(260, w), width.current - 380)
+ const panelWidth = (w: number) => Math.min(Math.max(360, w), width.current - 380)
// A compact Details presentation dismisses once the window is wide enough for the inspector.
useEffect(() => {
if (wide) setCompactDetails(false)
@@ -209,14 +209,14 @@ export const ThreadView = memo(function ThreadView({ botId }: { botId: string })
<ChatSidePanel
open={panelOpen}
width={panelWidth(detailsWidth)}
- min={260}
+ min={360}
max={width.current - 380}
onResize={(w) => setDetailsWidth(panelWidth(w))}
>
{details}
</ChatSidePanel>
- <Sheet open={compactDetails} onClose={() => setCompactDetails(false)} width={340} height={600}>
+ <Sheet open={compactDetails} onClose={() => setCompactDetails(false)} width={400} height={600}>
{details}
</Sheet>
<Sheet open={botChat !== null} onClose={() => setBotChat(null)} width={620} height={560}>
diff --git a/apps/desktop/src/renderer/views/thread/details-panel.css b/apps/desktop/src/renderer/views/thread/details-panel.css
index 1d8cc2d1..7e34d11f 100644
--- a/apps/desktop/src/renderer/views/thread/details-panel.css
+++ b/apps/desktop/src/renderer/views/thread/details-panel.css
@@ -40,11 +40,11 @@
display: flex;
flex-direction: column;
align-items: center;
- padding: 62px 20px 18px;
+ padding: 58px 20px 16px;
text-align: center;
}
.details-name {
- margin-top: 14px;
+ margin-top: 10px;
font-size: calc(16px * var(--scale));
font-weight: 600;
color: var(--text);
@@ -98,27 +98,22 @@
.details-tab .field-box {
background: var(--surface);
}
-/* Long notes (skill descriptions, explanations, a note's description) stop at two lines in the
- narrow panel; hovering shows the rest, and a skill's info button or a note opens it whole. */
+/* Settings explanations remain readable at every inspector width. */
.details-tab .detail-note,
.details-tab .memory-content > .memory-muted {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
+ overflow-wrap: anywhere;
+ line-height: 1.5;
}
.details-tab .routine-row > span {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-/* The Use the computer note is an instruction: it stays whole. */
-.details-tab .details-switch .detail-note {
- display: block;
- overflow: visible;
- -webkit-line-clamp: unset;
+ min-width: 0;
+ white-space: normal;
+ overflow-wrap: anywhere;
}
+.details-subtitle { flex-wrap: wrap; justify-content: center; overflow-wrap: anywhere; }
+.details-tab, .details-section, .details-tab .value-row > * { min-width: 0; }
+.details-tab .value-row { gap: 12px; }
+.details-tab .value-row > :first-child { min-width: 0; }
+.details-tab .value-row-value { overflow-wrap: anywhere; }
/* The panel is narrow: a row with a note puts its control under the label and note. */
.details-tab .value-row:has(.detail-note) {
diff --git a/apps/desktop/src/shared/fallbacks.test.ts b/apps/desktop/src/shared/fallbacks.test.ts
index 271d3e55..4dd47db5 100644
--- a/apps/desktop/src/shared/fallbacks.test.ts
+++ b/apps/desktop/src/shared/fallbacks.test.ts
@@ -57,3 +57,14 @@ test('an older host has no fallbacks to show or send', () => {
assert.equal(draftOf(bot).selfFallbacks, undefined)
assert.equal(normalizeBot({ id: 'b', selfFallbacks: false }).selfFallbacks, false)
})
+
+
+test('switching harness clears its model and effort, selecting the same harness preserves them', () => {
+ const draft = draftOf(normalizeBot({ id: 'b', backend: 'claude', model: 'opus', modelOptions: { effort: 'high' } }))
+ assert.equal(withBackend(draft, 'claude'), draft)
+ const changed = withBackend(draft, 'codex')
+ assert.equal(changed.model, null)
+ assert.deepEqual(changed.modelOptions, {})
+ const defaultModel = withBackend({ ...draft, model: null }, 'codex')
+ assert.deepEqual(defaultModel.modelOptions, {})
+})
diff --git a/apps/desktop/src/shared/fallbacks.ts b/apps/desktop/src/shared/fallbacks.ts
index d51558cc..f9d35f93 100644
--- a/apps/desktop/src/shared/fallbacks.ts
+++ b/apps/desktop/src/shared/fallbacks.ts
@@ -35,4 +35,6 @@ export function moveFallback(list: Fallback[], index: number, by: number): Fallb
}
/** The bot on agent `backend`: a fallback on that agent goes (an agent is in the chain once, as the host keeps it). */
-export const withBackend = (d: BotDraft, backend: string): BotDraft => ({ ...d, backend, fallbacks: d.fallbacks?.filter((f) => f.backend !== backend) })
+export const withBackend = (d: BotDraft, backend: string): BotDraft => d.backend === backend ? d : ({
+ ...d, backend, model: null, modelOptions: {}, fallbacks: d.fallbacks?.filter((f) => f.backend !== backend),
+})
diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/AgentFallback.swift b/apps/ios/Kit/Sources/CodyncKit/Models/AgentFallback.swift
index 8813ea37..83bc35b1 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Models/AgentFallback.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Models/AgentFallback.swift
@@ -84,7 +84,10 @@ public extension Bot {
public extension BotDraft {
/// The bot's own agent: a fallback on it goes, as the host drops it.
mutating func setAgent(_ backend: String) {
+ guard self.backend != backend else { return }
self.backend = backend
+ model = nil
+ modelOptions = [:]
fallbacks?.removeAll { $0.backend == backend }
}
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift b/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift
index 67bcf36b..d77e5b98 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift
@@ -8,6 +8,7 @@ public struct AgentModels: Decodable, Sendable {
public let description: String?
/// The model's own settings (effort, fast…); absent from hosts that don't list them.
public let options: [Option]?
+ public let optionsError: String?
}
/// A model setting and the values the agent accepts.
@@ -21,10 +22,15 @@ public struct AgentModels: Decodable, Sendable {
public let name: String
public let values: [Value]
public let `default`: String?
+ public let kind: String?
+ public var isReasoning: Bool {
+ kind == "reasoning" || ["effort", "reasoning_effort", "reasoning-effort", "thought_level"].contains(id)
+ }
}
public let models: [Model]
public let currentModelId: String?
/// The agent offers Fast mode (absent on older hosts).
public let fastMode: Bool?
+ public let defaultModelOptions: Bool?
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
index c1532b78..30a71d0c 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
@@ -1238,5 +1238,8 @@
"Install it first.": "Installiere es zuerst.",
"Not set up on {name} yet.": "Auf {name} noch nicht eingerichtet.",
"Downloads {name} on {host} if it needs to, then checks its sign-in.": "Lädt {name} bei Bedarf auf {host} herunter und prüft dann die Anmeldung.",
- "Rate on the App Store": "Im App Store bewerten"
+ "Rate on the App Store": "Im App Store bewerten",
+ "Search agents": "Agenten suchen",
+ "Search models": "Modelle suchen",
+ "No results": "Keine Ergebnisse"
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
index 5d540799..a0130a69 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
@@ -1238,5 +1238,8 @@
"Install it first.": "Instálalo primero.",
"Not set up on {name} yet.": "Aún no está configurado en {name}.",
"Downloads {name} on {host} if it needs to, then checks its sign-in.": "Descarga {name} en {host} si hace falta y luego comprueba su inicio de sesión.",
- "Rate on the App Store": "Valorar en el App Store"
+ "Rate on the App Store": "Valorar en el App Store",
+ "Search agents": "Buscar agentes",
+ "Search models": "Buscar modelos",
+ "No results": "Sin resultados"
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
index 1e6c02aa..e123b3b1 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
@@ -1238,5 +1238,8 @@
"Install it first.": "Installez-le d'abord.",
"Not set up on {name} yet.": "Pas encore configuré sur {name}.",
"Downloads {name} on {host} if it needs to, then checks its sign-in.": "Télécharge {name} sur {host} si besoin, puis vérifie sa connexion.",
- "Rate on the App Store": "Noter sur l’App Store"
+ "Rate on the App Store": "Noter sur l’App Store",
+ "Search agents": "Rechercher des agents",
+ "Search models": "Rechercher des modèles",
+ "No results": "Aucun résultat"
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
index 359a63f2..420122e3 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
@@ -1238,5 +1238,8 @@
"Install it first.": "先にインストールしてください。",
"Not set up on {name} yet.": "{name} ではまだセットアップされていません。",
"Downloads {name} on {host} if it needs to, then checks its sign-in.": "必要なら {host} に {name} をダウンロードし、サインイン状態を確認します。",
- "Rate on the App Store": "App Store で評価"
+ "Rate on the App Store": "App Store で評価",
+ "Search agents": "エージェントを検索",
+ "Search models": "モデルを検索",
+ "No results": "結果がありません"
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
index 8e7bc719..5f0d3215 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
@@ -1238,5 +1238,8 @@
"Install it first.": "먼저 설치하세요.",
"Not set up on {name} yet.": "{name}에 아직 설정되지 않았습니다.",
"Downloads {name} on {host} if it needs to, then checks its sign-in.": "필요하면 {host}에 {name}을(를) 내려받은 뒤 로그인 상태를 확인합니다.",
- "Rate on the App Store": "App Store에서 평가하기"
+ "Rate on the App Store": "App Store에서 평가하기",
+ "Search agents": "에이전트 검색",
+ "Search models": "모델 검색",
+ "No results": "결과 없음"
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
index 0193d145..42bbaa05 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
@@ -1238,5 +1238,8 @@
"Install it first.": "请先安装。",
"Not set up on {name} yet.": "还没在 {name} 上设置。",
"Downloads {name} on {host} if it needs to, then checks its sign-in.": "需要的话会在 {host} 上下载 {name},再检查登录状态。",
- "Rate on the App Store": "在 App Store 评分"
+ "Rate on the App Store": "在 App Store 评分",
+ "Search agents": "搜索智能体",
+ "Search models": "搜索模型",
+ "No results": "没有结果"
}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
index 8791369b..86040eea 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
@@ -1238,5 +1238,8 @@
"Install it first.": "請先安裝。",
"Not set up on {name} yet.": "還沒在 {name} 上設定。",
"Downloads {name} on {host} if it needs to, then checks its sign-in.": "需要的話會在 {host} 上下載 {name},再檢查登入狀態。",
- "Rate on the App Store": "在 App Store 評分"
+ "Rate on the App Store": "在 App Store 評分",
+ "Search agents": "搜尋智慧體",
+ "Search models": "搜尋模型",
+ "No results": "沒有結果"
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift
index ab69e411..33280a84 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift
@@ -2,8 +2,7 @@ import CodyncKit
import SwiftUI
/// Models come from the selected computer's agent, never a bundled provider list.
-/// Fast mode is a second card row, shown while the agent offers it or while it's on
-/// (so it can be turned off).
+/// The summary expands into one searchable agent/model picker and its settings.
struct AgentModelPicker: View {
let backend: String
@Binding var selection: String?
@@ -13,6 +12,14 @@ struct AgentModelPicker: View {
var fastMode: Binding<Bool>?
/// The saved bot: whether its own sessions offer Fast mode, and why the agent refused it.
var bot: Bot?
+ var agents: [(String, String)] = []
+ var onAgentChange: ((String) -> Void)?
+ var command: Binding<String?>?
+ var installHint: String?
+ var restLine: String?
+ private enum Stage { case closed, agents, models, settings }
+ @State private var stage = Stage.closed
+ @State private var query = ""
@Environment(BotStore.self) private var store
@State private var catalog: AgentModels?
@State private var catalogScope: String?
@@ -56,17 +63,13 @@ struct AgentModelPicker: View {
}
/// Settings the selected model offers.
- private var modelOptions: [AgentModels.Option] {
- catalog?.models.first { $0.id == value.wrappedValue }?.options ?? []
- }
-
- private func optionValue(_ id: String) -> Binding<String> {
- Binding(get: { options[id] ?? "" }, set: { options[id] = $0.isEmpty ? nil : $0 })
+ private var selectedModel: AgentModels.Model? {
+ catalog?.models.first { $0.id == (selection ?? agentDefault?.id ?? catalog?.currentModelId) }
}
- private func choices(_ option: AgentModels.Option) -> [(String, String)] {
- let fallback = option.values.first { $0.id == option.default }?.name
- return [("", fallback.map { "Default · \($0)" } ?? "Default")] + option.values.map { ($0.id, $0.name) }
+ private var modelOptions: [AgentModels.Option] {
+ guard !value.wrappedValue.isEmpty || catalog?.defaultModelOptions == true else { return [] }
+ return selectedModel?.options ?? []
}
private var showsFastMode: Bool {
@@ -75,69 +78,131 @@ struct AgentModelPicker: View {
|| (bot?.backend == backend && bot?.fastModeShown == true)
}
- var body: some View {
- modelRow
- .onChange(of: backend) { _, _ in
- selection = nil
- options = [:]
- }
- .task(id: requestKey) { await load() }
- if showsFastMode, let fastMode {
- SwitchRow("Fast mode", detail: bot?.fastModeRefusal ?? "Faster replies for more usage, on models that offer it.",
- isOn: fastMode)
- .transition(.opacity)
+ private var agentName: String { agents.first { $0.0 == backend }?.1 ?? backend }
+ private var modelName: String { value.wrappedValue.isEmpty ? L10n.tr("Default") : modelChoices.first { $0.0 == value.wrappedValue }?.1 ?? value.wrappedValue }
+ private var summary: String {
+ let settings = modelOptions.compactMap { option in
+ option.values.first { $0.id == (options[option.id] ?? option.default) }?.name
}
+ return ([agentName, modelName] + settings + (fastMode?.wrappedValue == true ? ["Fast"] : [])).joined(separator: " · ")
}
- private var modelRow: some View {
- VStack(alignment: .leading, spacing: 6) {
- HStack(spacing: 8) {
- Text(L10n.tr("Model"))
- .foregroundStyle(Palette.text)
- .fixedSize()
- Spacer(minLength: 0)
- HStack(spacing: 4) {
- if backend != "custom" { refreshControl }
- if backend == "custom" || (!loading && catalog?.models.isEmpty != false) {
- TextField("Default", text: value)
- .plainTextInput()
- .multilineTextAlignment(.trailing)
- .textFieldStyle(.plain)
- .frame(minWidth: 0, maxWidth: 180)
- .outlinedPill()
- } else {
- ChoicePicker(selection: value, options: modelChoices, fitsAvailableWidth: true)
- }
+ private func open(_ next: Stage) {
+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { query = ""; stage = next }
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 10) {
+ Button { open(stage == .closed ? .models : .closed) } label: {
+ HStack(spacing: 6) {
+ Text(summary).font(.subheadline).lineLimit(2)
+ .contentTransition(.opacity)
+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: summary)
+ Spacer(minLength: 0)
+ Image(systemName: stage == .closed ? "chevron.down" : "chevron.up").font(.caption)
}
+ .foregroundStyle(Palette.text)
+ .contentShape(Rectangle())
}
- ForEach(modelOptions) { option in
- HStack(spacing: 8) {
- Text(option.name)
- .foregroundStyle(Palette.text)
- .fixedSize()
+ .buttonStyle(.plain)
+ .accessibilityValue(stage == .closed ? "Collapsed" : "Expanded")
+ if stage != .closed {
+ HStack {
+ if onAgentChange != nil {
+ Button { open(stage == .agents ? .settings : .agents) } label: { Text(agentName).lineLimit(1); Image(systemName: "chevron.down") }
+ }
Spacer(minLength: 0)
- ChoicePicker(selection: optionValue(option.id), options: choices(option), fitsAvailableWidth: true)
+ Button { open(stage == .models ? .settings : .models) } label: { Text(modelName).lineLimit(1); Image(systemName: "chevron.down") }
+ }
+ .font(.subheadline)
+ .buttonStyle(.plain)
+ .foregroundStyle(Palette.text)
+ if let restLine { Text(restLine).font(.caption).foregroundStyle(Palette.secondary) }
+ if let installHint { Text(installHint).font(.caption).foregroundStyle(Palette.warning) }
+ if backend == "custom", let command {
+ TextField("ACP command, e.g. my-agent --acp", text: Binding(get: { command.wrappedValue ?? "" }, set: { command.wrappedValue = $0.isEmpty ? nil : $0 }))
+ .plainTextInput().fieldBox()
+ }
+ if stage == .agents || stage == .models { searchResults }
+ ForEach(modelOptions) { option in
+ if option.isReasoning {
+ ReasoningSlider(option: option, selection: Binding(get: { options[option.id] }, set: { options[option.id] = $0 }))
+ } else {
+ VStack(alignment: .leading, spacing: 6) {
+ HStack {
+ Text(option.name).foregroundStyle(Palette.secondary)
+ Spacer(minLength: 0)
+ Button {
+ withAnimation(Motion.reduced(Motion.fade, reduceMotion)) { options[option.id] = nil }
+ } label: {
+ let fallback = option.values.first { $0.id == option.default }?.name
+ Text(L10n.tr("Default") + (fallback.map { " · \($0)" } ?? "") + (options[option.id] == nil ? " ✓" : ""))
+ }
+ .buttonStyle(.plain)
+ }.font(.caption)
+ ScrollView(.horizontal) {
+ SegmentedChoice(selection: Binding(get: { options[option.id] ?? option.default ?? "" }, set: { options[option.id] = $0 }),
+ options: option.values.map { ($0.id, $0.name) })
+ .frame(minWidth: CGFloat(option.values.count) * 65)
+ }.scrollIndicators(.hidden)
+ }
+ }
+ }
+ if showsFastMode, let fastMode {
+ SwitchRow("Fast mode", detail: bot?.fastModeRefusal, isOn: fastMode)
+ }
+ if let error = selectedModel?.optionsError { Text(error).font(.caption).foregroundStyle(Palette.warning) }
+ if let failure { Text(L10n.tr(failure)).font(.caption).foregroundStyle(Palette.warning) }
+ if fastMode != nil {
+ Text(L10n.tr("Changing the model starts a new agent session. Chat history is kept."))
+ .font(.caption).foregroundStyle(Palette.secondary)
}
- .transition(.opacity)
}
- if backend != "custom", !loading {
- if let failure {
- Text(L10n.tr(failure))
- .font(.caption)
- .foregroundStyle(Palette.warning)
- } else if catalog?.models.isEmpty == true {
- Text(L10n.tr("This agent doesn't advertise a model list. Leave Default or enter a model ID."))
- .font(.caption)
- .foregroundStyle(Palette.secondary)
+ }
+ .task(id: requestKey) { await load() }
+ }
+
+ private var searchResults: some View {
+ VStack(spacing: 4) {
+ HStack(spacing: 6) {
+ if stage == .models, onAgentChange != nil {
+ IconButton("Back", systemImage: "chevron.left") { open(.agents) }
}
+ TextField(stage == .agents ? "Search agents" : "Search models", text: $query).plainTextInput()
+ refreshControl
}
- if fastMode != nil {
- Text(L10n.tr("Changing the model starts a new agent session. Chat history is kept."))
- .font(.caption)
- .foregroundStyle(Palette.secondary)
+ let choices = (stage == .agents ? agents : modelChoices).filter {
+ query.isEmpty || $0.1.localizedCaseInsensitiveContains(query)
+ }
+ ScrollView {
+ VStack(spacing: 2) {
+ ForEach(choices, id: \.0) { choice in
+ Button {
+ if stage == .agents {
+ if choice.0 != backend { onAgentChange?(choice.0) }
+ open(.models)
+ }
+ else { value.wrappedValue = choice.0; open(.settings) }
+ } label: {
+ HStack {
+ Text(L10n.tr(choice.1)).lineLimit(2)
+ Spacer(minLength: 0)
+ if choice.0 == (stage == .agents ? backend : value.wrappedValue) {
+ Image(systemName: "checkmark").font(.caption)
+ }
+ }
+ .foregroundStyle(Palette.text)
+ .padding(.vertical, 9).padding(.horizontal, 6)
+ .contentShape(Rectangle())
+ }.buttonStyle(.plain)
+ }
+ if choices.isEmpty { Text(L10n.tr("No results")).font(.caption).foregroundStyle(Palette.secondary) }
+ }
+ }.frame(maxHeight: 180)
+ if stage == .models, backend == "custom" || (!loading && catalog?.models.isEmpty != false) {
+ TextField("Default", text: value).plainTextInput().fieldBox()
}
}
- .animation(Motion.reduced(Motion.fade, reduceMotion), value: modelOptions.map(\.id))
}
/// Loading and refresh share one fixed slot, so the row never grows for loading.
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
index a4dad3b4..e5139cbe 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
@@ -104,7 +104,6 @@ struct BotSettingsForm: View {
CardSection("Instructions") { instructions }
CardSection("Agent") {
fallbackBanner
- agentPicker
modelPicker
fallbackList
}
@@ -123,33 +122,15 @@ struct BotSettingsForm: View {
}
}
- private var agentPicker: some View {
- VStack(alignment: .leading, spacing: 8) {
- ValueRow("Agent", detail: bot?.rest(of: draft.backend)?.line) {
- ChoicePicker(selection: Binding(get: { draft.backend }, set: { agent in
- withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { draft.setAgent(agent) }
- }),
- options: (model.hello?.backends ?? []).map { ($0.id, model.agentLabel($0)) } + [("custom", "Custom command")],
- image: { AgentIcon.image(registry: model.agentRegistry($0)) })
- }
- if let b = model.hello?.backends.first(where: { $0.id == draft.backend }), !b.available {
- Text(b.installHint).font(.caption).foregroundStyle(Palette.warning)
- .frame(maxWidth: .infinity, alignment: .leading)
- }
- if draft.backend == "custom" {
- TextField("ACP command, e.g. my-agent --acp", text: Binding(get: { draft.command ?? "" }, set: { draft.command = $0.isEmpty ? nil : $0 }))
- .font(.callout.monospaced())
- .plainTextInput()
- .fieldBox()
- }
- }
- }
-
private var modelPicker: some View {
AgentModelPicker(backend: draft.backend, selection: $draft.model, options: $draft.modelOptions,
fastMode: Binding(get: { draft.fastMode ?? false }, set: { on in
withAnimation(Motion.reduced(Motion.fade, reduceMotion)) { draft.fastMode = on }
- }), bot: bot)
+ }), bot: bot,
+ agents: (model.hello?.backends ?? []).map { ($0.id, model.agentLabel($0)) } + [("custom", "Custom command")],
+ onAgentChange: { draft.setAgent($0) }, command: $draft.command,
+ installHint: model.hello?.backends.first { $0.id == draft.backend && !$0.available }?.installHint,
+ restLine: bot?.rest(of: draft.backend)?.line)
}
/// While the bot runs on a fallback: which, and Switch back.
@@ -203,8 +184,7 @@ struct BotSettingsForm: View {
Text(model.hostName).lineLimit(1)
}
if part == .all {
- agentPicker
- modelPicker
+ modelPicker
fallbackList
}
ValueRow("Workspace", detail: draft.cwd.isEmpty
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/FallbackRows.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/FallbackRows.swift
index 8847d4b5..1ba5140d 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/FallbackRows.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/FallbackRows.swift
@@ -152,11 +152,9 @@ struct AddFallbackSheet: View {
}
CardForm {
CardSection {
- ValueRow("Agent") {
- ChoicePicker(selection: $fallback.backend, options: choices.map { ($0.id, model.agentLabel($0)) },
- image: { AgentIcon.image(registry: model.agentRegistry($0)) })
- }
- AgentModelPicker(backend: fallback.backend, selection: $fallback.model, options: $fallback.modelOptions)
+ AgentModelPicker(backend: fallback.backend, selection: $fallback.model, options: $fallback.modelOptions,
+ agents: choices.map { ($0.id, model.agentLabel($0)) },
+ onAgentChange: { fallback.backend = $0; fallback.model = nil; fallback.modelOptions = [:] })
}
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/ReasoningSlider.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/ReasoningSlider.swift
new file mode 100644
index 00000000..9f764dee
--- /dev/null
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/ReasoningSlider.swift
@@ -0,0 +1,69 @@
+import CodyncKit
+import SwiftUI
+
+/// A discrete slider whose stops come from the harness rather than a fixed list of effort levels.
+struct ReasoningSlider: View {
+ let option: AgentModels.Option
+ @Binding var selection: String?
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+
+ private var index: Int? { option.values.firstIndex { $0.id == (selection ?? option.default) } }
+ private var name: String { index.map { option.values[$0].name } ?? "" }
+
+ private func choose(_ index: Int) {
+ guard option.values.indices.contains(index) else { return }
+ withAnimation(Motion.reduced(Motion.hover, reduceMotion)) { selection = option.values[index].id }
+ }
+
+ var body: some View {
+ VStack(spacing: 6) {
+ HStack(spacing: 8) {
+ Text(option.name).font(.caption).foregroundStyle(Palette.secondary)
+ Spacer(minLength: 0)
+ Text(name).font(.subheadline.weight(.medium)).foregroundStyle(Palette.text)
+ .contentTransition(.opacity)
+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: name)
+ Spacer(minLength: 0)
+ Button { selection = nil } label: {
+ Text(L10n.tr("Default"))
+ Image(systemName: selection == nil ? "checkmark" : "arrow.counterclockwise")
+ }
+ .font(.caption).foregroundStyle(Palette.secondary).buttonStyle(.plain)
+ }
+ GeometryReader { geometry in
+ let travel = max(0, geometry.size.width - 30)
+ let last = max(1, option.values.count - 1)
+ let x = CGFloat(index ?? 0) / CGFloat(last) * travel
+ ZStack(alignment: .leading) {
+ Capsule().fill(Palette.surface).frame(height: 30)
+ if index != nil {
+ Capsule().fill(Palette.text.opacity(0.14)).frame(width: x + 30, height: 30)
+ }
+ ForEach(option.values.indices, id: \.self) { stop in
+ Circle().fill(Palette.secondary).frame(width: 4, height: 4)
+ .offset(x: 13 + CGFloat(stop) / CGFloat(last) * travel)
+ }
+ if index != nil { Circle().fill(Palette.text).frame(width: 30, height: 30).offset(x: x) }
+ }
+ .frame(height: 36)
+ .contentShape(Rectangle())
+ .gesture(DragGesture(minimumDistance: 0).onChanged { gesture in
+ guard travel > 0 else { return }
+ let position = min(1, max(0, (gesture.location.x - 15) / travel))
+ choose(Int((position * CGFloat(last)).rounded()))
+ })
+ .accessibilityElement(children: .ignore)
+ .accessibilityLabel(option.name)
+ .accessibilityValue(name.isEmpty ? L10n.tr("Default") : name)
+ .accessibilityAdjustableAction { direction in
+ switch direction {
+ case .increment: choose(min(last, (index ?? -1) + 1))
+ case .decrement: choose(max(0, (index ?? 1) - 1))
+ @unknown default: break
+ }
+ }
+ }.frame(height: 36)
+ .animation(Motion.reduced(Motion.hover, reduceMotion), value: index)
+ }
+ }
+}
diff --git a/apps/ios/Kit/Tests/CodyncKitTests/AgentFallbackTests.swift b/apps/ios/Kit/Tests/CodyncKitTests/AgentFallbackTests.swift
index fc669186..2b24a658 100644
--- a/apps/ios/Kit/Tests/CodyncKitTests/AgentFallbackTests.swift
+++ b/apps/ios/Kit/Tests/CodyncKitTests/AgentFallbackTests.swift
@@ -66,3 +66,17 @@ private func updateBody(_ draft: BotDraft) throws -> [String: Any] {
edited.notify = false
#expect(edited.rebased(from: base, onto: fresh).fallbacks == fresh.fallbacks)
}
+
+@Test func switchingHarnessResetsModelAndEffortTogether() {
+ var draft = BotDraft(name: "Reviewer")
+ draft.backend = "claude"
+ draft.model = "opus"
+ draft.modelOptions = ["effort": "high"]
+ draft.setAgent("claude")
+ #expect(draft.model == "opus" && draft.modelOptions == ["effort": "high"])
+ draft.setAgent("codex")
+ #expect(draft.model == nil && draft.modelOptions.isEmpty)
+ draft.modelOptions = ["reasoning_effort": "low"]
+ draft.setAgent("claude")
+ #expect(draft.model == nil && draft.modelOptions.isEmpty)
+}
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index 408477f1..009f0b45 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -9,7 +9,9 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
## 2.29.0
### zh-Hant
+- Agent、模型、推理強度與 Fast mode 整合成可收合的精簡設定;每個 Bot 可獨立保存推理強度,Default 也會顯示預設值。
- 評分邀請只會在你使用一段時間、看完 Bot 的成果並回到列表後出現,不會在開啟 App 時打擾你。也可以隨時從設定前往 App Store 評分。
### en-US
+- Agent, model, reasoning effort and Fast mode now share compact, expandable settings. Each bot keeps its own effort preference, with the default level shown.
- Rating invitations wait until you have used Codync for a while, viewed a bot's result, and returned to the list. You can also rate Codync anytime from Settings.
diff --git a/docs/features/marketplace.md b/docs/features/marketplace.md
index c4193fe0..4392735a 100644
--- a/docs/features/marketplace.md
+++ b/docs/features/marketplace.md
@@ -88,13 +88,15 @@ See [file structure](../architecture/file-structure.md), [bot collaboration](bot
## Model selection
-The shared bot editor requests `agentModels {backend}` from the selected computer. The host starts an isolated ACP session under its probe directory with saved agent credentials, no MCP servers and no prompt, then closes the process. The response is `{models: [{id, name, description, options}], currentModelId, fastMode}`.
+The shared bot editor requests `agentModels {backend}` from the selected computer. The host starts an isolated ACP session under its probe directory with saved agent credentials, no MCP servers and no prompt, then closes the process. The response is `{models: [{id, name, description, options, optionsError?}], currentModelId, fastMode, defaultModelOptions}`.
Discovery prefers ACP `configOptions` with category `model` (including grouped options), with conventional `model`/`models` IDs as a compatibility fallback. Older agents may expose `models.availableModels`. Model names and IDs come from the agent; Codync does not bundle a provider catalog. See the [ACP config option contract](https://agentclientprotocol.com/protocol/v1/session-config-options).
+For non-Cursor agents, discovery reads reasoning selects from ACP `thought_level` options (with legacy effort IDs as a fallback) and probes each model in the disposable session. A model that refuses selection keeps its catalog entry with `optionsError`; other models remain usable. Grouped effort values are flattened. The inherited/default choice has a single reset control. `defaultModelOptions: true` advertises that this host applies options even when no explicit model is chosen; clients hide Default-model options on older hosts without this capability.
+
A model's `options` are its own settings, such as reasoning effort or fast mode: `[{id, name, values: [{id, name}], default}]`. Every `initialize` sends `clientCapabilities._meta.parameterizedModelPicker: true`; Cursor then lists plain models and, on `cursor/list_available_models` (asked only of the Cursor backend), each model's settings as ACP select config options. Without the flag Cursor offers one fixed variant per model (`grok-4.7[reasoning_effort=high,fast=true]`) and rejects every other. The bot stores the picks as `modelOptions` (option id → value; an absent id means the agent's default). After choosing the model with `session/set_config_option`, the host sets each option the same way, on new sessions and again after `session/load`, because Cursor resumes a session on its last-used model. A bot saved with a variant ID keeps working: when the agent lists the plain model instead, the bracket's `key=value` pairs become options (Auto's `default[]` becomes `default`). Some values change Cursor's billing: a larger context (Grok 4.7 at 500K) turns on its Max Mode. Changing the model or agent clears the options; the host also clears them when an app that predates them changes the model.
-The editor keeps Default, shows available models in a dropdown, and resets the selected model when changing agents. Under the model it shows one picker per option (iPhone and desktop: a row each, named by the agent, with Default first; terminal UI: an Options row, ←→ to move, space to change). Errors are visible and retryable. Custom commands and agents without model discovery retain manual ID entry; an existing unlisted ID is preserved. The probe uses an isolated directory, so project-specific agent configuration can differ from the real bot session. Changing the model restarts the bot's agent sessions with fresh model context and preserves the stored chat history. The agent remains responsible for validating availability when a session starts.
+The graphical editors summarize harness, model, effort and Fast mode in one expandable row. Expanded controls keep harness and model accessible, with one shared search list and refresh at its right. Choosing a harness opens its model list; choosing a model hides only that list. Effort uses advertised levels and one Default reset label; Fast mode shares the panel. The terminal keeps keyboard fields and shows the effective default in its Options row (←→ moves, space changes). Errors are visible and retryable. Custom commands and agents without model discovery retain manual ID entry; an existing unlisted ID is preserved. The probe uses an isolated directory, so project-specific agent configuration can differ from the real bot session. Changing the model restarts the bot's agent sessions with fresh model context and preserves the stored chat history. The agent remains responsible for validating availability when a session starts.
## Fast mode
diff --git a/host/src/agent/auth/models.rs b/host/src/agent/auth/models.rs
index 87be8da1..f5dadbd1 100644
--- a/host/src/agent/auth/models.rs
+++ b/host/src/agent/auth/models.rs
@@ -32,12 +32,72 @@ pub async fn models(store: &Store, backend: &str) -> Result<Value> {
} else {
Value::Null
};
- Ok((session, options))
+ let mut catalog = model_catalog(&session, &options);
+ if backend != "cursor" {
+ discover_options(&acp, &session, &mut catalog).await?;
+ }
+ Ok(catalog)
})
.await;
acp.kill().await;
- let (session, options) = result.context("the agent's model list timed out")??;
- Ok(model_catalog(&session, &options))
+ result.context("the agent's model list timed out")?
+}
+
+/// Probe model-dependent settings in the disposable discovery session, never in a bot's session.
+async fn discover_options(acp: &crate::agent::acp::Acp, session: &Value, catalog: &mut Value) -> Result<()> {
+ let Some(sid) = session["sessionId"].as_str() else { return Ok(()) };
+ let Some(config) = model_config(session).and_then(|c| c["id"].as_str()) else { return Ok(()) };
+ let current = catalog["currentModelId"].clone();
+ let Some(models) = catalog["models"].as_array_mut() else { return Ok(()) };
+ for model in models {
+ let response = if model["id"] == current {
+ session.clone()
+ } else {
+ match acp
+ .request(
+ "session/set_config_option",
+ json!({"sessionId": sid,
+ "configId": config, "value": model["id"]}),
+ )
+ .await
+ {
+ Ok(response) => response,
+ Err(error) => {
+ model["options"] = json!([]);
+ model["optionsError"] = format!("Couldn't load model settings: {error}").into();
+ continue;
+ }
+ }
+ };
+ model["options"] = json!(reasoning_options(&response));
+ }
+ Ok(())
+}
+
+/// Only reasoning belongs here: permission/mode and Fast mode have their own controls.
+fn reasoning_options(session: &Value) -> Vec<Value> {
+ session["configOptions"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .filter(|o| {
+ o["category"] == "thought_level"
+ || (o["category"] != "mode"
+ && matches!(
+ o["id"].as_str(),
+ Some("reasoning_effort" | "reasoning-effort" | "thought_level" | "effort")
+ ))
+ })
+ .filter_map(parse_select_option)
+ .map(|mut option| {
+ option["kind"] = "reasoning".into();
+ // Inherit/reset has one dedicated control in every client, not a second effort level.
+ if let Some(values) = option["values"].as_array_mut() {
+ values.retain(|v| v["id"] != "default");
+ }
+ option
+ })
+ .collect()
}
/// IDs are agent-defined: use the category, with legacy conventional IDs as a fallback.
@@ -87,10 +147,13 @@ fn model_catalog(session: &Value, options: &Value) -> Value {
}
text(&session["models"]["currentModelId"])
};
+ let initial_options = reasoning_options(session);
for model in &mut models {
- model["options"] = json!(model_options(options, model["id"].as_str().unwrap_or_default()));
+ let own = model_options(options, model["id"].as_str().unwrap_or_default());
+ model["options"] = json!(if options.is_null() { initial_options.clone() } else { own });
}
json!({"models": models, "currentModelId": current,
+ "defaultModelOptions": true,
"fastMode": crate::agent::config::fast_mode_config(session).is_some()})
}
@@ -98,31 +161,74 @@ fn model_catalog(session: &Value, options: &Value) -> Value {
/// `{models: [{value, configOptions}]}` (ACP select config options).
fn model_options(options: &Value, model: &str) -> Vec<Value> {
let entry = options["models"].as_array().into_iter().flatten().find(|m| m["value"] == model);
- entry
- .and_then(|m| m["configOptions"].as_array())
- .into_iter()
- .flatten()
- .filter(|o| o["type"] == "select")
- .filter_map(|o| {
- let id = text(&o["id"])?;
- let values: Vec<Value> = o["options"]
- .as_array()?
- .iter()
- .filter_map(|v| {
- let value = text(&v["value"])?;
- Some(json!({"id": value, "name": text(&v["name"]).unwrap_or(value)}))
- })
- .collect();
- Some(json!({"id": id, "name": text(&o["name"]).unwrap_or(id), "values": values,
- "default": text(&o["currentValue"])}))
- })
- .collect()
+ entry.and_then(|m| m["configOptions"].as_array()).into_iter().flatten().filter_map(parse_select_option).collect()
+}
+
+fn parse_select_option(option: &Value) -> Option<Value> {
+ if option["type"] != "select" {
+ return None;
+ }
+ let id = text(&option["id"])?;
+ let mut values = Vec::new();
+ collect_values(&option["options"], &mut values);
+ if values.is_empty() {
+ return None;
+ }
+ Some(json!({"id": id, "name": text(&option["name"]).unwrap_or(id), "values": values,
+ "default": text(&option["currentValue"])}))
+}
+
+fn collect_values(options: &Value, out: &mut Vec<Value>) {
+ for value in options.as_array().into_iter().flatten() {
+ if value["options"].is_array() {
+ collect_values(&value["options"], out);
+ } else if let Some(id) = text(&value["value"])
+ && !out.iter().any(|v| v["id"] == id)
+ {
+ out.push(json!({"id": id, "name": text(&value["name"]).unwrap_or(id)}));
+ }
+ }
}
#[cfg(test)]
mod tests {
use super::*;
+ #[tokio::test]
+ async fn an_unavailable_model_keeps_other_models_and_their_options() {
+ let fixture = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/model_options_agent.py");
+ let command = format!("python3 '{}'", fixture.display());
+ let (acp, _inbox) = crate::agent::acp::Acp::spawn(&command, env!("CARGO_MANIFEST_DIR"), &[]).unwrap();
+ let session = json!({"sessionId": "s1", "configOptions": [{"id": "model", "category": "model",
+ "type": "select", "currentValue": "first", "options": [
+ {"value": "first"}, {"value": "unavailable"}, {"value": "second"}]}]});
+ let mut catalog = model_catalog(&session, &Value::Null);
+ discover_options(&acp, &session, &mut catalog).await.unwrap();
+ acp.kill().await;
+ assert_eq!(catalog["models"].as_array().unwrap().len(), 3);
+ assert!(catalog["models"][1]["optionsError"].as_str().unwrap().contains("model not available"));
+ assert_eq!(catalog["models"][1]["options"], json!([]));
+ assert_eq!(catalog["models"][2]["options"][0]["default"], "high");
+ assert_eq!(catalog["defaultModelOptions"], true);
+ }
+
+ #[test]
+ fn reasoning_catalog_preserves_defaults_and_grouped_levels_without_permission_options() {
+ let session = json!({"models": {"currentModelId": "opus", "availableModels": [{"modelId": "opus"}]},
+ "configOptions": [
+ {"id": "effort", "category": "thought_level", "type": "select", "currentValue": "high",
+ "options": [{"group": "levels", "options": [{"value": "low", "name": "Low"}, {"value": "high", "name": "High"}]}]},
+ {"id": "mode", "category": "mode", "type": "select", "options": [{"value": "bypassPermissions"}]},
+ {"id": "fast", "type": "boolean"}
+ ]});
+ let catalog = model_catalog(&session, &Value::Null);
+ let options = catalog["models"][0]["options"].as_array().unwrap();
+ assert_eq!(options.len(), 1);
+ assert_eq!(options[0]["id"], "effort");
+ assert_eq!(options[0]["default"], "high");
+ assert_eq!(options[0]["values"].as_array().unwrap().len(), 2);
+ }
+
#[test]
fn model_catalog_reads_grouped_config_and_preserves_agent_ids() {
let session = json!({"configOptions": [{
@@ -157,7 +263,7 @@ mod tests {
assert_eq!(result["models"][0]["description"], "Available here");
assert_eq!(
model_catalog(&json!({}), &Value::Null),
- json!({"models": [], "currentModelId": null, "fastMode": false})
+ json!({"models": [], "currentModelId": null, "fastMode": false, "defaultModelOptions": true})
);
}
diff --git a/host/src/agent/bot/launch.rs b/host/src/agent/bot/launch.rs
index 4ed4f1ec..5df50f1e 100644
--- a/host/src/agent/bot/launch.rs
+++ b/host/src/agent/bot/launch.rs
@@ -50,23 +50,31 @@ pub(crate) fn launch_commands(cfg: &BotConfig) -> Result<Vec<Candidate>> {
/// chosen model, then sets that model's options (effort, fast…). Returns the answer holding
/// the session's config options now: a model can change them.
pub(crate) async fn select_model(acp: &Acp, res: &Value, sid: &str, cfg: &BotConfig) -> Result<Value> {
- let Some(model) = cfg.model.as_deref().filter(|m| !m.is_empty()) else { return Ok(res.clone()) };
- let Some(config_id) = crate::agent::auth::model_config(res).and_then(|c| c["id"].as_str()) else {
- let r = acp.request("session/set_model", json!({"sessionId": sid, "modelId": model})).await;
- return r.map(|_| res.clone()).map_err(|e| model_error(model, &e));
- };
- let (model, options) = model_choice(res, model, &cfg.model_options);
+ let selected = cfg.model.as_deref().filter(|m| !m.is_empty());
+ let (model, options) = model_choice(res, selected.unwrap_or("Default"), &cfg.model_options);
let set = |id: &str, value: &str| {
acp.request("session/set_config_option", json!({"sessionId": sid, "configId": id, "value": value}))
};
- let mut current = set(config_id, model).await.map_err(|e| model_error(model, &e))?;
+ let mut current = res.clone();
+ if selected.is_some() {
+ if let Some(config_id) = crate::agent::auth::model_config(res).and_then(|c| c["id"].as_str()) {
+ let answer = set(config_id, model).await.map_err(|e| model_error(model, &e))?;
+ if answer["configOptions"].is_array() {
+ current = answer;
+ }
+ } else {
+ acp.request("session/set_model", json!({"sessionId": sid, "modelId": model}))
+ .await
+ .map_err(|e| model_error(model, &e))?;
+ }
+ }
for (id, value) in options {
let answer = set(id, value).await.map_err(|e| model_error(&format!("{model} with {id}={value}"), &e))?;
if answer["configOptions"].is_array() {
current = answer;
}
}
- Ok(if current["configOptions"].is_array() { current } else { res.clone() })
+ Ok(current)
}
/// The model to select and the options to set on it: the model id's variant, then the bot's own. How the agent
diff --git a/host/src/tui/app/bot.rs b/host/src/tui/app/bot.rs
index d47d3d84..59721afa 100644
--- a/host/src/tui/app/bot.rs
+++ b/host/src/tui/app/bot.rs
@@ -93,6 +93,7 @@ pub struct AgentModel {
pub id: String,
pub name: String,
pub options: Vec<ModelOption>,
+ pub options_error: Option<String>,
}
/// A model setting (effort, fast…) and its values as `(id, name)`.
@@ -100,6 +101,7 @@ pub struct ModelOption {
pub id: String,
pub name: String,
pub values: Vec<(String, String)>,
+ pub default: Option<String>,
}
impl AgentModel {
@@ -112,9 +114,14 @@ impl AgentModel {
let options = v["options"].as_array().into_iter().flatten().filter_map(|o| {
let (name, id) = pair(o)?;
let values = o["values"].as_array()?.iter().filter_map(|v| pair(v).map(|(n, i)| (i, n))).collect();
- Some(ModelOption { id, name, values })
+ Some(ModelOption { id, name, values, default: o["default"].as_str().map(str::to_owned) })
});
- Some(Self { id, name, options: options.collect() })
+ Some(Self {
+ id,
+ name,
+ options: options.collect(),
+ options_error: v["optionsError"].as_str().map(str::to_owned),
+ })
}
}
diff --git a/host/src/tui/app/forms.rs b/host/src/tui/app/forms.rs
index 26dc72dd..286479cc 100644
--- a/host/src/tui/app/forms.rs
+++ b/host/src/tui/app/forms.rs
@@ -248,6 +248,7 @@ impl App {
f.backend.clone_from(&ids[cycle(i, d, ids.len())]);
// Another agent's model ids mean nothing here, and it can't be its own fallback.
f.model.clear();
+ f.model_options = Default::default();
let own = f.backend.clone();
f.fallbacks.retain(|x| x.backend != own);
self.want_models(&f.backend);
@@ -383,6 +384,21 @@ mod tests {
use super::super::{AgentModel, test_app};
use super::*;
+ #[tokio::test]
+ async fn changing_agent_clears_default_model_effort() {
+ let mut app = test_app();
+ app.backends = vec![json!({"id": "claude", "available": true}), json!({"id": "codex", "available": true})];
+ let bot = json!({"id": "b", "backend": "claude", "modelOptions": {"effort": "high"}});
+ app.bots.insert("b".into(), Bot::parse(&bot).expect("a bot"));
+ app.selected = Some("b".into());
+ app.edit_bot();
+ let Some(Overlay::Form(mut f)) = app.overlays.pop() else { panic!("editor opens") };
+ f.field = FIELDS.iter().position(|x| *x == Field::Agent).expect("agent field");
+ let Some(Overlay::Form(f)) = app.form_key(f, KeyEvent::from(KeyCode::Right)) else { panic!("editor stays") };
+ assert_ne!(f.backend, "claude");
+ assert!(f.model_options.1.is_empty());
+ }
+
#[tokio::test]
async fn model_options_cycle_and_belong_to_their_model() {
let mut app = test_app();
diff --git a/host/src/tui/manage/mod.rs b/host/src/tui/manage/mod.rs
index 360cf83d..6029211f 100644
--- a/host/src/tui/manage/mod.rs
+++ b/host/src/tui/manage/mod.rs
@@ -327,7 +327,7 @@ impl App {
pub(super) fn cycle_model(&self, backend: &str, current: &str, d: isize) -> Option<String> {
let list = self.models.get(backend)?.as_ref()?;
let mut ids = vec![String::new()];
- ids.extend(list.iter().map(|m| m.id.clone()));
+ ids.extend(list.iter().filter(|m| !m.id.is_empty()).map(|m| m.id.clone()));
let i = ids.iter().position(|x| x == current).unwrap_or(0);
Some(ids[super::app::cycle(i, d, ids.len())].clone())
}
diff --git a/host/src/tui/manage/replies.rs b/host/src/tui/manage/replies.rs
index f7bfa141..4fb5fcf0 100644
--- a/host/src/tui/manage/replies.rs
+++ b/host/src/tui/manage/replies.rs
@@ -175,7 +175,26 @@ impl App {
}
}
Reply::Models(backend) => {
- let list = v["models"].as_array().into_iter().flatten().filter_map(AgentModel::parse).collect();
+ let mut list: Vec<_> =
+ v["models"].as_array().into_iter().flatten().filter_map(AgentModel::parse).collect();
+ if v["defaultModelOptions"] == true
+ && let Some(default) = v["models"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .find(|m| m["id"] == v["currentModelId"])
+ .and_then(AgentModel::parse)
+ {
+ list.insert(
+ 0,
+ AgentModel {
+ id: String::new(),
+ name: "Default".into(),
+ options: default.options,
+ options_error: default.options_error,
+ },
+ );
+ }
if v["fastMode"] == true {
self.fast_mode.insert(backend.clone());
}
diff --git a/host/src/tui/view/forms.rs b/host/src/tui/view/forms.rs
index 136929e1..56e4924a 100644
--- a/host/src/tui/view/forms.rs
+++ b/host/src/tui/view/forms.rs
@@ -132,14 +132,25 @@ pub(super) fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {
Field::ModelOptions => {
let offered = app.model_settings(&f.backend, f.model.text.trim());
if offered.is_empty() {
- put(buf, vx, y, vw, "none for this model", t.dim.patch(base));
+ let error = app
+ .models
+ .get(&f.backend)
+ .and_then(Option::as_ref)
+ .and_then(|models| models.iter().find(|m| m.id == f.model.text.trim()))
+ .and_then(|model| model.options_error.as_deref());
+ put(buf, vx, y, vw, error.unwrap_or("none for this model"), t.dim.patch(base));
}
let mut x = vx;
for (j, o) in offered.iter().enumerate() {
let picked = f.model_options().and_then(|p| p.get(&o.id));
- let value = picked.map_or("default", |v| {
- o.values.iter().find(|(id, _)| id == v).map_or(v.as_str(), |(_, name)| name.as_str())
- });
+ let chosen = picked.or(o.default.as_ref());
+ let name = chosen
+ .map(|v| o.values.iter().find(|(id, _)| id == v).map_or(v.as_str(), |(_, name)| name.as_str()));
+ let value = match (picked, name) {
+ (None, Some(name)) => format!("default · {name}"),
+ (_, Some(name)) => name.to_owned(),
+ _ => "default".to_owned(),
+ };
let item = format!("{} ‹{value}›", o.name);
let s = if active && j == f.sub { t.bold.add_modifier(Modifier::UNDERLINED) } else { t.text };
if x + u(w(&item)) >= inner.right() {
diff --git a/host/tests/fixtures/model_options_agent.py b/host/tests/fixtures/model_options_agent.py
new file mode 100644
index 00000000..834dd8b0
--- /dev/null
+++ b/host/tests/fixtures/model_options_agent.py
@@ -0,0 +1,17 @@
+"""Discovery fixture: two usable models and an advertised but unavailable model."""
+import json
+import sys
+model = "first"
+for line in sys.stdin:
+ msg = json.loads(line)
+ if "id" not in msg:
+ continue
+ requested = msg.get("params", {}).get("value")
+ if requested == "unavailable":
+ result = {"error": {"code": -32602, "message": "model not available"}}
+ else:
+ model = requested or model
+ level = "high" if model == "second" else "medium"
+ result = {"result": {"configOptions": [{"id": "effort", "type": "select", "category": "thought_level",
+ "currentValue": level, "options": [{"value": "medium"}, {"value": "high"}]}]}}
+ print(json.dumps({"jsonrpc": "2.0", "id": msg["id"], **result}), flush=True)
diff --git a/host/tests/fixtures/reasoning_agent.py b/host/tests/fixtures/reasoning_agent.py
new file mode 100644
index 00000000..23b2ade4
--- /dev/null
+++ b/host/tests/fixtures/reasoning_agent.py
@@ -0,0 +1,42 @@
+"""ACP fixture exposing effort with legacy model selection and per-process defaults."""
+import json
+import sys
+
+effort = "medium"
+model = "default"
+
+
+def send(value):
+ print(json.dumps({"jsonrpc": "2.0", **value}), flush=True)
+
+
+def options():
+ return {"configOptions": [{"id": "effort", "category": "thought_level", "type": "select",
+ "currentValue": effort, "options": [{"value": v, "name": v} for v in ["low", "medium", "high"]]}]}
+
+
+for line in sys.stdin:
+ message = json.loads(line)
+ method, rid = message.get("method"), message.get("id")
+ if method is None or rid is None:
+ continue
+ params = message.get("params", {})
+ if method == "initialize":
+ result = {"protocolVersion": 1, "agentCapabilities": {"loadSession": True}}
+ elif method in ("session/new", "session/load"):
+ result = {"sessionId": "s1", **options()}
+ elif method == "session/set_model":
+ model = params["modelId"]
+ result = {}
+ elif method == "session/set_config_option":
+ assert params["configId"] == "effort"
+ effort = params["value"]
+ result = options()
+ elif method == "session/prompt":
+ text = " ".join(b.get("text", "") for b in params.get("prompt", []))
+ send({"method": "session/update", "params": {"sessionId": "s1", "update": {
+ "sessionUpdate": "agent_message_chunk", "content": {"type": "text", "text": f"{model} {effort} · {text}"}}}})
+ result = {"stopReason": "end_turn"}
+ else:
+ result = {}
+ send({"id": rid, "result": result})
diff --git a/host/tests/turns_e2e.rs b/host/tests/turns_e2e.rs
index 1956dbf5..33cc1acc 100644
--- a/host/tests/turns_e2e.rs
+++ b/host/tests/turns_e2e.rs
@@ -314,3 +314,35 @@ async fn a_session_that_ended_in_the_agent_is_closed_and_loaded_again() {
host.call("send", json!({"botId": bot, "text": "still there?"})).await;
host.wait_for(&bot, Duration::from_secs(30), |e| e["kind"] == "agent" && e["data"]["text"] == "still here").await;
}
+
+#[tokio::test]
+async fn reasoning_is_per_bot_and_applies_with_default_and_legacy_models() {
+ if python_missing() {
+ return;
+ }
+ let mut host = Host::start().await;
+ let bot = host.bot("Reasoning", "tests/fixtures/reasoning_agent.py").await;
+ let other = host.bot("Other", "tests/fixtures/reasoning_agent.py").await;
+ host.call("updateBot", json!({"id": bot, "modelOptions": {"effort": "high"}})).await;
+ host.call("send", json!({"botId": bot, "text": "one"})).await;
+ host.wait_for(&bot, Duration::from_mins(1), speed_reply("default high", "one")).await;
+ host.call("send", json!({"botId": other, "text": "other"})).await;
+ host.wait_for(&other, Duration::from_mins(1), speed_reply("default medium", "other")).await;
+ host.wait_idle().await;
+
+ // The saved preference survives the host and agent process restarting.
+ common::stop(&mut host.child);
+ let (child, base) = common::serve(&host.home).await;
+ host.child = child;
+ host.base = base;
+ host.call("send", json!({"botId": bot, "text": "resumed"})).await;
+ host.wait_for(&bot, Duration::from_mins(1), speed_reply("default high", "resumed")).await;
+ host.wait_idle().await;
+ host.call("updateBot", json!({"id": bot, "model": "explicit", "modelOptions": {"effort": "low"}})).await;
+ host.call("send", json!({"botId": bot, "text": "explicit"})).await;
+ host.wait_for(&bot, Duration::from_mins(1), speed_reply("explicit low", "explicit")).await;
+ host.wait_idle().await;
+ host.call("updateBot", json!({"id": bot, "modelOptions": {}})).await;
+ host.call("send", json!({"botId": bot, "text": "reset"})).await;
+ host.wait_for(&bot, Duration::from_mins(1), speed_reply("explicit medium", "reset")).await;
+}
diff --git a/web/content/docs/agent-fallbacks.mdx b/web/content/docs/agent-fallbacks.mdx
index 67b57d7a..f609627b 100644
--- a/web/content/docs/agent-fallbacks.mdx
+++ b/web/content/docs/agent-fallbacks.mdx
@@ -6,7 +6,7 @@ A bot has no fallbacks until you add them.
## Set up fallbacks
-Fallbacks live in the bot's **Agent** card, under Model:
+Fallbacks live in the bot's **Agent** card, below its expandable settings:
- **Desktop app:** click the bot's name at the top of the chat. The **Details** tab shows the Agent card.
- **iPhone:** tap the bot's name at the top of the chat. The **Details** tab shows the Agent card.
@@ -15,7 +15,7 @@ Fallbacks live in the bot's **Agent** card, under Model:
In the desktop and iPhone apps:
1. Next to **Fallbacks**, press **+**.
-2. In **Add fallback**, choose the **Agent** and its **Model**.
+2. In **Add fallback**, expand the agent summary. Click the agent to search harnesses, then select its model. Selecting a model hides the search list; the agent, model and any reasoning settings remain accessible.
3. Add up to three. Use each row's ⋯ menu to **Move up**, **Move down** or **Remove**.
Each agent can appear once, and the bot's own agent isn't offered. The info button next to Fallbacks explains the feature.
diff --git a/web/content/docs/agents.mdx b/web/content/docs/agents.mdx
index ed10a2eb..2cec6d78 100644
--- a/web/content/docs/agents.mdx
+++ b/web/content/docs/agents.mdx
@@ -96,10 +96,12 @@ For an agent Codync knows by name, the chat also tells you when it needs signing
In the bot's settings, under **Agent**:
- **Model:** **Default** uses the agent's own default. The list shows the models the agent reports for the computer's sign-in; use the refresh button to load it again. If an agent doesn't report a model list, leave Default or type a model ID.
-- **Model options:** some models have their own settings, such as reasoning effort, each with a row and its own Default.
+- **Reasoning effort:** expand the Agent row to see the selected model’s supported levels. **Default** shows the agent’s reported level; selecting it removes this bot’s override. Each bot keeps its own choice across sessions, including when its model is Default, without changing the shared CLI settings. Available levels come from the agent, so they can differ by model.
- **Fast mode:** a switch shown when the agent offers it for the model. Claude Code and Codex do. You can also type `/fast` in the chat.
-Changing the model starts a new agent session; the chat history stays. Switching the bot to a different agent starts it on that agent's default model.
+On desktop and iPhone, the collapsed Agent row summarizes the harness, model, effort and Fast mode. Expand it to access all settings. Click the harness or model to search; selecting a model closes only the search list. The refresh control is beside the search field. In the terminal, use the Agent, Model and model-option fields with the keyboard.
+
+Changing the model or its options starts a new agent session; the chat history stays. Switching the bot to a different agent starts it on that agent's default model.
## The agent for a new bot