fix(webui): drive slash command routing from metadata

This commit is contained in:
chengyongru
2026-07-07 15:42:04 +08:00
committed by Xubin Ren
parent 8a231b6e4d
commit fa73448f6f
10 changed files with 243 additions and 68 deletions
+8 -2
View File
@@ -149,7 +149,10 @@ async def test_model_command_registered_as_exact_and_prefix(tmp_path) -> None:
def test_model_command_in_help_and_palette() -> None:
palette = builtin_command_palette()
assert any(item["command"] == "/model" and item["arg_hint"] == "[preset]" for item in palette)
model = next(item for item in palette if item["command"] == "/model")
assert model["arg_hint"] == "[preset]"
assert model["lifecycle"] == "side_channel"
assert model["accepts_args"] is True
assert "/model [preset]" in build_help_text()
@@ -204,5 +207,8 @@ async def test_goal_command_registered_on_router(tmp_path) -> None:
def test_goal_command_in_help_and_palette() -> None:
palette = builtin_command_palette()
assert any(item["command"] == "/goal" and item["arg_hint"] == "<goal>" for item in palette)
goal = next(item for item in palette if item["command"] == "/goal")
assert goal["arg_hint"] == "<goal>"
assert goal["lifecycle"] == "agent_turn_with_args"
assert goal["accepts_args"] is True
assert "/goal <goal>" in build_help_text()