-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.py
241 lines (205 loc) · 6.68 KB
/
request.py
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
from turtle import isvisible
from xmlrpc.client import Boolean
from pydantic import BaseModel
from typing import List, Optional, Dict
from enum import Enum
class Vector2(BaseModel):
x: float
y: float
class GameConstants(BaseModel):
distanceUnit: str
peopleSize: float
EntityId = str
AgentId = str
SimulationId = str
class ActionType(Enum):
UseToolToDamageEntity = "UseToolToDamageEntity"
UseToolToKillEntity = "UseToolToKillEntity"
PlaceGrowableInGrower = "PlaceGrowableInGrower"
DropItem = "DropItem"
PickUpItem = "PickUpItem"
UseEquippedTool = "UseEquippedTool"
EquipItem = "EquipItem"
UnequipItem = "UnequipItem"
Speak = "Speak"
Thought = "Thought"
Craft = "Craft"
class ActionResultType(Enum):
Success = "Success"
Failed = "Failed"
NoValidAction = "NoValidAction"
TargetNotAnItem = "TargetNotAnItem"
UnexpectedItemInStack = "UnexpectedItemInStack"
UnexpectedEquippedItem = "UnexpectedEquippedItem"
StillTooFarAfterMoving = "StillTooFarAfterMoving"
FailedToMoveForAction = "FailedToMoveForAction"
TargetNoLongerExists = "TargetNoLongerExists"
InvalidTargetEntityId = "InvalidTargetEntityId"
TargetAlreadyDead = "TargetAlreadyDead"
NoToolItemEquipped = "NoToolItemEquipped"
Busy = "Busy"
Obstructed = "Obstructed"
NoActionForEquippedTool = "NoActionForEquippedTool"
ItemNotInInventory = "ItemNotInInventory"
UnexpectedAutoAction = "UnexpectedAutoAction"
CannotAfford = "CannotAfford"
ItemCannotBeCrafted = "ItemCannotBeCrafted"
class ItemCollectionEntry(BaseModel):
itemConfigKey: str
amount: int
class ItemCollection(BaseModel):
entries: List[ItemCollectionEntry] = []
class ObservedSpokenMessage(BaseModel):
entityId: EntityId
messageId: str
characterName: str
message: str
time: float
speakerLocation: Vector2
myLocation: Vector2
class MovementRecord(BaseModel):
startedAtTime: float
endPoint: Vector2
startPoint: Vector2
reason: Optional[str]
class ItemInfo(BaseModel):
name: str
description: str
itemConfigKey: str
class CharacterEntityInfo(BaseModel):
name: str
gender: str
skinColor: str
age: int
description: str
equippedItemInfo: Optional[ItemInfo] = None
hairColor: Optional[str] = None
hairStyle: Optional[str] = None
class ItemEntityInfo(BaseModel):
itemConfigKey: str
itemName: str
description: str
canBePickedUp: bool
amount: int
class DamageableEntityInfo(BaseModel):
damageableByEquippedToolItemConfigKey: Optional[str] = None
hp: int
class ActiveGrowthInfo(BaseModel):
growableItemConfigKey: str
growingIntoItemConfigKey: str
startTime: float
duration: float
class GrowerEntityInfo(BaseModel):
activeGrowthInfo: Optional[ActiveGrowthInfo] = None
canReceiveGrowableItemConfigKeys: List[str]
class EntityInfo(BaseModel):
observedAtSimulationTime: float
entityId: EntityId
location: Vector2
itemInfo: Optional[ItemEntityInfo] = None
damageableInfo: Optional[DamageableEntityInfo] = None
characterInfo: Optional[CharacterEntityInfo] = None
growerInfo: Optional[GrowerEntityInfo] = None
isStale: bool
isVisible: bool
class EntityInfoWrapper(BaseModel):
entityInfo: EntityInfo
serializedAsJavaScript: str
javaScriptVariableName: str
class SpawnedItemEntity(BaseModel):
amount: int
itemConfigKey: str
entityId: EntityId
class ActivityStreamEntry(BaseModel):
time: float
title: Optional[str] = None
message: Optional[str] = None
longMessage: Optional[str] = None
shouldReportToAi: bool
agentReason: Optional[str] = None
agentUniqueActionId: Optional[str] = None
actionType: Optional[ActionType] = None
actionResultType: Optional[ActionResultType] = None
actionItemConfigKey: Optional[str] = None
sourceItemConfigKey: Optional[str] = None
sourceLocation: Optional[Vector2] = None
sourceEntityId: Optional[EntityId] = None
targetEntityId: Optional[EntityId] = None
targetItemConfigKey: Optional[str] = None
resultItemConfigKey: Optional[str] = None
resultEntityId: Optional[EntityId] = None
onlyShowForPerspectiveEntity: bool
observedByEntityIds: Optional[List[EntityId]] = None
spawnedItems: Optional[List[SpawnedItemEntity]] = None
class ScriptExecutionError(BaseModel):
error: str
scriptId: str
class ActionResult(BaseModel):
actionUniqueId: str
class ObservedNewEntity(BaseModel):
entityInfoWrapper: EntityInfoWrapper
class ObservedEntityChanged(BaseModel):
entityInfoWrapper: EntityInfoWrapper
class ObservedEntityDestroyed(BaseModel):
entityId: EntityId
class EntityObservationEvent(BaseModel):
newEntity: Optional[ObservedNewEntity] = None
entityChanged: Optional[ObservedEntityChanged] = None
entityDestroyed: Optional[ObservedEntityDestroyed] = None
class Observations(BaseModel):
entityObservationEvents: List[EntityObservationEvent]
scriptExecutionErrors: List[ScriptExecutionError]
movementRecords: List[MovementRecord]
activityStreamEntries: List[ActivityStreamEntry]
actionResults: List[ActionResult]
startedActionUniqueIds: List[str]
class ItemStackInfo(BaseModel):
amount: int
itemConfigKey: str
itemName: str
itemDescription: str
canBeEquipped: bool
canBeDropped: bool
isEquipped: bool
spawnItemOnUseConfigKey: Optional[str] = None
class ItemStackInfoWrapper(BaseModel):
itemStackInfo: ItemStackInfo
serializedAsJavaScript: str
javaScriptVariableName: str
class InventoryInfo(BaseModel):
itemStacks: List[ItemStackInfoWrapper]
class SelfInfo(BaseModel):
entityInfoWrapper: EntityInfoWrapper
corePersonality: str
initialMemories: List[str]
observationRadius: float
inventoryInfo: InventoryInfo
equippedItemConfigKey: Optional[str] = None
class CraftingRecipeInfo(BaseModel):
itemConfigKey: str
itemName: str
description: str
cost: ItemCollection
amount: int
canCurrentlyAfford: bool
class CraftingRecipeInfoWrapper(BaseModel):
craftingRecipeInfo: CraftingRecipeInfo
serializedAsJavaScript: str
javaScriptVariableName: str
class GameSimulationInfo(BaseModel):
worldBounds: Vector2
craftingRecipeInfoWrappers: List[CraftingRecipeInfoWrapper]
class AgentSyncInput(BaseModel):
agentType: str
syncId: str
agentId: AgentId
simulationId: SimulationId
simulationTime: float
selfInfo: SelfInfo
newObservations: Observations
gameConstants: GameConstants
gameSimulationInfo: GameSimulationInfo
agentTypeScriptInterfaceString: str
mostRecentCompletedScriptId: Optional[str] = None
class AgentSyncRequest(BaseModel):
input: AgentSyncInput