@your-world/cli 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/action-submit.js +1 -1
- package/dist/cli/action-submit.js.map +1 -1
- package/dist/cli/play-status.js +20 -2
- package/dist/cli/play-status.js.map +1 -1
- package/dist/cli/rules.js +1 -1
- package/dist/cli/rules.js.map +1 -1
- package/dist/cli/shared.js +15 -2
- package/dist/cli/shared.js.map +1 -1
- package/dist/config/credential-store.js +1 -1
- package/dist/config/credential-store.js.map +1 -1
- package/dist/generated/common/index.d.ts +3 -0
- package/dist/generated/common/index.js +21 -0
- package/dist/generated/common/index.js.map +1 -0
- package/dist/generated/common/json.d.ts +20 -0
- package/dist/generated/common/json.js +263 -0
- package/dist/generated/common/json.js.map +1 -0
- package/dist/generated/common/talents.d.ts +16 -0
- package/dist/generated/common/talents.js +30 -0
- package/dist/generated/common/talents.js.map +1 -0
- package/dist/generated/common/types.d.ts +1102 -0
- package/dist/generated/common/types.js +91 -0
- package/dist/generated/common/types.js.map +1 -0
- package/dist/prompting/turn-summary.js.map +1 -1
- package/dist/runtime/player-runtime.js +1 -1
- package/dist/runtime/player-runtime.js.map +1 -1
- package/dist/runtime/session-store.js +1 -1
- package/dist/runtime/session-store.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/world-client.js +1 -1
- package/dist/world-client.js.map +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,1102 @@
|
|
|
1
|
+
import { AgentTalents, AgentTalentViews, TalentId } from './talents';
|
|
2
|
+
export type Direction = 'north' | 'east' | 'south' | 'west';
|
|
3
|
+
export type WorldVerb = 'move' | 'gather' | 'plant' | 'harvest' | 'consume' | 'process' | 'build' | 'supply' | 'construct' | 'transfer' | 'execute_contract' | 'trade_create' | 'trade_accept' | 'trade_cancel' | 'attack' | 'create_organization' | 'invite_to_organization' | 'accept_organization_invite' | 'set_recipe' | 'set_contract' | 'start_work' | 'stop_work';
|
|
4
|
+
export declare const WORLD_VERBS: readonly ["move", "gather", "plant", "harvest", "consume", "process", "build", "supply", "construct", "transfer", "execute_contract", "trade_create", "trade_accept", "trade_cancel", "attack", "create_organization", "invite_to_organization", "accept_organization_invite", "set_recipe", "set_contract", "start_work", "stop_work"];
|
|
5
|
+
export declare function isWorldVerb(input: string): input is WorldVerb;
|
|
6
|
+
export type WithdrawLevel = 'owner' | 'organization' | 'public';
|
|
7
|
+
export type OwnerRef = {
|
|
8
|
+
kind: 'agent';
|
|
9
|
+
agentId: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'organization';
|
|
12
|
+
organizationId: string;
|
|
13
|
+
};
|
|
14
|
+
export type PartyRef = OwnerRef;
|
|
15
|
+
export interface AssetOwnership {
|
|
16
|
+
ownerRef: OwnerRef;
|
|
17
|
+
withdrawLevel: WithdrawLevel;
|
|
18
|
+
}
|
|
19
|
+
export interface Position {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}
|
|
23
|
+
export interface Footprint {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
}
|
|
27
|
+
export type TerrainType = 'forest' | 'plain' | 'mountain' | 'water';
|
|
28
|
+
export declare const TERRAIN_TYPES: readonly ["forest", "plain", "mountain", "water"];
|
|
29
|
+
export declare function isTerrainType(value: string): value is TerrainType;
|
|
30
|
+
export interface StructureTraversal {
|
|
31
|
+
passable: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface StorageSpec {
|
|
34
|
+
capacityGrams: number;
|
|
35
|
+
}
|
|
36
|
+
export interface StructureCapabilities {
|
|
37
|
+
canProcess?: boolean;
|
|
38
|
+
canBuildStarter?: boolean;
|
|
39
|
+
canTransfer?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export type StructureBehavior = {
|
|
42
|
+
kind: 'static';
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'gate';
|
|
45
|
+
defaultOpen: boolean;
|
|
46
|
+
openPassable: boolean;
|
|
47
|
+
closedPassable: boolean;
|
|
48
|
+
};
|
|
49
|
+
export interface StructureRender {
|
|
50
|
+
tileId?: number;
|
|
51
|
+
connectionGroup?: string;
|
|
52
|
+
variant?: 'default' | 'wall' | 'gate';
|
|
53
|
+
}
|
|
54
|
+
export type StructureRuntimeState = {
|
|
55
|
+
kind: 'static';
|
|
56
|
+
} | {
|
|
57
|
+
kind: 'gate';
|
|
58
|
+
open: boolean;
|
|
59
|
+
};
|
|
60
|
+
export interface ItemStack {
|
|
61
|
+
itemId: string;
|
|
62
|
+
amount: number;
|
|
63
|
+
tags?: string[];
|
|
64
|
+
toolType?: 'axe' | 'pickaxe' | 'drill';
|
|
65
|
+
gatherBonus?: number;
|
|
66
|
+
miningPower?: number;
|
|
67
|
+
durability?: number;
|
|
68
|
+
maxDurability?: number;
|
|
69
|
+
}
|
|
70
|
+
export interface AgentState {
|
|
71
|
+
agentId: string;
|
|
72
|
+
position: Position;
|
|
73
|
+
hunger: number;
|
|
74
|
+
stamina: number;
|
|
75
|
+
inventory: ItemStack[];
|
|
76
|
+
talents: AgentTalents;
|
|
77
|
+
}
|
|
78
|
+
export interface ResourceNode {
|
|
79
|
+
resourceId: string;
|
|
80
|
+
resourceTypeId: string;
|
|
81
|
+
nodeArchetypeId: string;
|
|
82
|
+
itemId: string;
|
|
83
|
+
miningDifficulty?: number;
|
|
84
|
+
position: Position;
|
|
85
|
+
amount: number;
|
|
86
|
+
maxAmount: number;
|
|
87
|
+
regenPerTick: number;
|
|
88
|
+
regenIntervalTicks?: number;
|
|
89
|
+
renderTileId?: number;
|
|
90
|
+
}
|
|
91
|
+
export type CropStageId = 'growing' | 'mature';
|
|
92
|
+
export declare const CROP_STAGE_IDS: readonly ["growing", "mature"];
|
|
93
|
+
export declare function isCropStageId(value: string): value is CropStageId;
|
|
94
|
+
export interface CropState {
|
|
95
|
+
cropId: string;
|
|
96
|
+
cropTypeId: string;
|
|
97
|
+
position: Position;
|
|
98
|
+
plantedTick: number;
|
|
99
|
+
matureTick: number;
|
|
100
|
+
stage: CropStageId;
|
|
101
|
+
}
|
|
102
|
+
export interface StructureState {
|
|
103
|
+
structureId: string;
|
|
104
|
+
structureTypeId: string;
|
|
105
|
+
origin: Position;
|
|
106
|
+
footprint: Footprint;
|
|
107
|
+
position: Position;
|
|
108
|
+
sourceBuildRecipeId?: string;
|
|
109
|
+
builderAgentId?: string;
|
|
110
|
+
ownerAgentId?: string;
|
|
111
|
+
ownerRef?: OwnerRef;
|
|
112
|
+
withdrawLevel?: WithdrawLevel;
|
|
113
|
+
hp: number;
|
|
114
|
+
inventory: ItemStack[];
|
|
115
|
+
state?: StructureRuntimeState;
|
|
116
|
+
}
|
|
117
|
+
export type BuildingProjectStage = 'frame' | 'supplied' | 'completed' | 'expired';
|
|
118
|
+
export interface BuildingProject {
|
|
119
|
+
projectId: string;
|
|
120
|
+
recipeId: string;
|
|
121
|
+
targetStructureTypeId: string;
|
|
122
|
+
origin: Position;
|
|
123
|
+
footprint: Footprint;
|
|
124
|
+
requiredInputs: ItemStack[];
|
|
125
|
+
deliveredInputs: ItemStack[];
|
|
126
|
+
requiredWork: number;
|
|
127
|
+
currentWork: number;
|
|
128
|
+
stage: BuildingProjectStage;
|
|
129
|
+
createdAtTick: number;
|
|
130
|
+
lastUpdatedTick: number;
|
|
131
|
+
builderAgentId: string;
|
|
132
|
+
ownerRef?: OwnerRef;
|
|
133
|
+
withdrawLevel?: WithdrawLevel;
|
|
134
|
+
frameReservationTicks: number;
|
|
135
|
+
reservedUntilTick: number;
|
|
136
|
+
completedStructureId?: string;
|
|
137
|
+
}
|
|
138
|
+
export type OrganizationRole = 'owner' | 'member';
|
|
139
|
+
export interface Organization {
|
|
140
|
+
organizationId: string;
|
|
141
|
+
name: string;
|
|
142
|
+
ownerAgentId: string;
|
|
143
|
+
createdAtTick: number;
|
|
144
|
+
memberAgentIds: string[];
|
|
145
|
+
}
|
|
146
|
+
export interface OrganizationMember {
|
|
147
|
+
organizationId: string;
|
|
148
|
+
agentId: string;
|
|
149
|
+
role: OrganizationRole;
|
|
150
|
+
joinedAtTick: number;
|
|
151
|
+
}
|
|
152
|
+
export interface OrganizationInvite {
|
|
153
|
+
organizationId: string;
|
|
154
|
+
targetAgentId: string;
|
|
155
|
+
invitedByAgentId: string;
|
|
156
|
+
createdAtTick: number;
|
|
157
|
+
}
|
|
158
|
+
export interface FactoryWorkerAssignment {
|
|
159
|
+
agentId: string;
|
|
160
|
+
startedAtTick: number;
|
|
161
|
+
contractId?: string;
|
|
162
|
+
partyRef?: PartyRef;
|
|
163
|
+
}
|
|
164
|
+
export interface Factory {
|
|
165
|
+
factoryId: string;
|
|
166
|
+
ownerRef: OwnerRef;
|
|
167
|
+
structureTypeId: string;
|
|
168
|
+
activeRecipeId?: string;
|
|
169
|
+
activeContractDefinitionIds: string[];
|
|
170
|
+
minWorkersToRun: number;
|
|
171
|
+
maxWorkers: number;
|
|
172
|
+
assignedWorkerAgentIds: string[];
|
|
173
|
+
workerAssignments?: Record<string, FactoryWorkerAssignment>;
|
|
174
|
+
lastProcessedTick?: number;
|
|
175
|
+
lastTickRuns?: number;
|
|
176
|
+
lastTickConsumed?: ItemStack[];
|
|
177
|
+
lastTickProduced?: ItemStack[];
|
|
178
|
+
pendingRecipeId?: string | null;
|
|
179
|
+
pendingWorkerAssignments?: Record<string, FactoryWorkerAssignment>;
|
|
180
|
+
}
|
|
181
|
+
export type ContractKind = 'supply' | 'employment';
|
|
182
|
+
export type ContractDefinitionStatus = 'draft' | 'open' | 'paused' | 'closed';
|
|
183
|
+
export type ContractInstanceStatus = 'fulfilled' | 'failed';
|
|
184
|
+
export interface EndpointRef {
|
|
185
|
+
endpointId: string;
|
|
186
|
+
}
|
|
187
|
+
export interface DeliverClause {
|
|
188
|
+
kind: 'deliver';
|
|
189
|
+
itemId: string;
|
|
190
|
+
amount: number;
|
|
191
|
+
source: EndpointRef;
|
|
192
|
+
destination: EndpointRef;
|
|
193
|
+
deliveryWindow: {
|
|
194
|
+
startTick: number;
|
|
195
|
+
endTick: number;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
export interface PayClause {
|
|
199
|
+
kind: 'pay';
|
|
200
|
+
itemId: string;
|
|
201
|
+
amount: number;
|
|
202
|
+
from: EndpointRef;
|
|
203
|
+
to: EndpointRef;
|
|
204
|
+
}
|
|
205
|
+
export interface WorkClause {
|
|
206
|
+
kind: 'work';
|
|
207
|
+
workType: 'factory-operator';
|
|
208
|
+
targetFactoryId: string;
|
|
209
|
+
}
|
|
210
|
+
export type ContractClause = DeliverClause | PayClause | WorkClause;
|
|
211
|
+
export interface ContractDefinition {
|
|
212
|
+
contractId: string;
|
|
213
|
+
kind: ContractKind;
|
|
214
|
+
status: ContractDefinitionStatus;
|
|
215
|
+
issuer: PartyRef;
|
|
216
|
+
createdAtTick: number;
|
|
217
|
+
clauses: ContractClause[];
|
|
218
|
+
linkedFactoryId?: string;
|
|
219
|
+
}
|
|
220
|
+
export interface ContractInstance {
|
|
221
|
+
contractInstanceId: string;
|
|
222
|
+
contractId: string;
|
|
223
|
+
kind: ContractKind;
|
|
224
|
+
status: ContractInstanceStatus;
|
|
225
|
+
requester: PartyRef;
|
|
226
|
+
provider: PartyRef;
|
|
227
|
+
createdAtTick: number;
|
|
228
|
+
settledAtTick: number;
|
|
229
|
+
linkedFactoryId?: string;
|
|
230
|
+
executionMode: 'explicit' | 'work-tick';
|
|
231
|
+
failureReason?: string;
|
|
232
|
+
}
|
|
233
|
+
export interface TradeOffer {
|
|
234
|
+
tradeId: string;
|
|
235
|
+
creatorAgentId: string;
|
|
236
|
+
toAgentId?: string;
|
|
237
|
+
give: ItemStack[];
|
|
238
|
+
receive: ItemStack[];
|
|
239
|
+
lockedGive: ItemStack[];
|
|
240
|
+
status: 'open' | 'accepted' | 'cancelled';
|
|
241
|
+
createdAtTick: number;
|
|
242
|
+
expiresAtTick?: number;
|
|
243
|
+
acceptedAtTick?: number;
|
|
244
|
+
acceptedByAgentId?: string;
|
|
245
|
+
cancelledAtTick?: number;
|
|
246
|
+
}
|
|
247
|
+
export interface WorldState {
|
|
248
|
+
worldId: string;
|
|
249
|
+
seed: number;
|
|
250
|
+
rngState: number;
|
|
251
|
+
catalogBaselineVersion?: string;
|
|
252
|
+
mapWidth: number;
|
|
253
|
+
mapHeight: number;
|
|
254
|
+
terrain: TerrainType[][];
|
|
255
|
+
tick: number;
|
|
256
|
+
nextAgentSeq: number;
|
|
257
|
+
nextStructureSeq: number;
|
|
258
|
+
nextProjectSeq: number;
|
|
259
|
+
nextTradeSeq: number;
|
|
260
|
+
nextCropSeq: number;
|
|
261
|
+
agents: Record<string, AgentState>;
|
|
262
|
+
resources: Record<string, ResourceNode>;
|
|
263
|
+
crops: Record<string, CropState>;
|
|
264
|
+
structures: Record<string, StructureState>;
|
|
265
|
+
buildingProjects: Record<string, BuildingProject>;
|
|
266
|
+
trades: Record<string, TradeOffer>;
|
|
267
|
+
organizations: Record<string, Organization>;
|
|
268
|
+
organizationInvites: Record<string, OrganizationInvite>;
|
|
269
|
+
factories: Record<string, Factory>;
|
|
270
|
+
contractDefinitions: Record<string, ContractDefinition>;
|
|
271
|
+
contractInstances: Record<string, ContractInstance>;
|
|
272
|
+
seenActionIds: Record<string, number>;
|
|
273
|
+
}
|
|
274
|
+
export type ActionObjectTarget = object;
|
|
275
|
+
export type ActionPrimitiveTarget = string | number;
|
|
276
|
+
export type ActionTarget = ActionPrimitiveTarget | ActionObjectTarget;
|
|
277
|
+
export type ActionParams = object;
|
|
278
|
+
interface ActionBase<Verb extends string, Target = never, Params = never> {
|
|
279
|
+
actionId?: string;
|
|
280
|
+
verb: Verb;
|
|
281
|
+
target?: Target;
|
|
282
|
+
params?: Params;
|
|
283
|
+
reason?: string;
|
|
284
|
+
}
|
|
285
|
+
export type MoveAction = ActionBase<'move', Position>;
|
|
286
|
+
export type GatherAction = ActionBase<'gather', string | {
|
|
287
|
+
resourceId?: string;
|
|
288
|
+
}>;
|
|
289
|
+
export type PlantAction = ActionBase<'plant', Position, {
|
|
290
|
+
cropTypeId?: string;
|
|
291
|
+
}>;
|
|
292
|
+
export type HarvestAction = ActionBase<'harvest', string | Position | {
|
|
293
|
+
cropId?: string;
|
|
294
|
+
}>;
|
|
295
|
+
export type ConsumeAction = ActionBase<'consume', never, {
|
|
296
|
+
itemId?: string;
|
|
297
|
+
amount?: number;
|
|
298
|
+
}>;
|
|
299
|
+
export type ProcessAction = ActionBase<'process', string | {
|
|
300
|
+
structureId?: string;
|
|
301
|
+
}, {
|
|
302
|
+
structureId?: string;
|
|
303
|
+
recipeId?: string;
|
|
304
|
+
amount?: number;
|
|
305
|
+
}>;
|
|
306
|
+
export type BuildAction = ActionBase<'build', Position, {
|
|
307
|
+
origin?: Position;
|
|
308
|
+
recipeId?: string;
|
|
309
|
+
ownerRef?: OwnerRef;
|
|
310
|
+
withdrawLevel?: WithdrawLevel;
|
|
311
|
+
}>;
|
|
312
|
+
export type SupplyAction = ActionBase<'supply', string | {
|
|
313
|
+
projectId?: string;
|
|
314
|
+
}, {
|
|
315
|
+
projectId?: string;
|
|
316
|
+
stacks?: ItemStack[];
|
|
317
|
+
}>;
|
|
318
|
+
export type ConstructAction = ActionBase<'construct', string | {
|
|
319
|
+
projectId?: string;
|
|
320
|
+
}, {
|
|
321
|
+
projectId?: string;
|
|
322
|
+
}>;
|
|
323
|
+
export type TransferAction = ActionBase<'transfer', string | {
|
|
324
|
+
structureId?: string;
|
|
325
|
+
}, {
|
|
326
|
+
structureId?: string;
|
|
327
|
+
direction?: 'deposit' | 'withdraw';
|
|
328
|
+
itemId?: string;
|
|
329
|
+
amount?: number;
|
|
330
|
+
contractId?: string;
|
|
331
|
+
partyRef?: PartyRef;
|
|
332
|
+
}>;
|
|
333
|
+
export type ExecuteContractAction = ActionBase<'execute_contract', string | {
|
|
334
|
+
structureId?: string;
|
|
335
|
+
}, {
|
|
336
|
+
factoryId?: string;
|
|
337
|
+
contractId?: string;
|
|
338
|
+
partyRef?: PartyRef;
|
|
339
|
+
}>;
|
|
340
|
+
export type CreateOrganizationAction = ActionBase<'create_organization', never, {
|
|
341
|
+
organizationId?: string;
|
|
342
|
+
name?: string;
|
|
343
|
+
}>;
|
|
344
|
+
export type InviteToOrganizationAction = ActionBase<'invite_to_organization', never, {
|
|
345
|
+
organizationId?: string;
|
|
346
|
+
targetAgentId?: string;
|
|
347
|
+
}>;
|
|
348
|
+
export type AcceptOrganizationInviteAction = ActionBase<'accept_organization_invite', never, {
|
|
349
|
+
organizationId?: string;
|
|
350
|
+
}>;
|
|
351
|
+
export type SetRecipeAction = ActionBase<'set_recipe', string | {
|
|
352
|
+
structureId?: string;
|
|
353
|
+
}, {
|
|
354
|
+
factoryId?: string;
|
|
355
|
+
recipeId?: string;
|
|
356
|
+
}>;
|
|
357
|
+
export interface DeliverClauseInput {
|
|
358
|
+
kind: 'deliver';
|
|
359
|
+
itemId?: string;
|
|
360
|
+
amount?: number;
|
|
361
|
+
source?: {
|
|
362
|
+
endpointId?: string;
|
|
363
|
+
};
|
|
364
|
+
destination?: {
|
|
365
|
+
endpointId?: string;
|
|
366
|
+
};
|
|
367
|
+
deliveryWindow?: {
|
|
368
|
+
startTick?: number;
|
|
369
|
+
endTick?: number;
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
export interface PayClauseInput {
|
|
373
|
+
kind: 'pay';
|
|
374
|
+
itemId?: string;
|
|
375
|
+
amount?: number;
|
|
376
|
+
from?: {
|
|
377
|
+
endpointId?: string;
|
|
378
|
+
};
|
|
379
|
+
to?: {
|
|
380
|
+
endpointId?: string;
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
export interface WorkClauseInput {
|
|
384
|
+
kind: 'work';
|
|
385
|
+
workType?: 'factory-operator';
|
|
386
|
+
targetFactoryId?: string;
|
|
387
|
+
}
|
|
388
|
+
export type ContractClauseInput = DeliverClauseInput | PayClauseInput | WorkClauseInput;
|
|
389
|
+
export interface ContractDefinitionInput {
|
|
390
|
+
contractId?: string;
|
|
391
|
+
kind?: ContractKind;
|
|
392
|
+
status?: ContractDefinitionStatus;
|
|
393
|
+
clauses?: ContractClauseInput[];
|
|
394
|
+
}
|
|
395
|
+
export type SetContractAction = ActionBase<'set_contract', string | {
|
|
396
|
+
structureId?: string;
|
|
397
|
+
}, {
|
|
398
|
+
factoryId?: string;
|
|
399
|
+
definition?: ContractDefinitionInput;
|
|
400
|
+
} & ContractDefinitionInput>;
|
|
401
|
+
export type StartWorkAction = ActionBase<'start_work', string | {
|
|
402
|
+
structureId?: string;
|
|
403
|
+
}, {
|
|
404
|
+
factoryId?: string;
|
|
405
|
+
contractId?: string;
|
|
406
|
+
partyRef?: PartyRef;
|
|
407
|
+
}>;
|
|
408
|
+
export type StopWorkAction = ActionBase<'stop_work', string | {
|
|
409
|
+
structureId?: string;
|
|
410
|
+
}, {
|
|
411
|
+
factoryId?: string;
|
|
412
|
+
}>;
|
|
413
|
+
export type TradeCreateAction = ActionBase<'trade_create', never, {
|
|
414
|
+
give?: ItemStack[];
|
|
415
|
+
receive?: ItemStack[];
|
|
416
|
+
toAgentId?: string;
|
|
417
|
+
tradeId?: string;
|
|
418
|
+
}>;
|
|
419
|
+
export type TradeAcceptAction = ActionBase<'trade_accept', string | {
|
|
420
|
+
tradeId?: string;
|
|
421
|
+
}, {
|
|
422
|
+
tradeId?: string;
|
|
423
|
+
}>;
|
|
424
|
+
export type TradeCancelAction = ActionBase<'trade_cancel', string | {
|
|
425
|
+
tradeId?: string;
|
|
426
|
+
}, {
|
|
427
|
+
tradeId?: string;
|
|
428
|
+
}>;
|
|
429
|
+
export type AttackAction = ActionBase<'attack', string | {
|
|
430
|
+
agentId?: string;
|
|
431
|
+
}>;
|
|
432
|
+
export type KnownAction = MoveAction | GatherAction | PlantAction | HarvestAction | ConsumeAction | ProcessAction | BuildAction | SupplyAction | ConstructAction | TransferAction | ExecuteContractAction | CreateOrganizationAction | InviteToOrganizationAction | AcceptOrganizationInviteAction | SetRecipeAction | SetContractAction | StartWorkAction | StopWorkAction | TradeCreateAction | TradeAcceptAction | TradeCancelAction | AttackAction;
|
|
433
|
+
export type Action = KnownAction;
|
|
434
|
+
export type ActionInput = ActionBase<string, ActionTarget, ActionParams>;
|
|
435
|
+
export interface QueuedAction {
|
|
436
|
+
actorId: string;
|
|
437
|
+
submitTick: number;
|
|
438
|
+
startTick: number;
|
|
439
|
+
action: Action;
|
|
440
|
+
}
|
|
441
|
+
export declare const WORLD_EVENT_TYPES: readonly ["agent_joined", "action_accepted", "action_ignored", "action_rejected", "move", "gather", "plant", "harvest", "process", "build", "frame_placed", "project_supply_progress", "project_supplied", "construction_progress", "construction_completed", "project_expired", "transfer", "execute_contract", "trade_create", "trade_accept", "trade_cancel", "attack", "crop_grow", "consume", "organization_created", "organization_member_added", "organization_member_role_changed", "asset_withdraw_denied", "factory_created", "factory_recipe_changed", "factory_contract_set", "factory_work_started", "factory_work_stopped", "factory_processed_tick", "contract_definition_created", "contract_definition_opened", "contract_definition_paused", "contract_definition_closed", "contract_instance_created", "contract_instance_settled", "contract_instance_failed", "tick_summary"];
|
|
442
|
+
export type WorldEventType = (typeof WORLD_EVENT_TYPES)[number];
|
|
443
|
+
export declare function isWorldEventType(input: string): input is WorldEventType;
|
|
444
|
+
type EventDataBase = Record<string, unknown>;
|
|
445
|
+
interface WorldEventBase<Type extends WorldEventType, Data extends EventDataBase = EventDataBase> {
|
|
446
|
+
eventId: string;
|
|
447
|
+
tick: number;
|
|
448
|
+
type: Type;
|
|
449
|
+
actorId?: string;
|
|
450
|
+
actionId?: string;
|
|
451
|
+
data: Data;
|
|
452
|
+
}
|
|
453
|
+
export type AgentJoinedEvent = WorldEventBase<'agent_joined', {
|
|
454
|
+
position: Position;
|
|
455
|
+
hunger: number;
|
|
456
|
+
stamina: number;
|
|
457
|
+
talents: AgentTalentViews;
|
|
458
|
+
} & EventDataBase>;
|
|
459
|
+
export type ActionAcceptedEvent = WorldEventBase<'action_accepted', {
|
|
460
|
+
verb: WorldVerb;
|
|
461
|
+
} & EventDataBase>;
|
|
462
|
+
export type ActionIgnoredEvent = WorldEventBase<'action_ignored', {
|
|
463
|
+
verb: WorldVerb;
|
|
464
|
+
reason: string;
|
|
465
|
+
factoryId?: string;
|
|
466
|
+
} & EventDataBase>;
|
|
467
|
+
export type ActionRejectedEvent = WorldEventBase<'action_rejected', {
|
|
468
|
+
code: string;
|
|
469
|
+
reason: string;
|
|
470
|
+
} & EventDataBase>;
|
|
471
|
+
export type MoveEvent = WorldEventBase<'move', {
|
|
472
|
+
from: Position;
|
|
473
|
+
to: Position;
|
|
474
|
+
} & EventDataBase>;
|
|
475
|
+
export type GatherEvent = WorldEventBase<'gather', {
|
|
476
|
+
resourceId: string;
|
|
477
|
+
resourceTypeId: string;
|
|
478
|
+
itemId: string;
|
|
479
|
+
miningDifficulty: number;
|
|
480
|
+
amount: number;
|
|
481
|
+
resourceRemaining: number;
|
|
482
|
+
position: Position;
|
|
483
|
+
toolItemId?: string;
|
|
484
|
+
toolType?: ItemStack['toolType'];
|
|
485
|
+
toolMiningPower?: number;
|
|
486
|
+
toolDurabilityAfter?: number;
|
|
487
|
+
bonusSeed: number;
|
|
488
|
+
bonusItemId?: string;
|
|
489
|
+
} & EventDataBase>;
|
|
490
|
+
export type PlantEvent = WorldEventBase<'plant', {
|
|
491
|
+
cropId: string;
|
|
492
|
+
cropTypeId: string;
|
|
493
|
+
position: Position;
|
|
494
|
+
matureTick: number;
|
|
495
|
+
} & EventDataBase>;
|
|
496
|
+
export type HarvestEvent = WorldEventBase<'harvest', {
|
|
497
|
+
cropId: string;
|
|
498
|
+
cropTypeId: string;
|
|
499
|
+
position: Position;
|
|
500
|
+
outputs: ItemStack[];
|
|
501
|
+
} & EventDataBase>;
|
|
502
|
+
export type ConsumeEvent = WorldEventBase<'consume', {
|
|
503
|
+
itemId: string;
|
|
504
|
+
amount: number;
|
|
505
|
+
consumedAmount: number;
|
|
506
|
+
spawnedItems: ItemStack[];
|
|
507
|
+
hungerAfter: number;
|
|
508
|
+
staminaAfter: number;
|
|
509
|
+
} & EventDataBase>;
|
|
510
|
+
export type ProcessEvent = WorldEventBase<'process', {
|
|
511
|
+
recipeId: string;
|
|
512
|
+
amount: number;
|
|
513
|
+
structureId?: string;
|
|
514
|
+
inputs: ItemStack[];
|
|
515
|
+
outputs: ItemStack[];
|
|
516
|
+
structureTypeId?: string;
|
|
517
|
+
} & EventDataBase>;
|
|
518
|
+
export type TransferEvent = WorldEventBase<'transfer', {
|
|
519
|
+
structureId: string;
|
|
520
|
+
direction: 'deposit' | 'withdraw';
|
|
521
|
+
itemId: string;
|
|
522
|
+
amount: number;
|
|
523
|
+
structureInventoryWeightGrams: number;
|
|
524
|
+
} & EventDataBase>;
|
|
525
|
+
export type TradeCreateEvent = WorldEventBase<'trade_create', {
|
|
526
|
+
tradeId: string;
|
|
527
|
+
toAgentId?: string;
|
|
528
|
+
give: ItemStack[];
|
|
529
|
+
receive: ItemStack[];
|
|
530
|
+
expiresAtTick?: number;
|
|
531
|
+
} & EventDataBase>;
|
|
532
|
+
export type TradeAcceptEvent = WorldEventBase<'trade_accept', {
|
|
533
|
+
tradeId: string;
|
|
534
|
+
creatorAgentId: string;
|
|
535
|
+
acceptedByAgentId: string;
|
|
536
|
+
give: ItemStack[];
|
|
537
|
+
receive: ItemStack[];
|
|
538
|
+
} & EventDataBase>;
|
|
539
|
+
export type TradeCancelEvent = WorldEventBase<'trade_cancel', {
|
|
540
|
+
tradeId: string;
|
|
541
|
+
creatorAgentId: string;
|
|
542
|
+
reason?: string;
|
|
543
|
+
expiresAtTick?: number;
|
|
544
|
+
} & EventDataBase>;
|
|
545
|
+
export type AttackEvent = WorldEventBase<'attack', {
|
|
546
|
+
targetAgentId: string;
|
|
547
|
+
damage: number;
|
|
548
|
+
attackerStaminaAfter: number;
|
|
549
|
+
targetStaminaAfter: number;
|
|
550
|
+
loot?: {
|
|
551
|
+
itemId: string;
|
|
552
|
+
amount: number;
|
|
553
|
+
durability?: number;
|
|
554
|
+
maxDurability?: number;
|
|
555
|
+
} | null;
|
|
556
|
+
} & EventDataBase>;
|
|
557
|
+
export type TickSummaryEvent = WorldEventBase<'tick_summary', {
|
|
558
|
+
tick: number;
|
|
559
|
+
queuedActions: number;
|
|
560
|
+
acceptedActions: number;
|
|
561
|
+
ignoredActions: number;
|
|
562
|
+
rejectedActions: number;
|
|
563
|
+
agentCount: number;
|
|
564
|
+
} & EventDataBase>;
|
|
565
|
+
export type LegacyBuildEvent = WorldEventBase<'build', {
|
|
566
|
+
structureType: string;
|
|
567
|
+
structureId: string;
|
|
568
|
+
position?: Position;
|
|
569
|
+
material?: string;
|
|
570
|
+
hp?: number;
|
|
571
|
+
} & EventDataBase>;
|
|
572
|
+
type ProjectEventDataBase = {
|
|
573
|
+
projectId: string;
|
|
574
|
+
recipeId: string;
|
|
575
|
+
targetStructureTypeId: string;
|
|
576
|
+
builderAgentId: string;
|
|
577
|
+
origin: Position;
|
|
578
|
+
footprint: Footprint;
|
|
579
|
+
stage: BuildingProjectStage;
|
|
580
|
+
deliveredInputs: ItemStack[];
|
|
581
|
+
requiredInputs: ItemStack[];
|
|
582
|
+
currentWork: number;
|
|
583
|
+
requiredWork: number;
|
|
584
|
+
reservedUntilTick: number;
|
|
585
|
+
} & EventDataBase;
|
|
586
|
+
export type FramePlacedEvent = WorldEventBase<'frame_placed', ProjectEventDataBase>;
|
|
587
|
+
export type ProjectSupplyProgressEvent = WorldEventBase<'project_supply_progress', ProjectEventDataBase & {
|
|
588
|
+
requestedStacks: ItemStack[];
|
|
589
|
+
appliedStacks: ItemStack[];
|
|
590
|
+
unusedStacks: Array<ItemStack & {
|
|
591
|
+
reason: string;
|
|
592
|
+
}>;
|
|
593
|
+
remainingRequiredInputsAfter: ItemStack[];
|
|
594
|
+
reservedUntilTickAfter: number;
|
|
595
|
+
}>;
|
|
596
|
+
export type ProjectSuppliedEvent = WorldEventBase<'project_supplied', ProjectEventDataBase & {
|
|
597
|
+
reservedUntilTickAfter: number;
|
|
598
|
+
}>;
|
|
599
|
+
export type ConstructionProgressEvent = WorldEventBase<'construction_progress', ProjectEventDataBase & {
|
|
600
|
+
workGain: number;
|
|
601
|
+
currentWorkAfter: number;
|
|
602
|
+
reservedUntilTickAfter: number;
|
|
603
|
+
}>;
|
|
604
|
+
export type ConstructionCompletedEvent = WorldEventBase<'construction_completed', ProjectEventDataBase & {
|
|
605
|
+
structureId: string;
|
|
606
|
+
sourceBuildRecipeId?: string;
|
|
607
|
+
}>;
|
|
608
|
+
export type ProjectExpiredEvent = WorldEventBase<'project_expired', {
|
|
609
|
+
projectId: string;
|
|
610
|
+
recipeId: string;
|
|
611
|
+
targetStructureTypeId: string;
|
|
612
|
+
builderAgentId: string;
|
|
613
|
+
origin: Position;
|
|
614
|
+
footprint: Footprint;
|
|
615
|
+
deliveredInputs: ItemStack[];
|
|
616
|
+
currentWork: number;
|
|
617
|
+
reservedUntilTick: number;
|
|
618
|
+
stage: Extract<BuildingProjectStage, 'expired'>;
|
|
619
|
+
} & EventDataBase>;
|
|
620
|
+
export type AssetWithdrawDeniedEvent = WorldEventBase<'asset_withdraw_denied', {
|
|
621
|
+
structureId: string;
|
|
622
|
+
ownerRef?: OwnerRef;
|
|
623
|
+
withdrawLevel?: WithdrawLevel;
|
|
624
|
+
} & EventDataBase>;
|
|
625
|
+
export type ExecuteContractEvent = WorldEventBase<'execute_contract', {
|
|
626
|
+
factoryId: string;
|
|
627
|
+
contractId: string;
|
|
628
|
+
contractInstanceId: string;
|
|
629
|
+
} & EventDataBase>;
|
|
630
|
+
export type CropGrowEvent = WorldEventBase<'crop_grow', {
|
|
631
|
+
cropId: string;
|
|
632
|
+
cropTypeId: string;
|
|
633
|
+
stage: CropStageId;
|
|
634
|
+
position: Position;
|
|
635
|
+
matureTick: number;
|
|
636
|
+
} & EventDataBase>;
|
|
637
|
+
export type OrganizationCreatedEvent = WorldEventBase<'organization_created', {
|
|
638
|
+
organizationId: string;
|
|
639
|
+
name: string;
|
|
640
|
+
ownerAgentId: string;
|
|
641
|
+
} & EventDataBase>;
|
|
642
|
+
export type OrganizationMemberAddedEvent = WorldEventBase<'organization_member_added', {
|
|
643
|
+
organizationId: string;
|
|
644
|
+
agentId: string;
|
|
645
|
+
role: OrganizationRole;
|
|
646
|
+
invitedByAgentId: string;
|
|
647
|
+
} & EventDataBase>;
|
|
648
|
+
export type OrganizationMemberRoleChangedEvent = WorldEventBase<'organization_member_role_changed', {
|
|
649
|
+
organizationId: string;
|
|
650
|
+
agentId: string;
|
|
651
|
+
role: OrganizationRole;
|
|
652
|
+
changedByAgentId: string;
|
|
653
|
+
} & EventDataBase>;
|
|
654
|
+
export type FactoryCreatedEvent = WorldEventBase<'factory_created', {
|
|
655
|
+
factoryId: string;
|
|
656
|
+
structureTypeId: string;
|
|
657
|
+
ownerRef: OwnerRef;
|
|
658
|
+
} & EventDataBase>;
|
|
659
|
+
export type FactoryRecipeChangedEvent = WorldEventBase<'factory_recipe_changed', {
|
|
660
|
+
factoryId: string;
|
|
661
|
+
previousRecipeId?: string;
|
|
662
|
+
pendingRecipeId?: string;
|
|
663
|
+
} & EventDataBase>;
|
|
664
|
+
export type FactoryContractSetEvent = WorldEventBase<'factory_contract_set', {
|
|
665
|
+
factoryId: string;
|
|
666
|
+
contractId: string;
|
|
667
|
+
status: ContractDefinitionStatus;
|
|
668
|
+
} & EventDataBase>;
|
|
669
|
+
export type FactoryWorkStartedEvent = WorldEventBase<'factory_work_started', {
|
|
670
|
+
factoryId: string;
|
|
671
|
+
contractId?: string;
|
|
672
|
+
effectiveAtTick: number;
|
|
673
|
+
} & EventDataBase>;
|
|
674
|
+
export type FactoryWorkStoppedEvent = WorldEventBase<'factory_work_stopped', {
|
|
675
|
+
factoryId: string;
|
|
676
|
+
effectiveAtTick: number;
|
|
677
|
+
} & EventDataBase>;
|
|
678
|
+
export type FactoryProcessedTickEvent = WorldEventBase<'factory_processed_tick', {
|
|
679
|
+
tick: number;
|
|
680
|
+
factoryId: string;
|
|
681
|
+
activeRecipeId: string;
|
|
682
|
+
runsExecuted: number;
|
|
683
|
+
consumed: ItemStack[];
|
|
684
|
+
produced: ItemStack[];
|
|
685
|
+
storageUsedGramsAfterTick: number;
|
|
686
|
+
workerCount: number;
|
|
687
|
+
} & EventDataBase>;
|
|
688
|
+
type ContractDefinitionLifecycleEventType = 'contract_definition_created' | 'contract_definition_opened' | 'contract_definition_paused' | 'contract_definition_closed';
|
|
689
|
+
export type ContractDefinitionLifecycleEvent = WorldEventBase<ContractDefinitionLifecycleEventType, {
|
|
690
|
+
contractId: string;
|
|
691
|
+
kind: ContractKind;
|
|
692
|
+
status: ContractDefinitionStatus;
|
|
693
|
+
linkedFactoryId?: string;
|
|
694
|
+
} & EventDataBase>;
|
|
695
|
+
export type ContractInstanceCreatedEvent = WorldEventBase<'contract_instance_created', {
|
|
696
|
+
contractInstanceId: string;
|
|
697
|
+
contractId: string;
|
|
698
|
+
linkedFactoryId?: string;
|
|
699
|
+
executionMode: ContractInstance['executionMode'];
|
|
700
|
+
} & EventDataBase>;
|
|
701
|
+
export type ContractInstanceSettledEvent = WorldEventBase<'contract_instance_settled', {
|
|
702
|
+
contractInstanceId: string;
|
|
703
|
+
contractId: string;
|
|
704
|
+
linkedFactoryId?: string;
|
|
705
|
+
} & EventDataBase>;
|
|
706
|
+
export type ContractInstanceFailedEvent = WorldEventBase<'contract_instance_failed', {
|
|
707
|
+
contractInstanceId: string;
|
|
708
|
+
contractId: string;
|
|
709
|
+
linkedFactoryId?: string;
|
|
710
|
+
failureReason?: string;
|
|
711
|
+
} & EventDataBase>;
|
|
712
|
+
type TypedWorldEvent = AgentJoinedEvent | ActionAcceptedEvent | ActionIgnoredEvent | ActionRejectedEvent | MoveEvent | GatherEvent | PlantEvent | HarvestEvent | ConsumeEvent | ProcessEvent | TransferEvent | TradeCreateEvent | TradeAcceptEvent | TradeCancelEvent | AttackEvent | TickSummaryEvent | LegacyBuildEvent | FramePlacedEvent | ProjectSupplyProgressEvent | ProjectSuppliedEvent | ConstructionProgressEvent | ConstructionCompletedEvent | ProjectExpiredEvent | AssetWithdrawDeniedEvent | ExecuteContractEvent | CropGrowEvent | OrganizationCreatedEvent | OrganizationMemberAddedEvent | OrganizationMemberRoleChangedEvent | FactoryCreatedEvent | FactoryRecipeChangedEvent | FactoryContractSetEvent | FactoryWorkStartedEvent | FactoryWorkStoppedEvent | FactoryProcessedTickEvent | ContractDefinitionLifecycleEvent | ContractInstanceCreatedEvent | ContractInstanceSettledEvent | ContractInstanceFailedEvent;
|
|
713
|
+
export type WorldEvent = TypedWorldEvent;
|
|
714
|
+
export type WorldEventData<Type extends WorldEventType> = Extract<WorldEvent, {
|
|
715
|
+
type: Type;
|
|
716
|
+
}>['data'];
|
|
717
|
+
export interface TickApplyResult {
|
|
718
|
+
state: WorldState;
|
|
719
|
+
events: WorldEvent[];
|
|
720
|
+
}
|
|
721
|
+
export interface JoinRequest {
|
|
722
|
+
agentId?: string;
|
|
723
|
+
metadata?: Record<string, unknown>;
|
|
724
|
+
}
|
|
725
|
+
export interface JoinResponse {
|
|
726
|
+
agentId: string;
|
|
727
|
+
acceptedAtTick: number;
|
|
728
|
+
}
|
|
729
|
+
export type ActRequest = Action & {
|
|
730
|
+
basedOnTick?: number;
|
|
731
|
+
intendedStartTick?: number;
|
|
732
|
+
};
|
|
733
|
+
export type ActRequestInput = ActionInput & {
|
|
734
|
+
basedOnTick?: number;
|
|
735
|
+
intendedStartTick?: number;
|
|
736
|
+
};
|
|
737
|
+
export interface ActResponse {
|
|
738
|
+
accepted: boolean;
|
|
739
|
+
reason?: string;
|
|
740
|
+
startTick?: number;
|
|
741
|
+
duplicate?: boolean;
|
|
742
|
+
currentTick?: number;
|
|
743
|
+
basedOnTick?: number;
|
|
744
|
+
intendedStartTick?: number;
|
|
745
|
+
lateSubmission?: boolean;
|
|
746
|
+
}
|
|
747
|
+
export interface ObserveTargetingQuery {
|
|
748
|
+
archetype?: string;
|
|
749
|
+
resource?: string;
|
|
750
|
+
}
|
|
751
|
+
export interface ObserveResourceHint {
|
|
752
|
+
resourceId: string;
|
|
753
|
+
resourceTypeId: string;
|
|
754
|
+
nodeArchetypeId: string;
|
|
755
|
+
itemId: string;
|
|
756
|
+
position: Position;
|
|
757
|
+
amount: number;
|
|
758
|
+
distance: number;
|
|
759
|
+
}
|
|
760
|
+
export type ObserveArchetypeHint = {
|
|
761
|
+
kind: 'structure';
|
|
762
|
+
archetypeId: string;
|
|
763
|
+
structureId: string;
|
|
764
|
+
structureTypeId: string;
|
|
765
|
+
origin: Position;
|
|
766
|
+
footprint: Footprint;
|
|
767
|
+
position: Position;
|
|
768
|
+
distance: number;
|
|
769
|
+
} | {
|
|
770
|
+
kind: 'resource';
|
|
771
|
+
archetypeId: string;
|
|
772
|
+
resourceId: string;
|
|
773
|
+
resourceTypeId: string;
|
|
774
|
+
nodeArchetypeId: string;
|
|
775
|
+
itemId: string;
|
|
776
|
+
position: Position;
|
|
777
|
+
amount: number;
|
|
778
|
+
distance: number;
|
|
779
|
+
};
|
|
780
|
+
export interface ObserveResponse {
|
|
781
|
+
tick: number;
|
|
782
|
+
agentId: string;
|
|
783
|
+
map: {
|
|
784
|
+
width: number;
|
|
785
|
+
height: number;
|
|
786
|
+
};
|
|
787
|
+
position: Position;
|
|
788
|
+
hunger: number;
|
|
789
|
+
stamina: number;
|
|
790
|
+
inventory: ItemStack[];
|
|
791
|
+
carryWeightGrams: number;
|
|
792
|
+
carryLimitGrams: number;
|
|
793
|
+
carryRemainingGrams: number;
|
|
794
|
+
joinedFactoryId?: string;
|
|
795
|
+
talents: AgentTalentViews;
|
|
796
|
+
organizations?: Array<{
|
|
797
|
+
organizationId: string;
|
|
798
|
+
name: string;
|
|
799
|
+
ownerAgentId: string;
|
|
800
|
+
members: OrganizationMember[];
|
|
801
|
+
}>;
|
|
802
|
+
factories?: FactoryView[];
|
|
803
|
+
contractDefinitions?: ContractDefinitionView[];
|
|
804
|
+
contractInstances?: ContractInstanceView[];
|
|
805
|
+
nearbyResources: Array<{
|
|
806
|
+
resourceId: string;
|
|
807
|
+
resourceTypeId: string;
|
|
808
|
+
nodeArchetypeId: string;
|
|
809
|
+
itemId: string;
|
|
810
|
+
miningDifficulty?: number;
|
|
811
|
+
position: Position;
|
|
812
|
+
amount: number;
|
|
813
|
+
distance: number;
|
|
814
|
+
}>;
|
|
815
|
+
nearbyCrops: Array<{
|
|
816
|
+
cropId: string;
|
|
817
|
+
cropTypeId: string;
|
|
818
|
+
position: Position;
|
|
819
|
+
stage: CropStageId;
|
|
820
|
+
matureTick: number;
|
|
821
|
+
distance: number;
|
|
822
|
+
}>;
|
|
823
|
+
nearbyStructures: Array<{
|
|
824
|
+
structureId: string;
|
|
825
|
+
structureTypeId: string;
|
|
826
|
+
origin: Position;
|
|
827
|
+
footprint: Footprint;
|
|
828
|
+
position: Position;
|
|
829
|
+
hp: number;
|
|
830
|
+
state?: StructureRuntimeState;
|
|
831
|
+
sourceBuildRecipeId?: string;
|
|
832
|
+
builderAgentId?: string;
|
|
833
|
+
ownerRef?: OwnerRef;
|
|
834
|
+
withdrawLevel?: WithdrawLevel;
|
|
835
|
+
canWithdraw?: boolean;
|
|
836
|
+
distance: number;
|
|
837
|
+
}>;
|
|
838
|
+
nearbyProjects: Array<{
|
|
839
|
+
projectId: string;
|
|
840
|
+
recipeId: string;
|
|
841
|
+
targetStructureTypeId: string;
|
|
842
|
+
builderAgentId: string;
|
|
843
|
+
origin: Position;
|
|
844
|
+
footprint: Footprint;
|
|
845
|
+
stage: Extract<BuildingProjectStage, 'frame' | 'supplied'>;
|
|
846
|
+
deliveredInputs: ItemStack[];
|
|
847
|
+
requiredInputs: ItemStack[];
|
|
848
|
+
currentWork: number;
|
|
849
|
+
requiredWork: number;
|
|
850
|
+
reservedUntilTick: number;
|
|
851
|
+
distance: number;
|
|
852
|
+
}>;
|
|
853
|
+
nearbyAgents: Array<{
|
|
854
|
+
agentId: string;
|
|
855
|
+
position: Position;
|
|
856
|
+
hunger: number;
|
|
857
|
+
stamina: number;
|
|
858
|
+
talents: AgentTalentViews;
|
|
859
|
+
distance: number;
|
|
860
|
+
}>;
|
|
861
|
+
adjacentTiles: Array<{
|
|
862
|
+
x: number;
|
|
863
|
+
y: number;
|
|
864
|
+
withinMap: boolean;
|
|
865
|
+
terrain?: TerrainType;
|
|
866
|
+
occupiedBy?: {
|
|
867
|
+
kind: 'resource' | 'crop' | 'structure' | 'project' | 'agent';
|
|
868
|
+
id: string;
|
|
869
|
+
typeId?: string;
|
|
870
|
+
};
|
|
871
|
+
canMove: boolean;
|
|
872
|
+
canBuild: boolean;
|
|
873
|
+
}>;
|
|
874
|
+
buildableAdjacentTargets: Position[];
|
|
875
|
+
visibleTrades: Array<{
|
|
876
|
+
tradeId: string;
|
|
877
|
+
creatorAgentId: string;
|
|
878
|
+
toAgentId?: string;
|
|
879
|
+
status: 'open' | 'accepted' | 'cancelled';
|
|
880
|
+
createdAtTick: number;
|
|
881
|
+
expiresAtTick: number;
|
|
882
|
+
ticksUntilExpire: number;
|
|
883
|
+
give: ItemStack[];
|
|
884
|
+
receive: ItemStack[];
|
|
885
|
+
canAccept: boolean;
|
|
886
|
+
canCancel: boolean;
|
|
887
|
+
acceptRequirementsMet: boolean;
|
|
888
|
+
}>;
|
|
889
|
+
resourceHints?: ObserveResourceHint[];
|
|
890
|
+
archetypeHints?: ObserveArchetypeHint[];
|
|
891
|
+
}
|
|
892
|
+
export interface TickSignal {
|
|
893
|
+
tick: number;
|
|
894
|
+
tickIntervalMs?: number;
|
|
895
|
+
nextTickAt?: string;
|
|
896
|
+
serverTime?: string;
|
|
897
|
+
}
|
|
898
|
+
export interface TickInfoResponse {
|
|
899
|
+
currentTick: number;
|
|
900
|
+
tickIntervalMs: number;
|
|
901
|
+
nextTickAt: string;
|
|
902
|
+
serverTime: string;
|
|
903
|
+
}
|
|
904
|
+
export interface WorldSnapshot {
|
|
905
|
+
tick: number;
|
|
906
|
+
savedAt: string;
|
|
907
|
+
state: WorldState;
|
|
908
|
+
}
|
|
909
|
+
export interface StoredEventBatch {
|
|
910
|
+
tick: number;
|
|
911
|
+
savedAt: string;
|
|
912
|
+
events: WorldEvent[];
|
|
913
|
+
}
|
|
914
|
+
export interface StoredTickRecord {
|
|
915
|
+
tick: number;
|
|
916
|
+
savedAt: string;
|
|
917
|
+
actions: QueuedAction[];
|
|
918
|
+
events: WorldEvent[];
|
|
919
|
+
}
|
|
920
|
+
export interface VerbSpec {
|
|
921
|
+
verb: string;
|
|
922
|
+
description: string;
|
|
923
|
+
params?: string[];
|
|
924
|
+
target?: string;
|
|
925
|
+
}
|
|
926
|
+
export interface CatalogArchetypeNeedsEffect {
|
|
927
|
+
type: 'needs';
|
|
928
|
+
hungerDelta?: number;
|
|
929
|
+
staminaDelta?: number;
|
|
930
|
+
}
|
|
931
|
+
export interface CatalogArchetypeSpawnItemEffect {
|
|
932
|
+
type: 'spawn-item';
|
|
933
|
+
itemId: string;
|
|
934
|
+
amount: number;
|
|
935
|
+
}
|
|
936
|
+
export type CatalogArchetypeUseEffect = CatalogArchetypeNeedsEffect | CatalogArchetypeSpawnItemEffect;
|
|
937
|
+
export interface CatalogArchetypeUse {
|
|
938
|
+
verb: 'consume';
|
|
939
|
+
amountPerUse?: number;
|
|
940
|
+
effects: CatalogArchetypeUseEffect[];
|
|
941
|
+
}
|
|
942
|
+
export interface CatalogArchetype {
|
|
943
|
+
id: string;
|
|
944
|
+
tags: string[];
|
|
945
|
+
description: string;
|
|
946
|
+
weightGrams?: number;
|
|
947
|
+
use?: CatalogArchetypeUse;
|
|
948
|
+
}
|
|
949
|
+
export interface CatalogStructureType {
|
|
950
|
+
id: string;
|
|
951
|
+
archetypeId?: string;
|
|
952
|
+
tags: string[];
|
|
953
|
+
description: string;
|
|
954
|
+
footprint: Footprint;
|
|
955
|
+
maxHp: number;
|
|
956
|
+
traversal: StructureTraversal;
|
|
957
|
+
storage?: StorageSpec;
|
|
958
|
+
behavior?: StructureBehavior;
|
|
959
|
+
capabilities?: StructureCapabilities;
|
|
960
|
+
render?: StructureRender;
|
|
961
|
+
}
|
|
962
|
+
export interface CropStageDefinition {
|
|
963
|
+
id: CropStageId;
|
|
964
|
+
}
|
|
965
|
+
export interface CropRender {
|
|
966
|
+
baseTileId?: number;
|
|
967
|
+
stageTileIds?: Partial<Record<CropStageId, number>>;
|
|
968
|
+
}
|
|
969
|
+
export interface CatalogCropType {
|
|
970
|
+
id: string;
|
|
971
|
+
archetypeId?: string;
|
|
972
|
+
tags: string[];
|
|
973
|
+
description: string;
|
|
974
|
+
seedArchetypeId: string;
|
|
975
|
+
allowedTerrain: TerrainType[];
|
|
976
|
+
growthDurationTicks: number;
|
|
977
|
+
harvestOutputs: ItemStack[];
|
|
978
|
+
stages?: CropStageDefinition[];
|
|
979
|
+
render?: CropRender;
|
|
980
|
+
}
|
|
981
|
+
export interface IndustryVisualProfile {
|
|
982
|
+
id: string;
|
|
983
|
+
label: string;
|
|
984
|
+
tilesetAssetPath?: string;
|
|
985
|
+
}
|
|
986
|
+
export type ProcessRecipeBehavior = {
|
|
987
|
+
kind: 'default';
|
|
988
|
+
} | {
|
|
989
|
+
kind: 'toggle-gate';
|
|
990
|
+
targetState: 'open' | 'closed';
|
|
991
|
+
};
|
|
992
|
+
export interface CatalogProcessRecipe {
|
|
993
|
+
id: string;
|
|
994
|
+
kind: 'process';
|
|
995
|
+
allowedStructureTypeIds?: string[];
|
|
996
|
+
inputs: ItemStack[];
|
|
997
|
+
outputs: ItemStack[];
|
|
998
|
+
durationTicks: number;
|
|
999
|
+
behavior?: ProcessRecipeBehavior;
|
|
1000
|
+
awardTalentId?: TalentId;
|
|
1001
|
+
industryVisualProfileId?: string;
|
|
1002
|
+
notes?: string;
|
|
1003
|
+
}
|
|
1004
|
+
export interface CatalogBuildRecipe {
|
|
1005
|
+
id: string;
|
|
1006
|
+
kind: 'build';
|
|
1007
|
+
targetStructureTypeId: string;
|
|
1008
|
+
inputs: ItemStack[];
|
|
1009
|
+
outputs: ItemStack[];
|
|
1010
|
+
durationTicks: number;
|
|
1011
|
+
requiredWork?: number;
|
|
1012
|
+
frameReservationTicks?: number;
|
|
1013
|
+
framePlacementTalents?: Partial<Record<TalentId, number>>;
|
|
1014
|
+
notes?: string;
|
|
1015
|
+
}
|
|
1016
|
+
export type CatalogRecipe = CatalogProcessRecipe | CatalogBuildRecipe;
|
|
1017
|
+
export interface CatalogResourceSpawn {
|
|
1018
|
+
count: number;
|
|
1019
|
+
terrainWeights: Partial<Record<TerrainType, number>>;
|
|
1020
|
+
renderTileIdRange?: [number, number];
|
|
1021
|
+
}
|
|
1022
|
+
export interface CatalogResourceGather {
|
|
1023
|
+
toolType?: 'axe' | 'pickaxe' | 'drill';
|
|
1024
|
+
bonusAmount?: number;
|
|
1025
|
+
miningDifficulty?: number;
|
|
1026
|
+
awardTalentId?: TalentId;
|
|
1027
|
+
seedDropChancePercent?: number;
|
|
1028
|
+
seedDropAmount?: number;
|
|
1029
|
+
}
|
|
1030
|
+
export interface CatalogResourceType {
|
|
1031
|
+
id: string;
|
|
1032
|
+
nodeArchetypeId: string;
|
|
1033
|
+
yieldItemId: string;
|
|
1034
|
+
maxAmount: number;
|
|
1035
|
+
regenPerTick: number;
|
|
1036
|
+
regenIntervalTicks?: number;
|
|
1037
|
+
spawn: CatalogResourceSpawn;
|
|
1038
|
+
gather?: CatalogResourceGather;
|
|
1039
|
+
}
|
|
1040
|
+
export interface CatalogPayload {
|
|
1041
|
+
version: string;
|
|
1042
|
+
archetypes: CatalogArchetype[];
|
|
1043
|
+
resourceTypes: CatalogResourceType[];
|
|
1044
|
+
structureTypes: CatalogStructureType[];
|
|
1045
|
+
cropTypes: CatalogCropType[];
|
|
1046
|
+
industryVisualProfiles: IndustryVisualProfile[];
|
|
1047
|
+
recipes: CatalogRecipe[];
|
|
1048
|
+
}
|
|
1049
|
+
export interface RulesPayload {
|
|
1050
|
+
version: string;
|
|
1051
|
+
verbs: VerbSpec[];
|
|
1052
|
+
errorCodes: Record<string, string>;
|
|
1053
|
+
}
|
|
1054
|
+
export interface EventQueryResult {
|
|
1055
|
+
events: WorldEvent[];
|
|
1056
|
+
nextCursor: number;
|
|
1057
|
+
}
|
|
1058
|
+
export interface ReplayResult {
|
|
1059
|
+
fromTick: number;
|
|
1060
|
+
toTick: number;
|
|
1061
|
+
finalState: WorldState;
|
|
1062
|
+
}
|
|
1063
|
+
export interface FactoryView {
|
|
1064
|
+
factoryId: string;
|
|
1065
|
+
ownerRef: OwnerRef;
|
|
1066
|
+
structureTypeId: string;
|
|
1067
|
+
activeRecipeId?: string;
|
|
1068
|
+
activeContractDefinitionIds: string[];
|
|
1069
|
+
minWorkersToRun: number;
|
|
1070
|
+
maxWorkers: number;
|
|
1071
|
+
assignedWorkerCount: number;
|
|
1072
|
+
maxRunsPerTick: number;
|
|
1073
|
+
storageCapacityGrams: number;
|
|
1074
|
+
storageUsedGrams: number;
|
|
1075
|
+
inventorySummary: ItemStack[];
|
|
1076
|
+
availableRecipeIds: string[];
|
|
1077
|
+
lastTickRuns: number;
|
|
1078
|
+
canConfigure: boolean;
|
|
1079
|
+
joinedByViewer: boolean;
|
|
1080
|
+
}
|
|
1081
|
+
export interface ContractDefinitionView {
|
|
1082
|
+
contractId: string;
|
|
1083
|
+
kind: ContractKind;
|
|
1084
|
+
status: ContractDefinitionStatus;
|
|
1085
|
+
issuerLabel: string;
|
|
1086
|
+
linkedFactoryId?: string;
|
|
1087
|
+
clausesSummary: string[];
|
|
1088
|
+
allowedActionsForViewer: ('open' | 'pause' | 'close' | 'inspect')[];
|
|
1089
|
+
}
|
|
1090
|
+
export interface ContractInstanceView {
|
|
1091
|
+
contractInstanceId: string;
|
|
1092
|
+
contractId: string;
|
|
1093
|
+
kind: ContractKind;
|
|
1094
|
+
status: ContractInstanceStatus;
|
|
1095
|
+
requesterLabel: string;
|
|
1096
|
+
providerLabel: string;
|
|
1097
|
+
linkedFactoryId?: string;
|
|
1098
|
+
executionMode: 'explicit' | 'work-tick';
|
|
1099
|
+
failureReason?: string;
|
|
1100
|
+
allowedActionsForViewer: 'inspect'[];
|
|
1101
|
+
}
|
|
1102
|
+
export {};
|