feat: introduce MCP server, cross-platform runtime, and Showcase UI reorganization

- Showcase UI Reorganization:
  * Move web UI dashboard from root directory into apps/showcase_ui/ for cleaner project structure
  * Add 'artemis ui' CLI command (artemis/interfaces/cli/commands/ui.py) and launcher scripts for the interactive showcase console
- Standalone MCP Server & Notifiers (mcp_server/):
  * Implement dedicated MCP server package with mobile automation tools (device_state, inspect_trace, task_manager, task_runner)
  * Add multi-channel notifiers (AgentAPI, Desktop notifications, Webhooks, File output, and Composite routing)
  * Introduce background task runner and trace store for autonomous mobile execution monitoring
- Cross-Platform Runtime & Toolchain Support:
  * Add artemis/platform/ with OS-specific implementations for Linux, macOS (Darwin), and Windows
  * Add artemis/runtime/supervisor.py for resilient process and agent runtime supervision
  * Add artemis/toolchain/ with dependency resolution and SDK descriptors
  * Add cross-platform launcher scripts (start.sh, start.bat) and installer scripts (scripts/install_deps.*)
- Core Enhancements & Diagnostics:
  * Enhance coordinate normalization, OCR API fallback, and perception pipeline
  * Add credential validation (credentials_validator.py) and system diagnostics
  * Update bilingual documentation (README.md, README_CN.md) and architecture diagrams
- Test Suite Expansion:
  * Add integration tests for cloud gateway, remote ADB, and Artemis login
  * Add unit tests covering core diagnostics, platform detection, toolchain, credentials validator, optional OCR, and MCP tools
This commit is contained in:
somew1nd committed 2026-08-18 13:59:27 -07:00
1 parent 78e478f502
commit 9a5aaf99b7
249 files changed
+37226 -9339

No files matched your search

