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.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat: let Claude Code and Codex bots use Fast mode (#101)
Kai Wud753e31e8014
diff --git a/apps/desktop/src/renderer/store/bot-store.ts b/apps/desktop/src/renderer/store/bot-store.tsindex 0d02cf98..9fa6bca0 100644--- a/apps/desktop/src/renderer/store/bot-store.ts+++ b/apps/desktop/src/renderer/store/bot-store.ts@@ -223,6 +223,10 @@ export class BotStore extends BotSync {this.patchBot(bot, { hidden })}+ setFastMode(bot: Bot, fastMode: boolean) {+ this.patchBot(bot, { fastMode })+ }+/** The roster as the user dragged it, top first: shown at once, then saved on the host. */reorder(ids: string[]) {ids.forEach((id, position) => {@@ -352,7 +356,7 @@ function updatePayload(bot: Bot): BotDraft {id: bot.id, name: bot.name, description: bot.description, avatarColor: bot.avatarColor, avatarShape: bot.avatarShape,backend: bot.backend, command: bot.command ?? null, cwd: bot.managedWorkspace ? '' : bot.cwd, permission: bot.permission,model: bot.model ?? null, pinned: bot.pinned, hidden: bot.hidden, notify: bot.notify ?? null,- connectors: bot.connectors, skills: bot.skills, computer: bot.computer,+ connectors: bot.connectors, skills: bot.skills, computer: bot.computer, fastMode: bot.fastMode,}}diff --git a/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx b/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsxindex 017f035a..8f64127c 100644--- a/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx+++ b/apps/desktop/src/renderer/views/bots/AgentModelPicker.tsx@@ -1,38 +1,18 @@-import { useEffect, useRef, useState } from 'react'+import { useEffect, useRef } from 'react'import { ChoicePicker, IconButton, Pill, Spinner } from '../../components/Controls'import { font } from '../../lib/fonts'-import { useStore } from '../../store/context'-import { errorText } from './drafts'+import type { AgentModelsState } from './agent-models'-/** A model's own setting (effort, fast…) and the values the agent accepts. */-interface ModelOption {- id: string- name: string- values: { id: string; name: string }[]- default?: string | null-}--/** Model identifiers and display names advertised by the selected computer's ACP agent. */-interface AgentModels {- models: { id: string; name: string; description?: string | null; options?: ModelOption[] }[]- currentModelId?: string | null-}--/** Models come from the selected computer's agent, never a bundled provider list. */-export function AgentModelPicker({ backend, selection, onChange, options: chosen, onOptionsChange }: {+/** 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 }: {backend: string+ models: AgentModelsStateselection: string | null | undefinedonChange: (model: string | null) => voidoptions: Record<string, string>onOptionsChange: (options: Record<string, string>) => void}) {- const store = useStore()- const online = store.connection.kind === 'online'- const [catalog, setCatalog] = useState<AgentModels | null>(null)- const scope = useRef<string | null>(null)- const [loading, setLoading] = useState(false)- const [failure, setFailure] = useState<string | null>(null)- const [retry, setRetry] = useState(0)+ const { catalog, loading, failure } = modelsconst custom = backend === 'custom'// A different agent starts on its own default model.@@ -43,32 +23,6 @@ export function AgentModelPicker({ backend, selection, onChange, options: chosenonChange(null)}, [backend, onChange])- useEffect(() => {- const key = `${store.computer.id}/${backend}`- if (scope.current !== key) {- setCatalog(null)- scope.current = key- }- setFailure(null)- setLoading(false)- if (custom) return- const client = store.client- if (!online || !client) {- setFailure('Connect to this computer to load its models. You can still enter a model ID.')- return- }- let cancelled = false- setLoading(true)- client- .call<AgentModels>('agentModels', { backend }, 300_000)- .then((res) => !cancelled && setCatalog(res))- .catch((e: unknown) => !cancelled && setFailure(`Couldn't load models: ${errorText(e)}`))- .finally(() => !cancelled && setLoading(false))- return () => {- cancelled = true- }- }, [store.computer.id, store.client, backend, online, retry, custom])-// 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'))@@ -95,7 +49,7 @@ export function AgentModelPicker({ backend, selection, onChange, options: chosen// Loading and refresh share one fixed slot, so the row never grows for loading.<div style={{ width: 28, height: 28, display: 'grid', placeItems: 'center', flex: 'none' }}><div style={{ gridArea: '1 / 1', opacity: loading ? 0 : 1, transition: 'opacity var(--fade)', pointerEvents: loading ? 'none' : undefined }}>- <IconButton title={failure ? 'Retry model list' : 'Refresh model list'} icon="arrow.clockwise" disabled={loading} onClick={() => setRetry((r) => r + 1)} />+ <IconButton title={failure ? 'Retry model list' : 'Refresh model list'} icon="arrow.clockwise" disabled={loading} onClick={models.reload} /></div>{loading ? (<div className="fade-in" style={{ gridArea: '1 / 1', display: 'flex' }} aria-label="Loading available models">diff --git a/apps/desktop/src/renderer/views/bots/BotEditorView.tsx b/apps/desktop/src/renderer/views/bots/BotEditorView.tsxindex 00a96772..1395ac4b 100644--- a/apps/desktop/src/renderer/views/bots/BotEditorView.tsx+++ b/apps/desktop/src/renderer/views/bots/BotEditorView.tsx@@ -1,4 +1,5 @@import { useCallback, useEffect, useRef, useState } from 'react'+import { fastModeRefusal, fastModeShown } from '@shared/fast-mode'import { draftOf, type BotDraft, type DirListing } from '@shared/models'import { CharacterAvatar } from '../../components/Avatar'import { CardSection, ChoicePicker, DropdownMenu, IconButton, Pill, SearchField, Spinner, ValueRow } from '../../components/Controls'@@ -7,6 +8,7 @@ import { ModalHeader, Sheet, useDismiss } from '../../components/Overlay'import { font } from '../../lib/fonts'import { AVATAR_COLORS, AVATAR_SHAPES } from '../../lib/theme'import { useStore } from '../../store/context'+import { useAgentModels } from './agent-models'import { AgentModelPicker } from './AgentModelPicker'import { errorText, fillDefaults, isValid, lastPathComponent, normalized, usePlugins, type Plugins } from './drafts'import { FormSheet } from '../marketplace/pieces'@@ -104,6 +106,8 @@ function BotSettingsForm({ draft, onChange, error, plugins }: {// Options belong to one model.const setModel = useCallback((model: string | null) => onChange((d) => (d.model === model ? d : { ...d, model, modelOptions: {} })), [onChange])const setModelOptions = useCallback((modelOptions: Record<string, string>) => onChange((d) => ({ ...d, modelOptions })), [onChange])+ const models = useAgentModels(draft.backend)+ const saved = draft.id ? (store.bots.get(draft.id) ?? null) : nullconst backends = store.hello?.backends ?? []const backend = backends.find((b) => b.id === draft.backend)@@ -160,7 +164,18 @@ function BotSettingsForm({ draft, onChange, error, plugins }: {/>) : null}</div>- <AgentModelPicker backend={draft.backend} selection={draft.model} onChange={setModel} options={draft.modelOptions ?? {}} onOptionsChange={setModelOptions} />+ <AgentModelPicker 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 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}<ValueRowlabel="Workspace"detail={diff --git a/apps/desktop/src/renderer/views/bots/agent-models.ts b/apps/desktop/src/renderer/views/bots/agent-models.tsnew file mode 100644index 00000000..e34a95bb--- /dev/null+++ b/apps/desktop/src/renderer/views/bots/agent-models.ts@@ -0,0 +1,67 @@+import { useEffect, useRef, useState } from 'react'+import { useStore } from '../../store/context'+import { errorText } from './drafts'++/** A model's own setting (effort, fast…) and the values the agent accepts. */+export interface ModelOption {+ id: string+ name: string+ values: { id: string; name: string }[]+ default?: string | null+}++/** 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[] }[]+ currentModelId?: string | null+ /** The agent offers Fast mode (absent on older hosts). */+ fastMode?: boolean+}++/** What the agent behind `backend` offers, loaded from the selected computer. */+export interface AgentModelsState {+ catalog: AgentModels | null+ loading: boolean+ failure: string | null+ reload: () => void+}++/** Models come from the selected computer's agent, never a bundled provider list. */+export function useAgentModels(backend: string): AgentModelsState {+ const store = useStore()+ const online = store.connection.kind === 'online'+ const [catalog, setCatalog] = useState<AgentModels | null>(null)+ const scope = useRef<string | null>(null)+ const [loading, setLoading] = useState(false)+ const [failure, setFailure] = useState<string | null>(null)+ const [retry, setRetry] = useState(0)+ const custom = backend === 'custom'++ useEffect(() => {+ const key = `${store.computer.id}/${backend}`+ if (scope.current !== key) {+ setCatalog(null)+ scope.current = key+ }+ setFailure(null)+ setLoading(false)+ if (custom) return+ const client = store.client+ if (!online || !client) {+ setFailure('Connect to this computer to load its models. You can still enter a model ID.')+ return+ }+ let cancelled = false+ setLoading(true)+ client+ .call<AgentModels>('agentModels', { backend }, 300_000)+ .then((res) => !cancelled && setCatalog(res))+ .catch((e: unknown) => !cancelled && setFailure(`Couldn't load models: ${errorText(e)}`))+ .finally(() => !cancelled && setLoading(false))+ return () => {+ cancelled = true+ }+ }, [store.computer.id, store.client, backend, online, retry, custom])++ return { catalog, loading, failure, reload: () => setRetry((r) => r + 1) }+}diff --git a/apps/desktop/src/renderer/views/thread/Composer.tsx b/apps/desktop/src/renderer/views/thread/Composer.tsxindex 3da4cac7..af16e30e 100644--- a/apps/desktop/src/renderer/views/thread/Composer.tsx+++ b/apps/desktop/src/renderer/views/thread/Composer.tsx@@ -1,5 +1,6 @@import { useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore, type ReactNode } from 'react'import { isBelow } from '@shared/compat'+import { fastModeShown, fastModeState, fastModeTitle } from '@shared/fast-mode'import { isGroup, isWorkingIn, type Bot } from '@shared/models'import { BotAvatar } from '../../components/Avatar'import { Icon } from '../../components/Icon'@@ -187,6 +188,17 @@ function DestinationComposer({ botId, thread, onCall, onInterrupt }: {<Icon name="plus" size={13} weight="medium" color="var(--text)" /></button>) : null}+ {bot && fastModeShown(bot) ? (+ <button+ className={`press composer-add composer-fast fade-in ${fastModeState(bot)}`}+ aria-label={fastModeTitle(bot)}+ aria-pressed={bot.fastMode}+ title={fastModeTitle(bot)}+ onClick={() => store.setFastMode(bot, !bot.fastMode)}+ >+ <Icon name="bolt" size={12} weight="semibold" />+ </button>+ ) : null}<div className="composer-field"><div ref={measure} className="composer-measure" aria-hidden="true">{draft + '\u200b'}</div><textareadiff --git a/apps/desktop/src/renderer/views/thread/composer.css b/apps/desktop/src/renderer/views/thread/composer.cssindex 34ed8a1a..23de49bd 100644--- a/apps/desktop/src/renderer/views/thread/composer.css+++ b/apps/desktop/src/renderer/views/thread/composer.css@@ -10,6 +10,17 @@flex: none;margin-bottom: calc(max(0px, (round(up, calc(var(--conversation) * 1.25), 1px) + 10px - 25px) / 2));}+/* Fast mode: filled while on, a warning tint while the agent refuses it. */+.composer-fast {+ color: var(--secondary);+ transition: background var(--fade), color var(--fade), border-color var(--fade);+}+.composer-fast.on {+ background: var(--accent-fill);+ border-color: transparent;+ color: var(--on-accent);+}+.composer-fast.refused { color: var(--warning); }.composer-surface {flex: 1;min-width: 0;diff --git a/apps/desktop/src/shared/fast-mode.ts b/apps/desktop/src/shared/fast-mode.tsnew file mode 100644index 00000000..d7ff8b3f--- /dev/null+++ b/apps/desktop/src/shared/fast-mode.ts@@ -0,0 +1,34 @@+// Fast mode in the chat (composer ⚡) and bot settings; the host reports what the agent+// offers (`fastModeSupport`, `fastModeIssue`): docs/features/marketplace.md, "Fast mode".+import type { Bot } from './models'++export type FastModeState = 'on' | 'off' | 'refused'++/** An agent bot whose agent offers Fast mode, or one that has it on (so it can be turned off). */+export function fastModeShown(bot: Bot | null): boolean {+ if (!bot || bot.kind === 'group') return false+ return bot.fastMode || bot.fastModeSupport === 'offered' || bot.fastModeSupport === 'refused'+}++export function fastModeState(bot: Bot): FastModeState {+ if (!bot.fastMode) return 'off'+ return bot.fastModeSupport === 'refused' ? 'refused' : 'on'+}++/** Why it isn't in effect, when the agent turned it off itself. */+export function fastModeRefusal(bot: Bot): string | null {+ if (fastModeState(bot) !== 'refused') return null+ return `The agent turned it off: ${bot.fastModeIssue ?? 'not available'}. Switch it off and on to try again.`+}++/** The composer button's tooltip and accessibility label. */+export function fastModeTitle(bot: Bot): string {+ switch (fastModeState(bot)) {+ case 'off':+ return 'Turn on Fast mode: faster replies, more usage'+ case 'on':+ return 'Turn off Fast mode'+ case 'refused':+ return `Fast mode is off. ${fastModeRefusal(bot)}`+ }+}diff --git a/apps/desktop/src/shared/models.test.ts b/apps/desktop/src/shared/models.test.tsnew file mode 100644index 00000000..a64bfe82--- /dev/null+++ b/apps/desktop/src/shared/models.test.ts@@ -0,0 +1,24 @@+import assert from 'node:assert/strict'+import { test } from 'node:test'+import { draftOf, normalizeBot } from './models.ts'++test('a bot keeps its Fast mode through the settings draft', () => {+ const bot = normalizeBot({ id: 'b', backend: 'codex', fastMode: true })+ assert.equal(bot.fastMode, true)+ assert.equal(draftOf(bot).fastMode, true)+})++test('a host without Fast mode reads as off', () => {+ assert.equal(normalizeBot({ id: 'b' }).fastMode, false)+})++test('the composer offers Fast mode once the agent does, and while it is on', async () => {+ const { fastModeShown, fastModeState, fastModeTitle } = await import('./fast-mode.ts')+ assert.equal(fastModeShown(normalizeBot({ id: 'b' })), false)+ assert.equal(fastModeShown(normalizeBot({ id: 'b', fastModeSupport: 'offered' })), true)+ assert.equal(fastModeShown(normalizeBot({ id: 'b', fastMode: true, fastModeSupport: 'unsupported' })), true)+ assert.equal(fastModeShown(normalizeBot({ id: 'g', kind: 'group', fastModeSupport: 'offered' })), false)+ const refused = normalizeBot({ id: 'b', fastMode: true, fastModeSupport: 'refused', fastModeIssue: 'requires extra usage' })+ assert.equal(fastModeState(refused), 'refused')+ assert.match(fastModeTitle(refused), /requires extra usage/)+})diff --git a/apps/desktop/src/shared/models.ts b/apps/desktop/src/shared/models.tsindex c6f7728a..21378b33 100644--- a/apps/desktop/src/shared/models.ts+++ b/apps/desktop/src/shared/models.ts@@ -22,6 +22,12 @@ export interface Bot {model?: string | null/** The model's own settings (effort, fast…): agent option id → value. */modelOptions: Record<string, string>+ /** The agent's Fast mode (Claude Code, Codex): faster replies for more usage. */+ fastMode: boolean+ /** What the agent says about Fast mode: `unknown` (no session yet), `offered`, `unsupported`,+ * or `refused` (it turned it off; `fastModeIssue` says why). */+ fastModeSupport: string+ fastModeIssue: string | nullpinned: boolean/** Where the user dragged it, lowest first (after pinned bots); ties sort by recent activity. */position: number@@ -62,6 +68,9 @@ export function normalizeBot(raw: Partial<Bot> & { id: string }): Bot {permission: raw.permission ?? 'auto',model: raw.model ?? null,modelOptions: raw.modelOptions ?? {},+ fastMode: raw.fastMode ?? false,+ fastModeSupport: raw.fastModeSupport ?? 'unknown',+ fastModeIssue: raw.fastModeIssue ?? null,pinned: raw.pinned ?? false,position: raw.position ?? 0,hidden: raw.hidden ?? false,@@ -409,6 +418,7 @@ export interface BotDraft {permission: stringmodel?: string | nullmodelOptions?: Record<string, string>+ fastMode?: booleanpinned?: booleanhidden?: booleannotify?: boolean | null@@ -430,6 +440,7 @@ export function draftOf(bot: Bot): BotDraft {permission: bot.permission,model: bot.model ?? null,modelOptions: bot.modelOptions,+ fastMode: bot.fastMode,pinned: bot.pinned,hidden: bot.hidden,notify: bot.notify ?? null,diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift b/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swiftindex 30d96674..67bcf36b 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/AgentModels.swift@@ -25,4 +25,6 @@ public struct AgentModels: Decodable, Sendable {public let models: [Model]public let currentModelId: String?+ /// The agent offers Fast mode (absent on older hosts).+ public let fastMode: Bool?}diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/Bot+FastMode.swift b/apps/ios/Kit/Sources/CodyncKit/Models/Bot+FastMode.swiftnew file mode 100644index 00000000..81560acf--- /dev/null+++ b/apps/ios/Kit/Sources/CodyncKit/Models/Bot+FastMode.swift@@ -0,0 +1,23 @@+import Foundation++/// Fast mode in the chat (composer) and bot settings; the host reports what the agent offers+/// (`fastModeSupport`, `fastModeIssue`): docs/features/marketplace.md, "Fast mode".+public extension Bot {+ enum FastModeState: Sendable { case on, off, refused }++ /// An agent bot whose agent offers Fast mode, or one that has it on (so it can be turned off).+ var fastModeShown: Bool {+ !isGroup && (fastMode || fastModeSupport == "offered" || fastModeSupport == "refused")+ }++ var fastModeState: FastModeState {+ guard fastMode else { return .off }+ return fastModeSupport == "refused" ? .refused : .on+ }++ /// Why it isn't in effect, when the agent turned it off itself.+ var fastModeRefusal: String? {+ guard fastModeState == .refused else { return nil }+ return "The agent turned it off: \(fastModeIssue ?? "not available"). Switch it off and on to try again."+ }+}diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/Models.swift b/apps/ios/Kit/Sources/CodyncKit/Models/Models.swiftindex 2afce11d..61a7f10c 100644--- a/apps/ios/Kit/Sources/CodyncKit/Models/Models.swift+++ b/apps/ios/Kit/Sources/CodyncKit/Models/Models.swift@@ -23,6 +23,12 @@ public struct Bot: Codable, Identifiable, Hashable, Sendable {public var model: String?/// The model's own settings (effort, fast…): agent option id → value.public var modelOptions: [String: String] = [:]+ /// The agent's Fast mode (Claude Code, Codex): faster replies for more usage.+ public var fastMode: Bool = false+ /// What the agent says about Fast mode: `unknown` (no session yet), `offered`, `unsupported`,+ /// or `refused` (it turned it off; `fastModeIssue` says why).+ public var fastModeSupport: String = "unknown"+ public var fastModeIssue: String?public var pinned: Bool/// Where the user dragged it, lowest first (after pinned bots); ties sort by recent activity.public var position: Int = 0@@ -341,6 +347,7 @@ public struct BotDraft: Codable, Hashable, Sendable {public var permission: Stringpublic var model: String?public var modelOptions: [String: String] = [:]+ public var fastMode: Bool?public var pinned: Bool?public var hidden: Bool?public var notify: Bool?@@ -372,6 +379,7 @@ public struct BotDraft: Codable, Hashable, Sendable {permission = bot.permissionmodel = bot.modelmodelOptions = bot.modelOptions+ fastMode = bot.fastModepinned = bot.pinnedhidden = bot.hiddennotify = bot.notify@@ -403,6 +411,9 @@ extension Bot {permission = try c.decodeIfPresent(String.self, forKey: .permission) ?? "auto"model = try c.decodeIfPresent(String.self, forKey: .model)modelOptions = try c.decodeIfPresent([String: String].self, forKey: .modelOptions) ?? [:]+ fastMode = try c.decodeIfPresent(Bool.self, forKey: .fastMode) ?? false+ fastModeSupport = try c.decodeIfPresent(String.self, forKey: .fastModeSupport) ?? "unknown"+ fastModeIssue = try c.decodeIfPresent(String.self, forKey: .fastModeIssue)pinned = try c.decodeIfPresent(Bool.self, forKey: .pinned) ?? falseposition = try c.decodeIfPresent(Int.self, forKey: .position) ?? 0hidden = try c.decodeIfPresent(Bool.self, forKey: .hidden) ?? falsediff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swiftindex 412bdc78..564c0bc3 100644--- a/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift@@ -2,11 +2,16 @@ import CodyncKitimport 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).struct AgentModelPicker: View {let backend: String@Binding var selection: String?/// The selected model's settings (effort, fast…); they belong to one model.@Binding var options: [String: String]+ @Binding var fastMode: Bool+ /// The saved bot: whether its own sessions offer Fast mode, and why the agent refused it.+ var bot: Bot?@Environment(BotStore.self) private var store@State private var catalog: AgentModels?@State private var catalogScope: String?@@ -63,7 +68,26 @@ struct AgentModelPicker: View {return [("", fallback.map { "Default · \($0)" } ?? "Default")] + option.values.map { ($0.id, $0.name) }}+ private var showsFastMode: Bool {+ (backend != "custom" && catalog?.fastMode == true) || fastMode+ || (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 {+ SwitchRow("Fast mode", detail: bot?.fastModeRefusal ?? "Faster replies for more usage, on models that offer it.",+ isOn: $fastMode)+ .transition(.opacity)+ }+ }++ private var modelRow: some View {VStack(alignment: .leading, spacing: 6) {HStack(spacing: 8) {Text("Model")@@ -109,12 +133,7 @@ struct AgentModelPicker: View {.font(.caption).foregroundStyle(Palette.secondary)}- .onChange(of: backend) { _, _ in- selection = nil- options = [:]- }.animation(Motion.reduced(Motion.fade, reduceMotion), value: modelOptions.map(\.id))- .task(id: requestKey) { await load() }}/// Loading and refresh share one fixed slot, so the row never grows for loading.@@ -153,7 +172,7 @@ struct AgentModelPicker: View {do {let response = try await client.agentModels(backend)try Task.checkCancellation()- catalog = response+ withAnimation(Motion.reduced(Motion.fade, reduceMotion)) { catalog = response }} catch {guard !Task.isCancelled else { return }failure = "Couldn't load models: \(error.localizedDescription)"diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swiftindex 127aa142..66603288 100644--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift@@ -140,7 +140,10 @@ struct BotSettingsForm: View {.fieldBox()}}- AgentModelPicker(backend: draft.backend, selection: $draft.model, options: $draft.modelOptions)+ 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: draft.id.flatMap { model.bots[$0] })ValueRow("Workspace", detail: draft.cwd.isEmpty? "This bot has its own space for files. It can work in other folders when you ask.": "This project is the default starting folder. The bot can work elsewhere when you ask.") {diff --git a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Actions.swift b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Actions.swiftindex d0004543..fdc6c57c 100644--- a/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Actions.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Store/BotStore+Actions.swift@@ -175,6 +175,13 @@ extension BotStore {perform(replay: true) { _ = try await $0.updateBot(d) }}+ public func setFastMode(_ bot: Bot, _ fastMode: Bool) {+ var d = BotDraft(bot)+ d.fastMode = fastMode+ bots[bot.id]?.fastMode = fastMode+ perform(replay: true) { _ = try await $0.updateBot(d) }+ }+// MARK: roster order/// Puts the roster in `ids` order (pinned bots still sort first) and sends it; the hostdiff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swiftindex 4e124296..f34ce162 100644--- a/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift@@ -239,9 +239,15 @@ struct Composer: View {if UIPasteboard.general.hasImages || UIPasteboard.general.hasURLs {items.append(MenuItem("Paste", icon: "doc.on.clipboard") { pasteFiles() })}+ if let bot, bot.fastModeShown {+ items.append(MenuItem("Fast mode", icon: "bolt", selected: bot.fastMode, divider: true) {+ model.setFastMode(bot, !bot.fastMode)+ })+ }return items} label: { addLabel }- .accessibilityLabel("Add files")+ .accessibilityLabel(bot?.fastModeShown == true ? "Add files or Fast mode" : "Add files")+ .accessibilityValue(bot?.fastModeShown == true ? (bot?.fastMode == true ? "Fast mode on" : "Fast mode off") : "")}private var addLabel: some View {@@ -251,6 +257,22 @@ struct Composer: View {.frame(width: fieldHeight, height: fieldHeight).glass(in: Circle()).contentShape(Circle())+ .overlay(alignment: .topTrailing) { fastModeBadge }+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: bot?.fastModeState)+ }++ /// Fast mode is on: a bolt on the + button, tinted while the agent refuses it.+ @ViewBuilder private var fastModeBadge: some View {+ if let bot, bot.fastModeShown, bot.fastMode {+ Image(systemName: "bolt.fill")+ .font(.system(size: 9, weight: .bold))+ .foregroundStyle(bot.fastModeState == .refused ? Palette.warning : Palette.background)+ .frame(width: 16, height: 16)+ .background(Circle().fill(bot.fastModeState == .refused ? Palette.secondary.opacity(0.25) : Palette.text))+ .offset(x: 3, y: -3)+ .transition(.opacity)+ .accessibilityHidden(true)+ }}private var fileChips: some View {diff --git a/apps/ios/Kit/Tests/CodyncKitTests/AgentModelsTests.swift b/apps/ios/Kit/Tests/CodyncKitTests/AgentModelsTests.swiftindex 2e69b802..80ea1b82 100644--- a/apps/ios/Kit/Tests/CodyncKitTests/AgentModelsTests.swift+++ b/apps/ios/Kit/Tests/CodyncKitTests/AgentModelsTests.swift@@ -33,3 +33,31 @@ import Testinglet body = try #require(JSONSerialization.jsonObject(with: JSONEncoder().encode(BotUpdate(draft: BotDraft(bot)))) as? [String: Any])#expect(body["modelOptions"] as? [String: String] == ["fast": "false"])}++@Test func modelCatalogReportsFastModeAndOlderHostsOmitIt() throws {+ let offered = try JSONDecoder().decode(AgentModels.self, from: Data(#"{"models":[],"fastMode":true}"#.utf8))+ #expect(offered.fastMode == true)+ let older = try JSONDecoder().decode(AgentModels.self, from: Data(#"{"models":[]}"#.utf8))+ #expect(older.fastMode == nil)+}++@Test func botFastModeReachesTheSettingsDraft() throws {+ let bot = try JSONDecoder().decode(Bot.self, from: Data(#"{"id":"b","backend":"codex","fastMode":true}"#.utf8))+ #expect(bot.fastMode)+ let draft = BotDraft(bot)+ let body = try #require(JSONSerialization.jsonObject(with: JSONEncoder().encode(BotUpdate(draft: draft))) as? [String: Any])+ #expect(body["fastMode"] as? Bool == true)+ let older = try JSONDecoder().decode(Bot.self, from: Data(#"{"id":"b"}"#.utf8))+ #expect(!older.fastMode)+}++@Test func composerOffersFastModeOnceTheAgentDoes() throws {+ func bot(_ json: String) throws -> Bot { try JSONDecoder().decode(Bot.self, from: Data(json.utf8)) }+ #expect(try !bot(#"{"id":"b"}"#).fastModeShown)+ #expect(try bot(#"{"id":"b","fastModeSupport":"offered"}"#).fastModeShown)+ #expect(try bot(#"{"id":"b","fastMode":true,"fastModeSupport":"unsupported"}"#).fastModeShown)+ #expect(try !bot(#"{"id":"g","kind":"group","fastModeSupport":"offered"}"#).fastModeShown)+ let refused = try bot(#"{"id":"b","fastMode":true,"fastModeSupport":"refused","fastModeIssue":"requires extra usage"}"#)+ #expect(refused.fastModeState == .refused)+ #expect(refused.fastModeRefusal?.contains("requires extra usage") == true)+}diff --git a/docs/architecture/file-structure.md b/docs/architecture/file-structure.mdindex 87cb39f8..af485604 100644--- a/docs/architecture/file-structure.md+++ b/docs/architecture/file-structure.md@@ -88,6 +88,7 @@ Codync/| Identity, encryption and direct channel | `host/src/remote/identity.rs`, `crypto.rs`, `channel.rs` || Host cloud state and relay connection | `host/src/remote/cloud.rs`, `relay.rs` || Agent discovery, sign-in, setup terminal, Node.js for npm agents | `host/src/agent/backends.rs`, `registry.rs`, `auth.rs`, `term.rs`, `node.rs` |+| Fast mode (session config option) | `host/src/agent/config.rs`, `agent/bot/fast_mode.rs` || Marketplace, Composio, connector OAuth | `host/src/market/` || Screen bridge and built-in MCP tools | `host/src/screen/`, `mcp.rs` || Swift transport and cloud API | `apps/ios/Kit/Sources/CodyncKit/Client/` |diff --git a/docs/design/ui-conventions.md b/docs/design/ui-conventions.mdindex 974bd4d0..81faaa95 100644--- a/docs/design/ui-conventions.md+++ b/docs/design/ui-conventions.md@@ -81,7 +81,7 @@ On iPhone, provider identity and activity presentation are shared with widgets iThe [2026-09-25 audit](../archive/ui-audit-2026-09-25.md) is historical. Its old line numbers and recommendations are not the current UI policy or a list of confirmed open bugs.-Model discovery keeps loading and refresh in one fixed-size slot beside the Model picker. Refresh retains the current catalog while loading, and loading does not add a separate row to the settings card. The Model label keeps its intrinsic width; the model picker takes the remaining width and truncates long names, with the full name available in its tooltip and menu.+Model discovery keeps loading and refresh in one fixed-size slot beside the Model picker. Refresh retains the current catalog while loading, and loading does not add a separate row to the settings card. The Model label keeps its intrinsic width; the model picker takes the remaining width and truncates long names, with the full name available in its tooltip and menu. Fast mode is a separate switch row below it (see [model selection](../features/marketplace.md#fast-mode)).## Desktop conversation detailsdiff --git a/docs/features/marketplace.md b/docs/features/marketplace.mdindex 9487c9ff..df17fc59 100644--- a/docs/features/marketplace.md+++ b/docs/features/marketplace.md@@ -50,7 +50,7 @@ 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}`.+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}`.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).@@ -58,6 +58,28 @@ A model's `options` are its own settings, such as reasoning effort or fast mode: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.+## Fast mode++Claude Code's and Codex's ACP adapters offer Fast mode (faster replies for more usage) as a session config option: Claude's `fast`, Codex's `fast-mode`, each a `select` of `on`/`off` (a boolean for clients that opt into boolean options), listed only while the session's model supports it. Only such an `on`/`off` or boolean option counts: Cursor's `fast` (`true`/`false`) is one of a model's options (see Model selection), so Fast mode leaves it to the bot's `modelOptions`. `fastMode` in `agentModels` says whether the probe session offered it, so it reflects the agent's default model.++The host keeps each live session's Fast mode option as the agent last listed it: from `session/new` (after the model switch, whose answer can change the options), `session/load`, `session/fork`, `session/set_config_option` answers and `config_option_update` notifications. Before every turn it switches the session to the bot's `fastMode` with `session/set_config_option` when the value differs, so changing the setting needs no agent restart and keeps the context. The adapters start each session or process at their own default, which is why a resumed session is switched again.++The bot's runtime carries what the agent says (`fastModeSupport`, `fastModeIssue` in the bot payload):++| `fastModeSupport` | Meaning |+|---|---|+| `unknown` | No session has listed its options yet. |+| `offered` | The agent offers it for the session's model. |+| `unsupported` | The session's model doesn't (the chat gets an info notice while the bot asks for it). |+| `refused` | The agent turned it off right after the bot asked, or despite the switch: Claude does this for an account without extra usage and appends the reason to the option's description, which becomes `fastModeIssue`. The host stops asking until the user changes the setting or the host restarts. |++`offered` and `unsupported` are kept across host restarts (`fast-mode.<bot>` in the kv store); a refusal isn't, so a new host asks again.++Clients show Fast mode for an agent bot whose runtime says `offered` or `refused`, or while it's on (so it can be turned off); never for a group:++- Composer: the desktop shows a ⚡ button next to +: filled while on, tinted with the warning color while refused (its tooltip gives the reason). The iPhone adds a Fast mode item to the + menu and a ⚡ badge on the + button while on. The terminal UI shows `⚡ fast` or `⚡ refused` in the chat header and toggles with `F`.+- Bot settings: a Fast mode switch row under Model when the agent's model list offers it (never for a custom command), when the bot's own sessions do, or while it's on. While refused, its detail gives the reason. The terminal UI form always lists the field and notes when the agent doesn't offer it.+## Secure connection setupSee [Connector setup and credentials](connector-credentials.md) for the shareddiff --git a/host/src/agent/auth.rs b/host/src/agent/auth.rsindex 0293da3a..db6e306c 100644--- a/host/src/agent/auth.rs+++ b/host/src/agent/auth.rs@@ -156,8 +156,8 @@ pub(crate) fn model_ids(session: &Value) -> Vec<String> {catalog["models"].as_array().into_iter().flatten().filter_map(|m| text(&m["id"])).collect()}-/// `{models: [{id, name, description, options}], currentModelId}`; `options` is Cursor's-/// `cursor/list_available_models` answer (`Null` for other agents).+/// `{models: [{id, name, description, options}], currentModelId, fastMode}`; `options` is+/// Cursor's `cursor/list_available_models` answer (`Null` for other agents).fn model_catalog(session: &Value, options: &Value) -> Value {fn collect(options: &Value, out: &mut Vec<Value>) {for option in options.as_array().into_iter().flatten() {@@ -189,7 +189,8 @@ fn model_catalog(session: &Value, options: &Value) -> Value {for model in &mut models {model["options"] = json!(model_options(options, model["id"].as_str().unwrap_or_default()));}- json!({"models": models, "currentModelId": current})+ json!({"models": models, "currentModelId": current,+ "fastMode": crate::agent::config::fast_mode_config(session).is_some()})}/// One model's options as `[{id, name, values: [{id, name}], default}]`, from Cursor's@@ -444,7 +445,10 @@ mod tests {);assert_eq!(result["models"].as_array().unwrap().len(), 1);assert_eq!(result["models"][0]["description"], "Available here");- assert_eq!(model_catalog(&json!({}), &Value::Null), json!({"models": [], "currentModelId": null}));+ assert_eq!(+ model_catalog(&json!({}), &Value::Null),+ json!({"models": [], "currentModelId": null, "fastMode": false})+ );}#[test]diff --git a/host/src/agent/bot/fast_mode.rs b/host/src/agent/bot/fast_mode.rsnew file mode 100644index 00000000..2809f300--- /dev/null+++ b/host/src/agent/bot/fast_mode.rs@@ -0,0 +1,90 @@+//! Fast mode: keeps each live session's option where the bot wants it, and tells clients what+//! the agent offers (docs/features/marketplace.md, "Fast mode").++use super::{Actor, NoticeStyle};+use crate::agent::config::{FastModeSupport, fast_mode_change, fast_mode_config, fast_mode_on, fast_mode_refusal};+use serde_json::{Value, json};++impl Actor {+ /// Records a session's options from an agent answer or a `config_option_update`.+ /// `requested`: the answer to our own switch.+ pub(super) fn note_options(&mut self, sid: &str, options: &Value, requested: bool) {+ // An answer without config options says nothing about Fast mode.+ if !options["configOptions"].is_array() {+ return;+ }+ let Some(conn) = self.conn.as_mut() else { return };+ let option = fast_mode_config(options).cloned();+ let was_on = conn.fast_options.get(sid).is_some_and(fast_mode_on);+ let support = match &option {+ None => FastModeSupport::Unsupported,+ // Turned off right after it was on, or despite our asking: the agent refused it.+ Some(o) if self.cfg.fast_mode && !fast_mode_on(o) && (requested || was_on) => {+ FastModeSupport::Refused(fast_mode_refusal(o))+ }+ Some(_) => FastModeSupport::Offered,+ };+ match option {+ Some(o) => conn.fast_options.insert(sid.to_owned(), o),+ None => conn.fast_options.remove(sid),+ };+ self.set_fast_support(support);+ }++ /// Switches a live session's Fast mode to the bot's setting before a turn. Once the agent+ /// refused it, asks again only after the user changes the setting.+ pub(super) async fn sync_fast_mode(&mut self, sid: &str) {+ let on = self.cfg.fast_mode;+ if on && matches!(self.fast_support, FastModeSupport::Refused(_)) {+ return;+ }+ let Some(option) = self.conn.as_ref().and_then(|c| c.fast_options.get(sid)) else { return };+ let (Some(config_id), Some(value)) = (option["id"].as_str(), fast_mode_change(option, on)) else { return };+ let params = json!({"sessionId": sid, "configId": config_id, "value": value});+ match self.session_request("session/set_config_option", params).await {+ Ok(answer) => self.note_options(sid, &answer, true),+ Err(error) => {+ tracing::warn!(bot = %self.cfg.id, error = format!("{error:#}"), "couldn't set Fast mode");+ self.notice(&format!("Couldn't change Fast mode: {error:#}"), NoticeStyle::Info);+ }+ }+ }++ /// The user changed the setting: a refusal no longer stands, so the next turn asks again.+ pub(super) fn fast_mode_changed(&mut self) {+ if matches!(self.fast_support, FastModeSupport::Refused(_)) {+ self.publish_fast_support(FastModeSupport::Offered);+ }+ }++ fn set_fast_support(&mut self, support: FastModeSupport) {+ // A refusal stands until the user changes the setting, whatever other sessions list.+ let support = match (&self.fast_support, support) {+ (FastModeSupport::Refused(why), FastModeSupport::Offered) => FastModeSupport::Refused(why.clone()),+ (_, support) => support,+ };+ self.publish_fast_support(support);+ }++ fn publish_fast_support(&mut self, support: FastModeSupport) {+ if support == self.fast_support {+ return;+ }+ if self.cfg.fast_mode && support == FastModeSupport::Unsupported {+ self.notice("Fast mode isn't available for this agent or model.", NoticeStyle::Info);+ }+ if support.stored() != self.fast_support.stored()+ && let Some(stored) = support.stored()+ && let Err(error) = self.hub.store.kv_set(&stored_key(&self.cfg.id), stored)+ {+ tracing::warn!(bot = %self.cfg.id, error = format!("{error:#}"), "couldn't store Fast mode support");+ }+ self.fast_support = support.clone();+ self.hub.set_runtime(&self.cfg.id, |r| r.fast_mode = support);+ }+}++/// kv key for what the bot's agent last said about Fast mode.+pub(super) fn stored_key(bot_id: &str) -> String {+ format!("fast-mode.{bot_id}")+}diff --git a/host/src/agent/bot/mod.rs b/host/src/agent/bot/mod.rsindex cb788d73..ce615850 100644--- a/host/src/agent/bot/mod.rs+++ b/host/src/agent/bot/mod.rs@@ -15,6 +15,7 @@//! forked from the main one when the agent can fork) and in group chats (turns in//! its main session, written to the group's transcript; see `group`).+mod fast_mode;mod files;mod queue;mod session;@@ -24,6 +25,7 @@ mod updates;pub(crate) use session::{launch_commands, select_model, start_agent};use crate::agent::acp::{Acp, Incoming};+use crate::agent::config::FastModeSupport;use crate::chat::context::{Identity, Snapshot};use crate::chat::group::GroupTurn;use crate::chat::memory;@@ -112,6 +114,9 @@ pub fn spawn(hub: Arc<Hub>, cfg: BotConfig) -> BotHandle {});let keeper = memory::spawn_keeper(hub.clone(), cfg.id.clone());let lane = Lane::main(&cfg.id);+ let fast_support = FastModeSupport::from_stored(hub.store.kv_get(&fast_mode::stored_key(&cfg.id)).as_deref());+ let support = fast_support.clone();+ hub.set_runtime(&cfg.id, |r| r.fast_mode = support);let actor = Actor {hub,cfg,@@ -148,6 +153,7 @@ pub fn spawn(hub: Arc<Hub>, cfg: BotConfig) -> BotHandle {cancel_deadline: None,exit_tail: None,tools_changed: false,+ fast_support,};let task = tokio::spawn(actor.run(rx, interrupted));BotHandle { tx, task }@@ -175,6 +181,8 @@ pub(crate) struct Conn {pub(crate) claude: bool,/// Sessions already created or loaded in this process.loaded: HashSet<String>,+ /// Each live session's Fast mode option, as the agent last listed it.+ fast_options: HashMap<String, Value>,}#[derive(Clone, Copy, PartialEq)]@@ -242,6 +250,8 @@ struct Actor {/// Connectors changed: restart the agent before the next turn so the/// session is resumed with the new MCP servers.tools_changed: bool,+ /// What the agent says about Fast mode; clients see it in the bot's runtime.+ fast_support: FastModeSupport,}struct RoutineCompletion {diff --git a/host/src/agent/bot/queue.rs b/host/src/agent/bot/queue.rsindex 9c6e0e19..594c7fea 100644--- a/host/src/agent/bot/queue.rs+++ b/host/src/agent/bot/queue.rs@@ -81,9 +81,14 @@ impl Actor {|| cfg.model != self.cfg.model|| cfg.model_options != self.cfg.model_options;self.tools_changed |= cfg.connectors != self.cfg.connectors || cfg.computer != self.cfg.computer;+ // Live sessions switch before their next turn (see `fast_mode`).+ let fast_changed = cfg.fast_mode != self.cfg.fast_mode;// Name, description and skill changes reach the agent as a profile update// on the next message (see `context`).self.cfg = cfg;+ if fast_changed {+ self.fast_mode_changed();+ }if restart {self.files.cancel();if let Some(c) = self.conn.take() {diff --git a/host/src/agent/bot/session.rs b/host/src/agent/bot/session.rsindex 688cf1ae..d310c8bb 100644--- a/host/src/agent/bot/session.rs+++ b/host/src/agent/bot/session.rs@@ -6,7 +6,7 @@ use crate::chat::context;use crate::store::{BotConfig, Entry, EntryKind, Lane, lane_key};use anyhow::{Result, anyhow, bail};use serde_json::{Value, json};-use std::collections::HashSet;+use std::collections::{HashMap, HashSet};use std::time::Duration;impl Actor {@@ -190,12 +190,15 @@ impl Actor {self.hub.set_runtime(&self.cfg.id, |r| r.activity = "Opening the thread…".into());let res = self.session_request("session/fork", json!({"sessionId": main, "cwd": self.cfg.cwd, "mcpServers": servers}))- .await;- if let Some(sid) = res.ok().and_then(|r| r["sessionId"].as_str().map(str::to_owned))+ .await+ .ok();+ if let Some(res) = res+ && let Some(sid) = res["sessionId"].as_str().map(str::to_owned)&& let Some(conn) = self.conn.as_mut(){conn.loaded.insert(sid.clone());self.set_session(slot, Some(&sid));+ self.note_options(&sid, &res, false);forked = true;} else {tracing::warn!(bot = %self.cfg.id, "session/fork failed; the thread starts fresh");@@ -245,10 +248,13 @@ impl Actor {Ok(res) => {// A resumed session can come back on the agent's last-used model (Cursor// keeps one for all its sessions), so the bot's own is set again.- if res.get("configOptions").is_some() || res.get("models").is_some() {- select_model(&conn.acp, &res, &sid, &self.cfg).await?;- }+ let res = if res.get("configOptions").is_some() || res.get("models").is_some() {+ select_model(&conn.acp, &res, &sid, &self.cfg).await?+ } else {+ res+ };conn.loaded.insert(sid.clone());+ self.note_options(&sid, &res, false);if let Some(s) = snapshot {// Its system prompt now names the bot as rendered.context::mark_announced(&self.hub.store, &self.cfg.id, &s, s.system_identity.clone())?;@@ -276,7 +282,8 @@ impl Actor {let Some(conn) = self.conn.as_mut() else { bail!("agent not running") };let sid = res["sessionId"].as_str().ok_or_else(|| anyhow!("agent returned no sessionId"))?.to_owned();conn.loaded.insert(sid.clone());- select_model(&conn.acp, &res, &sid, &self.cfg).await?;+ let options = select_model(&conn.acp, &res, &sid, &self.cfg).await?;+ self.note_options(&sid, &options, false);self.set_session(slot, Some(&sid));self.session_fresh = true;self.turn_session = Some(sid.clone());@@ -292,7 +299,7 @@ impl Actor {/// A session request the agent doesn't answer in time stops the agent: a hung one/// would otherwise hold the bot, and its Stop, forever.- async fn session_request(&mut self, method: &str, params: Value) -> Result<Value> {+ pub(super) async fn session_request(&mut self, method: &str, params: Value) -> Result<Value> {let acp = self.conn.as_ref().ok_or_else(|| anyhow!("agent not running"))?.acp.clone();if let Ok(result) = tokio::time::timeout(SESSION_TIMEOUT, acp.request(method, params)).await {return result;@@ -343,23 +350,27 @@ pub(crate) async fn launch_commands(cfg: &BotConfig, progress: impl Fn(&str)) ->}/// Switches a session (`session/new` or `session/load` answered `res`) to the bot's-/// chosen model, then sets that model's options (effort, fast…).-pub(crate) async fn select_model(acp: &Acp, res: &Value, sid: &str, cfg: &BotConfig) -> Result<()> {- let Some(model) = cfg.model.as_deref().filter(|m| !m.is_empty()) else { return Ok(()) };+/// 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(drop).map_err(|e| model_error(model, &e));+ return r.map(|_| res.clone()).map_err(|e| model_error(model, &e));};let (model, mut options) = split_variant(res, model);options.extend(cfg.model_options.iter().map(|(k, v)| (k.as_str(), v.as_str())));let set = |id: &str, value: &str| {acp.request("session/set_config_option", json!({"sessionId": sid, "configId": id, "value": value}))};- set(config_id, model).await.map_err(|e| model_error(model, &e))?;+ let mut current = set(config_id, model).await.map_err(|e| model_error(model, &e))?;for (id, value) in options {- set(id, value).await.map_err(|e| model_error(&format!("{model} with {id}={value}"), &e))?;+ 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(())+ Ok(if current["configOptions"].is_array() { current } else { res.clone() })}fn model_error(model: &str, e: &anyhow::Error) -> anyhow::Error {@@ -422,7 +433,7 @@ pub(crate) async fn start_agent(command: &str, cwd: &str, env: &[(String, Stringfork: init["agentCapabilities"]["sessionCapabilities"]["fork"].is_object(),};let claude = init["agentCapabilities"]["_meta"]["claudeCode"].is_object();- Ok(Conn { acp, rx, sessions, claude, loaded: HashSet::new() })+ Ok(Conn { acp, rx, sessions, claude, loaded: HashSet::new(), fast_options: HashMap::new() })}#[cfg(test)]diff --git a/host/src/agent/bot/turn.rs b/host/src/agent/bot/turn.rsindex 7c5e7ec5..e143d5e9 100644--- a/host/src/agent/bot/turn.rs+++ b/host/src/agent/bot/turn.rs@@ -82,6 +82,9 @@ impl Actor {} else {self.ensure_session(slot.as_deref()).await?;}+ if let Some(sid) = self.turn_session.clone() {+ self.sync_fast_mode(&sid).await;+ }if hidden && self.session_fresh {// A new session must never silently repeat an interrupted routine.self.finish_routine(diff --git a/host/src/agent/bot/updates.rs b/host/src/agent/bot/updates.rsindex ac36669f..59978108 100644--- a/host/src/agent/bot/updates.rs+++ b/host/src/agent/bot/updates.rs@@ -22,7 +22,13 @@ impl Actor {self.exit_tail = Some(tail);}Some(Incoming::Notification { method, params }) => {+ // Any session's, turn or not: the agent changed an option itself.if method == "session/update"+ && params["update"]["sessionUpdate"] == "config_option_update"+ && let Some(sid) = params["sessionId"].as_str()+ {+ self.note_options(sid, ¶ms["update"], false);+ } else if method == "session/update"&& params["sessionId"].as_str() == self.turn_session.as_deref()&& self.turn.is_some(){diff --git a/host/src/agent/config.rs b/host/src/agent/config.rsnew file mode 100644index 00000000..401f174a--- /dev/null+++ b/host/src/agent/config.rs@@ -0,0 +1,145 @@+//! Fast mode in a session's config options (ACP `configOptions`).++use serde_json::{Value, json};++/// Fast mode's option IDs: Claude's adapter (`fast`) and Codex's (`fast-mode`).+const FAST_MODE_IDS: [&str; 2] = ["fast", "fast-mode"];++/// The Fast mode option. Agents offer it only while the session's model supports it.+pub fn fast_mode_config(session: &Value) -> Option<&Value> {+ session["configOptions"]+ .as_array()?+ .iter()+ .find(|v| v["id"].as_str().is_some_and(|id| FAST_MODE_IDS.contains(&id)) && is_switch(v))+}++/// A boolean, or a select listing `on` and `off`, as Claude and Codex offer it. Cursor's `fast`+/// (`true` / `false`) is one of its model's options instead, set from the bot's `modelOptions`.+fn is_switch(option: &Value) -> bool {+ let lists = |value: &str| option["options"].as_array().is_some_and(|o| o.iter().any(|v| v["value"] == value));+ option["type"] == "boolean" || (option["type"] == "select" && lists("on") && lists("off"))+}++/// Whether the Fast mode option is on.+pub fn fast_mode_on(config: &Value) -> bool {+ config["currentValue"] == true || config["currentValue"] == "on"+}++/// Why the agent turned Fast mode off by itself, when it says: Claude's adapter appends it to+/// the option's description ("Faster responses on supported models — requires extra usage…").+pub fn fast_mode_refusal(config: &Value) -> Option<String> {+ let description = config["description"].as_str()?;+ let (_, why) = description.split_once(" — ")?;+ Some(why.trim()).filter(|why| !why.is_empty()).map(str::to_owned)+}++/// What a bot's agent says about Fast mode (wire `fastModeSupport` and `fastModeIssue`).+#[derive(Clone, Debug, Default, PartialEq, Eq)]+pub enum FastModeSupport {+ /// No session has listed its options yet.+ #[default]+ Unknown,+ Offered,+ /// The session's model doesn't offer it.+ Unsupported,+ /// The agent turned it off after the bot asked for it (Claude: the account can't use it),+ /// with its reason when it gave one. Asked again only once the user changes the setting.+ Refused(Option<String>),+}++impl FastModeSupport {+ pub fn as_str(&self) -> &'static str {+ match self {+ Self::Unknown => "unknown",+ Self::Offered => "offered",+ Self::Unsupported => "unsupported",+ Self::Refused(_) => "refused",+ }+ }++ pub fn issue(&self) -> Option<&str> {+ match self {+ Self::Refused(why) => why.as_deref(),+ _ => None,+ }+ }++ /// Kept across host restarts (`fast-mode.<bot>`), so clients can offer the switch before+ /// the first turn. A refusal isn't kept: the next host asks again.+ pub fn stored(&self) -> Option<&'static str> {+ match self {+ Self::Unknown => None,+ Self::Offered | Self::Refused(_) => Some("offered"),+ Self::Unsupported => Some("unsupported"),+ }+ }++ pub fn from_stored(v: Option<&str>) -> Self {+ match v {+ Some("offered") => Self::Offered,+ Some("unsupported") => Self::Unsupported,+ _ => Self::Unknown,+ }+ }+}++/// The value that turns `config` on or off: a boolean, or the `on` / `off` select entries.+/// `None` when it already is.+pub fn fast_mode_change(config: &Value, on: bool) -> Option<Value> {+ let value = if config["type"] == "boolean" { json!(on) } else { json!(if on { "on" } else { "off" }) };+ (config["currentValue"] != value).then_some(value)+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn fast_mode_is_claudes_and_codexs_on_off_option() {+ let on_off = json!([{"value": "on"}, {"value": "off"}]);+ for id in ["fast", "fast-mode"] {+ let session = json!({"configOptions": [+ {"id": "model", "category": "model", "type": "select", "options": []},+ {"id": id, "category": "model_config", "type": "select", "currentValue": "off", "options": on_off}+ ]});+ assert_eq!(fast_mode_config(&session).unwrap()["id"], id);+ }+ let boolean = json!({"configOptions": [{"id": "fast", "type": "boolean", "currentValue": false}]});+ assert!(fast_mode_config(&boolean).is_some());+ let other = json!({"configOptions": [{"id": "effort", "category": "thought_level", "type": "select"}]});+ assert!(fast_mode_config(&other).is_none());+ // Cursor's `fast` is a model option the bot sets through `modelOptions`.+ let cursor = json!({"configOptions": [{"id": "fast", "type": "select", "currentValue": "true",+ "options": [{"value": "false"}, {"value": "true"}]}]});+ assert!(fast_mode_config(&cursor).is_none());+ }++ #[test]+ fn fast_mode_refusal_reads_the_reason_from_the_description() {+ let refused = json!({"id": "fast", "currentValue": "off",+ "description": "Faster responses on supported models — requires extra usage to be enabled for this account"});+ assert_eq!(fast_mode_refusal(&refused).as_deref(), Some("requires extra usage to be enabled for this account"));+ assert!(!fast_mode_on(&refused));+ assert!(fast_mode_refusal(&json!({"description": "1.5x speed, increased usage"})).is_none());+ assert!(fast_mode_on(&json!({"currentValue": true})));+ }++ #[test]+ fn fast_mode_support_keeps_only_what_the_agent_offers_across_restarts() {+ let refused = FastModeSupport::Refused(Some("no extra usage".into()));+ assert_eq!(refused.as_str(), "refused");+ assert_eq!(refused.issue(), Some("no extra usage"));+ assert_eq!(FastModeSupport::from_stored(refused.stored()), FastModeSupport::Offered);+ assert_eq!(FastModeSupport::from_stored(FastModeSupport::Unknown.stored()), FastModeSupport::Unknown);+ }++ #[test]+ fn fast_mode_change_sends_only_a_different_value() {+ let select = json!({"id": "fast", "type": "select", "currentValue": "off"});+ assert_eq!(fast_mode_change(&select, true), Some(json!("on")));+ assert_eq!(fast_mode_change(&select, false), None);+ let boolean = json!({"id": "fast-mode", "type": "boolean", "currentValue": true});+ assert_eq!(fast_mode_change(&boolean, false), Some(json!(false)));+ assert_eq!(fast_mode_change(&boolean, true), None);+ }+}diff --git a/host/src/agent/mod.rs b/host/src/agent/mod.rsindex 162d15a9..7c6bb769 100644--- a/host/src/agent/mod.rs+++ b/host/src/agent/mod.rs@@ -5,6 +5,7 @@ pub mod acp;pub mod auth;pub mod backends;pub mod bot;+pub mod config;pub mod node;pub mod registry;pub mod term;diff --git a/host/src/hub.rs b/host/src/hub.rsindex 6d240e30..5f1af5fc 100644--- a/host/src/hub.rs+++ b/host/src/hub.rs@@ -39,6 +39,7 @@ pub struct Runtime {pub started_at: Option<i64>,/// Where the running turn talks: its own chat, a thread, or a group.pub lane: Option<Lane>,+ pub fast_mode: crate::agent::config::FastModeSupport,}/// Reactions per message: a handful of distinct emoji.@@ -353,7 +354,11 @@ impl Hub {f(rt);(before, rt.clone())};- if before.status != after.status || before.activity != after.activity || before.lane != after.lane {+ if before.status != after.status+ || before.activity != after.activity+ || before.lane != after.lane+ || before.fast_mode != after.fast_mode+ {self.emit_bot(id);// A group shows what its busy member is doing.for lane in [&before.lane, &after.lane].into_iter().flatten() {diff --git a/host/src/hub/sync.rs b/host/src/hub/sync.rsindex f224c138..da8ff7e3 100644--- a/host/src/hub/sync.rs+++ b/host/src/hub/sync.rs@@ -12,7 +12,11 @@ impl Hub {let mut v = serde_json::to_value(cfg).expect("BotConfig is plain data and always serializes");v["managedWorkspace"] = crate::agent::workspace::is_managed(cfg).into();let rt = if cfg.is_group() {- self.group_runtime(cfg)+ // A group has no agent: Fast mode belongs to its members.+ crate::hub::Runtime {+ fast_mode: crate::agent::config::FastModeSupport::default(),+ ..self.group_runtime(cfg)+ }} else {self.runtime.locked().get(&cfg.id).cloned().unwrap_or_default()};@@ -23,6 +27,8 @@ impl Hub {v["activity"] = rt.activity.into();v["startedAt"] = rt.started_at.into();v["workingChat"] = rt.lane.as_ref().map(|l| l.chat.clone()).into();+ v["fastModeSupport"] = rt.fast_mode.as_str().into();+ v["fastModeIssue"] = rt.fast_mode.issue().into();v["workingThread"] = rt.lane.and_then(|l| l.thread).into();v["unread"] = self.store.unread(&cfg.id, row.read_rev, ReadScope::All).into();let preview = last.as_ref().map(|l| match &l.author {diff --git a/host/src/store/bots.rs b/host/src/store/bots.rsindex b805c43a..a8e970d8 100644--- a/host/src/store/bots.rs+++ b/host/src/store/bots.rs@@ -215,6 +215,7 @@ mod tests {permission: Permission::Ask,model: None,model_options: std::collections::BTreeMap::new(),+ fast_mode: false,pinned: false,position: 0,hidden: false,diff --git a/host/src/store/model.rs b/host/src/store/model.rsindex dec7b63e..499c077d 100644--- a/host/src/store/model.rs+++ b/host/src/store/model.rs@@ -84,6 +84,9 @@ pub struct BotConfig {/// The model's own settings (effort, fast…): ACP config option id → value.#[serde(default)]pub model_options: BTreeMap<String, String>,+ /// Ask the agent for its Fast mode (Claude Code, Codex): faster replies for more usage.+ #[serde(default)]+ pub fast_mode: bool,#[serde(default)]pub pinned: bool,/// Place in the roster, lowest first (after pinned bots). All 0 until the user drags one:diff --git a/host/src/tui/app/events.rs b/host/src/tui/app/events.rsindex 56578414..696b3761 100644--- a/host/src/tui/app/events.rs+++ b/host/src/tui/app/events.rs@@ -454,4 +454,24 @@ mod tests {assert!(app.bots["b"].computer);assert!(FIELDS.contains(&Field::Computer));}++ #[test]+ fn fast_mode_survives_loading_the_editor() {+ let mut app = test_app();+ app.upsert_bot(&json!({"id":"b", "fastMode":true}));+ assert!(app.bots["b"].fast_mode);+ assert!(FIELDS.contains(&Field::Fast));+ }++ #[test]+ fn a_refused_fast_mode_reads_its_reason() {+ let mut app = test_app();+ app.upsert_bot(+ &json!({"id":"b", "fastMode":true, "fastModeSupport":"refused", "fastModeIssue":"requires extra usage"}),+ );+ assert!(app.bots["b"].fast_shown());+ assert!(app.bots["b"].fast_refusal().is_some_and(|why| why.contains("requires extra usage")));+ app.upsert_bot(&json!({"id":"g", "kind":"group", "fastModeSupport":"offered"}));+ assert!(!app.bots["g"].fast_shown());+ }}diff --git a/host/src/tui/app/forms.rs b/host/src/tui/app/forms.rsindex 33531e4f..481a4983 100644--- a/host/src/tui/app/forms.rs+++ b/host/src/tui/app/forms.rs@@ -129,6 +129,7 @@ impl App {backend: b.backend.clone(),model: Editor::with(b.model.as_deref().unwrap_or_default()),model_options: (b.model.clone().unwrap_or_default(), b.model_options.clone()),+ fast: b.fast_mode,cwd: if b.managed_workspace { String::new() } else { b.cwd.clone() },auto: b.auto,notify: b.notify,@@ -164,6 +165,7 @@ impl App {backend,model: Editor::default(),model_options: (String::new(), BTreeMap::new()),+ fast: false,cwd: String::new(),auto: true,notify: true,@@ -244,6 +246,7 @@ impl App {if matches!(field,Field::Agent+ | Field::Fast| Field::Approvals| Field::Notify| Field::Computer@@ -268,6 +271,7 @@ impl App {self.want_models(&f.backend);}}+ Field::Fast => f.fast = !f.fast,Field::Approvals => f.auto = !f.auto,Field::Notify => f.notify = !f.notify,Field::Computer => f.computer = !f.computer,@@ -339,6 +343,7 @@ impl App {"permission": if f.auto { "auto" } else { "ask" },"model": if model.is_empty() { Value::Null } else { model.into() },"modelOptions": f.model_options().cloned().unwrap_or_default(),+ "fastMode": f.fast,"notify": f.notify,"computer": f.computer,"avatarColor": COLORS[f.color],diff --git a/host/src/tui/app/input.rs b/host/src/tui/app/input.rsindex 45627380..5a9ca0ca 100644--- a/host/src/tui/app/input.rs+++ b/host/src/tui/app/input.rs@@ -369,11 +369,25 @@ impl App {self.call("updateBot", json!({"id": id, "pinned": pinned}), After::Nothing);}}+ KeyCode::Char('F') => self.toggle_fast_mode(),KeyCode::Char('c') => self.copy_last(),_ => {}}}+ fn toggle_fast_mode(&mut self) {+ let Some(b) = self.bot() else { return };+ if b.group {+ self.flash("A group has no agent of its own");+ } else if !b.fast_shown() {+ self.flash("This bot's agent doesn't offer Fast mode");+ } else {+ let (id, on) = (b.id.clone(), !b.fast_mode);+ self.call("updateBot", json!({"id": id, "fastMode": on}), After::Nothing);+ self.flash(if on { "Fast mode on" } else { "Fast mode off" });+ }+ }+// ---------- mouse ----------pub fn on_mouse(&mut self, m: MouseEvent) {diff --git a/host/src/tui/app/mod.rs b/host/src/tui/app/mod.rsindex cbfcb085..e62983ea 100644--- a/host/src/tui/app/mod.rs+++ b/host/src/tui/app/mod.rs@@ -89,6 +89,8 @@ pub struct App {pub plugins: (Vec<Value>, Vec<Value>),/// Models each agent offers (`None` while loading).pub models: HashMap<String, Option<Vec<AgentModel>>>,+ /// Agents whose model list came with Fast mode.+ pub fast_mode: HashSet<String>,/// A setup terminal holding the screen.pub shell: Option<Shell>,/// Chats and threads (`bot` / `bot/root`) marked read since their bot's unread count last changed.@@ -152,6 +154,7 @@ impl App {market: (vec![], vec![]),plugins: (vec![], vec![]),models: HashMap::new(),+ fast_mode: HashSet::new(),shell: None,reading: HashSet::new(),history_busy: HashSet::new(),diff --git a/host/src/tui/app/model.rs b/host/src/tui/app/model.rsindex 77243e1e..60a4de10 100644--- a/host/src/tui/app/model.rs+++ b/host/src/tui/app/model.rs@@ -96,6 +96,11 @@ pub struct Bot {pub model: Option<String>,/// The model's own settings (effort, fast…): option id → value.pub model_options: BTreeMap<String, String>,+ pub fast_mode: bool,+ /// What the agent says about Fast mode: `unknown`, `offered`, `unsupported` or `refused`.+ pub fast_support: String,+ /// Why the agent refused it.+ pub fast_issue: Option<String>,pub pinned: bool,/// Where the user dragged it (see `App::roster`).pub position: i64,@@ -153,6 +158,21 @@ impl AgentModel {}impl Bot {+ /// An agent bot whose agent offers Fast mode, or one that has it on (so it can be turned off).+ pub fn fast_shown(&self) -> bool {+ !self.group && (self.fast_mode || self.fast_support == "offered" || self.fast_support == "refused")+ }++ /// Why Fast mode isn't in effect, when the agent turned it off itself.+ pub fn fast_refusal(&self) -> Option<String> {+ (self.fast_mode && self.fast_support == "refused").then(|| {+ format!(+ "The agent turned it off: {}. Switch it off and on to try again.",+ self.fast_issue.as_deref().unwrap_or("not available")+ )+ })+ }+/// Where it works, as the header shows it.pub fn folder(&self, home: &str) -> String {if self.managed_workspace { "personal workspace".to_owned() } else { tilde(&self.cwd, home) }@@ -177,6 +197,9 @@ impl Bot {.flatten().filter_map(|(k, v)| Some((k.clone(), v.as_str()?.to_owned()))).collect(),+ fast_mode: v["fastMode"].as_bool().unwrap_or(false),+ fast_support: v["fastModeSupport"].as_str().unwrap_or("unknown").to_owned(),+ fast_issue: v["fastModeIssue"].as_str().map(str::to_owned),pinned: v["pinned"].as_bool().unwrap_or(false),position: v["position"].as_i64().unwrap_or(0),hidden: v["hidden"].as_bool().unwrap_or(false),diff --git a/host/src/tui/app/ui.rs b/host/src/tui/app/ui.rsindex 87b39d9b..abde98dc 100644--- a/host/src/tui/app/ui.rs+++ b/host/src/tui/app/ui.rs@@ -138,6 +138,7 @@ pub enum Field {Agent,Model,ModelOptions,+ Fast,Folder,Approvals,Notify,@@ -148,12 +149,13 @@ pub enum Field {Skills,}-pub const FIELDS: [Field; 13] = [+pub const FIELDS: [Field; 14] = [Field::Name,Field::Instructions,Field::Agent,Field::Model,Field::ModelOptions,+ Field::Fast,Field::Folder,Field::Approvals,Field::Notify,@@ -179,6 +181,7 @@ pub struct Form {pub model: Editor,/// Model settings (effort, fast…) and the model they were picked for.pub model_options: (String, BTreeMap<String, String>),+ pub fast: bool,pub cwd: String,pub auto: bool,pub notify: bool,diff --git a/host/src/tui/manage/replies.rs b/host/src/tui/manage/replies.rsindex 276b13df..68382ee5 100644--- a/host/src/tui/manage/replies.rs+++ b/host/src/tui/manage/replies.rs@@ -199,6 +199,9 @@ impl App {}Reply::Models(backend) => {let list = v["models"].as_array().into_iter().flatten().filter_map(AgentModel::parse).collect();+ if v["fastMode"] == true {+ self.fast_mode.insert(backend.clone());+ }self.models.insert(backend, Some(list));}Reply::Downloaded => {diff --git a/host/src/tui/view/chat.rs b/host/src/tui/view/chat.rsindex 453d41e4..60ccd4cf 100644--- a/host/src/tui/view/chat.rs+++ b/host/src/tui/view/chat.rs@@ -50,8 +50,14 @@ pub(super) fn chat(buf: &mut Buffer, r: Rect, app: &mut App, narrow: bool) {put(buf, x, r.y, room, &truncate(&format!("group · {}", names.join(", ")), usize::from(room)), t.secondary);} else if !narrow {let mode = if b.auto { "auto" } else { "ask" };- let cwd = truncate(&b.folder(&app.home), usize::from(room).saturating_sub(w(&b.backend) + w(mode) + 6));- put(buf, x, r.y, room, &format!("{} · {cwd} · {mode}", b.backend), t.secondary);+ let fast = match (b.fast_mode, b.fast_refusal().is_some()) {+ (true, true) => " · ⚡ refused",+ (true, false) => " · ⚡ fast",+ _ => "",+ };+ let cwd =+ truncate(&b.folder(&app.home), usize::from(room).saturating_sub(w(&b.backend) + w(mode) + w(fast) + 6));+ put(buf, x, r.y, room, &format!("{} · {cwd} · {mode}{fast}", b.backend), t.secondary);}let mut top = r.y + 1;if !narrow {diff --git a/host/src/tui/view/forms.rs b/host/src/tui/view/forms.rsindex 6aebe4ce..59e402e5 100644--- a/host/src/tui/view/forms.rs+++ b/host/src/tui/view/forms.rs@@ -49,6 +49,7 @@ pub(super) fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {Field::Agent => "Agent",Field::Model => "Model",Field::ModelOptions => "Options",+ Field::Fast => "Fast mode",Field::Folder => "Workspace",Field::Approvals => "Approvals",Field::Notify => "Notify",@@ -105,6 +106,17 @@ pub(super) fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {rput(buf, inner.right(), y, &hint, t.dim.patch(base));}}+ Field::Fast => {+ let s = if f.fast { "◉ On ○ Off" } else { "○ On ◉ Off" };+ // Known once the agent's model list loads, or once the bot's own sessions say.+ let saved = f.bot_id.as_ref().and_then(|id| app.bots.get(id)).filter(|b| b.backend == f.backend);+ let offered = match app.models.get(&f.backend) {+ _ if saved.is_some_and(super::super::app::Bot::fast_shown) => "",+ Some(Some(_)) if !app.fast_mode.contains(&f.backend) => " · not offered by this agent",+ _ => "",+ };+ put(buf, vx, y, vw, &format!("{s}{offered}"), t.text.patch(base));+ }Field::ModelOptions => {let offered = app.model_settings(&f.backend, f.model.text.trim());if offered.is_empty() {@@ -194,6 +206,13 @@ pub(super) fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {let by = inner.bottom() - 1;if let Some(e) = &f.error {put(buf, inner.x, by - 1, inner.width, e, t.red.patch(t.panel));+ } else if f.current() == Field::Fast {+ let refusal = f.bot_id.as_ref().and_then(|id| app.bots.get(id)).and_then(super::super::app::Bot::fast_refusal);+ let (line, style) = match refusal {+ Some(why) => (why, t.amber),+ None => ("Faster replies for more usage, on models that offer it (Claude Code, Codex)".to_owned(), t.dim),+ };+ put(buf, inner.x, by - 1, inner.width, &line, style.patch(t.panel));} else if f.current() == Field::Computer {put(buf,@@ -220,7 +239,7 @@ pub(super) fn form_view(buf: &mut Buffer, area: Rect, app: &App, f: &Form) {Field::Skills => "←→ move · space toggle · i details · tab next",Field::Agent => "←→ change · ↵ install / sign in · tab next",Field::Model => "←→ pick a model · or type its id",- Field::Color | Field::Shape | Field::Approvals | Field::Notify | Field::Computer => {+ Field::Fast | Field::Color | Field::Shape | Field::Approvals | Field::Notify | Field::Computer => {"←→ change · tab next field"}Field::Instructions => "⇧↵ new line · tab next field",diff --git a/host/src/tui/view/help.rs b/host/src/tui/view/help.rsindex f1f0bf0d..290379df 100644--- a/host/src/tui/view/help.rs+++ b/host/src/tui/view/help.rs@@ -9,7 +9,7 @@ use super::buffer::{centered, frame_box, put, u};use super::overlay::field_line;use super::style::theme;-const HELP: [(&str, &str, &str); 56] = [+const HELP: [(&str, &str, &str); 57] = [("MOVE", "j k ↑ ↓", "next / previous bot"),("MOVE", "[ ]", "previous / next bot"),("MOVE", "1…9", "jump to bot 1–9"),@@ -48,6 +48,7 @@ const HELP: [(&str, &str, &str); 56] = [("BOTS", "m", "new group chat"),("BOTS", "e", "edit bot or group"),("BOTS", "p", "pin / unpin"),+ ("BOTS", "F", "Fast mode on / off"),("BOTS", "J K", "move bot down / up"),("BOTS", "S", "new session"),("BOTS", "M", "memory"),diff --git a/host/tests/fixtures/fast_mode_agent.py b/host/tests/fixtures/fast_mode_agent.pynew file mode 100644index 00000000..90926c43--- /dev/null+++ b/host/tests/fixtures/fast_mode_agent.py@@ -0,0 +1,57 @@+"""ACP agent offering Fast mode like Claude's adapter: a `fast` select that is off in+every new process. It resumes sessions, logs session calls to calls.jsonl in its+folder, and answers each prompt with its speed and the prompt text. With a `refuse`+file in its folder it turns Fast mode back off during a prompt, the way Claude does+for an account without extra usage."""++import json+import os+import sys++fast = "off"+++def send(value):+ print(json.dumps({"jsonrpc": "2.0", **value}), flush=True)+++def log(value):+ with open("calls.jsonl", "a", encoding="utf-8") as f:+ f.write(json.dumps(value) + "\n")+++def options(description="Faster responses on supported models"):+ return {"configOptions": [{+ "id": "fast", "name": "Fast mode", "description": description, "category": "model_config",+ "type": "select", "currentValue": fast,+ "options": [{"value": "on", "name": "On"}, {"value": "off", "name": "Off"}],+ }]}+++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":+ send({"id": rid, "result": {"protocolVersion": 1, "agentCapabilities": {"loadSession": True}}})+ elif method in ("session/new", "session/load"):+ log({"method": method})+ send({"id": rid, "result": {"sessionId": "s1", **options()}})+ elif method == "session/set_config_option":+ log({"method": method, "configId": params["configId"], "value": params["value"]})+ fast = params["value"]+ send({"id": rid, "result": options()})+ elif method == "session/prompt":+ if fast == "on" and os.path.exists("refuse"):+ fast = "off"+ update = {"sessionUpdate": "config_option_update",+ **options("Faster responses on supported models — requires extra usage")}+ send({"method": "session/update", "params": {"sessionId": "s1", "update": update}})+ text = " ".join(b.get("text", "") for b in params.get("prompt", []))+ update = {"sessionUpdate": "agent_message_chunk", "content": {"type": "text", "text": f"fast {fast} · {text}"}}+ send({"method": "session/update", "params": {"sessionId": "s1", "update": update}})+ send({"id": rid, "result": {"stopReason": "end_turn"}})+ else:+ send({"id": rid, "result": {}})diff --git a/host/tests/fixtures/wire-shape.json b/host/tests/fixtures/wire-shape.jsonindex 9cbe51b8..39524002 100644--- a/host/tests/fixtures/wire-shape.json+++ b/host/tests/fixtures/wire-shape.json@@ -15,6 +15,9 @@"event:bot.bot.cwd": "string","event:bot.bot.deleted": "bool","event:bot.bot.description": "string",+ "event:bot.bot.fastMode": "bool",+ "event:bot.bot.fastModeIssue": "null",+ "event:bot.bot.fastModeSupport": "string","event:bot.bot.hidden": "bool","event:bot.bot.id": "string","event:bot.bot.kind": "string",diff --git a/host/tests/turns_e2e.rs b/host/tests/turns_e2e.rsindex a0e754b7..95e6dc8f 100644--- a/host/tests/turns_e2e.rs+++ b/host/tests/turns_e2e.rs@@ -1,5 +1,5 @@-//! A real host driving scripted ACP agents: Stop on an agent that ignores it, and room turns-//! that a newer group message replaced.+//! A real host driving scripted ACP agents: Stop on an agent that ignores it, room turns+//! that a newer group message replaced, and Fast mode across session resumes.#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]@@ -139,3 +139,75 @@ async fn a_member_busy_elsewhere_answers_only_the_latest_room_turn() {let finals = host.entries(&group).await.into_iter().filter(|e| e["kind"] == "agent" && e["data"]["final"] == true);assert_eq!(finals.count(), 1);}++/// A final reply that starts with `speed` and quotes `word` from its prompt.+fn speed_reply(speed: &'static str, word: &'static str) -> impl Fn(&Value) -> bool {+ move |e: &Value| {+ e["kind"] == "agent"+ && e["data"]["final"] == true+ && e["data"]["text"].as_str().is_some_and(|t| t.starts_with(speed) && t.contains(word))+ }+}++const FAST_ON: &str = r#""configId": "fast", "value": "on""#;+const FAST_OFF: &str = r#""configId": "fast", "value": "off""#;++#[tokio::test]+async fn fast_mode_switches_live_sessions_without_a_restart() {+ if python_missing() {+ return;+ }+ let host = Host::start().await;+ let bot = host.bot("Quick", "tests/fixtures/fast_mode_agent.py").await;+ let calls = host.home.join("Quick").join("calls.jsonl");+ let log = || std::fs::read_to_string(&calls).unwrap();++ host.call("updateBot", json!({"id": bot, "fastMode": true})).await;+ host.call("send", json!({"botId": bot, "text": "one"})).await;+ host.wait_for(&bot, Duration::from_secs(60), speed_reply("fast on", "one")).await;+ assert_eq!(log().matches(FAST_ON).count(), 1);+ let sync = common::snapshot(&host.base, &host.token).await;+ assert_eq!(sync["bots"][0]["fastModeSupport"], "offered");++ // Off and on again: the same agent process switches the live session before each turn.+ host.call("updateBot", json!({"id": bot, "fastMode": false})).await;+ host.call("send", json!({"botId": bot, "text": "two"})).await;+ host.wait_for(&bot, Duration::from_secs(60), speed_reply("fast off", "two")).await;+ host.call("updateBot", json!({"id": bot, "fastMode": true})).await;+ host.call("send", json!({"botId": bot, "text": "three"})).await;+ host.wait_for(&bot, Duration::from_secs(60), speed_reply("fast on", "three")).await;+ let log = log();+ assert!(!log.contains("session/load"), "{log}");+ assert_eq!((log.matches(FAST_ON).count(), log.matches(FAST_OFF).count()), (2, 1), "{log}");+}++#[tokio::test]+async fn a_refused_fast_mode_is_reported_and_not_asked_for_again() {+ if python_missing() {+ return;+ }+ let host = Host::start().await;+ let bot = host.bot("Refused", "tests/fixtures/fast_mode_agent.py").await;+ let folder = host.home.join("Refused");+ std::fs::write(folder.join("refuse"), "").unwrap();+ let log = || std::fs::read_to_string(folder.join("calls.jsonl")).unwrap();++ host.call("updateBot", json!({"id": bot, "fastMode": true})).await;+ host.call("send", json!({"botId": bot, "text": "one"})).await;+ host.wait_for(&bot, Duration::from_secs(60), speed_reply("fast off", "one")).await;+ let state = &common::snapshot(&host.base, &host.token).await["bots"][0];+ assert_eq!(state["fastModeSupport"], "refused");+ assert_eq!(state["fastModeIssue"], "requires extra usage");+ assert_eq!(state["fastMode"], true, "the user's choice stays");++ host.call("send", json!({"botId": bot, "text": "two"})).await;+ host.wait_for(&bot, Duration::from_secs(60), speed_reply("fast off", "two")).await;+ assert_eq!(log().matches(FAST_ON).count(), 1, "asked again after a refusal");++ // Changing the setting asks again.+ host.call("updateBot", json!({"id": bot, "fastMode": false})).await;+ host.call("updateBot", json!({"id": bot, "fastMode": true})).await;+ host.call("send", json!({"botId": bot, "text": "three"})).await;+ host.wait_for(&bot, Duration::from_secs(60), speed_reply("fast off", "three")).await;+ assert_eq!(log().matches(FAST_ON).count(), 2);+}