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: no import cycles (CI cycles step)
purple12bd33a0f82f
diff --git a/src/api/comfy-split.ts b/src/api/comfy-split.tsindex 4651abfe..07c99104 100644--- a/src/api/comfy-split.ts+++ b/src/api/comfy-split.ts@@ -44,7 +44,7 @@ export async function withComfySplit(workflow: ComfyApiGraph): Promise<ComfyApiG})return workflow}- const { getAllNodeInfo } = await import('./comfyui-nodes')+ const { getAllNodeInfo } = await import('./comfyui-node-info')const info = await getAllNodeInfo()const clip = SELECT_CLIP_DEVICE in infoconst vae = SELECT_VAE_DEVICE in infodiff --git a/src/api/comfyui-node-info.ts b/src/api/comfyui-node-info.tsnew file mode 100644index 00000000..bf35caa3--- /dev/null+++ b/src/api/comfyui-node-info.ts@@ -0,0 +1,63 @@+// The node catalogue of ComfyUI (/object_info), fetched once and cached.+// Split out of comfyui-nodes.ts (3.1.0) so comfy-split.ts can read it without+// the import cycle comfyui -> comfy-split -> comfyui-nodes -> comfyui.+// comfyui-nodes.ts re-exports getAllNodeInfo and the types.++import { comfyuiUrl, localFetch } from './backend'+import { log } from '../lib/logger'+import type { ComfyInputValue } from '../types/comfy-graph'++export interface NodeInputSpec {+ required: Record<string, ComfyInputValue>+ optional?: Record<string, ComfyInputValue>+}++export interface NodeMetadata {+ input: NodeInputSpec+ output: string[]+ output_tooltips?: string[]+ category?: string+ display_name?: string+ description?: string+}++// ─── Cache ───++let nodeInfoCache: Record<string, NodeMetadata> | null = null+let cacheTimestamp = 0+export const CACHE_TTL = 300_000 // 5 minutes++// ─── Fetch all node info (cached) ───++export async function getAllNodeInfo(forceRefresh = false): Promise<Record<string, NodeMetadata>> {+ if (!forceRefresh && nodeInfoCache && Date.now() - cacheTimestamp < CACHE_TTL) {+ return nodeInfoCache+ }++ // Bound this fetch. /object_info is the heaviest control-plane call (the full+ // node catalogue) and is the FIRST thing buildDynamicWorkflow hits. Without an+ // explicit cap it inherits the Rust proxy's 300 s default — and a single wedged+ // /object_info right after a ComfyUI (re)start froze the whole image-MCP VRAM+ // hand-off for minutes with the text model left unloaded (chat-agent hang,+ // 2026-06-03). 30 s is far beyond a healthy localhost response; on timeout we+ // throw a clean error so the hand-off's finally can free VRAM + reload the model.+ const res = await localFetch(comfyuiUrl('/object_info'), { timeoutMs: 30_000 })+ if (!res.ok) throw new Error(`Failed to fetch node info: ${res.status}`)+ const data = await res.json()++ nodeInfoCache = data+ cacheTimestamp = Date.now()+ log.info(`[comfyui-nodes] Loaded ${Object.keys(data).length} node types`)+ return data+}++/** Forgets the cached catalogue (comfyui-nodes' clearNodeCache). */+export function resetNodeInfo(): void {+ nodeInfoCache = null+ cacheTimestamp = 0+}++/** Whether the cached catalogue has this node; false before the first fetch. */+export function cachedNodeInfoHas(name: string): boolean {+ return nodeInfoCache ? name in nodeInfoCache : false+}diff --git a/src/api/comfyui-nodes.ts b/src/api/comfyui-nodes.tsindex 279b2496..354afc7d 100644--- a/src/api/comfyui-nodes.ts+++ b/src/api/comfyui-nodes.ts@@ -1,4 +1,3 @@-import { comfyuiUrl, localFetch } from './backend'import { log } from '../lib/logger'import { readComboOptions } from './comfyui-enum'// Audit W-T2: classifyModel/MODEL_TYPE_DEFAULTS kamen hier per `await import()`@@ -9,7 +8,10 @@ import { readComboOptions } from './comfyui-enum'// nicht, also ist ein ganz normaler statischer Import hier die ehrliche Form.import { classifyModel, MODEL_TYPE_DEFAULTS } from './comfyui'import type { ModelType } from './comfyui'-import type { ComfyInputValue } from '../types/comfy-graph'+// The /object_info cache lives in comfyui-node-info.ts (3.1.0), so comfy-split.ts+// can read it without the cycle comfyui -> comfy-split -> comfyui-nodes -> comfyui.+import { getAllNodeInfo, resetNodeInfo, cachedNodeInfoHas, CACHE_TTL, type NodeMetadata } from './comfyui-node-info'+export { getAllNodeInfo, type NodeInputSpec, type NodeMetadata } from './comfyui-node-info'// ─── Types ───@@ -22,19 +24,6 @@ import type { ComfyInputValue } from '../types/comfy-graph'* assume which — `readComboOptions` (comfyui-enum.ts) is the one reader that* knows all three shapes, and it takes `unknown` for exactly that reason.*/-export interface NodeInputSpec {- required: Record<string, ComfyInputValue>- optional?: Record<string, ComfyInputValue>-}--export interface NodeMetadata {- input: NodeInputSpec- output: string[]- output_tooltips?: string[]- category?: string- display_name?: string- description?: string-}export interface CategorizedNodes {loaders: string[]@@ -55,46 +44,16 @@ export interface AvailableModels {motionModels: string[]}-// ─── Cache ───--let nodeInfoCache: Record<string, NodeMetadata> | null = null-let cacheTimestamp = 0-const CACHE_TTL = 300_000 // 5 minutes--// ─── Fetch all node info (cached) ───--export async function getAllNodeInfo(forceRefresh = false): Promise<Record<string, NodeMetadata>> {- if (!forceRefresh && nodeInfoCache && Date.now() - cacheTimestamp < CACHE_TTL) {- return nodeInfoCache- }-- // Bound this fetch. /object_info is the heaviest control-plane call (the full- // node catalogue) and is the FIRST thing buildDynamicWorkflow hits. Without an- // explicit cap it inherits the Rust proxy's 300 s default — and a single wedged- // /object_info right after a ComfyUI (re)start froze the whole image-MCP VRAM- // hand-off for minutes with the text model left unloaded (chat-agent hang,- // 2026-06-03). 30 s is far beyond a healthy localhost response; on timeout we- // throw a clean error so the hand-off's finally can free VRAM + reload the model.- const res = await localFetch(comfyuiUrl('/object_info'), { timeoutMs: 30_000 })- if (!res.ok) throw new Error(`Failed to fetch node info: ${res.status}`)- const data = await res.json()-- nodeInfoCache = data- cacheTimestamp = Date.now()- log.info(`[comfyui-nodes] Loaded ${Object.keys(data).length} node types`)- return data-}export function clearNodeCache() {- nodeInfoCache = null- cacheTimestamp = 0+ resetNodeInfo()clearCapabilityCache()}// ─── Node existence check (from cache) ───export function hasNode(name: string): boolean {- return nodeInfoCache ? name in nodeInfoCache : false+ return cachedNodeInfoHas(name)}// ─── Categorize available nodes ───diff --git a/src/lib/__tests__/comfy-split.test.ts b/src/lib/__tests__/comfy-split.test.tsindex 4a83858c..773595ec 100644--- a/src/lib/__tests__/comfy-split.test.ts+++ b/src/lib/__tests__/comfy-split.test.ts@@ -20,8 +20,8 @@ import { join } from 'node:path'import type { ComfyApiGraph } from '../../types/comfy-graph'import type { ComfyNodeDefs } from '../../api/comfy-ui-format'-vi.mock('../../api/comfyui-nodes', async (importOriginal) => {- const actual = await importOriginal<typeof import('../../api/comfyui-nodes')>()+vi.mock('../../api/comfyui-node-info', async (importOriginal) => {+ const actual = await importOriginal<typeof import('../../api/comfyui-node-info')>()return { ...actual, getAllNodeInfo: vi.fn() }})vi.mock('../../api/backend', async (importOriginal) => {@@ -30,7 +30,7 @@ vi.mock('../../api/backend', async (importOriginal) => {})const { splitAcrossCards, comfySeesSplit, SELECT_CLIP_DEVICE, SELECT_VAE_DEVICE } = await import('../comfy-split')-const { getAllNodeInfo } = await import('../../api/comfyui-nodes')+const { getAllNodeInfo } = await import('../../api/comfyui-node-info')const { localFetch } = await import('../../api/backend')const { useSettingsStore } = await import('../../stores/settingsStore')const { withComfySplit } = await import('../../api/comfy-split')diff --git a/src/lib/create/character-hub.ts b/src/lib/create/character-hub.tsindex 34509db0..4f97118e 100644--- a/src/lib/create/character-hub.ts+++ b/src/lib/create/character-hub.ts@@ -12,7 +12,7 @@import type { CloudLora } from '../../api/cloud/loras'import type { CharacterRef } from '../character-ref'-import type { CreateIntent } from '../../stores/createStore'+import type { CreateIntent } from './create-intent'import {characterGenerationModels, cloudModelById, lengthPrice, loraGenModels,} from '../../stores/cloudCatalogStore'diff --git a/src/lib/create/create-intent.ts b/src/lib/create/create-intent.tsnew file mode 100644index 00000000..6f3caed6--- /dev/null+++ b/src/lib/create/create-intent.ts@@ -0,0 +1,18 @@+// The flat creation intents of the Create page. Split out of+// stores/createStore.ts (3.1.0) so character-hub.ts can use the type without+// an import cycle; createStore.ts re-exports both names.++/** 2.5.8 specialized Create categories (2026-07-17):+ * Character-Studio (LoRA training + generation), talking character (lipsync),+ * music, video extend and motion control. Like `utilityOp`, an escape hatch+ * over the image/video mode axis: when set it wins the intent derivation. */+export type CloudOp = 'character' | 'lipsync' | 'music' | 'extend' | 'motion' | '3d' | 'swap_character'++/**+ * The redesigned Create page's flat creation intents, derived over+ * mode / image sub-mode / video sub-mode / removebg. The `mode` + sub-mode+ * enums stay the load-bearing state; `intent` is a derived view over them.+ */+export type CreateIntent =+ | 'image' | 'edit' | 'removebg' | 'video' | 'animate' | 'upscale' | 'eraser'+ | CloudOpdiff --git a/src/lib/create/face-detect.ts b/src/lib/create/face-detect.tsindex 7a4b3f29..c5be3104 100644--- a/src/lib/create/face-detect.ts+++ b/src/lib/create/face-detect.ts@@ -10,7 +10,7 @@// Diese Datei wird nur ueber import() aus head-crop.ts geladen, also erst,// wenn der Bildschritt des Swaps Fotos hochlaedt.-import type { CropBox, FaceBox } from './head-crop'+import type { CropBox, FaceBox } from './head-crop-boxes'/** Wo die Dateien liegen (public/face/). */export const FACE_ASSET_BASE = '/face'diff --git a/src/lib/create/head-crop-boxes.ts b/src/lib/create/head-crop-boxes.tsnew file mode 100644index 00000000..49ebf7cc--- /dev/null+++ b/src/lib/create/head-crop-boxes.ts@@ -0,0 +1,8 @@+// Die zwei Rechtecke des Kopf-Zuschnitts, ohne Abhaengigkeiten, damit+// head-crop.ts und face-detect.ts sie beide nutzen koennen.++/** Ein gefundenes Gesicht in Pixeln des Fotos. */+export interface FaceBox { x: number; y: number; width: number; height: number; score: number }++/** Der Ausschnitt, ganzzahlig, in Pixeln des Fotos. */+export interface CropBox { x: number; y: number; width: number; height: number }diff --git a/src/lib/create/head-crop.ts b/src/lib/create/head-crop.tsindex 6a1b18af..7332a2b3 100644--- a/src/lib/create/head-crop.ts+++ b/src/lib/create/head-crop.ts@@ -13,11 +13,11 @@// Hier steht die Geometrie als reine Funktion und der Ablauf mit// austauschbaren Helfern, damit beides ohne Browser pruefbar ist.-/** Ein gefundenes Gesicht in Pixeln des Fotos. */-export interface FaceBox { x: number; y: number; width: number; height: number; score: number }+// FaceBox und CropBox stehen in head-crop-boxes.ts (3.1.0), damit face-detect.ts+// sie ohne Importkreis nutzen kann; hier unter demselben Namen weitergereicht.+import type { FaceBox, CropBox } from './head-crop-boxes'+export type { FaceBox, CropBox } from './head-crop-boxes'-/** Der Ausschnitt, ganzzahlig, in Pixeln des Fotos. */-export interface CropBox { x: number; y: number; width: number; height: number }export const HEAD_CROP = {/** Breite des Ausschnitts als Vielfaches der Gesichtsbreite. */diff --git a/src/stores/createStore.ts b/src/stores/createStore.tsindex 736cde6e..32484fda 100644--- a/src/stores/createStore.ts+++ b/src/stores/createStore.ts@@ -87,14 +87,6 @@ export type ProgressPhase = 'idle' | 'queued' | 'loading-model' | 'loading-clip'*/export type CreateBackend = 'local' | 'cloud'-/**- * The redesigned Create page's flat creation intents, derived over- * mode / image sub-mode / video sub-mode / removebg. The `mode` + sub-mode- * enums stay the load-bearing state; `intent` is a derived view over them.- */-export type CreateIntent =- | 'image' | 'edit' | 'removebg' | 'video' | 'animate' | 'upscale' | 'eraser'- | CloudOp/** Single-purpose tools (2.5.7): super-resolution and masked object removal.* Eraser is hosted only. Upscale also runs on the local ComfyUI backend@@ -106,11 +98,6 @@ export type UtilityOp = 'upscale' | 'eraser'* Windows and Linux, the way LOCAL_LANE_OPS keeps the specialized lanes. */export const LOCAL_UTILITY_OPS: ReadonlySet<UtilityOp> = new Set(['upscale'])-/** 2.5.8 specialized Create categories (2026-07-17):- * Character-Studio (LoRA training + generation), talking character (lipsync),- * music, video extend and motion control. Like `utilityOp`, an escape hatch- * over the image/video mode axis: when set it wins the intent derivation. */-export type CloudOp = 'character' | 'lipsync' | 'music' | 'extend' | 'motion' | '3d' | 'swap_character'// The three ways and the Detail step of the 3D tab (3.1.0) live in// lib/three/three-d-types.ts, so the 3D texts need not import the store.@@ -171,6 +158,10 @@ export type { CharacterRef }*/import type { ImageRef } from '../lib/image-ref'import { isHubIntent, type HubCharacter, type HubStep } from '../lib/create/character-hub'+// CreateIntent and CloudOp live in lib/create/create-intent.ts (3.1.0), so+// character-hub.ts can name them without an import cycle with this store.+import type { CreateIntent, CloudOp } from '../lib/create/create-intent'+export type { CreateIntent, CloudOp } from '../lib/create/create-intent'export type { ImageRef }/** Flatten mode / sub-mode / removebg / utilityOp / cloudOp into the single