feat: add UserMessage widget and UI backend selection during onboarding

- Introduced UserMessage widget for displaying user input with a styled prompt.
- Updated onboarding steps to include UI backend selection (Rich CLI or Textual TUI).
- Modified EvoScientistConfig to store selected UI backend.
- Enhanced configuration handling to support UI backend environment variable.
- Updated README with new UI backend options and commands.
- Added tests for new UI backend functionality and UserMessage widget.
- Removed obsolete test files and ensured existing tests are updated accordingly.
This commit is contained in:
X-iZhang
2026-02-21 01:18:33 +00:00
parent 75ee7aeba9
commit 03f4134190
32 changed files with 3499 additions and 380 deletions
+53
View File
@@ -0,0 +1,53 @@
"""Tests for CLI interactive UI backend dispatch."""
from EvoScientist.cli.interactive import cmd_interactive
def test_cmd_interactive_dispatches_to_textual(monkeypatch):
captured: dict[str, object] = {}
def _fake_resolve_ui_backend(value, *, warn_fallback=False): # noqa: ANN001
captured["resolved_input"] = value
captured["warn_fallback"] = warn_fallback
return "textual"
def _fake_run_textual_interactive(**kwargs): # noqa: ANN003
captured["kwargs"] = kwargs
monkeypatch.setattr(
"EvoScientist.cli.interactive.resolve_ui_backend",
_fake_resolve_ui_backend,
)
monkeypatch.setattr(
"EvoScientist.cli.interactive.run_textual_interactive",
_fake_run_textual_interactive,
)
cmd_interactive(
show_thinking=True,
channel_send_thinking=True,
workspace_dir="/tmp/workspace",
workspace_fixed=True,
mode="daemon",
model="demo-model",
provider="demo-provider",
run_name="demo-run",
thread_id="thread-1",
ui_backend="textual",
)
assert captured["resolved_input"] == "textual"
assert captured["warn_fallback"] is True
kwargs = captured["kwargs"]
assert isinstance(kwargs, dict)
assert kwargs["workspace_dir"] == "/tmp/workspace"
assert kwargs["workspace_fixed"] is True
assert kwargs["mode"] == "daemon"
assert kwargs["model"] == "demo-model"
assert kwargs["provider"] == "demo-provider"
assert kwargs["run_name"] == "demo-run"
assert kwargs["thread_id"] == "thread-1"
assert kwargs["channel_send_thinking"] is True
assert callable(kwargs["load_agent"])
assert callable(kwargs["create_session_workspace"])