+15 -11
View File
@@ -50,7 +50,7 @@ async def test_explorer_run():
mock_ctx.data_engine.base_dir = "/tmp/test_session"
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_state = MagicMock(spec=State)
mock_state.latest_screenshot = "/tmp/test_screenshot.jpg"
@@ -138,7 +138,7 @@ async def test_explorer_submit_answer():
mock_ctx.data_engine.base_dir = "/tmp/test_session"
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_state = MagicMock(spec=State)
mock_state.latest_screenshot = "/tmp/test_screenshot.jpg"
@@ -226,7 +226,7 @@ async def test_explorer_submit_answer_self_correction():
mock_ctx.data_engine.base_dir = "/tmp/test_session"
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_state = MagicMock(spec=State)
mock_state.latest_screenshot = "/tmp/test_screenshot.jpg"
@@ -380,7 +380,7 @@ async def test_explorer_initial_visual_marking():
mock_ctx.data_engine.base_dir = "/tmp/test_session"
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_state = MagicMock(spec=State)
mock_state.latest_screenshot = "/tmp/test_screenshot.jpg"
@@ -466,7 +466,7 @@ async def test_explorer_initial_visual_marking_previous_screenshot():
mock_ctx.data_engine.base_dir = "/tmp/test_session"
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_state = MagicMock(spec=State)
# current screenshot is different
@@ -559,7 +559,7 @@ async def test_explorer_initial_visual_marking_previous_screenshot_no_ui_tree():
mock_ctx.data_engine.base_dir = "/tmp/test_session"
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_state = MagicMock(spec=State)
mock_state.latest_screenshot = "/tmp/current_screenshot.jpg"
@@ -641,7 +641,7 @@ async def test_explorer_initial_visual_marking_previous_screenshot_ocr_fusion():
mock_ctx.data_engine.base_dir = "/tmp/test_session"
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_state = MagicMock(spec=State)
mock_state.latest_screenshot = "/tmp/current_screenshot.jpg"
@@ -743,7 +743,7 @@ async def test_explorer_initial_visual_marking_previous_screenshot_on_the_fly_oc
mock_ctx.data_engine.base_dir = "/tmp/test_session"
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_state = MagicMock(spec=State)
mock_state.latest_screenshot = "/tmp/current_screenshot.jpg"
@@ -816,6 +816,10 @@ async def test_explorer_initial_visual_marking_previous_screenshot_on_the_fly_oc
new_callable=AsyncMock,
return_value=mock_ocr_result,
) as mock_perform_ocr,
patch(
"artemis.agents.explorer.explorer.is_ocr_configured",
return_value=True,
),
patch("artemis.agents.explorer.explorer.draw_dots") as mock_draw_dots,
patch("pathlib.Path.exists", return_value=True),
patch("pathlib.Path.read_text", return_value=mock_prompt),
@@ -853,7 +857,7 @@ async def test_explorer_denylisted_tool():
mock_ctx.data_engine.base_dir = "/tmp/test_session"
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_ctx.agent_config = MagicMock()
mock_ctx.agent_config.denylisted_tools = {"explorer": ["search_xml_ocr"]}
@@ -1048,7 +1052,7 @@ async def test_explorer_final_turn_tool_stripping():
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.explorer = MagicMock()
mock_ctx.llm_config.explorer.model = "gemini-3.6-flash"
mock_ctx.llm_config.explorer.model = "gemini-3.7-flash"
mock_state = MagicMock(spec=State)
mock_state.latest_screenshot = "/tmp/test_screenshot.jpg"
@@ -1212,7 +1216,7 @@ async def test_explorer_ask_perception_tool():
detect_queries=["profile icon"],
)
assert "XML/OCR Text Search Results are:" in result["text"]
assert "Text Search Results are:" in result["text"]
assert "Coordinate Search Results are:" in result["text"]
assert "Object Detection Results are:" in result["text"]
@@ -339,7 +339,7 @@ async def test_swipe_happy_path_direction(mock_context, mock_controller):
ctx=mock_context,
)
assert "Swipe completed successfully" in outcome
mock_controller.swipe_coords.assert_called_once_with(648, 1920, 648, 480, 400)
mock_controller.swipe_coords.assert_called_once_with(648, 1680, 648, 720, 400)
@pytest.mark.asyncio
+3 -3
View File
@@ -158,7 +158,7 @@ async def test_perform_action_validation():
assert err is None
assert actions[0]["action"] == "swipe"
assert len(actions[0]["coordinates"]) == 4
assert actions[0]["duration"] == 380
assert actions[0]["duration"] == 800
# Test click with float target index (coercion)
actions, err = node._translate_and_validate_tool(
@@ -1547,7 +1547,7 @@ async def test_operator_swipe_translation():
assert err is None
assert len(actions) == 1
assert actions[0]["action"] == "swipe"
assert actions[0]["coordinates"] == [648, 1920, 648, 480]
assert actions[0]["coordinates"] == [648, 1680, 648, 720]
# 2. Start & End coordinate swipe (drag)
actions, err = node._translate_and_validate_tool(
@@ -1587,4 +1587,4 @@ async def test_operator_swipe_translation():
assert err is None
assert len(actions) == 1
assert actions[0]["action"] == "swipe"
assert actions[0]["coordinates"] == [648, 480, 648, 1920]
assert actions[0]["coordinates"] == [648, 720, 648, 1680]
@@ -0,0 +1,87 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from unittest.mock import MagicMock
from artemis.graph.graph import check_plan_mutation_rejections
from artemis.graph.state import State
def test_check_plan_mutation_incomplete_nested():
content_before = "- [/] Main task\n - [ ] Subtask 1"
content_after = "- [x] Main task\n - [ ] Subtask 1"
res = check_plan_mutation_rejections(content_before, content_after)
assert res is not None
assert "goals in the task plan that have not been marked as completed" in res
def test_check_plan_mutation_delete_continuous_loop():
content_before = (
"- [x] Open app\n"
"- [/] [Loop] Periodically monitor for new emails "
"(Exit: Continuous monitoring until manually stopped; Interval: every 5 minutes)\n"
" - [x] Polling Check #1: Done"
)
content_after = (
"- [x] Open app\n"
"- [x] Monitor for new emails\n"
" - [x] Baseline established\n"
" - [x] Polling Check #1: Done"
)
res = check_plan_mutation_rejections(content_before, content_after)
assert res is not None
assert "cannot delete an active [Loop]" in res
def test_check_plan_mutation_mark_continuous_loop_completed():
content_before = (
"- [x] Open app\n"
"- [/] [Loop] Periodically monitor for new emails "
"(Exit: Continuous monitoring until manually stopped; Interval: every 5 minutes)\n"
" - [x] Polling Check #1: Done"
)
content_after = (
"- [x] Open app\n"
"- [x] [Loop] Periodically monitor for new emails "
"(Exit: Continuous monitoring until manually stopped; Interval: every 5 minutes)\n"
" - [x] Polling Check #1: Done"
)
res = check_plan_mutation_rejections(content_before, content_after)
assert res is not None
assert "cannot be unilaterally marked as completed [x]" in res
def test_check_plan_mutation_user_stopped_allowed():
content_before = (
"- [x] Open app\n"
"- [/] [Loop] Periodically monitor for new emails "
"(Exit: Continuous monitoring until manually stopped; Interval: every 5 minutes)\n"
" - [x] Polling Check #1: Done"
)
content_after = (
"- [x] Open app\n"
"- [x] [Loop] Periodically monitor for new emails "
"(Exit: Continuous monitoring until manually stopped; Interval: every 5 minutes)\n"
" - [x] Polling Check #1: Done"
)
state = MagicMock(spec=State)
state.injected_instruction = "Please stop the task now."
res = check_plan_mutation_rejections(content_before, content_after, state=state)
assert res is None
def test_check_plan_mutation_normal_bounded_task():
content_before = "- [ ] Open Settings\n- [ ] Toggle WiFi"
content_after = "- [x] Open Settings\n- [x] Toggle WiFi"
res = check_plan_mutation_rejections(content_before, content_after)
assert res is None
+3 -3
View File
@@ -28,7 +28,7 @@ async def test_video_analyzer_run():
mock_ctx.data_engine = None
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.utils.video_analyzer = MagicMock()
mock_ctx.llm_config.utils.video_analyzer.model = "gemini-3.6-flash"
mock_ctx.llm_config.utils.video_analyzer.model = "gemini-3.7-flash"
# Mock Gemini Client
mock_client = MagicMock()
@@ -79,7 +79,7 @@ async def test_video_analyzer_preserves_thought_signature():
mock_ctx.data_engine = None
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.utils.video_analyzer = MagicMock()
mock_ctx.llm_config.utils.video_analyzer.model = "gemini-3.6-flash"
mock_ctx.llm_config.utils.video_analyzer.model = "gemini-3.7-flash"
# Mock MobileDeviceController
mock_controller = MagicMock()
@@ -255,7 +255,7 @@ async def test_video_analyzer_sub_agent_confidence_validation():
mock_ctx.data_engine = None
mock_ctx.llm_config = MagicMock()
mock_ctx.llm_config.utils.video_analyzer = MagicMock()
mock_ctx.llm_config.utils.video_analyzer.model = "gemini-3.6-flash"
mock_ctx.llm_config.utils.video_analyzer.model = "gemini-3.7-flash"
# Mock MobileDeviceController
mock_controller = MagicMock()