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

+12 -2
View File
@@ -67,11 +67,18 @@ def _init_llm_and_prompt(ctx: ArtemisContext, get_llm_fn):
def _describe_target(action_item: dict) -> str:
"""Describe the structured action target for the pixel judge."""
"""Describe the structured action target for the pixel judge.
Three kinds, keyed on provenance: an index-addressed target carries observed
element metadata; a coordinate target carries only the Operator's own
statement of what it aimed at (``target_description``); a legacy record may
carry neither.
"""
label = action_item.get("target_text")
resource_id = action_item.get("target_resource_id")
class_name = action_item.get("target_class")
bounds = action_item.get("target_bounds")
description = action_item.get("target_description")
lines = ["[Target]", f"Action: {action_item.get('action')}"]
if label or resource_id or class_name or bounds:
lines.append("Kind: specific UI control")
@@ -85,9 +92,12 @@ def _describe_target(action_item: dict) -> str:
lines.append("Label: (unlabelled; identify it by its shape in Image 1)")
if bounds:
lines.append(f"Bounds at decision time: {bounds}")
elif description:
lines.append("Kind: described target")
lines.append(f"Operator's description: {description}")
else:
lines.append(
"Kind: coordinates only (no UI hierarchy element was found under the point;"
"Kind: coordinates only (no target metadata recorded;"
" inspect Image 1 for a control at the red dot)"
)
return "\n".join(lines)