forked from chienchuanw/gma2-mcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.py
More file actions
75 lines (63 loc) · 2.15 KB
/
Copy pathcommon.py
File metadata and controls
75 lines (63 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Copyright (c) 2025-2026 thisis-romar. All rights reserved.
# Licensed under the Business Source License 1.1. See LICENSE file.
"""Common workflow building blocks — label, verify, discover.
Shared step builders used across patch, preset, and playback workflows.
"""
from __future__ import annotations
from src.agent.state import PlanStep
from src.vocab import RiskTier
def build_label_step(
object_type: str,
object_id: int | str,
name: str,
*,
depends_on: list[str] | None = None,
) -> PlanStep:
"""Build a step that labels an object."""
return PlanStep(
tool_name="label_or_appearance",
tool_args={
"object_type": object_type,
"object_id": int(object_id) if str(object_id).isdigit() else object_id,
"name": name,
"action": "label",
},
description=f'Label {object_type} {object_id} as "{name}"',
risk_tier=RiskTier.DESTRUCTIVE,
depends_on=depends_on or [],
)
def build_verify_step(
verify_tool: str,
description: str,
*,
tool_args: dict | None = None,
depends_on: list[str] | None = None,
) -> PlanStep:
"""Build a verification step that inspects console state."""
return PlanStep(
tool_name=verify_tool,
tool_args=tool_args or {},
description=f"Verify: {description}",
risk_tier=RiskTier.SAFE_READ,
depends_on=depends_on or [],
)
def build_discover_names_steps(
destination: str,
) -> list[PlanStep]:
"""Build steps for discovering object names at a pool destination."""
discover = PlanStep(
tool_name="discover_object_names",
tool_args={"destination": destination},
description=f"Discover object names at {destination}",
risk_tier=RiskTier.SAFE_READ,
)
return [discover]
def build_get_location_step(*, depends_on: list[str] | None = None) -> PlanStep:
"""Build a step that queries the current console location."""
return PlanStep(
tool_name="get_console_location",
tool_args={},
description="Get current console location",
risk_tier=RiskTier.SAFE_READ,
depends_on=depends_on or [],
)