feat: add agentic video analysis and clarify action results

Report device actions as dispatched and preserve full failure details. Route
Flash through McpActionExecutor and use ToolFailure across helper tools and
agent loops instead of inferring failure from response text.

Require model-provided descriptions for coordinate targets. Keep observed
element metadata separate from those descriptions in safety checks, visual
summaries, history, and frontend labels.

Add Gemini Interactions API video analysis with configurable processing mode,
chunk size, and timeouts. Centralize Google provider capabilities and token
usage normalization, and update google-genai to 2.22.0.

Preserve system instructions on follow-up interactions, replan pending chunks
when falling back to static processing, and reject unanswered native video
and audio segments instead of caching placeholder results. Keep helper-tool
failure status intact through history tools and committee calls.

Validation: 1,762 Python unit tests passed (3 skipped), 40 frontend formatter
tests passed, and the production UI build completed. Ruff lint, formatting,
the quality ratchet, and git diff checks passed.
This commit is contained in:
somew1nd committed 2026-09-08 17:05:54 -07:00
1 parent 611d1a0947
commit a45daf23f8
120 files changed
+6301 -1710

No files matched your search

+6 -3
View File
@@ -18,6 +18,7 @@ from typing import Any
from langchain_core.tools import BaseTool
from pydantic import BaseModel
from artemis.core.tool_failure import ToolFailure
from artemis.context import ArtemisContext
from artemis.data_engine.trace import trace_langchain_tool
from artemis.drivers.base import BaseDeviceDriver
@@ -75,16 +76,18 @@ class GetUiHierarchyTool(ArtemisTool):
xml_hierarchy = getattr(screen_data, "ui_hierarchy_xml", None)
if xml_hierarchy:
return str(xml_hierarchy)
return "Error retrieving UI hierarchy: No UI hierarchy in screen data."
return ToolFailure("Error retrieving UI hierarchy: No UI hierarchy in screen data.")
if driver is not None and hasattr(driver, "get_ui_hierarchy"):
xml_hierarchy = await driver.get_ui_hierarchy()
if inspect.iscoroutine(xml_hierarchy):
xml_hierarchy = await xml_hierarchy
return str(xml_hierarchy)
return "Error retrieving UI hierarchy: No UI Automator client or driver provided."
return ToolFailure(
"Error retrieving UI hierarchy: No UI Automator client or driver provided."
)
except Exception as e: # pylint: disable=broad-exception-caught
logger.error(f"Failed to get UI hierarchy: {e}")
return f"Error retrieving UI hierarchy: {e}"
return ToolFailure(f"Error retrieving UI hierarchy: {e}")
# Universal tool instance & aliases