Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.
Keep FreeVideo starting when the Agent editing package cannot be added
Bowen Xue94e49652ba64
diff --git a/constraints/engine.txt b/constraints/engine.txtindex 5260638..7f56b90 100644--- a/constraints/engine.txt+++ b/constraints/engine.txt@@ -62,7 +62,6 @@ protobuf==6.33.6psutil==7.2.2pygments==2.21.0pyyaml==6.0.3-quickjs==1.19.4quack-kernels==0.5.3regex==2026.9.3requests==2.34.2diff --git a/constraints/macos-runtime-requirements.txt b/constraints/macos-runtime-requirements.txtindex 3079258..3a2708d 100644--- a/constraints/macos-runtime-requirements.txt+++ b/constraints/macos-runtime-requirements.txt@@ -15,7 +15,6 @@ httpx[socks]requests[socks]importlib-metadatapackaging-quickjs==1.19.4wheelsetuptoolspipdiff --git a/constraints/macos-runtime.txt b/constraints/macos-runtime.txtindex f9d6522..4db0198 100644--- a/constraints/macos-runtime.txt+++ b/constraints/macos-runtime.txt@@ -43,7 +43,6 @@ pygments==2.21.0pycparser==3.0pysocks==1.7.1pyyaml==6.0.3-quickjs==1.19.4regex==2026.9.3requests==2.34.2rich==15.0.0diff --git a/constraints/unified.txt b/constraints/unified.txtindex 883da4a..882a9d6 100644--- a/constraints/unified.txt+++ b/constraints/unified.txt@@ -59,7 +59,6 @@ pygments==2.21.0pycparser==3.0pysocks==1.7.1pyyaml==6.0.3-quickjs==1.19.4regex==2026.9.3requests==2.34.2rich==15.0.0diff --git a/constraints/windows-portable.txt b/constraints/windows-portable.txtindex 66290b9..5d57608 100644--- a/constraints/windows-portable.txt+++ b/constraints/windows-portable.txt@@ -73,7 +73,6 @@ pyopengl==3.1.10pysocks==1.7.1python-dotenv==1.2.3pyyaml==6.0.3-quickjs==1.19.4regex==2026.9.3requests==2.34.2rich==15.0.0diff --git a/constraints/windows-unified.txt b/constraints/windows-unified.txtindex b545bd4..f369953 100644--- a/constraints/windows-unified.txt+++ b/constraints/windows-unified.txt@@ -42,7 +42,6 @@ pip==26.2.1psutil==7.2.2pygments==2.21.0pyyaml==6.0.3-quickjs==1.19.4regex==2026.9.3requests==2.34.2rich==15.0.0diff --git a/freevideo_engine/agent/editor_runtime.py b/freevideo_engine/agent/editor_runtime.pyindex 6ee8802..5bc05c1 100644--- a/freevideo_engine/agent/editor_runtime.py+++ b/freevideo_engine/agent/editor_runtime.py@@ -335,8 +335,12 @@ _RUNTIME_LOCK = threading.Lock()def available():"""Whether this process can run the editor rules (project and image edits)."""- import importlib.util- return importlib.util.find_spec('quickjs') is not None+ try:+ import quickjs # noqa: F401+ except Exception:+ # Not installed (an update could not add it), or installed and its library does not load here.+ return False+ return Truedef runtime():diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.pyindex cc077bb..f60466c 100644--- a/freevideo_engine/bootstrap.py+++ b/freevideo_engine/bootstrap.py@@ -190,7 +190,7 @@ def dependency_status(root, layout='unified', system=None):'engine': ['torch', 'torchvision', 'triton', 'transformers', 'accelerate', 'peft', 'safetensors','huggingface-hub', 'omegaconf', 'pyyaml', 'einops', 'numpy', 'pillow', 'av','psutil', 'tqdm', 'importlib-metadata', 'requests', 'httpx', 'socksio', 'pysocks',- 'modelscope-hub', 'hf-xet', 'quickjs', 'sageattention', 'diffusers', 'freevideo-engine'],+ 'modelscope-hub', 'hf-xet', 'sageattention', 'diffusers', 'freevideo-engine'],'encoder': ['torch', 'torchvision', 'torchaudio', 'freevideo-engine'] +[s.strip() for s in (SOURCE / 'constraints/encoder-runtime.txt').read_text(encoding='utf-8').splitlines()if s.strip() and not s.startswith('#')]}diff --git a/freevideo_engine/comfy_host.py b/freevideo_engine/comfy_host.pyindex bdfdd91..8431737 100644--- a/freevideo_engine/comfy_host.py+++ b/freevideo_engine/comfy_host.py@@ -169,13 +169,28 @@ def _prepare(root, comfy, machine, run, download, repair=False):# The receipt records the dependency contract, not that every package is# still there: uv only checks versions, so repair checks the files too.try:- recorded = python.is_file() and json.loads(receipt.read_text(encoding='utf-8')) == identity+ saved = json.loads(receipt.read_text(encoding='utf-8')) if python.is_file() else Noneexcept (OSError, ValueError):- recorded = False- if repair or not recorded:+ saved = None+ recorded = saved == identity+ uv = root / 'tools' / ('uv.exe' if os.name == 'nt' else 'uv' if sys.platform == 'darwin' else 'uv-x86_64-unknown-linux-gnu/uv')+ if not repair and not recorded and isinstance(saved, dict) and dict(saved, nodes=identity['nodes']) == identity:+ # An update gave our own nodes a package. Add only that: everything this ComfyUI+ # already runs on stays as it is, so a failure here leaves a working environment.+ if not uv.is_file():+ raise ValueError('The engine download tool is missing. Run engine repair first.')+ ui.phase('Install ComfyUI packages', stage_offset + 2, stage_total)+ try:+ network.package_command(plan, 'pypi', lambda environment, _: execute(+ [uv, 'pip', 'install', '--python', python, *NODE_PACKAGES], environment, 'Install ComfyUI packages'), env)+ except network.PackageSourcesError as error:+ error.log_files = list(package_logs)+ error.args = (str(error) + '. Attempt logs: ' + ', '.join(package_logs),)+ raise+ save(receipt, identity)+ elif repair or not recorded:if repair and not repair_marker.exists():save(repair_marker, dict(started=time.time()))- uv = root / 'tools' / ('uv.exe' if os.name == 'nt' else 'uv' if sys.platform == 'darwin' else 'uv-x86_64-unknown-linux-gnu/uv')if not uv.is_file():raise ValueError('The engine download tool is missing. Run engine repair first.')if not python.is_file():diff --git a/freevideo_engine/comfy_launcher_runtime.py b/freevideo_engine/comfy_launcher_runtime.pyindex fe7d8c0..2f1d42d 100644--- a/freevideo_engine/comfy_launcher_runtime.py+++ b/freevideo_engine/comfy_launcher_runtime.py@@ -177,9 +177,8 @@ def host_repair_pending(python):return bool(python) and (io_path(python).parent.parent / 'freevideo-host-repair.json').exists()-def managed_python(engine, comfy):- """Find our previously completed frontend without requiring its full disk budget again."""- from .comfy_host import NODE_PACKAGES+def _managed_environment(engine, comfy):+ """(python, recorded identity) of our previously completed frontend, or None."""engine, comfy = io_path(engine), io_path(comfy)try:record = json.loads((engine / 'launcher/comfy-host.json').read_text(encoding='utf-8'))@@ -188,18 +187,55 @@ def managed_python(engine, comfy):machine = json.loads((engine / 'machine.json').read_text(encoding='utf-8'))if (identity['comfy'] != plain(comfy) or identity['engine_python'] != machine['python']or identity['requirements'] != hashlib.sha256((comfy / 'requirements.txt').read_bytes()).hexdigest()- # Packages our nodes need beyond ComfyUI's own, added since the environment was made.- or identity.get('nodes', []) != list(NODE_PACKAGES)or environment.resolve().parent != (engine / 'envs').resolve()or python != environment / ('Scripts/python.exe' if os.name == 'nt' else 'bin/python')or json.loads((environment / 'freevideo-host.json').read_text(encoding='utf-8')) != identityor not python.is_file()):return None- return plain(python)+ return plain(python), identityexcept (OSError, ValueError, KeyError, TypeError):return None+def managed_python(engine, comfy):+ """Find our previously completed frontend without requiring its full disk budget again.++ Packages our own nodes gained since (node_packages_pending) do not make it unusable:+ ComfyUI and generation run without them, and only what needs them is not offered.+ """+ found = _managed_environment(engine, comfy)+ return found and found[0]+++NODE_PACKAGES_RETRY = 6 * 3600+++def node_packages_pending(engine, comfy, *, now=None):+ """Our frontend runs, but lacks packages our nodes gained in an update, and it is time to try adding them.++ A failed attempt (offline, say) is tried again after NODE_PACKAGES_RETRY, not at every start.+ """+ from .comfy_host import NODE_PACKAGES+ found = _managed_environment(engine, comfy)+ if not found or found[1].get('nodes', []) == list(NODE_PACKAGES):+ return False+ try:+ failed = json.loads((io_path(engine) / 'launcher/node-packages.json').read_text(encoding='utf-8'))+ recent = failed['nodes'] == list(NODE_PACKAGES) and 0 <= (now or time.time()) - failed['failed'] < NODE_PACKAGES_RETRY+ except (OSError, ValueError, KeyError, TypeError):+ recent = False+ return not recent+++def node_packages_failed(engine):+ """Remember that adding the node packages failed just now; the rest of FreeVideo carries on."""+ from .comfy_host import NODE_PACKAGES+ try:+ save(io_path(engine) / 'launcher/node-packages.json', dict(nodes=list(NODE_PACKAGES), failed=time.time()))+ except OSError:+ pass++@plain_errorsdef managed_frontend(selected):"""Identify our frontend even after reopening makes `separate` false.@@ -549,7 +585,8 @@ class Controller:# Anything that installs into this environment stops our idle server first# and never runs beside a job, including a host repair resumed here.if (repair or host_repair_pending(selected.get('python'))- or managed_python(Path(selected['engine']), Path(selected['root'])) is None):+ or managed_python(Path(selected['engine']), Path(selected['root'])) is None+ or node_packages_pending(Path(selected['engine']), Path(selected['root']))):self._stop_server_for_setup(selected['url'])self.setup.state = dict(status='running', action='comfy-host')self.setup.events.reset()@@ -898,9 +935,9 @@ class Controller:shield_engine(selected['engine'])url = selected['url']frontend_error = None- if (selected.get('python') and managed_frontend(selected)- and (managed_python(Path(selected['engine']), Path(selected['root'])) is None- or host_repair_pending(selected['python']))):+ managed = bool(selected.get('python') and managed_frontend(selected))+ if managed and (managed_python(Path(selected['engine']), Path(selected['root'])) is None+ or host_repair_pending(selected['python'])):# Requirements changed, or a previous host repair was interrupted.self.sections = [('comfy', 5), ('open', 1)]self.stage('comfy', label='Update ComfyUI packages')@@ -911,6 +948,19 @@ class Controller:raise# Offline, say: the previous environment may still run this ComfyUI.frontend_error = str(error)+ elif (managed and node_packages_pending(Path(selected['engine']), Path(selected['root']))+ # Never beside a running job: adding the package stops our idle server first.+ and not matches_server(server_info(url), selected['root'], selected['engine'], selected['source'])):+ # An update gave our nodes a package. Without it everything but what needs it still works,+ # so a failure (offline, say) is not an error here and is tried again later.+ self.sections = [('comfy', 5), ('open', 1)]+ self.stage('comfy', label='Update ComfyUI packages')+ try:+ self._prepare_frontend(selected)+ except Exception:+ if self.cancelled.is_set():+ raise+ node_packages_failed(Path(selected['engine']))self.stage('open', label='Open ComfyUI')info = server_info(url)if matches_server(info, selected['root'], selected['engine'], selected['source']):diff --git a/freevideo_engine/comfy_service.py b/freevideo_engine/comfy_service.pyindex 881e0c6..9881096 100644--- a/freevideo_engine/comfy_service.py+++ b/freevideo_engine/comfy_service.py@@ -37,6 +37,8 @@ UNIT = 'freevideo.service'WRAPPER_MARK = '# FreeVideo command, written by FreeVideo setup.'DESKTOP_ID = 'freevideo.desktop'LOOPBACK = ('127.0.0.1', 'localhost', '::1')+NODE_PACKAGES_NOTE = ('The Agent editing tools could not be added now; everything else works. '+ 'FreeVideo will try again later.')COMMANDS = ('open', 'stop', 'status', 'restart', 'server')@@ -98,6 +100,37 @@ def loopback(address):return False+def host_setup(root, source, machine, comfy, *, download=False):+ """Run the ComfyUI environment setup; its exit code."""+ # The engine's Python reads the CUDA packages the ComfyUI environment must match.+ code = ("import runpy,sys;sys.path.insert(0,sys.argv.pop(1));"+ "runpy.run_module('freevideo_engine.comfy_host',run_name='__main__')")+ command = [machine['python'], '-B', '-c', code, str(source), '--root', str(root), '--comfy', str(comfy)]+ if download:+ command.append('--download-comfy')+ env = dict(os.environ, FREEVIDEO_HOME=str(root), PYTHONUTF8='1', PYTHONIOENCODING='utf-8')+ for name in ('PYTHONPATH', 'PYTHONHOME', 'VIRTUAL_ENV', 'FREEVIDEO_UI_EVENTS'):+ env.pop(name, None)+ return execution_paths.run(command, cwd=str(root), env=env, stdin=subprocess.DEVNULL).returncode+++def add_node_packages(root, source, machine, comfy, out=say):+ """An update gave our nodes a package: add it to the environment ComfyUI already uses.++ ComfyUI and generation run without it, so a failure (offline, say) never stops FreeVideo:+ only what needs the package is not offered, and it is tried again later.+ """+ from .comfy_launcher_runtime import node_packages_failed, node_packages_pending+ try:+ if not node_packages_pending(Path(root), Path(comfy)):+ return+ if host_setup(root, source, machine, comfy):+ raise RuntimeError('setup failed')+ except Exception:+ node_packages_failed(Path(root))+ out(NODE_PACKAGES_NOTE)++def install(root, source, machine, port, out=say):"""The pinned ComfyUI in <root>/ComfyUI with its own environment, and our node in it."""from .comfy_launcher_runtime import deploy, managed_python@@ -116,21 +149,14 @@ def install(root, source, machine, port, out=say):python = managed_python(Path(root), comfy) if (comfy / 'main.py').is_file() else Noneif python is None:out('Installing ComfyUI for FreeVideo. This happens once; the next start takes seconds.')- # The engine's Python reads the CUDA packages the ComfyUI environment must match.- code = ("import runpy,sys;sys.path.insert(0,sys.argv.pop(1));"- "runpy.run_module('freevideo_engine.comfy_host',run_name='__main__')")- command = [machine['python'], '-B', '-c', code, str(source), '--root', str(root), '--comfy', str(comfy)]- if not (comfy / 'main.py').is_file():- command.append('--download-comfy')- env = dict(os.environ, FREEVIDEO_HOME=str(root), PYTHONUTF8='1', PYTHONIOENCODING='utf-8')- for name in ('PYTHONPATH', 'PYTHONHOME', 'VIRTUAL_ENV', 'FREEVIDEO_UI_EVENTS'):- env.pop(name, None)- if execution_paths.run(command, cwd=str(root), env=env, stdin=subprocess.DEVNULL).returncode:+ if host_setup(root, source, machine, comfy, download=not (comfy / 'main.py').is_file()):raise RuntimeError('ComfyUI could not be installed. Run the same command again to continue; ''downloaded files are kept.')python = managed_python(Path(root), comfy)if python is None:raise RuntimeError('ComfyUI was installed, but its environment is incomplete. Run the same command again.')+ else:+ add_node_packages(root, source, machine, comfy, out)if switching:engine_binding.rebind(root, machine, source)deploy(comfy, source, root)@@ -618,6 +644,7 @@ def ensure_installed(root, port, out=say):record = install(root, source, machine, port or (port_of(record['url']) if record else first_free_port()), out=out)else:from .comfy_launcher_runtime import deploy+ add_node_packages(root, source, machine, record['root'], out)deploy(record['root'], source, root)if port and port_of(record['url']) != port:record = dict(record, url='http://127.0.0.1:%d' % port)diff --git a/freevideo_engine/licenses/quickjs-MIT.txt b/freevideo_engine/licenses/quickjs-MIT.txtindex 02edabc..2b50b66 100644--- a/freevideo_engine/licenses/quickjs-MIT.txt+++ b/freevideo_engine/licenses/quickjs-MIT.txt@@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.QuickJS embedded engine-Copyright (c) 2017-2021 Fabrice Bellard+Copyright (c) 2016-2021 Fabrice BellardCopyright (c) 2017-2021 Charlie GordonPermission is hereby granted, free of charge, to any person obtaining a copydiff --git a/freevideo_engine/licenses/runtime/THIRD_PARTY_NOTICES.txt b/freevideo_engine/licenses/runtime/THIRD_PARTY_NOTICES.txtindex 7f4d984..58f9ed8 100644--- a/freevideo_engine/licenses/runtime/THIRD_PARTY_NOTICES.txt+++ b/freevideo_engine/licenses/runtime/THIRD_PARTY_NOTICES.txt@@ -175,8 +175,3 @@ TinyCC in triton-windowspython/Lib/site-packages/triton/runtime/tcc/lib/user32.defpython/Lib/site-packages/triton/runtime/tcc/libtcc.dllpython/Lib/site-packages/triton/runtime/tcc/tcc.exe--QuickJS Python binding 1.19.4 and embedded QuickJS- License: MIT; full notices in ../quickjs-MIT.txt- Binding author: Petter Strandmark. Engine copyright: Fabrice Bellard and Charlie Gordon.- Files: python/Lib/site-packages/quickjs*, python/Lib/site-packages/_quickjs*diff --git a/pyproject.toml b/pyproject.tomlindex 0eea88c..74c62c1 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -9,7 +9,7 @@ description = "FreeVideo video and audio generation with automatic GPU and memorrequires-python = ">=3.12,<3.13"readme = "README.md"license = "Apache-2.0"-dependencies = ["psutil>=6", "safetensors>=0.8.0", "numpy>=2", "pillow>=11", "av>=14", "quickjs==1.19.4"]+dependencies = ["psutil>=6", "safetensors>=0.8.0", "numpy>=2", "pillow>=11", "av>=14"][project.optional-dependencies]launcher = ["PySide6-Essentials==6.11.2"]@@ -19,7 +19,7 @@ runtime = ["transformers==5.15.0", "accelerate==1.14.0", "peft==0.20.0","safetensors==0.8.0", "huggingface_hub==1.30.0", "hf-xet==1.6.1a0","omegaconf==2.3.1", "pyyaml==6.0.3", "einops==0.8.2",- "numpy==2.5.2", "pillow==12.3.0", "av==18.1.0", "quickjs==1.19.4", "tqdm",+ "numpy==2.5.2", "pillow==12.3.0", "av==18.1.0", "tqdm","importlib_metadata>=8", "requests[socks]>=2.32", "httpx[socks]>=0.28","modelscope-hub==0.4.2"]