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
fix(settings): Disable auf dem Slot-Inhaber etikettiert DISABLED, nicht STANDBY
purple84f23176b212
diff --git a/src/api/providers/types.ts b/src/api/providers/types.tsindex 2d52fa83..64888b92 100644--- a/src/api/providers/types.ts+++ b/src/api/providers/types.ts@@ -41,6 +41,11 @@ export interface ProviderConfig {baseUrl: stringisLocal: booleanmanaged?: boolean+ // Set when this backend left the slot because the user pressed Disable on+ // it, rather than because something else took the slot from it. The card+ // then reads DISABLED instead of STANDBY, which is the button that was+ // pressed (Nebenbefund 3, R12/R13 re-measure 2026-08-30).+ disabledByUser?: boolean}}diff --git a/src/components/settings/ProviderConfig.tsx b/src/components/settings/ProviderConfig.tsxindex 14dd3291..f7a40462 100644--- a/src/components/settings/ProviderConfig.tsx+++ b/src/components/settings/ProviderConfig.tsx@@ -5,6 +5,7 @@ import { providerRowIds, isReturnableRow } from '../../lib/provider-visibility'import {slotTakeoverUpdate,slotHandbackUpdate,+ slotDisableOccupantUpdate,standbyOccupant,occupantIsRemovable,standbyIsRemovable,@@ -167,6 +168,10 @@ export function ProviderSettings() {// The backend Add Provider pushed out of the shared `openai` slot, if any.// It keeps a card instead of disappearing (Nebenbefund 3, R10 re-measure).const standby = standbyOccupant(providers.openai)+ // Was it pushed aside, or did the user switch it off. The slot looks the+ // same from here either way, so the mark rides on the card (Nebenbefund 3,+ // R12/R13 re-measure).+ const standbyOff = standby?.disabledByUser === true// Remove, armed by a second click on the same button (Nebenbefund (b), R11// re-measure). The house has one confirmation and this is it: the Reset@@ -281,8 +286,14 @@ export function ProviderSettings() {// one: the engine that was waiting for exactly this slot takes it back, and// the backend that is leaving takes the standby card in its place. That is// the same swap Enable does, only pressed from the other side.+ //+ // Nebenbefund 3, R12/R13 re-measure: the swap was right, the label was not.+ // The card of the backend that leaves said STANDBY, which is the word for a+ // backend that was pushed aside, and this one was switched off by hand. It+ // says DISABLED now and carries the same disabledByUser mark every other+ // switched-off row carries. Enable and Remove stay on it, unchanged.if (!nextEnabled && id === 'openai') {- const handback = slotHandbackUpdate(providers.openai)+ const handback = slotDisableOccupantUpdate(providers.openai)if (handback) {setProviderConfig('openai', handback)setStatuses(prev => ({ ...prev, openai: 'idle' }))@@ -591,20 +602,28 @@ export function ProviderSettings() {)})}- {/* The backend Add Provider pushed out of the shared local slot. It used- to vanish without a word, and the way back (Add Provider, Built-in+ {/* The backend that is no longer in the shared local slot. It used to+ vanish without a word, and the way back (Add Provider, Built-inEngine) was there but unlabelled. Same shape as the switched-off row- above, with the reason written out. */}+ above, with the reason written out.++ Two ways to land here, and they are not the same state (Nebenbefund 3,+ R12/R13 re-measure): something else TOOK the slot, or the user pressed+ Disable on this backend and the slot went back to the engine waiting+ for it. The first is STANDBY, the second is DISABLED, because that is+ the button the user pressed. Enable and Remove sit on both. */}{standby && (<div className="rounded-lg border border-white/8 bg-white/[0.01] overflow-hidden"><div className="flex items-center gap-2 px-2 py-1.5">- <button onClick={handBackSlot} className="group flex items-center" title="Put this backend back in the local slot">+ <button onClick={handBackSlot} className="group flex items-center" title={standbyOff ? 'Switch this backend back on and give it the local slot' : 'Put this backend back in the local slot'}><Power size={10} className="text-gray-500 group-hover:text-green-400 transition-colors" /></button><div className="flex-1 flex items-center gap-2 min-w-0"><span className="w-1.5 h-1.5 rounded-full shrink-0 bg-gray-600" /><span className="text-[0.65rem] text-gray-500 font-medium truncate">{standby.name}</span>- <span className="text-[0.5rem] px-1 py-0.5 rounded bg-white/5 text-gray-500 shrink-0">STANDBY</span>+ {standbyOff+ ? <span className="text-[0.5rem] px-1 py-0.5 rounded bg-white/5 text-gray-500 shrink-0">DISABLED</span>+ : <span className="text-[0.5rem] px-1 py-0.5 rounded bg-white/5 text-gray-500 shrink-0">STANDBY</span>}</div>{standbyIsRemovable(providers.openai) && (<button@@ -633,7 +652,13 @@ export function ProviderSettings() {produce a switched-off holder any more, but onboarding still parksthis slot without anyone pressing anything, and then the takeoverwording would be a lie. */}- {providers.openai.enabled ? (+ {standbyOff ? (+ <p className="px-2 pb-1.5 text-[0.55rem] text-gray-600 leading-snug">+ You switched {standby.name} off, so the local OpenAI compatible slot went back to+ {' '}{providers.openai.name}, which holds it now. Press Enable to switch {standby.name}+ {' '}back on and give it the slot again.+ </p>+ ) : providers.openai.enabled ? (<p className="px-2 pb-1.5 text-[0.55rem] text-gray-600 leading-snug">{providers.openai.name} took over the local OpenAI compatible slot, which holds onebackend at a time. Press Enable to hand the slot back to {standby.name}.diff --git a/src/lib/__tests__/disable-hands-the-slot-back.test.ts b/src/lib/__tests__/disable-hands-the-slot-back.test.tsindex 43abb418..d0d184d6 100644--- a/src/lib/__tests__/disable-hands-the-slot-back.test.ts+++ b/src/lib/__tests__/disable-hands-the-slot-back.test.ts@@ -81,16 +81,24 @@ describe('THE FIX: Disable on the slot holder gives the slot back', () => {it('the standby sentence can no longer claim a takeover that is switched off', () => {const pane = read('src/components/settings/ProviderConfig.tsx')- // the takeover wording is now bound to the slot actually being on- expect(pane).toMatch(/\{providers\.openai\.enabled \? \([\s\S]{0,400}took over the local OpenAI compatible slot/)+ // the takeover wording is now bound to the slot actually being on. Round 14+ // put the user's own Disable in front of this branch (Nebenbefund 3,+ // R12/R13), so the condition is no longer the first one in the chain, but+ // it is the same condition and it still guards the same sentence.+ expect(pane).toMatch(/providers\.openai\.enabled \? \([\s\S]{0,400}took over the local OpenAI compatible slot/)// and the other state has a sentence of its own that says what is trueexpect(pane).toMatch(/holds the local OpenAI compatible slot and is switched off,\s*\n?\s*so no local backend is running/)})it('the wiring: the Disable button routes through the handback', () => {const pane = read('src/components/settings/ProviderConfig.tsx')- expect(pane).toMatch(/if \(!nextEnabled && id === 'openai'\) \{\s*\n\s*const handback = slotHandbackUpdate\(providers\.openai\)/)+ // Round 14: the same handback, wrapped so the backend that leaves is+ // labelled DISABLED rather than STANDBY. slotDisableOccupantUpdate IS+ // slotHandbackUpdate plus that mark, see openai-slot-handover.ts.+ expect(pane).toMatch(/if \(!nextEnabled && id === 'openai'\) \{\s*\n\s*const handback = slotDisableOccupantUpdate\(providers\.openai\)/)expect(pane).toMatch(/setProviderConfig\('openai', handback\)/)+ const lib = read('src/lib/openai-slot-handover.ts')+ expect(lib).toMatch(/const patch = slotHandbackUpdate\(slot\)/)})})diff --git a/src/lib/__tests__/disable-says-disabled.test.ts b/src/lib/__tests__/disable-says-disabled.test.tsnew file mode 100644index 00000000..df0c223f--- /dev/null+++ b/src/lib/__tests__/disable-says-disabled.test.ts@@ -0,0 +1,162 @@+/**+ * Nebenbefund 3 of the R12/R13 re-measure on the real 2.6.7 Windows build+ * (2026-08-30, ergebnis-r1213-nachmessung.md):+ *+ * "Disable auf dem Slot-Inhaber setzt den Anbieter nicht auf DISABLED,+ * sondern auf STANDBY. Das ist die freundlichere Auslegung und verhindert+ * genau die Meldung aus T2. Es weicht aber von der Beschriftung ab: der+ * Knopf heisst Disable, das Ergebnis ist ein Rollentausch."+ *+ * The swap itself is right and stays exactly as R11 built it: the engine+ * waiting for the slot takes it back, so nobody is left without a local+ * backend. Only the word on the card was wrong. STANDBY is what a backend gets+ * when something ELSE took the slot from it; this one was switched off by hand,+ * and the button that did it says Disable.+ *+ * So the card reads DISABLED and carries `disabledByUser`, the same mark every+ * other switched-off row in the pane carries. Enable and Remove stay on it: the+ * way back must not depend on how the backend got there.+ *+ * Run: npx vitest run src/lib/__tests__/disable-says-disabled.test.ts+ */+import { describe, it, expect } from 'vitest'+import { readFileSync } from 'node:fs'+import { fileURLToPath } from 'node:url'+import { dirname, resolve } from 'node:path'++import {+ slotTakeoverUpdate,+ slotHandbackUpdate,+ slotDisableOccupantUpdate,+ standbyOccupant,+ standbyIsRemovable,+ type HandoverSlot,+} from '../openai-slot-handover'+import { noChatBackendEnabled } from '../provider-visibility'+import { PROVIDER_PRESETS } from '../../api/providers/types'++const here = dirname(fileURLToPath(import.meta.url))+const repo = resolve(here, '../../..')+const read = (rel: string) => readFileSync(resolve(repo, rel), 'utf8')++const preset = (id: string) => {+ const p = PROVIDER_PRESETS.find((x) => x.id === id)!+ return { name: p.name, baseUrl: p.baseUrl, isLocal: p.isLocal, managed: p.managed }+}+const BUILTIN = preset('builtin')+const JAN = preset('jan')++const SHIPPED: HandoverSlot = { enabled: true, ...BUILTIN }+/** The measured state: Add Provider, entry Jan, on top of the built-in engine. */+const JAN_IN_SLOT = { ...SHIPPED, ...slotTakeoverUpdate(SHIPPED, JAN) } as HandoverSlot++const listWith = (openai: HandoverSlot) => ({+ ollama: { enabled: false },+ openai,+ anthropic: { enabled: false },+ 'lu-cloud': { enabled: true },+})++describe('THE FIX: Disable on the slot holder says the backend is disabled', () => {+ const afterDisable = { ...JAN_IN_SLOT, ...slotDisableOccupantUpdate(JAN_IN_SLOT)! } as HandoverSlot++ it('the card of the backend the user switched off carries the mark', () => {+ expect(standbyOccupant(afterDisable)?.name).toBe('Jan')+ expect(standbyOccupant(afterDisable)?.disabledByUser).toBe(true)+ })++ it('the pane draws DISABLED for it, and keeps STANDBY for a real takeover', () => {+ const pane = read('src/components/settings/ProviderConfig.tsx')+ expect(pane).toMatch(/const standbyOff = standby\?\.disabledByUser === true/)+ expect(pane).toMatch(/\{standbyOff\s*\n?\s*\? <span[^>]*>DISABLED<\/span>/)+ expect(pane).toMatch(/: <span[^>]*>STANDBY<\/span>\}/)+ })++ it('and the sentence under it names the press instead of a takeover', () => {+ const pane = read('src/components/settings/ProviderConfig.tsx')+ expect(pane).toMatch(/\{standbyOff \? \([\s\S]{0,400}You switched \{standby\.name\} off/)+ expect(pane).toMatch(/Press Enable to switch \{standby\.name\}\s*\n?\s*\{' '\}back on and give it the slot again/)+ })++ it('the Disable button is the only thing that writes the mark', () => {+ const pane = read('src/components/settings/ProviderConfig.tsx')+ expect(pane).toMatch(/if \(!nextEnabled && id === 'openai'\) \{\s*\n\s*const handback = slotDisableOccupantUpdate\(providers\.openai\)/)+ // Add Provider still takes the slot without claiming anybody switched off+ expect(standbyOccupant(JAN_IN_SLOT)?.disabledByUser).toBeUndefined()+ })++ it('Enable and Remove stay on the card, whichever way it got there', () => {+ expect(standbyIsRemovable(afterDisable)).toBe(true)+ const back = slotHandbackUpdate(afterDisable)!+ expect(back.enabled).toBe(true)+ expect(back.name).toBe('Jan')+ // and switching it back on clears the mark rather than dragging it along+ expect(back.disabledByUser).toBe(false)+ const reEnabled = { ...afterDisable, ...back } as HandoverSlot+ expect(standbyOccupant(reEnabled)?.name).toBe('Built-in Engine')+ expect(standbyOccupant(reEnabled)?.disabledByUser).toBeUndefined()+ })+})++describe('NEGATIVE CONTROL: everything R10, R11 and R13 settled', () => {+ it('the swap itself is untouched, the slot still goes back to the engine', () => {+ // The R11 finding: Disable on the slot holder must not leave the machine+ // with no local backend at all.+ const patch = slotDisableOccupantUpdate(JAN_IN_SLOT)!+ const after = listWith({ ...JAN_IN_SLOT, ...patch } as HandoverSlot)+ expect(after.openai.name).toBe('Built-in Engine')+ expect(after.openai.managed).toBe(true)+ expect(after.openai.enabled).toBe(true)+ expect(noChatBackendEnabled(after, 'local')).toBe(false)+ })++ it('the slot itself is NOT marked disabled, only the card that left it', () => {+ // Marking the slot would grey out the engine that just took it over, which+ // is the hole R10 closed. The mark belongs to the backend, not the seat.+ const patch = slotDisableOccupantUpdate(JAN_IN_SLOT)!+ expect(patch.disabledByUser).toBe(false)+ expect(patch.enabled).toBe(true)+ })++ it('a slot with nobody waiting still goes to the plain greyed DISABLED row', () => {+ // Fresh install, built-in engine in the slot, nothing displaced: there is+ // nobody to hand the slot to, so the ordinary Disable path applies and the+ // R10 row is what the user sees.+ expect(slotDisableOccupantUpdate(SHIPPED)).toBeNull()+ const pane = read('src/components/settings/ProviderConfig.tsx')+ expect(pane).toMatch(/setProviderConfig\(id, \{ enabled: nextEnabled, disabledByUser: !nextEnabled \}\)/)+ expect(pane).toMatch(/if \(isReturnableRow\(config\)\)/)+ })++ it('Enable on the standby card is still a swap and never writes the mark', () => {+ // Pressing Enable is the opposite wish, so the backend it displaces goes to+ // STANDBY, not to DISABLED.+ const patch = slotHandbackUpdate(JAN_IN_SLOT)!+ const after = { ...JAN_IN_SLOT, ...patch } as HandoverSlot+ expect(standbyOccupant(after)?.name).toBe('Jan')+ expect(standbyOccupant(after)?.disabledByUser).toBeUndefined()+ })++ it('Add Provider still labels the backend it pushed out STANDBY', () => {+ const pane = read('src/components/settings/ProviderConfig.tsx')+ expect(pane).toMatch(/took over the local OpenAI compatible slot/)+ expect(standbyOccupant(JAN_IN_SLOT)?.name).toBe('Built-in Engine')+ expect(standbyOccupant(JAN_IN_SLOT)?.disabledByUser).toBeUndefined()+ })++ it('the parked-slot sentence onboarding needs is still there', () => {+ const pane = read('src/components/settings/ProviderConfig.tsx')+ expect(pane).toMatch(/holds the local OpenAI compatible slot and is switched off,\s*\n?\s*so no local backend is running/)+ })++ it('no em dash in the new copy', () => {+ const lib = read('src/lib/openai-slot-handover.ts')+ const i = lib.indexOf('The patch DISABLE on the slot holder writes')+ expect(i).toBeGreaterThan(-1)+ expect(lib.slice(i, lib.indexOf('export function slotDisableOccupantUpdate', i))).not.toMatch(/[–—]/)+ const pane = read('src/components/settings/ProviderConfig.tsx')+ const j = pane.indexOf('Two ways to land here')+ expect(j).toBeGreaterThan(-1)+ expect(pane.slice(j, pane.indexOf('{/* No backend warning', j))).not.toMatch(/[–—]/)+ })+})diff --git a/src/lib/openai-slot-handover.ts b/src/lib/openai-slot-handover.tsindex 257864e2..eb5ae63f 100644--- a/src/lib/openai-slot-handover.ts+++ b/src/lib/openai-slot-handover.ts@@ -50,6 +50,17 @@ export interface SlotOccupant {baseUrl: stringisLocal: booleanmanaged?: boolean+ /**+ * This backend is waiting beside the slot because the USER switched it off,+ * not because something else took the slot from it.+ *+ * Nebenbefund 3 of the R12/R13 re-measure (2026-08-30): Disable on the slot+ * holder gives the slot back correctly, but then labelled Jan STANDBY. The+ * button says Disable and the user pressed it, so the card has to say the+ * backend is off. Parked and switched off are two different states and only+ * the card can tell them apart, because the slot itself looks identical.+ */+ disabledByUser?: boolean}/** The part of the `openai` slot this decision reads. */@@ -142,6 +153,33 @@ export function slotHandbackUpdate(slot: HandoverSlot): Partial<ProviderConfig>return slotTakeoverUpdate({ ...slot, enabled: true, displaced: undefined }, back)}+/**+ * The patch DISABLE on the slot holder writes.+ *+ * Same swap as the handback, because that is the part R11 got right: switching+ * a backend off is not a wish to be left without one, and the engine waiting+ * beside the slot takes it back. The one difference is the label the leaving+ * backend gets, which is Nebenbefund 3 of the R12/R13 re-measure:+ *+ * "Disable auf dem Slot-Inhaber setzt den Anbieter nicht auf DISABLED,+ * sondern auf STANDBY. Das ist die freundlichere Auslegung ... Es weicht+ * aber von der Beschriftung ab: der Knopf heisst Disable, das Ergebnis ist+ * ein Rollentausch."+ *+ * So the card says DISABLED and carries the same `disabledByUser` mark every+ * other switched-off row carries. Enable and Remove stay on it either way: the+ * way back must not depend on how the backend got there.+ *+ * Null when there is nobody to hand the slot to, and then the plain Disable+ * path applies unchanged (the row goes greyed DISABLED where it always did).+ */+export function slotDisableOccupantUpdate(slot: HandoverSlot): Partial<ProviderConfig> | null {+ const patch = slotHandbackUpdate(slot)+ const leaving = (patch as { displaced?: SlotOccupant } | null)?.displaced+ if (!patch || !leaving) return patch+ return { ...patch, displaced: { ...leaving, disabledByUser: true } }+}+/*** Whether the backend SITTING IN the slot may be removed, and whether the one* waiting beside it may be.