File size: 2,664 Bytes
362bbff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Data models for the Shopify Store Audit & Remediation Environment.

Defines the Action and Observation types that agents use to interact
with a simulated Shopify store, mirroring real Admin GraphQL API patterns.
"""

from typing import Any, Dict, List

from openenv.core.env_server.types import Action, Observation
from pydantic import Field


class ShopifyStoreAuditAction(Action):
    """Agent action that mirrors a Shopify Admin API operation.

    Commands map to real Shopify GraphQL mutations/queries:
      - query_products, query_product β†’ products / product query
      - query_collections, query_collection β†’ collections query
      - query_inventory β†’ inventoryLevels query
      - query_orders β†’ orders query
      - query_store_health β†’ custom diagnostic summary
      - update_product β†’ productUpdate mutation
      - update_variant β†’ productVariantUpdate mutation
      - update_product_seo β†’ productUpdate (seo fields)
      - update_image_alt_text β†’ productImageUpdate mutation
      - update_collection β†’ collectionUpdate mutation
      - add_product_to_collection β†’ collectionAddProducts mutation
      - remove_product_from_collection β†’ collectionRemoveProducts mutation
      - adjust_inventory β†’ inventoryAdjustQuantities mutation
      - update_metafield β†’ metafieldsSet mutation
      - publish_product β†’ publishablePublish mutation
    """

    command: str = Field(
        ...,
        description="API command to execute, e.g. 'query_products', 'update_product'",
    )
    params: Dict[str, Any] = Field(
        default_factory=dict,
        description="Command parameters (varies by command)",
    )


class ShopifyStoreAuditObservation(Observation):
    """Observation returned after each environment step.

    Contains both human-readable feedback and structured data so that
    LLM agents can reason about the store state and decide next actions.
    """

    message: str = Field(default="", description="Human-readable result description")
    data: Dict[str, Any] = Field(
        default_factory=dict, description="Structured API response data"
    )
    issues_remaining: int = Field(default=0, description="Unfixed issues count")
    issues_fixed: int = Field(default=0, description="Issues fixed so far")
    total_issues: int = Field(default=0, description="Total issues in this task")
    store_health_score: float = Field(
        default=0.0, description="Store health 0.0-1.0"
    )
    available_commands: List[str] = Field(
        default_factory=list, description="Commands the agent can use"
    )
    task_name: str = Field(default="", description="Current task identifier")