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(catalog): the gate pop-up's offline lists come from the public catalogue
purple9c5abb9e236a
diff --git a/scripts/studio-snapshot.mjs b/scripts/studio-snapshot.mjsindex dd0311ca..28f025a9 100644--- a/scripts/studio-snapshot.mjs+++ b/scripts/studio-snapshot.mjs@@ -217,15 +217,55 @@ export function snapshotFromWeb(webRepo, desktopRoot = DESKTOP_ROOT, ref) {/** sha256 of a generated file, hex. @param {string} text */export const hashText = (text) => createHash('sha256').update(text, 'utf8').digest('hex')+/** The gate pop-up's offline lists (src/lib/cloud-gate-seed.json). They are+ * not files of the web: the web builds them from the pricing page in+ * /api/public/cloud-catalog. So the seed is written from that answer as the+ * app reads it (header x-lu-client: desktop), with the app's own names and+ * only the fields the app keeps, and its source and hash are recorded next+ * to the catalogue's. Run it against the live server of the release.+ * `--gate <url or saved answer>` */+export const GATE_SEED_FILE = 'src/lib/cloud-gate-seed.json'+export const GATE_URL = 'https://lu-labs.ai/api/public/cloud-catalog'++/** The seed text from one answer of the public catalogue.+ * @param {any} answer @returns {string} */+export function gateSeedText(answer) {+ if (!answer || answer.version !== 1 || !answer.categories) throw new Error('studio-snapshot: not a public catalogue answer (version 1)')+ const pick = (list, create) => (Array.isArray(list) ? list : []).flatMap((m) => {+ if (!m || typeof m.id !== 'string') return []+ const label = [m.native_label, m.label].find((v) => typeof v === 'string' && v.trim() !== '')?.trim() ?? m.id+ const out = { id: m.id, label }+ if (create) out.kind = m.kind+ if (m.adult === true) out.adult = true+ return [out]+ })+ const c = answer.categories+ const seed = { chat: pick(c.chat, false), code: pick(c.code, false), create: pick(c.create, true) }+ if (!seed.chat.length || !seed.create.length) throw new Error('studio-snapshot: the public catalogue answer has no chat or create models')+ return `${JSON.stringify(seed, null, 1)}\n`+}++/** Reads the answer: a URL (GET with the app's header, read only) or a file.+ * @param {string} from */+export async function readGateAnswer(from) {+ if (/^https:\/\//.test(from)) {+ const res = await fetch(from, { headers: { 'x-lu-client': 'desktop', 'user-agent': 'LU-catalog-snapshot' } })+ if (!res.ok) throw new Error(`studio-snapshot: ${from} answered ${res.status}`)+ return res.json()+ }+ return JSON.parse(readFileSync(from, 'utf8'))+}+/** The record of where the generated files came from.* @param {Record<string, string>} texts @param {{ commit: string | null, committed: string | null, dirty: boolean }} origin* @param {string | undefined} ref @returns {string} */-export function sourceText(texts, origin, ref) {+export function sourceText(texts, origin, ref, gate) {const record = {generator: 'scripts/studio-snapshot.mjs',note: 'Generated files. Do not edit them by hand: run the generator against the web commit this release ships with.',web: { ref: ref ?? null, ...origin },files: Object.fromEntries(GENERATED_FILES.map((name) => [name, hashText(texts[name])])),+ ...(gate ? { gate } : {}),}return `${JSON.stringify(record, null, 2)}\n`}@@ -238,7 +278,7 @@ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.urprocess.stderr.write('studio-snapshot: --ref needs a commit.\n')process.exit(2)}- const webRepo = process.env.LU_WEB_REPO?.trim() || args.find((arg, i) => !arg.startsWith('--') && i !== refAt + 1)+ const webRepo = process.env.LU_WEB_REPO?.trim() || args.find((arg, i) => !arg.startsWith('--') && i !== refAt + 1 && args[i - 1] !== '--gate')if (!webRepo) {process.stderr.write('studio-snapshot: set LU_WEB_REPO to the web repository, or pass its path.\n')process.exit(2)@@ -247,10 +287,23 @@ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.urconst repo = resolve(webRepo)const texts = snapshotFromWeb(repo, DESKTOP_ROOT, ref)const origin = webReader(repo, ref).origin([...GENERATED_FILES.map((name) => `${WEB_DIR}/${name}`), `apps/web/${MARK_FILE}`])- texts[SOURCE_FILE] = sourceText(texts, origin, ref)+ // The gate seed: written from --gate, else kept as the last run recorded it.+ const gateAt = args.indexOf('--gate')+ const sourcePath = resolve(DESKTOP_ROOT, DESKTOP_DIR, SOURCE_FILE)+ let gate = existsSync(sourcePath) ? JSON.parse(readFileSync(sourcePath, 'utf8')).gate : undefined+ if (gateAt >= 0) {+ const from = args[gateAt + 1] === 'live' ? GATE_URL : args[gateAt + 1]+ if (!from) {+ process.stderr.write('studio-snapshot: --gate needs a URL, a saved answer or `live`.\n')+ process.exit(2)+ }+ texts[GATE_SEED_FILE] = gateSeedText(await readGateAnswer(from))+ gate = { from: /^https:/.test(from) ? from : 'file', file: GATE_SEED_FILE, sha256: hashText(texts[GATE_SEED_FILE]) }+ }+ texts[SOURCE_FILE] = sourceText(texts, origin, ref, gate)let differ = 0- for (const name of [...GENERATED_FILES, SOURCE_FILE]) {- const file = resolve(DESKTOP_ROOT, DESKTOP_DIR, name)+ for (const name of [...GENERATED_FILES, SOURCE_FILE, ...(gateAt >= 0 ? [GATE_SEED_FILE] : [])]) {+ const file = name === GATE_SEED_FILE ? resolve(DESKTOP_ROOT, name) : resolve(DESKTOP_ROOT, DESKTOP_DIR, name)const same = existsSync(file) && readFileSync(file, 'utf8') === texts[name]if (!same) differ++if (!same && !check) writeFileSync(file, texts[name])diff --git a/src/lib/__tests__/cloud-gate.test.ts b/src/lib/__tests__/cloud-gate.test.tsindex 2d80d294..ba2c6533 100644--- a/src/lib/__tests__/cloud-gate.test.ts+++ b/src/lib/__tests__/cloud-gate.test.ts@@ -62,14 +62,15 @@ describe('the server answer', () => {expect(GATE_SEED.offers).toBeNull()})- // 3.0.8: Kimi K3.1 Pro kommt in die Cloud und steht im Schnappschuss vor- // Kimi K3, das bleibt.- it('offline names Kimi K3.1 Pro right before Kimi K3 in Chat and Code', () => {+ // 3.0.8: Kimi K3.1 Pro kommt in die Cloud, Kimi K3 bleibt. Die Reihenfolge+ // kommt seit 3.1.0 aus der öffentlichen Liste (scripts/studio-snapshot.mjs+ // --gate live) und wird hier nicht festgeschrieben.+ it('offline names Kimi K3.1 Pro and keeps Kimi K3 in Chat and Code', () => {for (const cat of ['chat', 'code'] as const) {const ids = GATE_SEED.categories[cat].map((m) => m.id)const pro = ids.indexOf('moonshotai/Kimi-K3.1-Pro')expect(pro).toBeGreaterThanOrEqual(0)- expect(ids[pro + 1]).toBe('moonshotai/Kimi-K3')+ expect(ids).toContain('moonshotai/Kimi-K3')expect(GATE_SEED.categories[cat][pro].label).toBe('Kimi K3.1 Pro')expect(paramsInId(ids[pro])).toBeNull()}diff --git a/src/lib/cloud-gate-seed.json b/src/lib/cloud-gate-seed.jsonindex bbbff984..175c4378 100644--- a/src/lib/cloud-gate-seed.json+++ b/src/lib/cloud-gate-seed.json@@ -1,25 +1,17 @@{"chat": [- {- "id": "deepseek-ai/DeepSeek-V4.1-Flash",- "label": "DeepSeek V4.1 Flash"- },{"id": "moonshotai/Kimi-K3.1-Pro","label": "Kimi K3.1 Pro"},{- "id": "moonshotai/Kimi-K3",- "label": "Kimi K3"+ "id": "deepseek-ai/DeepSeek-V4.1-Flash-1017",+ "label": "DeepSeek V4.1 Flash 1017"},{"id": "zai-org/GLM-5.3","label": "GLM 5.3"},- {- "id": "Qwen/Qwen3.8-2.4T-A95B",- "label": "Qwen 3.8 A95B"- },{"id": "zai-org/GLM-5.3-Flash","label": "GLM 5.3 Flash"@@ -60,26 +52,18 @@"id": "Sao10K/L3-8B-Lunaris-v1-Turbo","label": "Lunaris 8B"},- {- "id": "Gryphe/MythoMax-L2-13b",- "label": "MythoMax 13B"- },- {- "id": "NousResearch/Hermes-3-Llama-3.1-70B",- "label": "Hermes 3 70B"- },{"id": "Sao10K/L3.1-70B-Euryale-v2.2","label": "Euryale 70B"},- {- "id": "NousResearch/Hermes-3-Llama-3.1-405B",- "label": "Hermes 3 405B"- },{"id": "Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo","label": "Qwen3 Coder 480B"},+ {+ "id": "moonshotai/Kimi-K3",+ "label": "Kimi K3"+ },{"id": "deepseek-ai/DeepSeek-V3.1","label": "DeepSeek V3.1"@@ -88,10 +72,6 @@"id": "deepseek-ai/DeepSeek-V4-Flash-0731","label": "DeepSeek V4 Flash 0731"},- {- "id": "deepseek-ai/DeepSeek-R1-0528",- "label": "DeepSeek R1"- },{"id": "Qwen/Qwen3-32B","label": "Qwen3 32B"@@ -136,10 +116,6 @@"id": "meta-llama/Llama-3.3-70B-Instruct-Turbo","label": "Llama 3.3 70B Turbo"},- {- "id": "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",- "label": "Llama 4 Maverick"- },{"id": "meta-llama/Llama-4-Scout-17B-16E-Instruct","label": "Llama 4 Scout"@@ -152,14 +128,6 @@"id": "zai-org/GLM-4.7","label": "GLM 4.7"},- {- "id": "zai-org/GLM-5",- "label": "GLM 5"- },- {- "id": "zai-org/GLM-5.1",- "label": "GLM 5.1"- },{"id": "zai-org/GLM-5.2","label": "GLM 5.2"@@ -168,6 +136,10 @@"id": "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B","label": "Nemotron 3 Super 120B"},+ {+ "id": "nvidia/NVIDIA-Nemotron-3.5-Super-VL",+ "label": "Nemotron 3.5 Super VL"+ },{"id": "openai/gpt-oss-20b","label": "gpt-oss 20B"@@ -176,18 +148,14 @@"id": "moonshotai/Kimi-K2.6","label": "Kimi K2.6"},- {- "id": "moonshotai/Kimi-K2.7-Code",- "label": "Kimi K2.7 Code"- },- {- "id": "MiniMaxAI/MiniMax-M2.7",- "label": "MiniMax M2.7"- },{"id": "MiniMaxAI/MiniMax-M3","label": "MiniMax M3"},+ {+ "id": "XiaomiMiMo/MiMo-V2.6-Pro",+ "label": "MiMo V2.6 Pro"+ },{"id": "mistralai/Mistral-Small-3.2-24B-Instruct-2506","label": "Mistral Small 3.2 24B"@@ -231,29 +199,29 @@{"id": "direct/abliterated-large-v2","label": "Abliterated Large V2"+ },+ {+ "id": "direct/abliterated-large-flash",+ "label": "Abliterated Large Flash"+ },+ {+ "id": "direct/deepseek-v4.1-flash",+ "label": "DeepSeek V4.1 Flash Uncensored"}],"code": [- {- "id": "deepseek-ai/DeepSeek-V4.1-Flash",- "label": "DeepSeek V4.1 Flash"- },{"id": "moonshotai/Kimi-K3.1-Pro","label": "Kimi K3.1 Pro"},{- "id": "moonshotai/Kimi-K3",- "label": "Kimi K3"+ "id": "deepseek-ai/DeepSeek-V4.1-Flash-1017",+ "label": "DeepSeek V4.1 Flash 1017"},{"id": "zai-org/GLM-5.3","label": "GLM 5.3"},- {- "id": "Qwen/Qwen3.8-2.4T-A95B",- "label": "Qwen 3.8 A95B"- },{"id": "zai-org/GLM-5.3-Flash","label": "GLM 5.3 Flash"@@ -294,26 +262,18 @@"id": "Sao10K/L3-8B-Lunaris-v1-Turbo","label": "Lunaris 8B"},- {- "id": "Gryphe/MythoMax-L2-13b",- "label": "MythoMax 13B"- },- {- "id": "NousResearch/Hermes-3-Llama-3.1-70B",- "label": "Hermes 3 70B"- },{"id": "Sao10K/L3.1-70B-Euryale-v2.2","label": "Euryale 70B"},- {- "id": "NousResearch/Hermes-3-Llama-3.1-405B",- "label": "Hermes 3 405B"- },{"id": "Qwen/Qwen3-Coder-480B-A35B-Instruct-Turbo","label": "Qwen3 Coder 480B"},+ {+ "id": "moonshotai/Kimi-K3",+ "label": "Kimi K3"+ },{"id": "deepseek-ai/DeepSeek-V3.1","label": "DeepSeek V3.1"@@ -322,10 +282,6 @@"id": "deepseek-ai/DeepSeek-V4-Flash-0731","label": "DeepSeek V4 Flash 0731"},- {- "id": "deepseek-ai/DeepSeek-R1-0528",- "label": "DeepSeek R1"- },{"id": "Qwen/Qwen3-32B","label": "Qwen3 32B"@@ -370,10 +326,6 @@"id": "meta-llama/Llama-3.3-70B-Instruct-Turbo","label": "Llama 3.3 70B Turbo"},- {- "id": "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",- "label": "Llama 4 Maverick"- },{"id": "meta-llama/Llama-4-Scout-17B-16E-Instruct","label": "Llama 4 Scout"@@ -386,14 +338,6 @@"id": "zai-org/GLM-4.7","label": "GLM 4.7"},- {- "id": "zai-org/GLM-5",- "label": "GLM 5"- },- {- "id": "zai-org/GLM-5.1",- "label": "GLM 5.1"- },{"id": "zai-org/GLM-5.2","label": "GLM 5.2"@@ -402,6 +346,10 @@"id": "nvidia/NVIDIA-Nemotron-3-Super-120B-A12B","label": "Nemotron 3 Super 120B"},+ {+ "id": "nvidia/NVIDIA-Nemotron-3.5-Super-VL",+ "label": "Nemotron 3.5 Super VL"+ },{"id": "openai/gpt-oss-20b","label": "gpt-oss 20B"@@ -410,18 +358,14 @@"id": "moonshotai/Kimi-K2.6","label": "Kimi K2.6"},- {- "id": "moonshotai/Kimi-K2.7-Code",- "label": "Kimi K2.7 Code"- },- {- "id": "MiniMaxAI/MiniMax-M2.7",- "label": "MiniMax M2.7"- },{"id": "MiniMaxAI/MiniMax-M3","label": "MiniMax M3"},+ {+ "id": "XiaomiMiMo/MiMo-V2.6-Pro",+ "label": "MiMo V2.6 Pro"+ },{"id": "mistralai/Mistral-Small-3.2-24B-Instruct-2506","label": "Mistral Small 3.2 24B"@@ -465,6 +409,14 @@{"id": "direct/abliterated-large-v2","label": "Abliterated Large V2"+ },+ {+ "id": "direct/abliterated-large-flash",+ "label": "Abliterated Large Flash"+ },+ {+ "id": "direct/deepseek-v4.1-flash",+ "label": "DeepSeek V4.1 Flash Uncensored"}],"create": [@@ -488,16 +440,6 @@"label": "Qwen Image","kind": "image"},- {- "id": "hidream",- "label": "HiDream",- "kind": "image"- },- {- "id": "hunyuan-image",- "label": "HunyuanImage 2.1",- "kind": "image"- },{"id": "z-image-turbo","label": "Z-Image Turbo (fast)",@@ -536,16 +478,6 @@"label": "LTX-2 (with audio)","kind": "video"},- {- "id": "hunyuan-video",- "label": "HunyuanVideo 1.5",- "kind": "video"- },- {- "id": "ltx-2.3",- "label": "LTX 2.3",- "kind": "video"- },{"id": "wan-2.2-spicy","label": "Wan 2.2 Uncensored",@@ -600,6 +532,12 @@"kind": "video","adult": true},+ {+ "id": "seedance-2.0-mini-spicy",+ "label": "Seedance 2.0 Mini Uncensored",+ "kind": "video",+ "adult": true+ },{"id": "vidu-q3-spicy","label": "Vidu Q3 Uncensored",@@ -855,6 +793,85 @@"label": "Wan 3.0 • Reference","kind": "video"},+ {+ "id": "flux-3-klein",+ "label": "FLUX 3 Klein",+ "kind": "image"+ },+ {+ "id": "flux-3-klein-base",+ "label": "FLUX 3 Klein Base",+ "kind": "image"+ },+ {+ "id": "krea-2-turbo",+ "label": "Krea 2 Turbo",+ "kind": "image",+ "adult": true+ },+ {+ "id": "moss-image",+ "label": "MOSS Image",+ "kind": "image",+ "adult": true+ },+ {+ "id": "wan-3.0-t2v",+ "label": "Wan 3.0",+ "kind": "video"+ },+ {+ "id": "wan-3.0-prime-t2v",+ "label": "Wan 3.0 Prime",+ "kind": "video"+ },+ {+ "id": "minimax-h3-singularity",+ "label": "MiniMax H3 Singularity Uncensored",+ "kind": "video",+ "adult": true+ },+ {+ "id": "minimax-h3-singularity-ref",+ "label": "MiniMax H3 Singularity Uncensored • Reference",+ "kind": "video",+ "adult": true+ },+ {+ "id": "gpt-image-2",+ "label": "GPT Image 2",+ "kind": "image"+ },+ {+ "id": "nano-banana-pro",+ "label": "Nano Banana Pro",+ "kind": "image"+ },+ {+ "id": "flux-2-max",+ "label": "FLUX.2 Max",+ "kind": "image"+ },+ {+ "id": "midjourney",+ "label": "Midjourney",+ "kind": "image"+ },+ {+ "id": "grok-imagine-quality",+ "label": "Grok Imagine Quality",+ "kind": "image"+ },+ {+ "id": "recraft-v4.1-pro",+ "label": "Recraft V4.1 Pro",+ "kind": "image"+ },+ {+ "id": "kling-image-o3",+ "label": "Kling Image O3",+ "kind": "image"+ },{"id": "minimax-h3-edit","label": "MiniMax H3 • Image Edit",@@ -874,6 +891,36 @@"id": "qwen-image-2.1-edit","label": "Qwen Image 2.1","kind": "edit"+ },+ {+ "id": "flux-3-klein-edit",+ "label": "FLUX 3 Klein",+ "kind": "edit"+ },+ {+ "id": "gpt-image-2-edit",+ "label": "GPT Image 2",+ "kind": "edit"+ },+ {+ "id": "nano-banana-pro-edit",+ "label": "Nano Banana Pro",+ "kind": "edit"+ },+ {+ "id": "flux-2-max-edit",+ "label": "FLUX.2 Max",+ "kind": "edit"+ },+ {+ "id": "grok-imagine-quality-edit",+ "label": "Grok Imagine Quality",+ "kind": "edit"+ },+ {+ "id": "kling-image-o3-edit",+ "label": "Kling Image O3",+ "kind": "edit"}]-}\ No newline at end of file+}diff --git a/src/lib/render/__tests__/web-catalog-source.test.ts b/src/lib/render/__tests__/web-catalog-source.test.tsindex e55cc292..54ad106c 100644--- a/src/lib/render/__tests__/web-catalog-source.test.ts+++ b/src/lib/render/__tests__/web-catalog-source.test.ts@@ -18,7 +18,8 @@import { describe, expect, it } from 'vitest'import { readFileSync } from 'node:fs'import { resolve } from 'node:path'-import { GENERATED_FILES, SOURCE_FILE, checkSnapshot, hashText } from '../../../../scripts/studio-snapshot.mjs'+import { GATE_SEED_FILE, GENERATED_FILES, SOURCE_FILE, checkSnapshot, gateSeedText, hashText } from '../../../../scripts/studio-snapshot.mjs'+import { isRetiredMediaModel } from '../retired-models'const DIR = 'src/lib/render'const read = (name: string) => readFileSync(resolve(DIR, name), 'utf8')@@ -27,6 +28,7 @@ interface Source {generator: stringweb: { ref: string | null; commit: string | null; committed: string | null; dirty: boolean }files: Record<string, string>+ gate?: { from: string; file: string; sha256: string }}const source = JSON.parse(read(SOURCE_FILE)) as Source@@ -54,3 +56,32 @@ describe('the catalogue copy is what the generator wrote', () => {expect(() => checkSnapshot(Object.fromEntries(GENERATED_FILES.map((name) => [name, read(name)])))).not.toThrow()})})++describe('the offline lists of the gate pop-up are what the generator wrote', () => {+ const seedText = readFileSync(resolve(GATE_SEED_FILE), 'utf8')+ const seed = JSON.parse(seedText) as Record<'chat' | 'code' | 'create', Array<{ id: string; label: string; kind?: string; adult?: true }>>++ it('come from the public catalogue and have the hash recorded for them', () => {+ expect(source.gate?.file).toBe(GATE_SEED_FILE)+ expect(source.gate?.from).toMatch(/^https:\/\/lu-labs\.ai\/api\/public\/cloud-catalog$/)+ expect(hashText(seedText), `${GATE_SEED_FILE} differs from what the generator wrote. Run scripts/studio-snapshot.mjs --gate live instead of editing it.`)+ .toBe(source.gate?.sha256)+ })++ it('name no model the cloud has retired', () => {+ expect(seed.create.filter((m) => isRetiredMediaModel(m.id)).map((m) => m.id)).toEqual([])+ })++ it('keep the app\'s own names and only what the app reads', () => {+ const out = gateSeedText({+ version: 1,+ categories: {+ chat: [{ id: 'a/b', label: 'Public name', native_label: 'App name', plans: ['hosted'] }],+ code: [],+ create: [{ id: 'flux-x', label: 'Flux X', kind: 'image', plans: ['hosted'], adult: true }],+ },+ })+ expect(JSON.parse(out)).toEqual({ chat: [{ id: 'a/b', label: 'App name' }], code: [], create: [{ id: 'flux-x', label: 'Flux X', kind: 'image', adult: true }] })+ expect(() => gateSeedText({ version: 2, categories: {} })).toThrow()+ })+})diff --git a/src/lib/render/web-catalog-source.json b/src/lib/render/web-catalog-source.jsonindex cbfaa26d..e3d7fc92 100644--- a/src/lib/render/web-catalog-source.json+++ b/src/lib/render/web-catalog-source.json@@ -14,5 +14,10 @@"video-durations.json": "131f8dcf8a075066a640175f536847e870b0b45d402d7884d60fc65c33cf1595","retired-models.ts": "fc9f494bcbfc640c555bd216819d0b00574a6e31aaa1d30f557f15a26f078de6","studio-roles.ts": "8610db1bbc6953d5d4c1ded2f1444ea0336542b3bf473c085d90918bd1fd15ed"+ },+ "gate": {+ "from": "https://lu-labs.ai/api/public/cloud-catalog",+ "file": "src/lib/cloud-gate-seed.json",+ "sha256": "3b1813a87ca3508d87e44ff2c1785bcd5bf84ef78feffc1a95715762f3ebe07d"}}