From 49ad589c2dac65a36102985dae3e062727c810f2 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Tue, 7 Jul 2026 08:30:49 +0800 Subject: [PATCH] fix(semantic-scene): move describe_screen_semantic out of the tools/ layer tools/ is a Hexagonal inner layer that must never depend on LLM concerns (ADR 0002), but describe_screen_semantic.py imported semantic.enricher, which pulls in the Anthropic client by default. Relocated the wrapper to runtime/, which is where LLM-dependent code is allowed to live; updated the tool registry and all test imports accordingly. No behavior change. openspec: semantic-scene capability, archived change semantic-scene-runtime --- {tools => runtime}/describe_screen_semantic.py | 0 runtime/executor.py | 2 +- tests/test_describe_screen_semantic.py | 2 +- tests/test_semantic_task_loop.py | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename {tools => runtime}/describe_screen_semantic.py (100%) diff --git a/tools/describe_screen_semantic.py b/runtime/describe_screen_semantic.py similarity index 100% rename from tools/describe_screen_semantic.py rename to runtime/describe_screen_semantic.py diff --git a/runtime/executor.py b/runtime/executor.py index 4a785c8..94d31a2 100644 --- a/runtime/executor.py +++ b/runtime/executor.py @@ -109,8 +109,8 @@ def default_tool_registry( *, manager: DeviceManager | None = None, ) -> dict[str, ToolCallable]: + from runtime.describe_screen_semantic import describe_screen_semantic from tools.describe_screen import describe_screen - from tools.describe_screen_semantic import describe_screen_semantic from tools.find_icon import find_icon, find_icon_on_screen from tools.find_text import find_text, find_text_on_screen from tools.input_text import input_text diff --git a/tests/test_describe_screen_semantic.py b/tests/test_describe_screen_semantic.py index 578a5d9..c1a4c3a 100644 --- a/tests/test_describe_screen_semantic.py +++ b/tests/test_describe_screen_semantic.py @@ -6,8 +6,8 @@ from core.models import Bounds, Scene, SceneElement from device.manager import DeviceManager from semantic.config import SemanticConfig from semantic.llm_client import EnrichmentUnavailable +from runtime.describe_screen_semantic import describe_screen_semantic from tools.describe_screen import describe_screen -from tools.describe_screen_semantic import describe_screen_semantic from tests.fakes import FakeDriver diff --git a/tests/test_semantic_task_loop.py b/tests/test_semantic_task_loop.py index afe93ae..c311d27 100644 --- a/tests/test_semantic_task_loop.py +++ b/tests/test_semantic_task_loop.py @@ -6,12 +6,12 @@ import pytest from core.models import Bounds, Scene, SceneElement, Task from device.manager import DeviceManager +from runtime.describe_screen_semantic import describe_screen_semantic from runtime.executor import Executor, ExecutorConfig from runtime.planner import PlannedStep, Planner from runtime.task import TaskRunner, TaskRunnerConfig from semantic.config import SemanticConfig from semantic.llm_client import EnrichmentUnavailable -from tools.describe_screen_semantic import describe_screen_semantic from tests.fakes import FakeDriver, PNG_10X20