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
test(bench): engine runs answer the backend picker and pin the engine's model; agent shell sandbox prepared, off (CA, E3)
purple460454672bf6
diff --git a/e2e/agent-live/run.bench.ts b/e2e/agent-live/run.bench.tsindex d139ef7e..d3f015ce 100644--- a/e2e/agent-live/run.bench.ts+++ b/e2e/agent-live/run.bench.ts@@ -33,6 +33,7 @@ const STORES = ['/src/stores/toolAuditStore.ts','/src/stores/generationStore.ts','/src/stores/providerStore.ts',+ '/src/stores/modelStore.ts',]const tasks = TASKS.filter((t) => !WANTED.length || WANTED.includes(t.id))@@ -63,6 +64,21 @@ async function boot(page: Page) {// The picker reads the providers when it loads its list.await page.reload()await appModules(page, STORES)+ // With the engine up, the app finds it (and any Ollama) and asks which to+ // use. The engine is preselected; Ollama stays off.+ const pick = page.getByRole('button', { name: 'Use selected', exact: true })+ if (await pick.waitFor({ state: 'visible', timeout: 8_000 }).then(() => true, () => false)) {+ await expect(page.getByText('LU Engine', { exact: true }).first()).toBeVisible()+ await pick.click()+ }+ // Never fall back to whatever model was active before (it can be one of+ // the owner's Ollama models the dev server lists): the engine's model only.+ await page.evaluate(() => {+ const A = (window as unknown as AppWindow).__APP__+ const ms = A['/src/stores/modelStore.ts']?.useModelStore?.getState()+ const own = ms?.models?.find((m: { name: string }) => m.name.startsWith('openai::'))+ if (own) ms.setActiveModel(own.name)+ })}}diff --git a/src/lib/agent-core/__tests__/shell-sandbox.test.ts b/src/lib/agent-core/__tests__/shell-sandbox.test.tsnew file mode 100644index 00000000..06db3b7f--- /dev/null+++ b/src/lib/agent-core/__tests__/shell-sandbox.test.ts@@ -0,0 +1,31 @@+import { describe, expect, it } from 'vitest'+import { DEFAULT_SHELL_SANDBOX, seatbeltProfile, workspaceIsFenceable } from '../shell-sandbox'++describe('the agent shell sandbox, prepared (CA, E3)', () => {+ it('is off until David switches it on', () => {+ expect(DEFAULT_SHELL_SANDBOX).toBe('off')+ })++ it('closes the home folder and opens the workspace, temp and toolchains', () => {+ const p = seatbeltProfile({ home: '/Users/u', workspace: '/Users/u/code/app', temp: ['/private/tmp'], toolchains: ['/Users/u/.nvm'], readOnlyFiles: ['/Users/u/.gitconfig'] })+ expect(p).toContain('(deny file-read-data file-write* (subpath "/Users/u") (subpath "/Volumes"))')+ expect(p).toContain('(allow file-read-data (subpath "/Users/u/.nvm") (literal "/Users/u/.gitconfig"))')+ expect(p).toContain('(allow file-read-data file-write* (subpath "/Users/u/code/app") (subpath "/private/tmp"))')+ // Later rules win in Seatbelt: the openings come after the deny.+ expect(p.indexOf('(deny')).toBeLessThan(p.indexOf('/Users/u/code/app'))+ })++ it('refuses to fence the home itself or a parent of it', () => {+ expect(workspaceIsFenceable('/Users/u', '/Users/u')).toBe(false)+ expect(workspaceIsFenceable('/Users/u', '/Users')).toBe(false)+ expect(workspaceIsFenceable('/Users/u', '/Users/u/code')).toBe(true)+ })++ it('nothing calls it yet', async () => {+ const { readFileSync } = await import('node:fs')+ const { resolve } = await import('node:path')+ for (const f of ['api/mcp/builtin-tools.ts', 'hooks/useCodex.ts', 'hooks/useAgentChat.ts']) {+ expect(readFileSync(resolve(__dirname, '../../..', f), 'utf8')).not.toContain('seatbeltProfile')+ }+ })+})diff --git a/src/lib/agent-core/shell-sandbox.ts b/src/lib/agent-core/shell-sandbox.tsnew file mode 100644index 00000000..c1321d7e--- /dev/null+++ b/src/lib/agent-core/shell-sandbox.ts@@ -0,0 +1,63 @@+/**+ * The agent shell's OS sandbox, prepared and not switched on (CA, David's E3+ * of 13.11.2026: "nur vorbereiten, damit sie später ein Schalter ist").+ *+ * Claude Code and Codex run agent commands under Seatbelt on macOS (Landlock /+ * bubblewrap on Linux) with the workspace writable and the rest of the home+ * folder closed. LU's bench already does this for its own runs+ * (dev-server/bench-sandbox.ts). This module is the product side of the same+ * idea, as pure data, so the switch later is a setting plus one wrapper call in+ * src-tauri/src/commands/shell.rs and bg_tasks.rs:+ *+ * mode 'workspace' on macOS → spawn `/usr/bin/sandbox-exec -p <profile> <shell> …`+ *+ * Nothing calls it yet. Mode 'off' is today's behaviour.+ */++export type ShellSandboxMode = 'off' | 'workspace'++/** The switch's value until David decides otherwise. */+export const DEFAULT_SHELL_SANDBOX: ShellSandboxMode = 'off'++export interface SandboxPaths {+ /** The real home folder. */+ home: string+ /** The run's working folder: readable and writable. */+ workspace: string+ /** Temp folders: readable and writable (npm, pip, compilers). */+ temp: readonly string[]+ /** Toolchains under the home (nvm, cargo, pyenv …): readable only. */+ toolchains: readonly string[]+ /** Under the home and still needed to read: ~/.gitconfig and the like. */+ readOnlyFiles?: readonly string[]+}++const q = (p: string) => JSON.stringify(p)++/**+ * A Seatbelt profile: everything allowed except reading or writing under the+ * home folder and /Volumes; inside that, the workspace and temp are open again,+ * toolchains are readable. The network stays on (package installs, git).+ * Secret files inside the workspace are still refused by name by the tool+ * guard (lib/secret-paths), before the command runs.+ */+export function seatbeltProfile(p: SandboxPaths): string {+ const readable = [...p.toolchains.map((d) => `(subpath ${q(d)})`), ...(p.readOnlyFiles ?? []).map((f) => `(literal ${q(f)})`)]+ const writable = [p.workspace, ...p.temp].map((d) => `(subpath ${q(d)})`)+ return [+ '(version 1)',+ '(allow default)',+ `(deny file-read-data file-write* (subpath ${q(p.home)}) (subpath "/Volumes"))`,+ ...(readable.length ? [`(allow file-read-data ${readable.join(' ')})`] : []),+ `(allow file-read-data file-write* ${writable.join(' ')})`,+ ].join('\n')+}++/** Whether a workspace can be fenced at all: it must not be the home itself+ * or a parent of it (the fence would open everything again). */+export function workspaceIsFenceable(home: string, workspace: string): boolean {+ const norm = (s: string) => s.replace(/\/+$/, '')+ const h = norm(home)+ const w = norm(workspace)+ return !!w && w !== h && !h.startsWith(w + '/') && w !== ''+}