v2.7.4 (#579)
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai> Co-authored-by: Lucas Marandat <31749711+lucasmrdt@users.noreply.github.com> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Paul Cacheux <paul.cacheux@mistral.ai> Co-authored-by: Peter Evers <pevers90@gmail.com> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Pierre Rossinès <pierre.rossines@protonmail.com> Co-authored-by: Quentin <quentin.torroba@mistral.ai> Co-authored-by: Simon Van de Kerckhove <simon.vandekerckhove@mistral.ai> Co-authored-by: Val <102326092+vdeva@users.noreply.github.com> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
90763daf81
commit
e9a9217cc8
113 changed files with 7202 additions and 541 deletions
|
|
@ -5,9 +5,13 @@ import time
|
|||
import pytest
|
||||
from textual.widgets import Static
|
||||
|
||||
from tests.conftest import build_test_agent_loop, build_test_vibe_app
|
||||
from tests.mock.utils import mock_llm_chunk
|
||||
from tests.stubs.fake_backend import FakeBackend
|
||||
from vibe.cli.textual_ui.app import VibeApp
|
||||
from vibe.cli.textual_ui.widgets.chat_input.container import ChatInputContainer
|
||||
from vibe.cli.textual_ui.widgets.messages import BashOutputMessage, ErrorMessage
|
||||
from vibe.core.types import Role
|
||||
|
||||
|
||||
async def _wait_for_bash_output_message(
|
||||
|
|
@ -118,3 +122,38 @@ async def test_ui_handles_non_utf8_stderr(vibe_app: VibeApp) -> None:
|
|||
output_widget = message.query_one(".bash-output", Static)
|
||||
assert str(output_widget.render()) == "<EFBFBD><EFBFBD>"
|
||||
assert_no_command_error(vibe_app)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_ui_sends_manual_command_output_to_next_agent_turn() -> None:
|
||||
backend = FakeBackend(mock_llm_chunk(content="I saw it."))
|
||||
vibe_app = build_test_vibe_app(agent_loop=build_test_agent_loop(backend=backend))
|
||||
|
||||
async with vibe_app.run_test() as pilot:
|
||||
chat_input = vibe_app.query_one(ChatInputContainer)
|
||||
chat_input.value = "!echo hello"
|
||||
|
||||
await pilot.press("enter")
|
||||
await _wait_for_bash_output_message(vibe_app, pilot)
|
||||
|
||||
injected_message = vibe_app.agent_loop.messages[-1]
|
||||
assert injected_message.role == Role.user
|
||||
assert injected_message.injected is True
|
||||
assert injected_message.content is not None
|
||||
assert "Manual `!` command result from the user." in injected_message.content
|
||||
assert "Command: `echo hello`" in injected_message.content
|
||||
assert "Exit code: 0" in injected_message.content
|
||||
assert "Stdout:\n```text\nhello\n```" in injected_message.content
|
||||
|
||||
chat_input.value = "what did the command print?"
|
||||
await pilot.press("enter")
|
||||
await pilot.app.workers.wait_for_complete()
|
||||
|
||||
assert len(backend.requests_messages) == 1
|
||||
user_messages = [
|
||||
msg for msg in backend.requests_messages[0] if msg.role == Role.user
|
||||
]
|
||||
assert len(user_messages) >= 2
|
||||
assert user_messages[-2].content == injected_message.content
|
||||
assert user_messages[-2].injected is True
|
||||
assert user_messages[-1].content == "what did the command print?"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue