The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Docs: workers and Fuobe Connect, share your GPUs with other machines
Adarshbcac4b52ac9e
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 0e266c13..1094eb37 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -349,6 +349,16 @@ Round 4 part 4. A share link is an unguessable token that opens one public, readChecked: unit tests (token storage and lookup, scopes, share-scoped files, the proxy's paths, `ShareGuard`, views, the cleaner over synthetic media) and a scripted live check against a dev server in demo mode with a password set and the visitor signed out, with real ComfyUI PNG and MP4 outputs in the data folder. Not checked: real fal or Replicate files through the cleaner. An MP4 track's handler name isn't blanked, and Canvas boards can't be shared.+## Workers and Fuobe Connect (`src/server/computer/`, `bin/lib/worker/`, `integrations/fuobe-connect/`)++The "computer" routes (`/api/gpu/computer/*`) take a person's browser tab or a worker token (`fuobe_wkr_…`,+`relay_workers`, only its SHA-256 kept). A personal worker (paired with Fuobe Connect, `relay_pairings`) acts as its+person's own computer and gets only that person's tasks. A pool worker takes the owner's tasks for its pool: a task+for workers keeps its principal and names `pools`, `lane`, `needs_json`, `rank_at` and `not_after`, and `pool.ts`+claims in one transaction (pause, hours, lanes and delays, files and VRAM, the retry rule, sticky lanes), puts a silent+worker's task back in line after 2 minutes, and fails it after 3 lost attempts. The proxy lets a worker token through+only on those routes; `validToken()` never takes one. See [gpu-workers.md](gpu-workers.md).+## Security (`src/proxy.ts`, `src/server/auth.ts`, `src/server/remote-fetch.ts`)- **Sign-in** is off until a password is set in Settings → Security or `FUOBE_PASSWORD`. State lives in `data/auth.json` (not SQLite) so the proxy can check requests with `fs` and `crypto` alone: a scrypt password hash, an HMAC secret for 30-day session cookies (replaced when the password changes), and API tokens stored as SHA-256 hashes (with public sign-up, below, the accounts too). The proxy lets `/login` and `/api/auth/login` through (and, since round 4 part 4, GET and HEAD on a share link's page and files, checked by `openShare`: see Share links), answers other API calls with 401 and redirects pages to `/login?next=…` (`safeNext()` in `src/lib/safe-redirect.ts` keeps it on the same origin). Its matcher leaves out only build assets, `samples/`, `previews/`, `vendor/`, root SVGs and `/api/uploads` (which makes the proxy's checks itself: `src/server/direct-gate.ts`).diff --git a/docs/SELF-HOSTING.md b/docs/SELF-HOSTING.mdindex 911271cd..f32d9526 100644--- a/docs/SELF-HOSTING.md+++ b/docs/SELF-HOSTING.md@@ -106,6 +106,14 @@ LatentSync 1.6 and ThinkSound are optional and run on a separate, isolated Comfy**Split soundtrack** runs only on your ComfyUI (nobody hosts DBS). On Windows or ComfyUI Desktop, where the install script doesn't run, clone `hiroki-abe-58/ComfyUI-DBS` into `custom_nodes` and check out `f656e53`, then put `config.json` and `model.safetensors` from `JusperLee/DBS-BSRNN-DnR` and `JusperLee/DBS-TIGER-DnR` into `models/dbs/<that name>/` (the Workflows page's "Split a soundtrack" card lists them). DBS runs on a CPU too: Best is preselected on a CUDA GPU (NVIDIA, or AMD with ROCm), Fast anywhere else. The Comfy Registry flags the pack's only version without giving a reason; its code was read at the pinned commit. **MOSS-Image** and the **fly path** use only nodes built into the ComfyUI version Fuobe pins (0.41.0), so an older ComfyUI may not run them. MOSS-Image's int8 files run on kernels that need a PyTorch built for CUDA 13 (cu130); without it ComfyUI logs a warning and probably runs slower (untested). The turnaround video needs no new files: it uses Frames mode's Wan 2.2 14B graphs and the Angles app's Qwen-Image-Edit 2511 with the Multiple-Angles LoRA. **Connect your GPU** (`/connect`) shows what each of them still needs on your ComfyUI.+### Workers and Fuobe Connect++To share your GPUs with your team or your other machines, add **workers** in **Settings → Workers**. Each GPU's PC runs+`fuobe worker`, which takes the studio's ComfyUI jobs over HTTPS and runs them on its own ComfyUI. The PC opens no+port. A person who connects their own ComfyUI from the browser needs only **Fuobe Connect**, a ComfyUI custom node+pack in `integrations/fuobe-connect`. They do not need a start flag. See [gpu-workers.md](gpu-workers.md). With no+worker added, nothing changes.+To check a ComfyUI connection end to end without downloading any models:```bashdiff --git a/docs/cli.md b/docs/cli.mdindex 123068b0..af8ae0b7 100644--- a/docs/cli.md+++ b/docs/cli.md@@ -245,6 +245,21 @@ fuobe eval trash latest # the run's generations toSee [`scripts/eval/README.md`](../scripts/eval/README.md) for the suites, metrics, blind review andthe promote rule.+### `fuobe worker`++Runs this PC's GPU as a worker for a studio: it takes the studio's ComfyUI jobs over HTTPS and runs them on its own+ComfyUI, and it opens no port. See [gpu-workers.md](gpu-workers.md).++```bash+node scripts/build-worker.mjs # once, in the checkout: the worker's shared parts+fuobe worker setup # the studio's address, the token from Settings → Workers, ComfyUI's folder, a port+fuobe worker run # until Ctrl+C+fuobe worker pause # finish the job, then stop its ComfyUI; --now: stop now; --for 2h: back by itself+fuobe worker resume+fuobe worker status+fuobe worker install # Windows: shows a sign-in task and pause/resume shortcuts; --yes adds them+```+## Skills for other agentsFuobe's skills are [Agent Skills](https://agentskills.io/specification), so the open `skills` CLIdiff --git a/docs/gpu-workers.md b/docs/gpu-workers.mdnew file mode 100644index 00000000..ea8802ef--- /dev/null+++ b/docs/gpu-workers.md@@ -0,0 +1,191 @@+# Workers: share your GPUs with other machines++A Fuobe studio can run its ComfyUI jobs on GPUs in other places:++- **Fuobe Connect** connects a person's own ComfyUI to their account. Each person installs it once in ComfyUI. Their+ runs then go to their own GPU.+- **Workers** are the owner's GPUs on other PCs, for example a team's machines or a spare PC. Each PC runs+ `fuobe worker`. The worker takes the studio's ComfyUI jobs and runs them on its own ComfyUI.++Both use the same job routes as the browser's "Use the ComfyUI on this computer" (`/api/gpu/computer/*`). Both call+the studio over HTTPS, and neither opens a port. With no worker added and nothing paired, the studio works as before.++## Fuobe Connect (a person's own ComfyUI)++Fuobe Connect is a ComfyUI custom node pack. Its code is in `integrations/fuobe-connect`, and its own README tells you+how to install it. It adds no nodes.++**Direct mode.** ComfyUI turns away every other website. Fuobe Connect lets in only the studios that you trust. Each+studio is an exact origin, and the default is `https://fuobe.com`. You can add your own studio in ComfyUI's settings,+or with `FUOBE_CONNECT_ORIGINS`. A trusted studio can use only what a run needs: ComfyUI's facts, model lists, queue+and history, the run's results, uploads of its inputs, and its prompt. It cannot reach the Manager's install calls,+your user files or your settings. Fuobe Connect answers the CORS and Private Network Access preflights for the trusted+origins only. Every other website still meets ComfyUI's own check.++You do not need a start flag or a guard file. In the studio, **Connect your GPU** finds ComfyUI after one browser+"Allow" prompt, and then connects.++**Pairing mode.** Use pairing with Safari, phones, a blocked browser or a PC with no screen:++1. In ComfyUI, open **Extensions → Connect to Fuobe**. On a PC with no screen, start ComfyUI with+ `FUOBE_CONNECT_PAIR=1`. Fuobe Connect asks the studio for a short code: `POST /api/gpu/pair/start`.+2. The person opens `/connect?code=…`, signs in, checks the computer's name and GPU, and approves the code:+ `POST /api/gpu/pair`. A code is valid for 10 minutes and works only once.+3. Fuobe Connect polls with a secret that only it knows: `POST /api/gpu/pair/poll`. After the approval, its next poll+ gets a worker token (`fuobe_wkr_…`). The studio makes the token at that moment and keeps only its SHA-256 hash.++The token acts only as that person's own computer. The ComfyUI gets that person's jobs, and nobody else's. The jobs+run with no Fuobe tab open. The person can disconnect the ComfyUI in Settings → Your GPU (`DELETE /api/gpu/paired/<id>`)+or press Disconnect in ComfyUI (`POST /api/gpu/computer/unpair`). A disconnected token gets 401 at its next call.++## Workers (the owner's shared GPUs)++### Add a worker++1. In **Settings → Workers**, press **Add a worker** and give it a name. The page shows the worker's token only once.+ The worker starts paused, with no hours and no lanes.+2. On the GPU's PC, you need Node 22 or later and a Fuobe checkout (or a copy of `bin/`, `package.json` and+ `workflows/comfyui/requirements.json`). Run `node scripts/build-worker.mjs`, then run `node bin/fuobe.mjs worker setup`.+ Setup asks for the studio's address, the token (as hidden input), ComfyUI's folder, the model folders, a worker+ folder and a port for the worker's own ComfyUI (default 8190). It refuses these:+ - a folder that a cloud drive syncs;+ - a port that another program is using;+ - port 8188.++ On Windows it marks the worker folder as "not content indexed". The settings go to `worker.json`, and only you can+ read that file. Setup also pauses the worker on the PC.+3. In Settings → Workers, set the worker's hours and the lanes it may run (with a delay for each lane), then press+ **Resume**. On the PC, run `fuobe worker resume`, then `fuobe worker run`. On Windows, `fuobe worker install` shows a+ sign-in task and pause and resume shortcuts (Ctrl+Alt+P). It adds them only when you run it again with `--yes`.+4. To send the studio's own ComfyUI jobs to the workers, select **Run this studio's ComfyUI jobs on the workers** in+ Settings → Workers (the setting is `comfyWhere=workers`).++On a machine with no keyboard, set `FUOBE_WORKER_TOKEN` and `FUOBE_WORKER_SITE` so that the token stays out of files.++### The worker's own ComfyUI++The worker always starts and stops its own ComfyUI process. It never uses a ComfyUI that it did not start. Its ComfyUI:++- listens on `127.0.0.1` only, on the worker's own port;+- uses its own `user`, `input`, `output` and `temp` folders in the worker folder;+- gets the model folders through `extra_model_paths.yaml`;+- starts with `--disable-metadata` and `--disable-auto-launch`;+- loads only the custom node packs that the worker found (`--disable-all-custom-nodes --whitelist-custom-nodes …`).++**The port guard.** Before each start, the worker binds the port itself and releases it at once. If the bind fails,+another program is using the port. The worker then does not start ComfyUI, pauses itself (its state says "port-busy")+and never connects to that port. The worker also talks to its ComfyUI only while the process that it started is+running.++If its ComfyUI stops by itself, the worker starts it again, at most 3 times in one hour. After that, it pauses itself+("ComfyUI keeps stopping").++### Pauses++The worker obeys any one of these pauses. One pause never ends another pause.++- **On the PC:** `fuobe worker pause` lets the current job finish. `--now` sends the job back to the queue at no cost.+ `--for 2h` resumes the worker by itself after 2 hours. The worker then stops its ComfyUI, so the VRAM and the RAM go+ back to you.+- **On the website:** Settings → Workers has **Pause**, **Pause now** and **Finish, then pause**. Each one reaches the+ worker within one beat.+- **The GPU is busy.** Every 5 seconds, the worker reads `nvidia-smi`. It reads nothing else and contacts no other+ port. Other programs' VRAM is the GPU's used memory minus what the worker's own ComfyUI holds. If that is above+ 1,024 MB (`busyVramMb`), or if another process shows more than that of its own, the worker pauses at once. Its job+ goes back to the queue and its ComfyUI stops. This works also when the per-process memory reads `[N/A]`, as it often+ does on Windows. The state says "Your GPU is busy (blender.exe)".+- **Automatic resume** (off by default): after a busy pause, the worker resumes only after the GPU stayed free for+ `resumeAfterMin` minutes in a row (10) and is cooler than `resumeBelowC` (75 °C). Any busy reading restarts the+ cool-down. A pause by hand is never ended by the automatic resume. Turn it on with `autoResume` in `worker.json`, or+ with **Resume by itself after another program used the GPU** in Settings → Workers. The website's switch wins over+ `worker.json`. With it on, a PC can serve whenever its owner isn't using the GPU.+- **Hours:** outside its hours, the worker takes nothing new. Near the end of a window, it takes only a job that its+ estimate says will finish in time.++### The queue++A job for the workers belongs to the owner. It names the pools that may take it (`pool` by default). It also keeps:++- its lane: the first 12 hex digits of the SHA-256 of the sorted names of the workflow's files over 2 GB. A workflow+ with no big file is in the lane `small`.+- what it needs: the workflow, its files (folder, name, exact size, and SHA-256 where it is pinned), its node packs+ and its VRAM;+- `rank_at`: `created_at` minus a boost. The owner's jobs get a one-day boost.+- a wait limit (`FUOBE_POOL_WAIT_MIN`, 30 minutes). Past it, the job fails with "The GPUs were busy".++A worker gets a job only when all of these are true, all in one SQLite transaction:++- it is paused in neither place, it is not draining, it is inside its hours, and the studio heard from it in the last+ 30 seconds;+- the job is in its pool, in a lane that the owner allows for it, after the lane's delay and `claim_after_ms`;+- it has the workflow's files and packs (from its inventory) and enough VRAM;+- the retry rule allows it: a worker that lost or failed the job gets it again only when no other worker that can run+ the job was heard from in the last 10 minutes;+- near the end of its hours, the job's estimate fits before the window closes.++The lowest `rank_at` goes first. A worker keeps to its warm lane (the models that it has loaded) until another lane's+best job has waited longer than `switch_after_ms` (30 minutes) and is older.++If a worker stops answering for 2 minutes, or its ComfyUI is down for 2 minutes, its job goes back to the queue. The+worker is added to the job's `tried_json` list, and the input reads start again. The old worker's late calls get 409,+and it deletes that prompt. After the third lost attempt, the job fails. A job that is put back because of a pause+does not count as an attempt.++### What the worker checks itself++Before its ComfyUI gets a graph, the worker checks all of these. The studio cannot change these checks:++1. Every node type is on the allowlist that is built into the worker (`bin/lib/worker/dist/allowed-nodes.json`, made+ by `scripts/build-worker.mjs` from the catalog's workflows and the graph builders). For your own workflows, pass+ a file with `allowNodesFile` in `worker.json`. The studio can never send a file like that.+2. Every file that the graph reads was sent with the job.+3. No string input names a path (an absolute path, a drive letter, a network share or a `..` step).+4. Every model file that the graph names is one that the worker verified.++After each job, the worker deletes the job's inputs and results from its folders and deletes the prompt from its+ComfyUI's history. At start, it empties its folders.++Pictures for workers are made again from their pixels on the studio (no EXIF, no GPS). Clips and sound go to workers+only when `FUOBE_POOL_MEDIA_INPUTS` allows them (`image` by default; `image,video,audio` for all).++### The protocol++Every worker call carries `Authorization: Bearer fuobe_wkr_…`. A worker token works only on `/api/gpu/computer/*` and+gets 403 everywhere else. It is never the owner, and an owner API token can never act as a worker. The studio reads the+token on every call, so a revoked token stops at once.++- `POST /api/gpu/computer/beat`: the browser's beat plus `{ protocol, version, local: { paused, why, until }, gpu: {+ otherApps, tempC }, inventoryHash, warmLane }`. The answer adds `worker: { paused, pauseNow, drain, autoResume,+ insideHours, nextChangeAt, lanes, minProtocol, sendInventory }`.+- `PUT /api/gpu/computer/inventory`: `{ files: [{ folder, name, size, sha256 }], nodePacks: [{ name, commit }] }` →+ `{ lanes, workflows, missing }`.+- `POST /api/gpu/computer/claim`: the browser's claimed task plus `{ lane, estMs, runLimitMs, notAfter, attempt,+ models }`.+- `POST /api/gpu/computer/bench`: bench jobs for this worker only (none are defined yet). The times of every finished+ job also count: the last 20 jobs in each lane give the median and the 90th percentile.+- Reports, inputs and results work as they do for the browser. `failed` can also give `unknown-node`, `unsafe-path`+ or `model-unverified` as the reason.++Each worker counts against its own rate limits, so three workers that beat every 5 seconds never hold each other up.++### For the owner++- `GET /api/admin/workers` and `POST /api/admin/workers` (`{ name, pool? }`; the answer shows the token once).+- `PATCH /api/admin/workers/<id>`: `{ paused, pauseNow, drain, autoResume, hours, allow, claimAfterMs, switchAfterMs,+ rotate, revoke }`. Hours are `{ "always": true }` or `{ "tz": "Asia/Kolkata", "days": { "mon": [["01:00", "09:00"]] } }`.+ A window can go past midnight.+- `GET /api/admin/queue`: the jobs that wait in each lane, the oldest job, the estimate, and which workers have the+ lane warm.++### Behind Cloudflare++Worker calls come from programs, not browsers. If a bot check or a challenge is in front of your studio, add a rule+that skips it for requests to `/api/gpu/computer/*` and `/api/gpu/pair/*`. The worker tokens still protect these+routes.++## Tests++- `pnpm test` (`tests/workers-pool.test.ts`, `tests/workers-pairing.test.ts`, `tests/worker-program.test.ts`)+- `node tests/e2e/worker.mjs` and `node tests/e2e/fuobe-connect.mjs` (after `pnpm build`, or with `E2E_DEV=1`). These+ use a stand-in ComfyUI and a stand-in `nvidia-smi` on ports 3361 and 3362. They never touch a real GPU or ComfyUI.+- `python -m unittest discover -s tests` in `integrations/fuobe-connect`diff --git a/docs/public-signup.md b/docs/public-signup.mdindex 72f0cc1b..75914a76 100644--- a/docs/public-signup.md+++ b/docs/public-signup.md@@ -144,7 +144,16 @@ its own results, once. The server never calls the person's computer. Runs wait wand 7821, or one the person types. While the browser would still ask to let the site reach appson this device, it looks only after a click, and explains that question first. A tab neverreaches the computer's apps by itself before that.-- **Fuobe's setting.** A page can read a ComfyUI on the computer only when ComfyUI runs with+- **Fuobe Connect (the one step).** A page can read a ComfyUI on the computer only when ComfyUI lets+ that site in. Fuobe Connect (`integrations/fuobe-connect`, from ComfyUI-Manager or a git clone)+ lets in only the studios that the person trusts (`https://fuobe.com` unless they name others), and+ only for what a run needs. Every other website still meets ComfyUI's own check. The card asks for+ this one install and connects by itself when ComfyUI is back with it. The setting and the guard+ below are under "Advanced". See [gpu-workers.md](gpu-workers.md).+- **Pairing** (Safari, phones, a blocked browser, a PC with no screen): Fuobe Connect shows a code,+ and the person approves it while signed in (`/connect?code=…`). That ComfyUI then runs this+ person's jobs, and only theirs, with no tab open. Settings → Your GPU lists it, with Disconnect.+- **Fuobe's setting (Advanced).** Without Fuobe Connect, ComfyUI must run with`--enable-cors-header <the site's address>`. The card gives the fix for the install it finds: astart file for Windows portable or Easy-Install (it restarts ComfyUI with the setting and leaves astart file with it for next time; it never changes the person's own start files), the place in@@ -155,7 +164,7 @@ its own results, once. The server never calls the person's computer. Runs wait w`custom_nodes` and that the other installs download from the card, puts the check back: a requestfrom a web page gets in only from ComfyUI's own page or the site the setting names, the livesocket included. It answers `GET /fuobe/guard`, and the card warns while it's missing.-- **Phones and Safari** can't reach a ComfyUI on the device: they get the link instead, with why.+- **Phones and Safari** can't reach a ComfyUI on the device: they get pairing and the link instead, with why.The owner can do the same on a deployed studio: **Settings → Where ComfyUI runs → On the computeryou're using**. A studio with ComfyUI on its own machine keeps calling it from the server.