The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(effort): eine Stufe, und sie kommt in Chat, Agent und Coding an
purple2cc466f67ca1
diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.tsindex 6905ddda..0c0267d0 100644--- a/src/hooks/useAgentChat.ts+++ b/src/hooks/useAgentChat.ts@@ -755,6 +755,11 @@ export function useAgentChat() {const agentMeta = useModelStore.getState().models.find((m) => m.name === activeModel)const agentThinkMode = agentMeta && 'thinkMode' in agentMeta ? agentMeta.thinkMode : undefinedconst canThinkAgent = agentThinkMode ? agentThinkMode === 'toggle' : isThinkingCompatible(activeModel)+ // Same ladder as the composer shows and as useChat sends. An agent run+ // that quietly kept the old fixed 'high' would make the control a lie+ // on the surface where the token bill is largest.+ const agentEffortLevels = agentMeta && 'effortLevels' in agentMeta ? agentMeta.effortLevels : undefined+ const agentEffortDefault = agentMeta && 'effortDefault' in agentMeta ? agentMeta.effortDefault : undefinedconst plainPlanAgent = isPlainTextPlanner(activeModel)// forceNoThink: set by the dud-turn recovery below — a thinking model// (gemma4) dumped its whole answer into the thinking channel and emitted@@ -787,6 +792,8 @@ export function useAgentChat() {maxTokens: settings.maxTokens || undefined,contextWindow: agentCtx,thinking: thinkOpt as unknown as boolean,+ reasoningEffort: settings.reasoningEffort ?? agentEffortDefault,+ effortLevels: agentEffortLevels,signal: abort.signal,}diff --git a/src/hooks/useChat.ts b/src/hooks/useChat.tsindex d1d7a3ec..03772abd 100644--- a/src/hooks/useChat.ts+++ b/src/hooks/useChat.ts@@ -536,6 +536,11 @@ export function useChat() {const activeMeta = useModelStore.getState().models.find((m) => m.name === activeModel)const thinkMode = activeMeta && 'thinkMode' in activeMeta ? activeMeta.thinkMode : undefinedconst canThink = thinkMode ? thinkMode === 'toggle' : isThinkingCompatible(activeModel)+ // The reasoning ladder the server declared for THIS model. Absent on every+ // local backend and on a cloud deployment that predates 2.6.8, and absent+ // means the provider keeps sending exactly what it sent before.+ const effortLevels = activeMeta && 'effortLevels' in activeMeta ? activeMeta.effortLevels : undefined+ const effortDefault = activeMeta && 'effortDefault' in activeMeta ? activeMeta.effortDefault : undefined// And not for a LOCAL OpenAI-compatible backend any more (2.6.7// Denk-Audit): the built-in engine, LM Studio, llama.cpp and friends// render the model's own template, which has a real thinking switch the@@ -681,6 +686,11 @@ export function useChat() {// num_ctx: real model context (capped) for Ollama, else override-or-none.contextWindow: effectiveCtx,thinking: useThinking,+ // The rung, and the rungs this model has. Sent on every turn so Chat,+ // Agent mode and the Coding Agent cannot drift apart; the provider+ // clamps the wish onto the ladder and ignores both without one.+ reasoningEffort: settings.reasoningEffort ?? effortDefault,+ effortLevels,signal: abort.signal,}diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.tsindex 0f4b45cb..e842de89 100644--- a/src/hooks/useCodex.ts+++ b/src/hooks/useCodex.ts@@ -231,6 +231,14 @@ function codexCanThink(model: string): boolean {const mode = codexThinkMode(model)return mode ? mode === 'toggle' : isThinkingCompatible(model)}+/** The reasoning ladder the server declared for this model, if any. */+function codexEffort(model: string): { levels?: string[]; fallback?: string } {+ const meta = useModelStore.getState().models.find((m) => m.name === model)+ return {+ levels: meta && 'effortLevels' in meta ? meta.effortLevels : undefined,+ fallback: meta && 'effortDefault' in meta ? meta.effortDefault : undefined,+ }+}/*** The pending next /loop pass. MODULE scope, not a hook ref (audit A3): the@@ -962,10 +970,15 @@ export function useCodex() {: settings.thinkingEnabled === true): undefined+ const cxEffort = codexEffort(activeModel)const chatOptions = {temperature: 0.1, // Low temp for coding precisionmaxTokens: settings.maxTokens || undefined,thinking: thinkOptCx as unknown as boolean,+ // The Coding Agent is the third caller that builds its own options,+ // and the one where a forgotten field costs the most tokens.+ reasoningEffort: settings.reasoningEffort ?? cxEffort.fallback,+ effortLevels: cxEffort.levels,signal: abort.signal,}// Hoisted to the top of the step (2.6.7 Denk-Audit): the promptdiff --git a/src/lib/__tests__/constants-validation.test.ts b/src/lib/__tests__/constants-validation.test.tsindex 990120b1..f4227b2d 100644--- a/src/lib/__tests__/constants-validation.test.ts+++ b/src/lib/__tests__/constants-validation.test.ts@@ -12,6 +12,7 @@* Run: npx vitest run src/lib/__tests__/constants-validation.test.ts*/import { describe, it, expect } from 'vitest'+import { DEFAULT_EFFORT } from '../effort'import {DEFAULT_SETTINGS,BUILT_IN_PERSONAS,@@ -63,6 +64,16 @@ describe('constants-validation', () => {expect(typeof DEFAULT_SETTINGS.thinkingEnabled).toBe('boolean')})+ it('has reasoningEffort on the rung the client has always sent', () => {+ // Not a taste. The default IS the old behaviour: 'high' is what the+ // provider put on the wire for thinking ON before the control existed,+ // so a profile that rides the v22 migration sends byte-for-byte the same+ // request it sent before. Any other default moves an existing customer's+ // token bill without them touching anything.+ expect(DEFAULT_SETTINGS.reasoningEffort).toBe('high')+ expect(DEFAULT_SETTINGS.reasoningEffort).toBe(DEFAULT_EFFORT)+ })+it('has cavemanMode as a valid level', () => {expect(['off', 'lite', 'full', 'ultra']).toContain(DEFAULT_SETTINGS.cavemanMode)})diff --git a/src/lib/__tests__/thinking-side-surfaces.test.ts b/src/lib/__tests__/thinking-side-surfaces.test.tsindex e82f0d85..f8e89900 100644--- a/src/lib/__tests__/thinking-side-surfaces.test.ts+++ b/src/lib/__tests__/thinking-side-surfaces.test.ts@@ -154,3 +154,36 @@ describe('what a hidden agent hands back is an answer, not a thought', () => {expect(settleThinking('1. read the file', '', false).content).toBe('1. read the file')})})++// ── 2.6.8: the effort rung, on all three surfaces ──────────────+describe('the effort rung reaches every surface, not only chat', () => {+ // The rung is one global setting, like the Think switch, and the composer+ // shows it on every surface. Three hooks build their own options object, and+ // a hook that forgets the field silently keeps sending the old fixed 'high'+ // while the button beside the prompt says something else. The Coding Agent is+ // where that costs the most, so it is checked by name too.+ const chat = read('../../hooks/useChat.ts')+ const agent = read('../../hooks/useAgentChat.ts')+ const codex = read('../../hooks/useCodex.ts')++ it('chat sends the rung and the ladder', () => {+ expect(chat).toContain('reasoningEffort: settings.reasoningEffort ?? effortDefault')+ expect(chat).toMatch(/^\s*effortLevels,$/m)+ })++ it('agent mode sends them too', () => {+ expect(agent).toContain('reasoningEffort: settings.reasoningEffort ?? agentEffortDefault')+ expect(agent).toContain('effortLevels: agentEffortLevels')+ })++ it('and the coding agent, the surface with the largest token bill', () => {+ expect(codex).toContain('reasoningEffort: settings.reasoningEffort ?? cxEffort.fallback')+ expect(codex).toContain('effortLevels: cxEffort.levels')+ })++ it('all three read the ladder off the model row the server filled in', () => {+ for (const src of [chat, agent, codex]) {+ expect(src).toMatch(/'effortLevels' in \w+ \? \w+\.effortLevels : undefined/)+ }+ })+})diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex 96633ff9..5540927d 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -20,6 +20,10 @@ export const DEFAULT_SETTINGS: Settings = {cloudTeasersEnabled: true,personasEnabled: true,thinkingEnabled: true,+ // Reasoning effort (2.6.8). 'high' is not a taste, it is the rung this+ // client has always sent for thinking ON. Any other default would move every+ // existing customer's token bill on update without them touching anything.+ reasoningEffort: 'high',// Small-Model Mode (v2.5.0) — lean profile for 3B-8B local models.// Default OFF: big models behave exactly as before until the user flips it.smallModelMode: false,diff --git a/src/stores/__tests__/settingsStore-cloud-confirm-optin.test.ts b/src/stores/__tests__/settingsStore-cloud-confirm-optin.test.tsindex 2cbb2903..3f6186b8 100644--- a/src/stores/__tests__/settingsStore-cloud-confirm-optin.test.ts+++ b/src/stores/__tests__/settingsStore-cloud-confirm-optin.test.ts@@ -29,7 +29,10 @@ const localStorageShim = {} as Storageconst KEY = 'chat-settings'-const CURRENT = 21+/** Must track STORE_VERSION in settingsStore.ts: the case below needs a blob+ * that zustand does NOT migrate, and that is only true at the current+ * version. Bumped to 22 with the reasoningEffort field (2.6.8). */+const CURRENT = 22/** What a 2.6.5 build stamps back into the shared profile. */const OLD_BUILD = 20diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex e907037c..c28cdcbd 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -85,7 +85,13 @@ import { DEFAULT_SETTINGS, BUILT_IN_PERSONAS } from '../lib/constants'// fills in for everyone, an opt-in the user makes survives every A/B switch,// and the stale old key is simply never read again. STRICTLY ADDITIVE and// IDEMPOTENT, like v20 and unlike v10 and v19.-const STORE_VERSION = 21+// v22 (2.6.8): added settings.reasoningEffort (default 'high'), the rung the+// composer's effort control cycles through. STRICTLY ADDITIVE and IDEMPOTENT+// like v20 and v21: the merge below fills the default in, every existing value+// survives, and there is NO one-shot reset. The default equals what the client+// already sent for thinking ON, so a profile that rides this migration sends+// byte-for-byte the same request it sent before.+const STORE_VERSION = 22interface SettingsState {settings: Settingsdiff --git a/src/types/settings.ts b/src/types/settings.tsindex 2767bf7d..5f831a83 100644--- a/src/types/settings.ts+++ b/src/types/settings.ts@@ -1,4 +1,5 @@import type { AgentWorkspace } from './agent-workspace'+import type { EffortLevel } from '../lib/effort'export type SearchProvider = 'auto' | 'brave' | 'tavily'@@ -56,6 +57,18 @@ export interface Settings {* prompt (raw model). Default true. Ported from the uselu web companion. */personasEnabled: booleanthinkingEnabled: boolean+ /**+ * How hard a reasoning model should think (2.6.8). One global rung, the same+ * way thinkingEnabled is one global switch, and it reaches Chat, Agent mode+ * and the Coding Agent alike.+ *+ * It only ever leaves the app for a model whose catalogue entry declares its+ * own rungs (`reasoning_effort_levels`); everything else keeps sending what+ * it sent before. The value is clamped onto the model's ladder in+ * lib/effort.ts, so a wish this model has never heard of cannot become a 400+ * and cannot become "think as hard as you possibly can" either.+ */+ reasoningEffort: EffortLevel/*** Small-Model Mode (v2.5.0). Evidence-backed lean profile that maximises* tool-call reliability + context retention on small local models (3B-8B,