feat: prepare 2.2.0 with UI and execution fixes
Add dark theme, richer Markdown and readable plugin results. Improve Android input evidence, response integrity and diagnostics. Unify lifecycle, guidance receipts and evidence sources across clients. Keep direct action dispatch without an added AI quota approval layer. Align version metadata at 2.2.0 and bundle Helper 1.2.2. Validation: 3063 backend tests before the version bump; 44 after. Frontend: 317 tests and production build passed.
This commit is contained in:
1 parent
83bcfd54d5
commit
fac4ccb760
146 files changed
+5689
-2033
No files matched your search
@@ -15,7 +15,12 @@
|
||||
"""Tests for pixel safety-net target descriptions."""
|
||||
|
||||
from pathlib import Path
|
||||
from io import BytesIO
|
||||
from unittest.mock import MagicMock
|
||||
from unittest.mock import AsyncMock
|
||||
import base64
|
||||
import pytest
|
||||
from PIL import Image
|
||||
|
||||
from artemis.agents.validator import precondition_pixel as pp
|
||||
from langchain_core.messages import HumanMessage, SystemMessage
|
||||
@@ -23,6 +28,58 @@ from langchain_core.messages import HumanMessage, SystemMessage
|
||||
_PNG = b"fake-image-bytes"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize(
|
||||
"response",
|
||||
[
|
||||
{"is_present": True, "confidence": 0.99, "target_kind": "surface", "target_matches": True},
|
||||
{"is_present": True, "confidence": 0.99},
|
||||
{"is_present": True, "confidence": 0.2, "target_kind": "control", "target_matches": True},
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"target",
|
||||
[
|
||||
{"action": "tap", "target_text": "Input"},
|
||||
{"action": "input_text", "target_description": "Input"},
|
||||
],
|
||||
)
|
||||
async def test_named_input_is_never_approved_as_blank_or_unverified(response, target, monkeypatch):
|
||||
monkeypatch.setattr(pp.visualization, "crop_and_annotate_target", lambda *a, **k: _PNG)
|
||||
monkeypatch.setattr(pp, "acomplete_structured", AsyncMock(return_value=response))
|
||||
session = AsyncMock()
|
||||
session.screenshot_b64.return_value = base64.b64encode(_PNG).decode()
|
||||
verdict = await pp._run_attempt(session, None, "prompt", _PNG, [1, 2], target, None, 1)
|
||||
assert verdict[0] is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_renaming_rejected_point_cannot_dispatch_again(monkeypatch):
|
||||
monkeypatch.setattr(pp, "_init_llm_and_prompt", lambda *a: (None, "prompt"))
|
||||
attempt = AsyncMock(
|
||||
return_value=(False, pp.ValidationErrorCategory.PIXEL_TARGET_DISAPPEARED, "No input")
|
||||
)
|
||||
monkeypatch.setattr(pp, "_run_attempt", attempt)
|
||||
ctx = MagicMock()
|
||||
image = Image.new("RGB", (400, 400), "white")
|
||||
frames = []
|
||||
for color in ("black", "blue"):
|
||||
image.putpixel((5, 5), Image.new("RGB", (1, 1), color).getpixel((0, 0)))
|
||||
encoded = BytesIO()
|
||||
image.save(encoded, format="PNG")
|
||||
frames.append(base64.b64encode(encoded.getvalue()).decode())
|
||||
for description, frame in zip(("pairing input", "blank surface"), frames, strict=True):
|
||||
verdict = await pp.validate_action_precondition_pixel(
|
||||
ctx,
|
||||
AsyncMock(),
|
||||
{"action": "tap", "coordinates": [200, 300], "target_description": description},
|
||||
frame,
|
||||
get_llm_fn=lambda: None,
|
||||
)
|
||||
assert verdict[0] is False
|
||||
assert attempt.await_count == 1
|
||||
|
||||
|
||||
def _texts(messages: list) -> list[str]:
|
||||
human = messages[1]
|
||||
return [part["text"] for part in human.content if part["type"] == "text"]
|
||||
|
||||
Reference in new issue
Block a user