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:
1 parent
78e478f502
commit
9a5aaf99b7
249 files changed
+37226
-9339
No files matched your search
+27
-12
@@ -30,13 +30,33 @@ def get_http_client() -> httpx.AsyncClient:
|
||||
return _HTTP_CLIENT
|
||||
|
||||
|
||||
def is_ocr_configured() -> bool:
|
||||
"""Checks if a valid Google Vision OCR API key is configured."""
|
||||
ocr_secret = settings.get_api_key("ocr")
|
||||
if ocr_secret and ocr_secret.get_secret_value().strip():
|
||||
val = ocr_secret.get_secret_value().strip()
|
||||
if val not in ("API_KEY", "your_google_cloud_vision_api_key_here"):
|
||||
return True
|
||||
for env_var in ("OCR_API_KEY", "VISION_API_KEY"):
|
||||
val = os.environ.get(env_var)
|
||||
if (
|
||||
val
|
||||
and val.strip()
|
||||
and val.strip() not in ("API_KEY", "your_google_cloud_vision_api_key_here")
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
async def perform_ocr(
|
||||
screenshot_b64: str, client: httpx.AsyncClient = None
|
||||
screenshot_b64: str,
|
||||
client: httpx.AsyncClient | None = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Calls Google Vision API for OCR using a persistent client to reuse TLS handshakes.
|
||||
"""Calls Google Vision API for text recognition on an image.
|
||||
|
||||
Args:
|
||||
screenshot_b64: Base64 encoded screenshot image.
|
||||
client: Optional persistent httpx.AsyncClient.
|
||||
|
||||
Returns:
|
||||
A list of dictionaries containing detected text and position vertices.
|
||||
@@ -46,10 +66,9 @@ async def perform_ocr(
|
||||
(ocr_secret.get_secret_value() if ocr_secret else None)
|
||||
or os.environ.get("OCR_API_KEY")
|
||||
or os.environ.get("VISION_API_KEY")
|
||||
or os.environ.get("API_KEY")
|
||||
or os.environ.get("GOOGLE_API_KEY")
|
||||
or "API_KEY"
|
||||
)
|
||||
if not api_key:
|
||||
return []
|
||||
|
||||
url = f"https://vision.googleapis.com/v1/images:annotate?key={api_key}"
|
||||
headers = {"Content-Type": "application/json"}
|
||||
@@ -62,13 +81,9 @@ async def perform_ocr(
|
||||
]
|
||||
}
|
||||
|
||||
try:
|
||||
active_client = client if client is not None else get_http_client()
|
||||
response = await active_client.post(url, json=data, headers=headers, timeout=30.0)
|
||||
return _parse_ocr_response(response)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to call Vision API for OCR: {e}")
|
||||
raise e
|
||||
active_client = client if client is not None else get_http_client()
|
||||
response = await active_client.post(url, json=data, headers=headers, timeout=30.0)
|
||||
return _parse_ocr_response(response)
|
||||
|
||||
|
||||
def _parse_ocr_response(response: httpx.Response) -> list[dict[str, Any]]:
|
||||
|
||||
Reference in new issue
Block a user