Spaces:
Sleeping
Sleeping
Create data_structures.py
Browse files- data_structures.py +71 -0
data_structures.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel, Field
|
| 2 |
+
from typing import List, Dict, Optional, Union, Literal
|
| 3 |
+
|
| 4 |
+
# --- 1. THE MATTER FORMAT (For 3D/World Agents) ---
|
| 5 |
+
class Vector3(BaseModel):
|
| 6 |
+
x: float
|
| 7 |
+
y: float
|
| 8 |
+
z: float
|
| 9 |
+
|
| 10 |
+
class MatterObject(BaseModel):
|
| 11 |
+
id: str = Field(description="Unique ID for this specific part")
|
| 12 |
+
group_id: Optional[str] = Field(None, description="Logical grouping (e.g., 'Lobby_Wall_North')")
|
| 13 |
+
class_name: str = Field("Part", description="Roblox ClassName: Part, MeshPart, WedgePart")
|
| 14 |
+
|
| 15 |
+
# Transform
|
| 16 |
+
position: Vector3
|
| 17 |
+
rotation: Vector3
|
| 18 |
+
size: Vector3
|
| 19 |
+
|
| 20 |
+
# Appearance
|
| 21 |
+
color_hex: str = "#A3A2A5"
|
| 22 |
+
material: str = "Plastic"
|
| 23 |
+
transparency: float = 0.0
|
| 24 |
+
reflectance: float = 0.0
|
| 25 |
+
|
| 26 |
+
# External Assets
|
| 27 |
+
mesh_id: Optional[str] = None
|
| 28 |
+
texture_id: Optional[str] = None
|
| 29 |
+
|
| 30 |
+
class MatterManifest(BaseModel):
|
| 31 |
+
"""The output of the 3D Artist or World Builder."""
|
| 32 |
+
assets: List[MatterObject]
|
| 33 |
+
|
| 34 |
+
# --- 2. THE PROJECT FLOW FORMAT (For PM/Supervisors) ---
|
| 35 |
+
class TaskNode(BaseModel):
|
| 36 |
+
task_id: str
|
| 37 |
+
title: str
|
| 38 |
+
role_required: Literal["PROJECT_MANAGER", "SUPERVISOR_WORLD", "SUPERVISOR_SCRIPT", "3D_ARTIST", "SCRIPTING_ENGINEER", "ERRANDS"]
|
| 39 |
+
instruction: str
|
| 40 |
+
assigned_instance_id: Optional[str] = None # Which specific agent instance handles this
|
| 41 |
+
|
| 42 |
+
# Recursive dependency structure
|
| 43 |
+
subtasks: List['TaskNode'] = []
|
| 44 |
+
dependencies: List[str] = [] # IDs of tasks that must finish first
|
| 45 |
+
|
| 46 |
+
class ProjectFlow(BaseModel):
|
| 47 |
+
"""The Master GDD (Game Design Document) and Execution Plan."""
|
| 48 |
+
project_id: str
|
| 49 |
+
game_concept_summary: str
|
| 50 |
+
root_tasks: List[TaskNode]
|
| 51 |
+
|
| 52 |
+
# --- 3. COMMUNICATION PROTOCOLS ---
|
| 53 |
+
class AgentMessage(BaseModel):
|
| 54 |
+
id: str
|
| 55 |
+
from_agent: str
|
| 56 |
+
to_agents: List[str] # Visibility Constraint
|
| 57 |
+
role: str # 'user' or 'model' (Gemini format)
|
| 58 |
+
content: str # Text or JSON string
|
| 59 |
+
image_base64: Optional[str] = None # For reference injection
|
| 60 |
+
|
| 61 |
+
class GenerationRequest(BaseModel):
|
| 62 |
+
agent_type: str
|
| 63 |
+
agent_instance_id: str
|
| 64 |
+
prompt: str
|
| 65 |
+
|
| 66 |
+
# The Visibility Layer
|
| 67 |
+
# The agent responding needs to know who they are talking to
|
| 68 |
+
# to filter history correctly.
|
| 69 |
+
conversation_partner_id: str
|
| 70 |
+
|
| 71 |
+
image_base64: Optional[str] = None # If the prompt includes an image
|