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: vier neue Dateien fehlten in den vorigen Commits
Davidd94077ae897f
diff --git a/src/hooks/__tests__/shortcut-owner.test.ts b/src/hooks/__tests__/shortcut-owner.test.tsnew file mode 100644index 00000000..e11299ea--- /dev/null+++ b/src/hooks/__tests__/shortcut-owner.test.ts@@ -0,0 +1,88 @@+/**+ * Tastenkürzel mit Modifier dürfen nicht am Eingabefeld hängenbleiben (Welle 2)+ *+ * Die `isCtrl`-Prüfung stand HINTER dem Eingabefeld-Guard, also verschluckte+ * jedes fokussierte Textfeld sämtliche Kürzel mit Ctrl/Cmd — und in dieser App+ * hat fast immer das Chat-Eingabefeld den Fokus. Ctrl+N und Ctrl+E waren damit+ * praktisch tot.+ *+ * Beim Vorziehen darf das Tippen nicht kaputtgehen: Cmd+A/C/V/X/Z gehören+ * weiterhin dem Feld, und unter macOS auch die Emacs-Bindings auf Ctrl.+ *+ * Run: npx vitest run src/hooks/__tests__/shortcut-owner.test.ts+ */+import { describe, it, expect } from 'vitest'+import { shortcutOwner } from '../useKeyboardShortcuts'++const key = (k: string, mods: { ctrl?: boolean; meta?: boolean } = {}) => ({+ key: k,+ ctrlKey: mods.ctrl ?? false,+ metaKey: mods.meta ?? false,+})++const WIN = false+const MAC = true++describe('shortcutOwner — außerhalb eines Eingabefelds', () => {+ it('gibt der App jede Taste', () => {+ expect(shortcutOwner(key('n'), false, WIN)).toBe('app')+ expect(shortcutOwner(key('n', { ctrl: true }), false, WIN)).toBe('app')+ expect(shortcutOwner(key('a', { meta: true }), false, MAC)).toBe('app')+ })+})++describe('shortcutOwner — im Eingabefeld', () => {+ it('lässt getippte Zeichen beim Feld (der eigentliche Zweck des Guards)', () => {+ expect(shortcutOwner(key('n'), true, WIN)).toBe('field')+ expect(shortcutOwner(key('e'), true, WIN)).toBe('field')+ expect(shortcutOwner(key(' '), true, WIN)).toBe('field')+ })++ it('gibt Kürzel MIT Modifier an die App — das war der Fehler', () => {+ expect(shortcutOwner(key('n', { ctrl: true }), true, WIN)).toBe('app')+ expect(shortcutOwner(key('e', { ctrl: true }), true, WIN)).toBe('app')+ expect(shortcutOwner(key('l', { ctrl: true }), true, WIN)).toBe('app')+ expect(shortcutOwner(key('/', { ctrl: true }), true, WIN)).toBe('app')+ expect(shortcutOwner(key('D', { ctrl: true }), true, WIN)).toBe('app')+ })++ it('lässt Cmd+A, Cmd+C, Cmd+V, Cmd+X, Cmd+Z beim Textfeld', () => {+ for (const k of ['a', 'c', 'v', 'x', 'z']) {+ expect(shortcutOwner(key(k, { meta: true }), true, MAC)).toBe('field')+ expect(shortcutOwner(key(k, { ctrl: true }), true, WIN)).toBe('field')+ }+ })++ it('lässt auch Cmd+Shift+Z (Wiederherstellen) beim Feld — Groß/Klein egal', () => {+ expect(shortcutOwner(key('Z', { meta: true }), true, MAC)).toBe('field')+ expect(shortcutOwner(key('y', { ctrl: true }), true, WIN)).toBe('field')+ })++ it('lässt wortweises Springen und Löschen beim Feld', () => {+ for (const k of ['ArrowLeft', 'ArrowRight', 'Home', 'End', 'Backspace', 'Delete']) {+ expect(shortcutOwner(key(k, { ctrl: true }), true, WIN)).toBe('field')+ expect(shortcutOwner(key(k, { meta: true }), true, MAC)).toBe('field')+ }+ })++ it('macOS: die Emacs-Bindings auf Ctrl bleiben beim Feld (Ctrl+E = Zeilenende)', () => {+ expect(shortcutOwner(key('e', { ctrl: true }), true, MAC)).toBe('field')+ expect(shortcutOwner(key('n', { ctrl: true }), true, MAC)).toBe('field')+ expect(shortcutOwner(key('k', { ctrl: true }), true, MAC)).toBe('field')+ })++ it('macOS: die App-Kürzel laufen dort über Cmd und kommen weiterhin durch', () => {+ expect(shortcutOwner(key('n', { meta: true }), true, MAC)).toBe('app')+ expect(shortcutOwner(key('e', { meta: true }), true, MAC)).toBe('app')+ })++ it('Windows/Linux: Ctrl+E bleibt ein App-Kürzel (dort gibt es keine Emacs-Bindings)', () => {+ expect(shortcutOwner(key('e', { ctrl: true }), true, WIN)).toBe('app')+ expect(shortcutOwner(key('n', { ctrl: true }), true, WIN)).toBe('app')+ })++ it('Escape kommt immer durch, auch aus einem Eingabefeld heraus', () => {+ expect(shortcutOwner(key('Escape'), true, MAC)).toBe('app')+ expect(shortcutOwner(key('Escape'), true, WIN)).toBe('app')+ })+})diff --git a/src/lib/provider-slot-darkening.ts b/src/lib/provider-slot-darkening.tsnew file mode 100644index 00000000..bc787631--- /dev/null+++ b/src/lib/provider-slot-darkening.ts@@ -0,0 +1,65 @@+/**+ * Die Ansage "diese Backend-Slots sind gerade abgeschaltet worden" — und wer+ * darauf hört.+ *+ * Der providerStore weiß, wann ein Slot dunkel wird; der modelStore muss dann+ * eine Modellwahl räumen, die von diesem Slot bedient wurde (sonst bietet der+ * Composer weiter ein Modell an, dessen Backend aus ist, und jedes Senden+ * scheitert mit model-not-found). Die fachliche Regel steht unverändert in+ * beiden Stores; hier steht nur die Leitung dazwischen.+ *+ * Audit W-T2: providerStore.ts hat sich den modelStore dafür mit+ * `void import('./modelStore')` selbst geholt, mit dem Kommentar "a static edge+ * would close that circle at module-init time". Der Kreis war echt+ * (providerStore → modelStore → engine → providerStore, und ein zweites Mal+ * über chatStore → remoteStore), der dynamische Import hat ihn nur unsichtbar+ * gemacht statt aufgelöst.+ *+ * Zwei Zustandsspeicher, die sich gegenseitig lesen, sind kein Grund für einen+ * versteckten Import: der eine sagt an, der andere hört zu, und die Ansage+ * gehört keinem von beiden. Dieselbe Bauform, die dieses Repo mit+ * `onLocalSlotChanged` (lib/builtin-slot-eviction.ts) für die+ * Speicher-Freigabe schon benutzt, und dieselbe Umkehr wie `setRetiredRunner`+ * in api/mcp/tool-registry.ts.+ */++import type { ProviderId } from '../api/providers/types'++type DarkenedSlotsListener = (darkened: readonly ProviderId[]) => void++/**+ * Genau ein Zuhörer. Es gibt genau einen Modell-Store; eine Liste würde nur+ * verdecken, wenn sich versehentlich zweimal jemand anmeldet.+ */+let listener: DarkenedSlotsListener | null = null++/** Anmelden. Der modelStore tut das beim Laden. */+export function onProviderSlotsDarkened(fn: DarkenedSlotsListener): void {+ listener = fn+}++/**+ * Ansagen. Ohne Zuhörer passiert nichts — genauso wie der frühere dynamische+ * Import mit `.catch(() => {})` endete: die nächste Inventar-Aktualisierung+ * prüft die Wahl ohnehin erneut.+ *+ * Die Zustellung ist nachgelagert, weil der frühere `import()` es auch war: der+ * Aufruf lief hinter der laufenden `set()`-Runde des providerStore, und dabei+ * bleibt es — ein Schreiben im Modell-Store soll nicht mitten im Schreiben des+ * Provider-Stores passieren.+ */+export function announceDarkenedSlots(darkened: readonly ProviderId[]): void {+ if (darkened.length === 0) return+ const fn = listener+ if (!fn) return+ void Promise.resolve().then(() => {+ try {+ fn(darkened)+ } catch { /* best-effort: the next inventory refresh re-checks */ }+ })+}++/** Test-only: die Anmeldung vergessen, damit Tests isoliert bleiben. */+export function __resetProviderSlotDarkeningForTests(): void {+ listener = null+}diff --git a/src/types/downloads.ts b/src/types/downloads.tsnew file mode 100644index 00000000..d594a90e--- /dev/null+++ b/src/types/downloads.ts@@ -0,0 +1,24 @@+/**+ * Die Fortschrittsmeldung des Rust-Downloaders, so wie sie über+ * `get_download_progress` hereinkommt.+ *+ * Audit W-T2: Die Form stand in api/discover.ts. lib/bundle-install.ts braucht+ * nur diesen Typ von dort — und discover.ts holt sich umgekehrt+ * `waitForModelsVisible` aus bundle-install.ts. Das war ein Zyklus, den+ * discover.ts mit einem `await import()` mitten in der Funktion umgangen hat+ * ("bundle-install.ts points back at this module").+ *+ * Der Typ beschreibt Daten, keine Zuständigkeit, also wohnt er hier — in einem+ * Modul, das selbst nichts importiert. discover.ts re-exportiert ihn, damit+ * kein Aufrufer seinen Importpfad ändern muss, und darf bundle-install.ts+ * seither ganz normal statisch importieren.+ */++export interface DownloadProgress {+ progress: number+ total: number+ speed: number+ filename: string+ status: 'connecting' | 'downloading' | 'pausing' | 'paused' | 'complete' | 'error'+ error?: string+}diff --git a/src/types/staged-changes.ts b/src/types/staged-changes.tsnew file mode 100644index 00000000..c8263962--- /dev/null+++ b/src/types/staged-changes.ts@@ -0,0 +1,50 @@+/**+ * Die Datenform einer vorgemerkten Dateiänderung (Stage-and-Approve).+ *+ * Audit W-T2: Die Form stand in stores/stagedChangesStore.ts, und+ * lib/staged-overlay.ts holte sie sich von dort — während der Store umgekehrt+ * `normalizeStagedPath` aus dem Overlay zieht. Zwei Module, die sich+ * gegenseitig importieren, nur weil eine Typdeklaration im falschen Haus+ * wohnte.+ *+ * Der Typ ist reine Beschreibung: er beschreibt, was gestaged wurde, nicht wer+ * es hält. Also gehört er in ein blattnahes Modul, das selbst nichts+ * importiert — Store und Overlay lesen beide von hier. stagedChangesStore+ * exportiert `StagedChange` weiterhin re-exportierend, damit kein Aufrufer+ * seinen Importpfad ändern muss.+ */++export interface StagedChange {+ /** Stable id assigned at stage-time so the UI can key + remove safely. */+ id: string+ /** Path the model called `file_write` with (as the model wrote it — may be relative). */+ path: string+ /**+ * Absolute path resolved against the run's workspace AT STAGE TIME. Apply+ * happens after the run ends, when useCodex's finally has cleared the active+ * chat/workspace context — so a relative `path` would route to+ * agent-workspace/default/ instead of the project folder the agent wrote into.+ * Writing this captured absolute path makes the approved diff land exactly+ * where it should. Falls back to `path` (already absolute / no workspace set).+ */+ resolvedPath?: string+ /**+ * The run's workspace root, captured AT STAGE TIME. Apply runs after the loop+ * ends, when the active chat/workspace context is cleared — so without this+ * the write jails to agent-workspace/default and REJECTS the absolute project+ * path ("escapes the allowed workspace"), silently failing every apply into a+ * real folder. The apply path (a trusted, user-gated UI action) passes this+ * as fs_write's working_directory so the jail root is the real project folder.+ * Undefined for sandbox-mode runs (no real folder), where the per-chat+ * sandbox is the correct root anyway.+ */+ workingDirectory?: string+ /** Full file content before the write — empty string when the target didn't exist. */+ oldContent: string+ /** Full file content the model wants to write. */+ newContent: string+ /** Pre-computed unified diff for snappy rendering — caller decides format. */+ diff: string+ /** Wall-clock when the model staged this change. */+ stagedAt: number+}