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 <amp@ampcode.com>
This commit is contained in:
Jedrzej Kosinski 2026-06-04 14:46:52 -07:00
parent 4e1f7cb1db
commit 8a89f8340a
2 changed files with 14 additions and 0 deletions

View File

@ -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",
},
}

View File

@ -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