Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Merge main's newer work (Fuobe Connect checks every request, Restore & colourise on a visitor's own GPU, connect steps, covers)

Adarsh1437a5dd3e48
diff --cc docs/gpu-workers.md
index 035ba5ac,f409580f..aae88786
--- a/docs/gpu-workers.md
+++ b/docs/gpu-workers.md
@@@ -35,10 -50,9 +50,13 @@@ Connect get a refusal that asks them t
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. When the owner pairs a ComfyUI, the studio's ComfyUI jobs move to the owner's computer, as
- before, unless they run on workers or hosted runs are on (`FUOBE_HOSTED_RUNS=1`). Then the pairing changes nothing of
- where they run: the paired ComfyUI takes the owner's jobs once the owner chooses the computer in Settings → ComfyUI.
- Every change of that setting is in the admin log (`settings.comfy_where`, with the value before and after). The person can disconnect the ComfyUI in Settings → Your GPU (`DELETE /api/gpu/paired/<id>`)
+ run with no Fuobe tab open. Fuobe Connect pairs only with a studio the person trusts (or `https://fuobe.com`), and
+ checks every job as in direct mode before ComfyUI sees it. If the poll answer names the approving account, ComfyUI
-shows it. The person can pause jobs in ComfyUI. The person can disconnect the ComfyUI in Settings → Your GPU (`DELETE /api/gpu/paired/<id>`)
++shows it. The person can pause jobs in ComfyUI. When the owner pairs a ComfyUI, the studio's ComfyUI jobs move to the
++owner's computer, as before, unless they run on workers or hosted runs are on (`FUOBE_HOSTED_RUNS=1`). Then the pairing
++changes nothing of where they run: the paired ComfyUI takes the owner's jobs once the owner chooses the computer in
++Settings → ComfyUI. Every change of that setting is in the admin log (`settings.comfy_where`, with the value before and
++after). 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)
@@@ -785,23 -203,7 +803,23 @@@ routes
## Tests
- `pnpm test` (`tests/workers-pool.test.ts`, `tests/workers-pairing.test.ts`, `tests/worker-program.test.ts`,
- `tests/fuobe-connect-nodes.test.ts`)
+ `tests/worker-queue.test.ts`, `tests/worker-tokens.test.ts`, `tests/pool-account-runs.test.ts`,
+ `tests/pool-line-order.test.ts`, `tests/pool-limits.test.ts`,
+ `tests/worker-input-rules.test.ts`, `tests/worker-environment.test.ts`, `tests/worker-guard.test.ts`,
+ `tests/worker-runner.test.ts`, `tests/worker-recovery.test.ts`, `tests/worker-parts.test.ts`,
+ `tests/worker-turns.test.ts`, `tests/worker-turns-run.test.ts`, `tests/cpu-slot.test.ts`,
- `tests/worker-cpu-slot.test.ts`). The CPU slot tests run a CPU task while a GPU job runs, refuse a GLB that names
++ `tests/worker-cpu-slot.test.ts`, `tests/fuobe-connect-nodes.test.ts`). The CPU slot tests run a CPU task while a GPU job runs, refuse a GLB that names
+ an outside file on the worker, bring a turntable back with its GLB, check that an account's picture reaches its
+ ComfyUI with no EXIF, and drop a preview over 64 KB. The turn tests use a fake port table, fake GPU
+ counters and a fake lock file. With only local ComfyUI work on the GPU, the worker writes `siteWaiting` and claims
+ within 5 seconds of the answer; with a game, it pauses and asks for no turn. The input-rule tests
+ send graphs that try to write or read files outside the worker's folders, and check that the worker refuses them.
+ They also prepare every catalog workflow the way the studio does, and check that the worker accepts each one. The
+ recovery tests run the worker against the studio's routes and a stand-in ComfyUI that the worker starts: they kill
+ its ComfyUI halfway, stop the worker before an upload, make its ComfyUI hang, and check that the output arrives
+ each time, once. The guard tests run the real guard in front of a stand-in ComfyUI when a Python with aiohttp is
+ there (`FUOBE_TEST_PYTHON`, else `python3` or `python`), also through a venv's Python (that Python itself when it is
+ a venv's, else a venv made from it); the clip tests need `ffmpeg` on the `PATH`.
- `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 --cc docs/public-signup.md
index 5712c5b4,0df28b6b..ea2709ac
--- a/docs/public-signup.md
+++ b/docs/public-signup.md
@@@ -402,15 -402,10 +404,18 @@@ cloudflared tunnel --url http://localho
AI helper. Turnaround and Fly around never use the studio's WorldCast worker for an account; a character from the
owner's library answers 404. Katana's runs are its own projects (`GET /api/katana`, `GET`/`DELETE
/api/katana/<id>`): up to 50, another account's or the owner's read as 404, deleted with the account. A guest gets
- the sign-up card.
- - **Restore & colourise.** An account runs it (`POST /api/restore`) on its own GPU or its own fal.ai key, the same way
- as the Video tools: every window, join and the sound put back on its own setup, with only its own clip and reference
- picture, after the same checks. The prompt is the account's own words, or Fuobe's offline template filled with its
- few words. The prompt writer (`POST /api/restore/prompt`) stays the owner's, because it uses the studio's AI helper.
- A cloud run that has no copy of the gated Restore IC-LoRA to send is refused with one sentence that says to switch to
- the open engine. Its price check (`POST /api/restore/estimate`) is priced as the account's run would go: on its own
- GPU, or on its own key for the cloud engine. With hosted runs on, an account with neither gets the "own setup" label
- (`video-tools:restore`) in the price check, and Run opens that setup. A guest gets the sign-up card.
+ the sign-up card. Removing a person with MiniMax H3 and VOID's removal on the open engine keep their "own setup"
+ entries (`video-tools:remove-person`, `video-tools:remove-object-void` in `src/lib/own-setup.ts`) until a real render
+ passes on this studio's GPU and is recorded in `workflows/comfyui/gpu-tested.json` (`remove-person`,
+ `remove-object-void`): their graphs' `validated` in the manifest says only that ComfyUI accepted the graph.
++- **Restore & colourise.** An account runs it (`POST /api/restore`) on its own GPU, the same way as the Video tools:
++ every window, join and the sound put back on its own setup, with only its own clip and reference picture, after the
++ same checks. The prompt is the account's own words, or Fuobe's offline template filled with its few words. The prompt
++ writer (`POST /api/restore/prompt`) stays the owner's, because it uses the studio's AI helper. A cloud run is refused
++ before anything starts, with one sentence that says to switch to the open engine: the gated Restore IC-LoRA never goes
++ with an account's own key. Its price check (`POST /api/restore/estimate`) is priced as the account's run would go, on
++ its own GPU. With hosted runs on, an account without a GPU gets the "own setup" label (`video-tools:restore`) in the
++ price check, and Run opens that setup. A guest gets the sign-up card.
- **Audio tools.** An account runs Split soundtrack and Clean up dialogue, Video tools → Remove dialogue, Edit speech,
Loop / extend, Join and Clean up voice (`POST /api/audio-tools`) the same way as Genjutsu's: every step on its own
ComfyUI, or on its own fal.ai or Replicate key where a step is a cloud model, with only its own files, after the same
diff --cc scripts/lib/studio-nodes.mjs
index 00000000,67ad4468..875a1ecb
mode 000000,100644..100644
--- a/scripts/lib/studio-nodes.mjs
+++ b/scripts/lib/studio-nodes.mjs
@@@ -1,0 -1,28 +1,29 @@@
-// Every node type the studio's workflows and graph builders use. The worker program (scripts/build-worker.mjs) and
-// Fuobe Connect (scripts/connect-nodes.mjs) each freeze this list into what they ship: a graph with any other node is
-// refused on the person's computer, and the studio can't add to the list.
++// Every node type the studio's workflows and graph builders use. Fuobe Connect (scripts/connect-nodes.mjs) freezes this
++// list into what it ships, and the worker program's build makes the same list from its catalog copy
++// (scripts/lib/worker-catalog.mjs allowedNodeList): a graph with any other node is refused on the person's computer, and
++// the studio can't add to the list.
+ import fs from "node:fs";
+ import path from "node:path";
+
+ export function studioNodes(root) {
+ const index = JSON.parse(fs.readFileSync(path.join(root, "workflows/comfyui/requirements.json"), "utf8"));
+ const nodes = new Set();
+ for (const wf of Object.values(index.workflows)) {
+ for (const c of wf.core) nodes.add(c);
+ for (const cs of Object.values(wf.packs)) for (const c of cs) nodes.add(c);
+ }
+ for (const f of fs.readdirSync(path.join(root, "workflows/comfyui"))) {
+ if (!f.endsWith(".json") || f === "requirements.json" || f === "manifest.json") continue;
+ try {
+ const g = JSON.parse(fs.readFileSync(path.join(root, "workflows/comfyui", f), "utf8"));
+ for (const n of Object.values(g)) if (n && typeof n === "object" && typeof n.class_type === "string") nodes.add(n.class_type);
+ } catch {}
+ }
+ // What the graph builders add on their own (LoRA loaders, video joins, overlays…).
+ const walk = (dir) => fs.readdirSync(dir, { withFileTypes: true }).flatMap((e) => (e.isDirectory() ? walk(path.join(dir, e.name)) : /\.tsx?$/.test(e.name) ? [path.join(dir, e.name)] : []));
+ for (const file of [...walk(path.join(root, "src/lib")), ...walk(path.join(root, "src/server"))]) {
+ for (const m of fs.readFileSync(file, "utf8").matchAll(/class_type: "([^"]+)"/g)) nodes.add(m[1]);
+ }
+ for (const extra of ["LoraLoader", "LoraLoaderModelOnly"]) nodes.add(extra);
+ return [...nodes].sort();
+ }
diff --cc src/components/shorts/ui.tsx
index 0d161638,81510fc6..8487b653
--- a/src/components/shorts/ui.tsx
+++ b/src/components/shorts/ui.tsx
@@@ -238,16 -240,9 +241,14 @@@ export function Steps({ steps, current
);
}
-/** "≈ $0.42", "Placeholder · free", "Free · your GPU". A visitor's price is never a demo (src/server/visitor.ts priceAs). */
+/**
- * "≈ $0.42", "Placeholder · free", "Free · your GPU". visitor: a guest or an account, whose GPU these tools don't run on yet
- * (the page says why): "Not available here", a demo's price too, since its button is off. A run on this studio's GPUs
- * (the estimate says so): the service's price and the place in line.
++ * "≈ $0.42", "Placeholder · free", "Free · your GPU". A visitor's price is never a demo (src/server/visitor.ts
++ * priceAs). A run on this studio's GPUs (the estimate says so): the service's price and the place in line.
+ */
- export function costText(e: { costUsd: number | null; demo: boolean } | undefined, engine: "cloud" | "open", visitor?: boolean): string {
+ export function costText(e: { costUsd: number | null; demo: boolean } | undefined, engine: "cloud" | "open"): string {
if (!e) return "…";
+ const pool = toolPoolPrice(e);
+ if (pool) return pool.text;
- if (visitor && (e.demo || engine === "open")) return "Not available here";
if (e.demo) return "Placeholder · free";
if (engine === "open") return "Free · your GPU";
if (e.costUsd === null) return "Price unknown";
diff --cc src/server/billing-outbox.ts
index 42751b5e,fede02cc..3bc6812a
--- a/src/server/billing-outbox.ts
+++ b/src/server/billing-outbox.ts
@@@ -231,29 -160,23 +231,30 @@@ function accountOfHold(holdId: string)
}
declare global {
- var __fuobeBillingSweep: boolean | undefined;
+ /** This process's outbox sweep while it runs. */
+ var __fuobeBillingSweep: Promise<void> | undefined;
}
-/** One outbox sweep (the runner's tick): write what is due, send what is due. One at a time. */
-export async function sweepBilling(now = Date.now()): Promise<void> {
- if (globalThis.__fuobeBillingSweep) return;
+/** One outbox sweep (the runner's tick): write what is due, send what is due. One at a time: a call meanwhile waits for it. */
+export function sweepBilling(now = Date.now()): Promise<void> {
+ if (globalThis.__fuobeBillingSweep) return globalThis.__fuobeBillingSweep;
// Reports wait for a service: with none set, nothing is written (a hold can only exist while one was set).
- if (!billingConfigured()) return;
- globalThis.__fuobeBillingSweep = true;
- try {
- queueReports(now);
- await drainOutbox(now);
- } catch (e) {
- console.warn(`[fuobe] billing sweep: ${(e as Error).message}`);
- } finally {
- globalThis.__fuobeBillingSweep = false;
- }
+ if (!billingConfigured()) return Promise.resolve();
- const sweep: Promise<void> = (async () => {
++ let sweep: Promise<void> | undefined = undefined;
++ sweep = (async () => {
+ // (Set as this process's sweep before any of it runs.)
+ await null;
+ try {
+ queueReports(now);
+ await drainDue(now);
+ } catch (e) {
+ console.warn(`[fuobe] billing sweep: ${(e as Error).message}`);
+ } finally {
+ if (globalThis.__fuobeBillingSweep === sweep) globalThis.__fuobeBillingSweep = undefined;
+ }
+ })();
+ globalThis.__fuobeBillingSweep = sweep;
+ return sweep;
}
/** How many reports wait, and since when (for the admin queue view). */