From 8a89f8340afab7d9684c1490cd4942eeb23f6f19 Mon Sep 17 00:00:00 2001 From: Jedrzej Kosinski Date: Thu, 4 Jun 2026 14:46:52 -0700 Subject: [PATCH] feat: register supports_terminal CLI feature flag Add a registered, bool-typed supports_terminal flag so a terminal host (e.g. ComfyUI Desktop) can advertise interactive-terminal availability to the frontend via --feature-flag supports_terminal=true. Registration is required so the value coerces to a real boolean; the frontend gates the terminal UI on a strict === true check. Amp-Thread-ID: https://ampcode.com/threads/T-019e9464-f097-7430-a762-405ffb717dae Co-authored-by: Amp --- comfy_api/feature_flags.py | 5 +++++ tests-unit/feature_flags_test.py | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/comfy_api/feature_flags.py b/comfy_api/feature_flags.py index adb5a3144..64d1d63ca 100644 --- a/comfy_api/feature_flags.py +++ b/comfy_api/feature_flags.py @@ -25,6 +25,11 @@ CLI_FEATURE_FLAG_REGISTRY: dict[str, FeatureFlagInfo] = { "default": False, "description": "Show the sign-in button in the frontend even when not signed in", }, + "supports_terminal": { + "type": "bool", + "default": False, + "description": "An interactive terminal host is available for this server (e.g. ComfyUI Desktop), so the frontend may surface a terminal/console UI", + }, } diff --git a/tests-unit/feature_flags_test.py b/tests-unit/feature_flags_test.py index 8ec52a124..4427c62aa 100644 --- a/tests-unit/feature_flags_test.py +++ b/tests-unit/feature_flags_test.py @@ -181,3 +181,12 @@ class TestCliFeatureFlagRegistry: assert "type" in info, f"{key} missing 'type'" assert "default" in info, f"{key} missing 'default'" assert "description" in info, f"{key} missing 'description'" + + def test_supports_terminal_registered_as_bool(self): + """supports_terminal must be a registered bool so --feature-flag + supports_terminal=true coerces to a real boolean. The frontend gates + on a strict `=== true` check, so a raw string 'true' would not work.""" + assert "supports_terminal" in CLI_FEATURE_FLAG_REGISTRY + assert CLI_FEATURE_FLAG_REGISTRY["supports_terminal"]["type"] == "bool" + assert _coerce_flag_value("supports_terminal", "true") is True + assert _coerce_flag_value("supports_terminal", "false") is False