@dreamboard-games/sdk 0.5.0-alpha.2 → 0.5.0-alpha.3

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.
Files changed (150) hide show
  1. package/README.md +136 -45
  2. package/dist/chunk-DMFVAZI2.js +16 -0
  3. package/dist/chunk-DMFVAZI2.js.map +1 -0
  4. package/dist/chunk-FMM5LVJW.js +833 -0
  5. package/dist/chunk-FMM5LVJW.js.map +1 -0
  6. package/dist/{chunk-S2JEDVWH.js → chunk-LRILEVKC.js} +6113 -6489
  7. package/dist/chunk-LRILEVKC.js.map +1 -0
  8. package/dist/chunk-SP234IY4.js +1363 -0
  9. package/dist/chunk-SP234IY4.js.map +1 -0
  10. package/dist/chunk-VUWNJXLJ.js +52 -0
  11. package/dist/chunk-VUWNJXLJ.js.map +1 -0
  12. package/dist/chunk-ZPRKWPEP.js +511 -0
  13. package/dist/chunk-ZPRKWPEP.js.map +1 -0
  14. package/dist/definition-BaHNPZol.d.ts +4639 -0
  15. package/dist/diagnostics-B0lgnuZ6.d.ts +65 -0
  16. package/dist/index.d.ts +3553 -1
  17. package/dist/index.js +1045 -6
  18. package/dist/index.js.map +1 -1
  19. package/dist/model-BHro6yXu.d.ts +288 -0
  20. package/dist/react.d.ts +32 -0
  21. package/dist/react.js +80 -0
  22. package/dist/react.js.map +1 -0
  23. package/dist/reducer.d.ts +1194 -79
  24. package/dist/reducer.js +4326 -121
  25. package/dist/reducer.js.map +1 -1
  26. package/dist/testing.d.ts +518 -564
  27. package/dist/testing.js +2448 -915
  28. package/dist/testing.js.map +1 -1
  29. package/dist/types-DimqnJBq.d.ts +86 -0
  30. package/package.json +26 -131
  31. package/dist/HandView-Bi2lxzQP.d.ts +0 -79
  32. package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
  33. package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
  34. package/dist/attributes-DbvyMbXw.d.ts +0 -68
  35. package/dist/browser-interaction.d.ts +0 -910
  36. package/dist/browser-interaction.js +0 -119
  37. package/dist/browser-interaction.js.map +0 -1
  38. package/dist/chunk-32PFKDV7.js +0 -11705
  39. package/dist/chunk-32PFKDV7.js.map +0 -1
  40. package/dist/chunk-3BAD4VC2.js +0 -263
  41. package/dist/chunk-3BAD4VC2.js.map +0 -1
  42. package/dist/chunk-3SKDNDPG.js +0 -104
  43. package/dist/chunk-3SKDNDPG.js.map +0 -1
  44. package/dist/chunk-5YV2WHJ4.js +0 -25
  45. package/dist/chunk-5YV2WHJ4.js.map +0 -1
  46. package/dist/chunk-ANRB4XKA.js +0 -90
  47. package/dist/chunk-ANRB4XKA.js.map +0 -1
  48. package/dist/chunk-BI4G3PM2.js +0 -1864
  49. package/dist/chunk-BI4G3PM2.js.map +0 -1
  50. package/dist/chunk-EVCLTY4Q.js +0 -935
  51. package/dist/chunk-EVCLTY4Q.js.map +0 -1
  52. package/dist/chunk-GDPKTBUR.js +0 -564
  53. package/dist/chunk-GDPKTBUR.js.map +0 -1
  54. package/dist/chunk-H6VDGFL5.js +0 -2903
  55. package/dist/chunk-H6VDGFL5.js.map +0 -1
  56. package/dist/chunk-LR3ZTWQF.js +0 -5960
  57. package/dist/chunk-LR3ZTWQF.js.map +0 -1
  58. package/dist/chunk-PF7L4BMG.js +0 -117
  59. package/dist/chunk-PF7L4BMG.js.map +0 -1
  60. package/dist/chunk-PN5O6GG2.js +0 -32
  61. package/dist/chunk-PN5O6GG2.js.map +0 -1
  62. package/dist/chunk-PZ5AY32C.js +0 -10
  63. package/dist/chunk-PZ5AY32C.js.map +0 -1
  64. package/dist/chunk-S2JEDVWH.js.map +0 -1
  65. package/dist/chunk-T3ZKNUZ7.js +0 -1
  66. package/dist/chunk-T3ZKNUZ7.js.map +0 -1
  67. package/dist/chunk-UGH54WZ2.js +0 -223
  68. package/dist/chunk-UGH54WZ2.js.map +0 -1
  69. package/dist/chunk-VCDWP5VL.js +0 -746
  70. package/dist/chunk-VCDWP5VL.js.map +0 -1
  71. package/dist/chunk-VDXOF4FW.js +0 -69
  72. package/dist/chunk-VDXOF4FW.js.map +0 -1
  73. package/dist/chunk-WHR5UW3F.js +0 -1988
  74. package/dist/chunk-WHR5UW3F.js.map +0 -1
  75. package/dist/chunk-Y75CFE77.js +0 -17
  76. package/dist/chunk-Y75CFE77.js.map +0 -1
  77. package/dist/chunk-Z7QCREWI.js +0 -3435
  78. package/dist/chunk-Z7QCREWI.js.map +0 -1
  79. package/dist/chunk-ZZGN2ATS.js +0 -1941
  80. package/dist/chunk-ZZGN2ATS.js.map +0 -1
  81. package/dist/components-gAbIz7hK.d.ts +0 -1284
  82. package/dist/definitions-BgmV_GhC.d.ts +0 -300
  83. package/dist/diagnostics-DIi3ina7.d.ts +0 -50
  84. package/dist/digest.d.ts +0 -8
  85. package/dist/game-CsZScpcn.d.ts +0 -763
  86. package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
  87. package/dist/index-CcT9Q7N7.d.ts +0 -193
  88. package/dist/index.d-DjzoK7zn.d.ts +0 -2101
  89. package/dist/package-set.d.ts +0 -13
  90. package/dist/package-set.js +0 -12
  91. package/dist/package-set.js.map +0 -1
  92. package/dist/player-state-Cqpyeql0.d.ts +0 -371
  93. package/dist/plugin-runtime-contract.d.ts +0 -17
  94. package/dist/plugin-runtime-contract.js +0 -92
  95. package/dist/plugin-runtime-contract.js.map +0 -1
  96. package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
  97. package/dist/protocol-dYgafTYY.d.ts +0 -314
  98. package/dist/reducer/advanced.d.ts +0 -82
  99. package/dist/reducer/advanced.js +0 -51
  100. package/dist/reducer/advanced.js.map +0 -1
  101. package/dist/reducer-contract.d.ts +0 -11
  102. package/dist/reducer-contract.js +0 -16
  103. package/dist/reducer-contract.js.map +0 -1
  104. package/dist/reference-games/index.d.ts +0 -31
  105. package/dist/reference-games/index.js +0 -48
  106. package/dist/reference-games/index.js.map +0 -1
  107. package/dist/runtime/primitives.d.ts +0 -250
  108. package/dist/runtime/primitives.js +0 -189
  109. package/dist/runtime/primitives.js.map +0 -1
  110. package/dist/runtime/runtime-api.d.ts +0 -2
  111. package/dist/runtime/runtime-api.js +0 -1
  112. package/dist/runtime/runtime-api.js.map +0 -1
  113. package/dist/runtime/workspace-contract.d.ts +0 -392
  114. package/dist/runtime/workspace-contract.js +0 -28
  115. package/dist/runtime/workspace-contract.js.map +0 -1
  116. package/dist/runtime-RJ5orDJU.d.ts +0 -1699
  117. package/dist/runtime-api-Bz5pwNU_.d.ts +0 -296
  118. package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
  119. package/dist/runtime.d.ts +0 -83
  120. package/dist/runtime.js +0 -242
  121. package/dist/runtime.js.map +0 -1
  122. package/dist/schema.d.ts +0 -379
  123. package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
  124. package/dist/testing-compiler.d.ts +0 -37
  125. package/dist/testing-compiler.js +0 -272
  126. package/dist/testing-compiler.js.map +0 -1
  127. package/dist/testing-runtime.d.ts +0 -119
  128. package/dist/testing-runtime.js +0 -212
  129. package/dist/testing-runtime.js.map +0 -1
  130. package/dist/types-DJj5MJkl.d.ts +0 -256
  131. package/dist/types-DR7DoB1x.d.ts +0 -28
  132. package/dist/types-JWCYHmu7.d.ts +0 -122
  133. package/dist/types.d.ts +0 -1958
  134. package/dist/types.js +0 -14
  135. package/dist/types.js.map +0 -1
  136. package/dist/ui/components.d.ts +0 -17
  137. package/dist/ui/components.js +0 -216
  138. package/dist/ui/components.js.map +0 -1
  139. package/dist/ui/defaults.d.ts +0 -19
  140. package/dist/ui/defaults.js +0 -104
  141. package/dist/ui/defaults.js.map +0 -1
  142. package/dist/ui/player-state.d.ts +0 -2
  143. package/dist/ui/player-state.js +0 -1
  144. package/dist/ui/player-state.js.map +0 -1
  145. package/dist/ui/plugin-styles.css +0 -2
  146. package/dist/ui-contract-GTUPkf8z.d.ts +0 -1168
  147. package/dist/ui.d.ts +0 -317
  148. package/dist/ui.js +0 -277
  149. package/dist/ui.js.map +0 -1
  150. package/dist/views-BpuWcOyN.d.ts +0 -1641
@@ -0,0 +1,4639 @@
1
+ import { z } from 'zod';
2
+ import { Point } from 'honeycomb-grid';
3
+
4
+ /** JSON values shared by protocol and game-owned runtime state. */
5
+ declare const RuntimeJsonSchema: z.ZodJSONSchema;
6
+ type RuntimeJson = z.infer<typeof RuntimeJsonSchema>;
7
+
8
+ type RuntimeRecord = Record<string, RuntimeJson>;
9
+ type RuntimePayload = RuntimeJson;
10
+ type SchemaLike<Output> = z.ZodType<Output>;
11
+ type AnySchema = z.ZodTypeAny;
12
+ type StringKeyOf<T> = Extract<keyof T, string>;
13
+ type Brand<Value, Name extends string> = Value & {
14
+ readonly __brand: Name;
15
+ };
16
+ type RuntimeHandVisibilityMode = "all" | "ownerOnly" | "public" | "hidden";
17
+ type RuntimeDeckMap = Record<string, string[]>;
18
+ type RuntimeHandMap = Record<string, Record<string, string[]>>;
19
+ type RuntimeZoneMap = {
20
+ shared: Record<string, string[]>;
21
+ perPlayer: Record<string, Record<string, string[]>>;
22
+ visibility: Record<string, RuntimeHandVisibilityMode>;
23
+ cardSetIdsByZoneId?: Record<string, readonly string[]>;
24
+ };
25
+ type RuntimeOwnerMap = Record<string, string | null>;
26
+ type RuntimeResourceMap = Record<string, RuntimeRecord>;
27
+ type RuntimeBoardSpaceState = {
28
+ id: string;
29
+ name?: string | null;
30
+ typeId?: string | null;
31
+ fields: RuntimeRecord;
32
+ zoneId?: string | null;
33
+ };
34
+ type RuntimeBoardRelationState = {
35
+ id?: string | null;
36
+ typeId: string;
37
+ fromSpaceId: string;
38
+ toSpaceId: string;
39
+ directed: boolean;
40
+ fields: RuntimeRecord;
41
+ };
42
+ type RuntimeBoardContainerState = {
43
+ id: string;
44
+ name: string;
45
+ host: {
46
+ type: "board";
47
+ } | {
48
+ type: "space";
49
+ spaceId: string;
50
+ };
51
+ allowedCardSetIds?: readonly string[];
52
+ zoneId: string;
53
+ fields: RuntimeRecord;
54
+ };
55
+ type RuntimeBoardCompatibilityState = {
56
+ spaces: Record<string, RuntimeBoardSpaceState>;
57
+ relations: RuntimeBoardRelationState[];
58
+ containers: Record<string, RuntimeBoardContainerState>;
59
+ };
60
+ type RuntimeBoardBaseState = {
61
+ id: string;
62
+ baseId?: string;
63
+ layout: "generic" | "hex" | "square";
64
+ typeId?: string | null;
65
+ scope: "shared" | "perPlayer";
66
+ playerId?: string | null;
67
+ fields: RuntimeRecord;
68
+ };
69
+ type RuntimeGenericBoardState = RuntimeBoardBaseState & {
70
+ layout: "generic";
71
+ } & RuntimeBoardCompatibilityState;
72
+ type RuntimeHexSpaceState = RuntimeBoardSpaceState & {
73
+ q: number;
74
+ r: number;
75
+ };
76
+ type RuntimeSquareSpaceState = RuntimeBoardSpaceState & {
77
+ row: number;
78
+ col: number;
79
+ };
80
+ type RuntimeTiledEdgeState = {
81
+ id: string;
82
+ spaceIds: readonly string[];
83
+ typeId?: string | null;
84
+ label?: string | null;
85
+ ownerId?: string | null;
86
+ fields: RuntimeRecord;
87
+ };
88
+ type RuntimeTiledVertexState = {
89
+ id: string;
90
+ spaceIds: readonly string[];
91
+ typeId?: string | null;
92
+ label?: string | null;
93
+ ownerId?: string | null;
94
+ fields: RuntimeRecord;
95
+ };
96
+ type RuntimeHexEdgeState = RuntimeTiledEdgeState;
97
+ type RuntimeHexVertexState = RuntimeTiledVertexState;
98
+ type RuntimeSquareEdgeState = RuntimeTiledEdgeState;
99
+ type RuntimeSquareVertexState = RuntimeTiledVertexState;
100
+ type RuntimeHexOrientation = "pointy" | "flat";
101
+ type RuntimeTiledBoardBaseState = RuntimeBoardBaseState & {
102
+ layout: "hex" | "square";
103
+ relations: RuntimeBoardRelationState[];
104
+ containers: Record<string, RuntimeBoardContainerState>;
105
+ edges: RuntimeTiledEdgeState[];
106
+ vertices: RuntimeTiledVertexState[];
107
+ };
108
+ type RuntimeHexBoardState = RuntimeTiledBoardBaseState & {
109
+ layout: "hex";
110
+ spaces: Record<string, RuntimeHexSpaceState>;
111
+ orientation: RuntimeHexOrientation;
112
+ edges: RuntimeHexEdgeState[];
113
+ vertices: RuntimeHexVertexState[];
114
+ };
115
+ type RuntimeSquareBoardState = RuntimeTiledBoardBaseState & {
116
+ layout: "square";
117
+ spaces: Record<string, RuntimeSquareSpaceState>;
118
+ edges: RuntimeSquareEdgeState[];
119
+ vertices: RuntimeSquareVertexState[];
120
+ };
121
+ type RuntimeTiledBoardState = RuntimeHexBoardState | RuntimeSquareBoardState;
122
+ type RuntimeBoardState = RuntimeGenericBoardState | RuntimeTiledBoardState;
123
+ type RuntimeBoardCollections = {
124
+ byId: Record<string, RuntimeBoardState>;
125
+ hex: Record<string, RuntimeHexBoardState>;
126
+ square: Record<string, RuntimeSquareBoardState>;
127
+ /** Structured board buckets used by manifest table schemas (empty when unused). */
128
+ network: Record<string, RuntimeRecord>;
129
+ track: Record<string, RuntimeRecord>;
130
+ };
131
+ type RuntimeCardVisibility = {
132
+ faceUp: boolean;
133
+ visibleTo?: string[] | null;
134
+ };
135
+ type RuntimeCardData = {
136
+ componentType?: string;
137
+ id: string;
138
+ cardSetId: string;
139
+ cardType: string;
140
+ name?: string;
141
+ text?: string;
142
+ properties: RuntimeRecord;
143
+ };
144
+ type RuntimePieceData = {
145
+ componentType?: string;
146
+ id: string;
147
+ pieceTypeId: string;
148
+ pieceName?: string | null;
149
+ ownerId?: string | null;
150
+ properties: RuntimeRecord;
151
+ };
152
+ type RuntimeDieData = {
153
+ componentType?: string;
154
+ id: string;
155
+ dieTypeId: string;
156
+ dieName?: string | null;
157
+ ownerId?: string | null;
158
+ sides: number;
159
+ value?: number | null;
160
+ properties: RuntimeRecord;
161
+ };
162
+ type RuntimeSlotHostRef = {
163
+ kind: "piece";
164
+ id: string;
165
+ } | {
166
+ kind: "die";
167
+ id: string;
168
+ };
169
+ type RuntimeComponentLocation = {
170
+ type: "Detached";
171
+ } | {
172
+ type: "InDeck";
173
+ deckId: string;
174
+ playedBy: string | null;
175
+ position?: number | null;
176
+ } | {
177
+ type: "InHand";
178
+ handId: string;
179
+ playerId: string;
180
+ position?: number | null;
181
+ } | {
182
+ type: "InZone";
183
+ zoneId: string;
184
+ playedBy?: string | null;
185
+ position?: number | null;
186
+ } | {
187
+ type: "OnSpace";
188
+ boardId: string;
189
+ spaceId: string;
190
+ position?: number | null;
191
+ } | {
192
+ type: "InContainer";
193
+ boardId: string;
194
+ containerId: string;
195
+ position?: number | null;
196
+ } | {
197
+ type: "OnEdge";
198
+ boardId: string;
199
+ edgeId: string;
200
+ position?: number | null;
201
+ } | {
202
+ type: "OnVertex";
203
+ boardId: string;
204
+ vertexId: string;
205
+ position?: number | null;
206
+ } | {
207
+ type: "InSlot";
208
+ host: RuntimeSlotHostRef;
209
+ slotId: string;
210
+ position?: number | null;
211
+ };
212
+ type RuntimeComponentLocationMap = Record<string, RuntimeComponentLocation>;
213
+ type RuntimeVisibilityMap = Record<string, RuntimeCardVisibility>;
214
+ type RuntimeTableRecord = {
215
+ playerOrder: string[];
216
+ zones: RuntimeZoneMap;
217
+ decks: RuntimeDeckMap;
218
+ hands: RuntimeHandMap;
219
+ handVisibility: Record<string, RuntimeHandVisibilityMode>;
220
+ cards: Record<string, RuntimeCardData>;
221
+ pieces: Record<string, RuntimePieceData>;
222
+ componentLocations: RuntimeComponentLocationMap;
223
+ ownerOfCard: RuntimeOwnerMap;
224
+ visibility: RuntimeVisibilityMap;
225
+ resources: RuntimeResourceMap;
226
+ boards: RuntimeBoardCollections;
227
+ dice: Record<string, RuntimeDieData>;
228
+ };
229
+
230
+ declare const FrameworkErrorCodes: {
231
+ readonly NOT_YOUR_TURN: "NOT_YOUR_TURN";
232
+ readonly WRONG_PHASE: "WRONG_PHASE";
233
+ readonly WRONG_STEP: "WRONG_STEP";
234
+ readonly NO_LEGAL_INPUT: "NO_LEGAL_INPUT";
235
+ readonly INVALID_PARAMS: "INVALID_PARAMS";
236
+ readonly UNKNOWN_INTERACTION: "UNKNOWN_INTERACTION";
237
+ readonly INTERNAL_ERROR: "INTERNAL_ERROR";
238
+ };
239
+ type FrameworkErrorCode = (typeof FrameworkErrorCodes)[keyof typeof FrameworkErrorCodes];
240
+
241
+ type TableOfState<State> = State extends {
242
+ table: infer Table;
243
+ } ? Table : never;
244
+ type TableOfManifest<Manifest> = Manifest extends {
245
+ tableSchema: z.ZodType<infer Table extends RuntimeTableRecord>;
246
+ } ? Table : Manifest extends ReducerManifestContractLike<infer Table> ? Table : never;
247
+ type PhaseNameOfState<State> = State extends {
248
+ flow: {
249
+ currentPhase: infer PhaseName;
250
+ };
251
+ } ? Extract<PhaseName, string> : never;
252
+ type PhaseNameOfManifest<Manifest> = Manifest extends {
253
+ literals: {
254
+ phaseNames: readonly (infer PhaseName)[];
255
+ };
256
+ } ? Extract<PhaseName, string> : never;
257
+ type PlayerIdOfTable<Table> = Table extends {
258
+ playerOrder: readonly (infer PlayerId)[];
259
+ } ? Extract<PlayerId, string> : never;
260
+ type PlayerIdOfState<State> = PlayerIdOfTable<TableOfState<State>>;
261
+ type ErrorCodeOfContract<Contract> = Contract extends {
262
+ errors: infer Errors extends Record<string, string>;
263
+ } ? (keyof Errors & string) | FrameworkErrorCode : string;
264
+ /**
265
+ * Manifest-declared resource id union for a runtime table.
266
+ *
267
+ * Derived from the shape of `table.resources`, which the generated
268
+ * manifest contract seeds as `Record<PlayerId, Record<ResourceId, number>>`.
269
+ * Resource identifiers come from the player balance record.
270
+ */
271
+ type ResourceIdOfTable<Table> = Table extends {
272
+ resources: infer Resources;
273
+ } ? PlayerRecordValue<Resources> extends infer PlayerValue ? PlayerValue extends Record<string, unknown> ? StringKeyOf<PlayerValue> : never : never : never;
274
+ /**
275
+ * Per-player balance shape for a runtime table. Extracts the
276
+ * value of `table.resources` so callers receive the manifest-typed
277
+ * record directly (e.g. `Record<ResourceId, number>`).
278
+ */
279
+ type ResourceBalancesOfTable<Table> = Table extends {
280
+ resources: infer Resources;
281
+ } ? PlayerRecordValue<Resources> extends infer PlayerValue ? PlayerValue extends Record<string, unknown> ? PlayerValue : never : never : never;
282
+ /**
283
+ * Per-player resource counts: a partial `Record<ResourceId, number>`.
284
+ *
285
+ * Used as the input shape for {@link ReducerTransaction.addResources},
286
+ * {@link ReducerTransaction.spendResources}, and {@link ReducerTransaction.transferResources}.
287
+ */
288
+ type ResourceAmountsOfTable<Table> = Partial<Record<ResourceIdOfTable<Table>, number>>;
289
+ type PhaseStateOfState<State> = State extends {
290
+ phase: infer PhaseState;
291
+ } ? PhaseState : never;
292
+ type PublicStateOfState<State> = State extends {
293
+ publicState: infer PublicState;
294
+ } ? PublicState : never;
295
+ type HiddenStateOfState<State> = State extends {
296
+ hiddenState: infer HiddenState;
297
+ } ? HiddenState : never;
298
+ type PrivateStateOfState<State> = State extends {
299
+ privateState: Record<string, infer PrivateState>;
300
+ } ? PrivateState : never;
301
+ type DeckIdOfTable<Table> = Table extends {
302
+ decks: infer Decks;
303
+ } ? StringKeyOf<Decks> : never;
304
+ type HandIdOfTable<Table> = Table extends {
305
+ hands: infer Hands;
306
+ } ? StringKeyOf<Hands> : never;
307
+ type CardIdOfTable<Table> = Table extends {
308
+ cards: infer Cards;
309
+ } ? StringKeyOf<Cards> : never;
310
+ type DeckIdOfState<State> = DeckIdOfTable<TableOfState<State>>;
311
+ type HandIdOfState<State> = HandIdOfTable<TableOfState<State>>;
312
+ type CardIdOfManifest<Manifest> = Manifest extends {
313
+ literals: {
314
+ cardIds: readonly (infer CardId)[];
315
+ };
316
+ } ? Extract<CardId, string> : string;
317
+ type SharedZoneIdOfTable<Table> = DeckIdOfTable<Table>;
318
+ type PlayerZoneIdOfTable<Table> = HandIdOfTable<Table>;
319
+ type BoardMapOfTable<Table> = Table extends {
320
+ boards: {
321
+ byId: infer Boards;
322
+ };
323
+ } ? Boards : never;
324
+ type BoardIdOfTable<Table> = StringKeyOf<BoardMapOfTable<Table>>;
325
+ type BoardStateOfTable<Table, BoardId extends BoardIdOfTable<Table>> = BoardMapOfTable<Table>[BoardId];
326
+ type TiledBoardIdOfTable<Table> = {
327
+ [BoardId in BoardIdOfTable<Table>]: BoardStateOfTable<Table, BoardId> extends {
328
+ layout: "hex" | "square";
329
+ } ? BoardId : never;
330
+ }[BoardIdOfTable<Table>];
331
+ type TiledBoardStateOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends infer BoardState ? BoardState extends {
332
+ layout: "hex" | "square";
333
+ spaces: Record<string, unknown>;
334
+ edges: readonly {
335
+ id: string;
336
+ }[];
337
+ vertices: readonly {
338
+ id: string;
339
+ }[];
340
+ } ? BoardState : never : never;
341
+ type SpaceIdOfTable<Table, BoardId extends BoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends {
342
+ spaces: infer Spaces;
343
+ } ? StringKeyOf<Spaces> : never;
344
+ type BoardContainerIdOfTable<Table, BoardId extends BoardIdOfTable<Table>> = BoardStateOfTable<Table, BoardId> extends {
345
+ containers: infer Containers;
346
+ } ? StringKeyOf<Containers> : never;
347
+ type TiledSpaceIdOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = TiledBoardStateOfTable<Table, BoardId> extends {
348
+ spaces: infer Spaces;
349
+ } ? StringKeyOf<Spaces> : never;
350
+ type TiledEdgeIdOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = TiledBoardStateOfTable<Table, BoardId> extends {
351
+ edges: readonly (infer Edge)[];
352
+ } ? Edge extends {
353
+ id: infer EdgeId;
354
+ } ? Extract<EdgeId, string> : never : never;
355
+ type TiledVertexIdOfTable<Table, BoardId extends TiledBoardIdOfTable<Table>> = TiledBoardStateOfTable<Table, BoardId> extends {
356
+ vertices: readonly (infer Vertex)[];
357
+ } ? Vertex extends {
358
+ id: infer VertexId;
359
+ } ? Extract<VertexId, string> : never : never;
360
+ type ComponentIdOfTable<Table> = Table extends {
361
+ componentLocations: infer ComponentLocations;
362
+ } ? StringKeyOf<ComponentLocations> : never;
363
+ type PlayerZoneIdOfState<State> = HandIdOfState<State>;
364
+ type ManifestOf<Source> = Source extends {
365
+ contract: infer Contract;
366
+ } ? ManifestOf<Contract> : Source extends {
367
+ manifest: infer Manifest;
368
+ } ? Manifest : never;
369
+ type StateDefinitionOfContract<Contract> = Contract extends {
370
+ state: infer StateDefinitionValue;
371
+ } ? StateDefinitionValue : never;
372
+ type PhaseSchemasOfContract<Contract> = Contract extends {
373
+ phases: infer Phases extends Record<string, SchemaLike<object>>;
374
+ } ? Phases : Record<PhaseNameOfManifest<ManifestOf<Contract>>, SchemaLike<object>>;
375
+ type PhaseStateMapOfContract<Contract> = {
376
+ [Name in keyof PhaseSchemasOfContract<Contract> & string]: z.infer<PhaseSchemasOfContract<Contract>[Name]>;
377
+ };
378
+ type PublicSchemaOfContract<Contract> = StateDefinitionOfContract<Contract> extends StateDefinition<infer PublicSchema, SchemaLike<object>, SchemaLike<object>> ? PublicSchema : never;
379
+ type PrivateSchemaOfContract<Contract> = StateDefinitionOfContract<Contract> extends StateDefinition<SchemaLike<object>, infer PrivateSchema, SchemaLike<object>> ? PrivateSchema : never;
380
+ type HiddenSchemaOfContract<Contract> = StateDefinitionOfContract<Contract> extends StateDefinition<SchemaLike<object>, SchemaLike<object>, infer HiddenSchema> ? HiddenSchema : never;
381
+ type PhaseNameOfContract<Contract> = keyof PhaseSchemasOfContract<Contract> extends string ? keyof PhaseSchemasOfContract<Contract> & string : PhaseNameOfManifest<ManifestOf<Contract>>;
382
+ type ManifestContractOf<Contract> = ManifestContract<TableOfManifest<ManifestOf<Contract>>>;
383
+ type ExactManifestContractOf<Contract> = ManifestOf<Contract> & ReducerManifestContractLike<TableOfManifest<ManifestOf<Contract>>>;
384
+ type DeckCardsOfTable<Table, DeckId extends DeckIdOfTable<Table>> = Table extends {
385
+ decks: infer Decks extends Record<string, readonly unknown[]>;
386
+ } ? Decks[DeckId] : never;
387
+ type PlayerRecordValue<T> = T extends Record<string, infer Value> ? Value : never;
388
+ type HandCardsOfTable<Table, HandId extends HandIdOfTable<Table>> = Table extends {
389
+ hands: infer Hands extends Record<string, unknown>;
390
+ } ? HandId extends keyof Hands ? PlayerRecordValue<Hands[HandId]> extends infer Value ? Value extends readonly unknown[] ? Value : never : never : never : never;
391
+ type CardIdOfDeck<Table, DeckId extends DeckIdOfTable<Table>> = DeckCardsOfTable<Table, DeckId>[number];
392
+ type CardIdOfHand<Table, HandId extends HandIdOfTable<Table>> = HandCardsOfTable<Table, HandId>[number];
393
+ type CompatibleHandIdForDeck<Table, DeckId extends DeckIdOfTable<Table>> = {
394
+ [CandidateHandId in HandIdOfTable<Table>]: Extract<CardIdOfDeck<Table, DeckId>, CardIdOfHand<Table, CandidateHandId>> extends never ? never : CandidateHandId;
395
+ }[HandIdOfTable<Table>];
396
+ type CompatibleCardIdForHandAndDeck<Table, HandId extends HandIdOfTable<Table>, DeckId extends DeckIdOfTable<Table>> = Extract<CardIdOfHand<Table, HandId>, CardIdOfDeck<Table, DeckId>>;
397
+ type CompatibleCardIdForTwoPlayerZones<Table, FromZoneId extends HandIdOfTable<Table>, ToZoneId extends HandIdOfTable<Table>> = Extract<CardIdOfHand<Table, FromZoneId>, CardIdOfHand<Table, ToZoneId>>;
398
+ type OptionsSchemaOfContract<Contract> = Contract extends {
399
+ options: infer Schema extends SchemaLike<RuntimeRecord>;
400
+ } ? Schema : SchemaLike<Record<string, never>>;
401
+ type OptionsOfContract<Contract> = z.infer<OptionsSchemaOfContract<Contract>>;
402
+
403
+ declare const InteractionCommitPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
404
+ mode: z.ZodLiteral<"manual">;
405
+ }, z.core.$strict>, z.ZodObject<{
406
+ mode: z.ZodLiteral<"autoWhenReady">;
407
+ }, z.core.$strict>], "mode">;
408
+ declare const InputSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
409
+ mode: z.ZodLiteral<"single">;
410
+ }, z.core.$strict>, z.ZodObject<{
411
+ mode: z.ZodLiteral<"many">;
412
+ min: z.ZodNumber;
413
+ max: z.ZodOptional<z.ZodNumber>;
414
+ distinct: z.ZodOptional<z.ZodBoolean>;
415
+ }, z.core.$strict>], "mode">;
416
+ declare const InteractionChoiceOptionSchema: z.ZodObject<{
417
+ value: z.ZodNullable<z.ZodString>;
418
+ label: z.ZodString;
419
+ icon: z.ZodOptional<z.ZodString>;
420
+ badge: z.ZodOptional<z.ZodString>;
421
+ description: z.ZodOptional<z.ZodString>;
422
+ disabled: z.ZodOptional<z.ZodBoolean>;
423
+ disabledReason: z.ZodOptional<z.ZodString>;
424
+ }, z.core.$strict>;
425
+ declare const InputDomainSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
426
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
427
+ mode: z.ZodLiteral<"single">;
428
+ }, z.core.$strict>, z.ZodObject<{
429
+ mode: z.ZodLiteral<"many">;
430
+ min: z.ZodNumber;
431
+ max: z.ZodOptional<z.ZodNumber>;
432
+ distinct: z.ZodOptional<z.ZodBoolean>;
433
+ }, z.core.$strict>], "mode">>;
434
+ type: z.ZodLiteral<"cardTarget">;
435
+ projection: z.ZodLiteral<"resolved">;
436
+ targetKind: z.ZodLiteral<"card">;
437
+ zoneIds: z.ZodArray<z.ZodString>;
438
+ eligibleTargets: z.ZodArray<z.ZodString>;
439
+ }, z.core.$strict>, z.ZodObject<{
440
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
441
+ mode: z.ZodLiteral<"single">;
442
+ }, z.core.$strict>, z.ZodObject<{
443
+ mode: z.ZodLiteral<"many">;
444
+ min: z.ZodNumber;
445
+ max: z.ZodOptional<z.ZodNumber>;
446
+ distinct: z.ZodOptional<z.ZodBoolean>;
447
+ }, z.core.$strict>], "mode">>;
448
+ type: z.ZodLiteral<"boardTarget">;
449
+ projection: z.ZodLiteral<"resolved">;
450
+ targetKind: z.ZodEnum<{
451
+ edge: "edge";
452
+ vertex: "vertex";
453
+ space: "space";
454
+ tile: "tile";
455
+ }>;
456
+ boardId: z.ZodString;
457
+ valueKind: z.ZodOptional<z.ZodEnum<{
458
+ "board-id": "board-id";
459
+ "player-board-space": "player-board-space";
460
+ }>>;
461
+ eligibleTargets: z.ZodArray<z.ZodString>;
462
+ }, z.core.$strict>, z.ZodObject<{
463
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
464
+ mode: z.ZodLiteral<"single">;
465
+ }, z.core.$strict>, z.ZodObject<{
466
+ mode: z.ZodLiteral<"many">;
467
+ min: z.ZodNumber;
468
+ max: z.ZodOptional<z.ZodNumber>;
469
+ distinct: z.ZodOptional<z.ZodBoolean>;
470
+ }, z.core.$strict>], "mode">>;
471
+ type: z.ZodLiteral<"resourceMap">;
472
+ resources: z.ZodArray<z.ZodObject<{
473
+ resourceId: z.ZodString;
474
+ label: z.ZodOptional<z.ZodString>;
475
+ icon: z.ZodOptional<z.ZodString>;
476
+ min: z.ZodNumber;
477
+ max: z.ZodNumber;
478
+ }, z.core.$strict>>;
479
+ }, z.core.$strict>, z.ZodObject<{
480
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
481
+ mode: z.ZodLiteral<"single">;
482
+ }, z.core.$strict>, z.ZodObject<{
483
+ mode: z.ZodLiteral<"many">;
484
+ min: z.ZodNumber;
485
+ max: z.ZodOptional<z.ZodNumber>;
486
+ distinct: z.ZodOptional<z.ZodBoolean>;
487
+ }, z.core.$strict>], "mode">>;
488
+ type: z.ZodLiteral<"boundedNumber">;
489
+ min: z.ZodNumber;
490
+ max: z.ZodNumber;
491
+ step: z.ZodOptional<z.ZodNumber>;
492
+ }, z.core.$strict>, z.ZodObject<{
493
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
494
+ mode: z.ZodLiteral<"single">;
495
+ }, z.core.$strict>, z.ZodObject<{
496
+ mode: z.ZodLiteral<"many">;
497
+ min: z.ZodNumber;
498
+ max: z.ZodOptional<z.ZodNumber>;
499
+ distinct: z.ZodOptional<z.ZodBoolean>;
500
+ }, z.core.$strict>], "mode">>;
501
+ type: z.ZodLiteral<"choice">;
502
+ choices: z.ZodArray<z.ZodObject<{
503
+ value: z.ZodNullable<z.ZodString>;
504
+ label: z.ZodString;
505
+ icon: z.ZodOptional<z.ZodString>;
506
+ badge: z.ZodOptional<z.ZodString>;
507
+ description: z.ZodOptional<z.ZodString>;
508
+ disabled: z.ZodOptional<z.ZodBoolean>;
509
+ disabledReason: z.ZodOptional<z.ZodString>;
510
+ }, z.core.$strict>>;
511
+ }, z.core.$strict>, z.ZodObject<{
512
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
513
+ mode: z.ZodLiteral<"single">;
514
+ }, z.core.$strict>, z.ZodObject<{
515
+ mode: z.ZodLiteral<"many">;
516
+ min: z.ZodNumber;
517
+ max: z.ZodOptional<z.ZodNumber>;
518
+ distinct: z.ZodOptional<z.ZodBoolean>;
519
+ }, z.core.$strict>], "mode">>;
520
+ type: z.ZodLiteral<"choiceList">;
521
+ choices: z.ZodArray<z.ZodObject<{
522
+ label: z.ZodString;
523
+ icon: z.ZodOptional<z.ZodString>;
524
+ badge: z.ZodOptional<z.ZodString>;
525
+ description: z.ZodOptional<z.ZodString>;
526
+ disabled: z.ZodOptional<z.ZodBoolean>;
527
+ disabledReason: z.ZodOptional<z.ZodString>;
528
+ value: z.ZodString;
529
+ }, z.core.$strict>>;
530
+ min: z.ZodOptional<z.ZodNumber>;
531
+ max: z.ZodOptional<z.ZodNumber>;
532
+ }, z.core.$strict>], "type">;
533
+ declare const InteractionInputDescriptorSchema: z.ZodObject<{
534
+ key: z.ZodString;
535
+ kind: z.ZodEnum<{
536
+ card: "card";
537
+ form: "form";
538
+ "board-vertex": "board-vertex";
539
+ "board-edge": "board-edge";
540
+ "board-tile": "board-tile";
541
+ "board-space": "board-space";
542
+ rng: "rng";
543
+ }>;
544
+ domain: z.ZodDiscriminatedUnion<[z.ZodObject<{
545
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
546
+ mode: z.ZodLiteral<"single">;
547
+ }, z.core.$strict>, z.ZodObject<{
548
+ mode: z.ZodLiteral<"many">;
549
+ min: z.ZodNumber;
550
+ max: z.ZodOptional<z.ZodNumber>;
551
+ distinct: z.ZodOptional<z.ZodBoolean>;
552
+ }, z.core.$strict>], "mode">>;
553
+ type: z.ZodLiteral<"cardTarget">;
554
+ projection: z.ZodLiteral<"resolved">;
555
+ targetKind: z.ZodLiteral<"card">;
556
+ zoneIds: z.ZodArray<z.ZodString>;
557
+ eligibleTargets: z.ZodArray<z.ZodString>;
558
+ }, z.core.$strict>, z.ZodObject<{
559
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
560
+ mode: z.ZodLiteral<"single">;
561
+ }, z.core.$strict>, z.ZodObject<{
562
+ mode: z.ZodLiteral<"many">;
563
+ min: z.ZodNumber;
564
+ max: z.ZodOptional<z.ZodNumber>;
565
+ distinct: z.ZodOptional<z.ZodBoolean>;
566
+ }, z.core.$strict>], "mode">>;
567
+ type: z.ZodLiteral<"boardTarget">;
568
+ projection: z.ZodLiteral<"resolved">;
569
+ targetKind: z.ZodEnum<{
570
+ edge: "edge";
571
+ vertex: "vertex";
572
+ space: "space";
573
+ tile: "tile";
574
+ }>;
575
+ boardId: z.ZodString;
576
+ valueKind: z.ZodOptional<z.ZodEnum<{
577
+ "board-id": "board-id";
578
+ "player-board-space": "player-board-space";
579
+ }>>;
580
+ eligibleTargets: z.ZodArray<z.ZodString>;
581
+ }, z.core.$strict>, z.ZodObject<{
582
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
583
+ mode: z.ZodLiteral<"single">;
584
+ }, z.core.$strict>, z.ZodObject<{
585
+ mode: z.ZodLiteral<"many">;
586
+ min: z.ZodNumber;
587
+ max: z.ZodOptional<z.ZodNumber>;
588
+ distinct: z.ZodOptional<z.ZodBoolean>;
589
+ }, z.core.$strict>], "mode">>;
590
+ type: z.ZodLiteral<"resourceMap">;
591
+ resources: z.ZodArray<z.ZodObject<{
592
+ resourceId: z.ZodString;
593
+ label: z.ZodOptional<z.ZodString>;
594
+ icon: z.ZodOptional<z.ZodString>;
595
+ min: z.ZodNumber;
596
+ max: z.ZodNumber;
597
+ }, z.core.$strict>>;
598
+ }, z.core.$strict>, z.ZodObject<{
599
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
600
+ mode: z.ZodLiteral<"single">;
601
+ }, z.core.$strict>, z.ZodObject<{
602
+ mode: z.ZodLiteral<"many">;
603
+ min: z.ZodNumber;
604
+ max: z.ZodOptional<z.ZodNumber>;
605
+ distinct: z.ZodOptional<z.ZodBoolean>;
606
+ }, z.core.$strict>], "mode">>;
607
+ type: z.ZodLiteral<"boundedNumber">;
608
+ min: z.ZodNumber;
609
+ max: z.ZodNumber;
610
+ step: z.ZodOptional<z.ZodNumber>;
611
+ }, z.core.$strict>, z.ZodObject<{
612
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
613
+ mode: z.ZodLiteral<"single">;
614
+ }, z.core.$strict>, z.ZodObject<{
615
+ mode: z.ZodLiteral<"many">;
616
+ min: z.ZodNumber;
617
+ max: z.ZodOptional<z.ZodNumber>;
618
+ distinct: z.ZodOptional<z.ZodBoolean>;
619
+ }, z.core.$strict>], "mode">>;
620
+ type: z.ZodLiteral<"choice">;
621
+ choices: z.ZodArray<z.ZodObject<{
622
+ value: z.ZodNullable<z.ZodString>;
623
+ label: z.ZodString;
624
+ icon: z.ZodOptional<z.ZodString>;
625
+ badge: z.ZodOptional<z.ZodString>;
626
+ description: z.ZodOptional<z.ZodString>;
627
+ disabled: z.ZodOptional<z.ZodBoolean>;
628
+ disabledReason: z.ZodOptional<z.ZodString>;
629
+ }, z.core.$strict>>;
630
+ }, z.core.$strict>, z.ZodObject<{
631
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
632
+ mode: z.ZodLiteral<"single">;
633
+ }, z.core.$strict>, z.ZodObject<{
634
+ mode: z.ZodLiteral<"many">;
635
+ min: z.ZodNumber;
636
+ max: z.ZodOptional<z.ZodNumber>;
637
+ distinct: z.ZodOptional<z.ZodBoolean>;
638
+ }, z.core.$strict>], "mode">>;
639
+ type: z.ZodLiteral<"choiceList">;
640
+ choices: z.ZodArray<z.ZodObject<{
641
+ label: z.ZodString;
642
+ icon: z.ZodOptional<z.ZodString>;
643
+ badge: z.ZodOptional<z.ZodString>;
644
+ description: z.ZodOptional<z.ZodString>;
645
+ disabled: z.ZodOptional<z.ZodBoolean>;
646
+ disabledReason: z.ZodOptional<z.ZodString>;
647
+ value: z.ZodString;
648
+ }, z.core.$strict>>;
649
+ min: z.ZodOptional<z.ZodNumber>;
650
+ max: z.ZodOptional<z.ZodNumber>;
651
+ }, z.core.$strict>], "type">;
652
+ defaultValue: z.ZodOptional<z.ZodJSONSchema>;
653
+ }, z.core.$strict>;
654
+ declare const InteractionAvailabilitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
655
+ status: z.ZodLiteral<"available">;
656
+ }, z.core.$strict>, z.ZodObject<{
657
+ status: z.ZodLiteral<"notYourTurn">;
658
+ reason: z.ZodString;
659
+ }, z.core.$strict>, z.ZodObject<{
660
+ status: z.ZodLiteral<"blocked">;
661
+ reason: z.ZodString;
662
+ code: z.ZodOptional<z.ZodString>;
663
+ }, z.core.$strict>], "status">;
664
+ declare const InteractionDescriptorSchema: z.ZodObject<{
665
+ phaseName: z.ZodString;
666
+ interactionKey: z.ZodString;
667
+ interactionId: z.ZodString;
668
+ label: z.ZodString;
669
+ help: z.ZodOptional<z.ZodString>;
670
+ zoneId: z.ZodOptional<z.ZodString>;
671
+ zoneIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
672
+ commit: z.ZodDiscriminatedUnion<[z.ZodObject<{
673
+ mode: z.ZodLiteral<"manual">;
674
+ }, z.core.$strict>, z.ZodObject<{
675
+ mode: z.ZodLiteral<"autoWhenReady">;
676
+ }, z.core.$strict>], "mode">;
677
+ descriptorDigest: z.ZodOptional<z.ZodString>;
678
+ actorSeat: z.ZodOptional<z.ZodNumber>;
679
+ draftDigest: z.ZodOptional<z.ZodString>;
680
+ inputs: z.ZodArray<z.ZodObject<{
681
+ key: z.ZodString;
682
+ kind: z.ZodEnum<{
683
+ card: "card";
684
+ form: "form";
685
+ "board-vertex": "board-vertex";
686
+ "board-edge": "board-edge";
687
+ "board-tile": "board-tile";
688
+ "board-space": "board-space";
689
+ rng: "rng";
690
+ }>;
691
+ domain: z.ZodDiscriminatedUnion<[z.ZodObject<{
692
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
693
+ mode: z.ZodLiteral<"single">;
694
+ }, z.core.$strict>, z.ZodObject<{
695
+ mode: z.ZodLiteral<"many">;
696
+ min: z.ZodNumber;
697
+ max: z.ZodOptional<z.ZodNumber>;
698
+ distinct: z.ZodOptional<z.ZodBoolean>;
699
+ }, z.core.$strict>], "mode">>;
700
+ type: z.ZodLiteral<"cardTarget">;
701
+ projection: z.ZodLiteral<"resolved">;
702
+ targetKind: z.ZodLiteral<"card">;
703
+ zoneIds: z.ZodArray<z.ZodString>;
704
+ eligibleTargets: z.ZodArray<z.ZodString>;
705
+ }, z.core.$strict>, z.ZodObject<{
706
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
707
+ mode: z.ZodLiteral<"single">;
708
+ }, z.core.$strict>, z.ZodObject<{
709
+ mode: z.ZodLiteral<"many">;
710
+ min: z.ZodNumber;
711
+ max: z.ZodOptional<z.ZodNumber>;
712
+ distinct: z.ZodOptional<z.ZodBoolean>;
713
+ }, z.core.$strict>], "mode">>;
714
+ type: z.ZodLiteral<"boardTarget">;
715
+ projection: z.ZodLiteral<"resolved">;
716
+ targetKind: z.ZodEnum<{
717
+ edge: "edge";
718
+ vertex: "vertex";
719
+ space: "space";
720
+ tile: "tile";
721
+ }>;
722
+ boardId: z.ZodString;
723
+ valueKind: z.ZodOptional<z.ZodEnum<{
724
+ "board-id": "board-id";
725
+ "player-board-space": "player-board-space";
726
+ }>>;
727
+ eligibleTargets: z.ZodArray<z.ZodString>;
728
+ }, z.core.$strict>, z.ZodObject<{
729
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
730
+ mode: z.ZodLiteral<"single">;
731
+ }, z.core.$strict>, z.ZodObject<{
732
+ mode: z.ZodLiteral<"many">;
733
+ min: z.ZodNumber;
734
+ max: z.ZodOptional<z.ZodNumber>;
735
+ distinct: z.ZodOptional<z.ZodBoolean>;
736
+ }, z.core.$strict>], "mode">>;
737
+ type: z.ZodLiteral<"resourceMap">;
738
+ resources: z.ZodArray<z.ZodObject<{
739
+ resourceId: z.ZodString;
740
+ label: z.ZodOptional<z.ZodString>;
741
+ icon: z.ZodOptional<z.ZodString>;
742
+ min: z.ZodNumber;
743
+ max: z.ZodNumber;
744
+ }, z.core.$strict>>;
745
+ }, z.core.$strict>, z.ZodObject<{
746
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
747
+ mode: z.ZodLiteral<"single">;
748
+ }, z.core.$strict>, z.ZodObject<{
749
+ mode: z.ZodLiteral<"many">;
750
+ min: z.ZodNumber;
751
+ max: z.ZodOptional<z.ZodNumber>;
752
+ distinct: z.ZodOptional<z.ZodBoolean>;
753
+ }, z.core.$strict>], "mode">>;
754
+ type: z.ZodLiteral<"boundedNumber">;
755
+ min: z.ZodNumber;
756
+ max: z.ZodNumber;
757
+ step: z.ZodOptional<z.ZodNumber>;
758
+ }, z.core.$strict>, z.ZodObject<{
759
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
760
+ mode: z.ZodLiteral<"single">;
761
+ }, z.core.$strict>, z.ZodObject<{
762
+ mode: z.ZodLiteral<"many">;
763
+ min: z.ZodNumber;
764
+ max: z.ZodOptional<z.ZodNumber>;
765
+ distinct: z.ZodOptional<z.ZodBoolean>;
766
+ }, z.core.$strict>], "mode">>;
767
+ type: z.ZodLiteral<"choice">;
768
+ choices: z.ZodArray<z.ZodObject<{
769
+ value: z.ZodNullable<z.ZodString>;
770
+ label: z.ZodString;
771
+ icon: z.ZodOptional<z.ZodString>;
772
+ badge: z.ZodOptional<z.ZodString>;
773
+ description: z.ZodOptional<z.ZodString>;
774
+ disabled: z.ZodOptional<z.ZodBoolean>;
775
+ disabledReason: z.ZodOptional<z.ZodString>;
776
+ }, z.core.$strict>>;
777
+ }, z.core.$strict>, z.ZodObject<{
778
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
779
+ mode: z.ZodLiteral<"single">;
780
+ }, z.core.$strict>, z.ZodObject<{
781
+ mode: z.ZodLiteral<"many">;
782
+ min: z.ZodNumber;
783
+ max: z.ZodOptional<z.ZodNumber>;
784
+ distinct: z.ZodOptional<z.ZodBoolean>;
785
+ }, z.core.$strict>], "mode">>;
786
+ type: z.ZodLiteral<"choiceList">;
787
+ choices: z.ZodArray<z.ZodObject<{
788
+ label: z.ZodString;
789
+ icon: z.ZodOptional<z.ZodString>;
790
+ badge: z.ZodOptional<z.ZodString>;
791
+ description: z.ZodOptional<z.ZodString>;
792
+ disabled: z.ZodOptional<z.ZodBoolean>;
793
+ disabledReason: z.ZodOptional<z.ZodString>;
794
+ value: z.ZodString;
795
+ }, z.core.$strict>>;
796
+ min: z.ZodOptional<z.ZodNumber>;
797
+ max: z.ZodOptional<z.ZodNumber>;
798
+ }, z.core.$strict>], "type">;
799
+ defaultValue: z.ZodOptional<z.ZodJSONSchema>;
800
+ }, z.core.$strict>>;
801
+ step: z.ZodOptional<z.ZodObject<{
802
+ index: z.ZodNumber;
803
+ total: z.ZodNumber;
804
+ selected: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
805
+ canCancel: z.ZodBoolean;
806
+ }, z.core.$strict>>;
807
+ availability: z.ZodDiscriminatedUnion<[z.ZodObject<{
808
+ status: z.ZodLiteral<"available">;
809
+ }, z.core.$strict>, z.ZodObject<{
810
+ status: z.ZodLiteral<"notYourTurn">;
811
+ reason: z.ZodString;
812
+ }, z.core.$strict>, z.ZodObject<{
813
+ status: z.ZodLiteral<"blocked">;
814
+ reason: z.ZodString;
815
+ code: z.ZodOptional<z.ZodString>;
816
+ }, z.core.$strict>], "status">;
817
+ reasons: z.ZodOptional<z.ZodArray<z.ZodObject<{
818
+ ruleId: z.ZodString;
819
+ errorCode: z.ZodString;
820
+ }, z.core.$strict>>>;
821
+ kind: z.ZodLiteral<"action">;
822
+ }, z.core.$strict>;
823
+ type DeepReadonly<T> = T extends readonly (infer Item)[] ? readonly DeepReadonly<Item>[] : T extends object ? {
824
+ readonly [K in keyof T]: DeepReadonly<T[K]>;
825
+ } : T;
826
+ type InputDomain = DeepReadonly<z.infer<typeof InputDomainSchema>>;
827
+ type InputSelection = DeepReadonly<z.infer<typeof InputSelectionSchema>>;
828
+ type InteractionCommitPolicy$1 = z.infer<typeof InteractionCommitPolicySchema>;
829
+ type InteractionChoiceOption = DeepReadonly<z.infer<typeof InteractionChoiceOptionSchema>>;
830
+ type InteractionInputDescriptor = Readonly<Omit<z.infer<typeof InteractionInputDescriptorSchema>, "domain">> & {
831
+ readonly domain: InputDomain;
832
+ };
833
+ type InteractionAvailability = DeepReadonly<z.infer<typeof InteractionAvailabilitySchema>>;
834
+ type DescriptorData = z.infer<typeof InteractionDescriptorSchema>;
835
+ type InteractionDescriptor = Readonly<Omit<DescriptorData, "inputs" | "step" | "zoneIds" | "reasons">> & {
836
+ readonly inputs: readonly InteractionInputDescriptor[];
837
+ readonly zoneIds?: readonly string[];
838
+ readonly reasons?: readonly Readonly<NonNullable<DescriptorData["reasons"]>[number]>[];
839
+ readonly step?: Readonly<Omit<NonNullable<DescriptorData["step"]>, "selected">> & {
840
+ readonly selected: Readonly<NonNullable<DescriptorData["step"]>["selected"]>;
841
+ };
842
+ };
843
+ type InteractionDiagnosticReason = NonNullable<InteractionDescriptor["reasons"]>[number];
844
+
845
+ /**
846
+ * Supported player-count metadata for the game
847
+ */
848
+ type PlayersDefinition = {
849
+ minPlayers: number;
850
+ maxPlayers: number;
851
+ optimalPlayers?: number;
852
+ };
853
+ type PresetCardSetDefinition = {
854
+ /**
855
+ * Unique local identifier for the authored card set
856
+ */
857
+ id: string;
858
+ /**
859
+ * Built-in preset card-set selector
860
+ */
861
+ presetId: string;
862
+ /**
863
+ * Display name of the card set
864
+ */
865
+ name: string;
866
+ /**
867
+ * Type of card set source
868
+ */
869
+ type: "preset";
870
+ /**
871
+ * Default initial home for cards materialized from the preset.
872
+ */
873
+ defaultHome: ComponentHomeSpec;
874
+ };
875
+ /**
876
+ * Arbitrary authored JSON value.
877
+ */
878
+ type JsonValue = RuntimeJson;
879
+ type PropertySchema = {
880
+ /**
881
+ * The data type of the property.
882
+ */
883
+ type: "string" | "integer" | "number" | "boolean" | "zoneId" | "cardId" | "playerId" | "boardId" | "edgeId" | "vertexId" | "spaceId" | "pieceId" | "dieId" | "resourceId" | "array" | "object" | "record" | "enum";
884
+ /**
885
+ * Optional description of the property's purpose and usage.
886
+ */
887
+ description?: string;
888
+ /**
889
+ * Whether an object property may be omitted.
890
+ */
891
+ optional?: boolean;
892
+ /**
893
+ * Whether the value may be null.
894
+ */
895
+ nullable?: boolean;
896
+ /**
897
+ * Optional authored default value for this property. When present, omitted
898
+ * seed values materialize to the default and generated TypeScript treats
899
+ * the property as present even if `optional: true` is also set.
900
+ *
901
+ */
902
+ default?: JsonValue;
903
+ /**
904
+ * For array types, the schema of the array items. Required if type is 'array'.
905
+ */
906
+ items?: PropertySchema;
907
+ /**
908
+ * For object types, the schema of the object's properties. Required if type is 'object'.
909
+ */
910
+ properties?: {
911
+ [key: string]: PropertySchema;
912
+ };
913
+ /**
914
+ * For enum types, the list of allowed string values. Required if type is 'enum'.
915
+ */
916
+ enums?: Array<string>;
917
+ /**
918
+ * For record types, the schema of the record's values. Required if type is 'record'.
919
+ */
920
+ values?: PropertySchema;
921
+ };
922
+ type ObjectSchema = {
923
+ /**
924
+ * Map of property names to their schemas. Type is always 'object' and all properties are required.
925
+ */
926
+ properties: {
927
+ [key: string]: PropertySchema;
928
+ };
929
+ };
930
+ type CardPropertySchemaVariants = {
931
+ /**
932
+ * Property schemas present on every card-type variant.
933
+ */
934
+ shared?: {
935
+ [key: string]: PropertySchema;
936
+ };
937
+ /**
938
+ * Property schema for each card type in this manual card set.
939
+ */
940
+ variants: {
941
+ [key: string]: ObjectSchema;
942
+ };
943
+ };
944
+ type CardPropertySchema = ObjectSchema | CardPropertySchemaVariants;
945
+ type DetachedHomeSpec = {
946
+ type: "detached";
947
+ };
948
+ type ZoneHomeSpec = {
949
+ type: "zone";
950
+ zoneId: string;
951
+ };
952
+ type SpaceHomeSpec = {
953
+ type: "space";
954
+ boardId: string;
955
+ spaceId: string;
956
+ };
957
+ type ContainerHomeSpec = {
958
+ type: "container";
959
+ boardId: string;
960
+ containerId: string;
961
+ };
962
+ /**
963
+ * Tiled board edge identified by the spaces that border it
964
+ */
965
+ type BoardEdgeRef = {
966
+ spaces: Array<string>;
967
+ };
968
+ type EdgeHomeSpec = {
969
+ type: "edge";
970
+ boardId: string;
971
+ ref: BoardEdgeRef;
972
+ };
973
+ /**
974
+ * Tiled board vertex identified by the spaces that touch it
975
+ */
976
+ type BoardVertexRef = {
977
+ spaces: Array<string>;
978
+ };
979
+ type VertexHomeSpec = {
980
+ type: "vertex";
981
+ boardId: string;
982
+ ref: BoardVertexRef;
983
+ };
984
+ type PieceSlotHostRef = {
985
+ kind: "piece";
986
+ id: string;
987
+ };
988
+ type DieSlotHostRef = {
989
+ kind: "die";
990
+ id: string;
991
+ };
992
+ type SlotHostRef = ({
993
+ kind: "piece";
994
+ } & PieceSlotHostRef) | ({
995
+ kind: "die";
996
+ } & DieSlotHostRef);
997
+ type SlotHomeSpec = {
998
+ type: "slot";
999
+ host: SlotHostRef;
1000
+ slotId: string;
1001
+ };
1002
+ type ComponentHomeSpec = ({
1003
+ type: "detached";
1004
+ } & DetachedHomeSpec) | ({
1005
+ type: "zone";
1006
+ } & ZoneHomeSpec) | ({
1007
+ type: "space";
1008
+ } & SpaceHomeSpec) | ({
1009
+ type: "container";
1010
+ } & ContainerHomeSpec) | ({
1011
+ type: "edge";
1012
+ } & EdgeHomeSpec) | ({
1013
+ type: "vertex";
1014
+ } & VertexHomeSpec) | ({
1015
+ type: "slot";
1016
+ } & SlotHomeSpec);
1017
+ /**
1018
+ * Default authored visibility for a component instance
1019
+ */
1020
+ type ComponentVisibilitySpec = {
1021
+ faceUp?: boolean;
1022
+ /**
1023
+ * When omitted, visible to all players
1024
+ */
1025
+ visibleTo?: Array<string>;
1026
+ };
1027
+ type BoardCard = {
1028
+ /**
1029
+ * Card type identifier used to generate runtime CardIds. When count > 1, runtime IDs are generated as '{type}-1', '{type}-2', etc.
1030
+ */
1031
+ type: string;
1032
+ /**
1033
+ * Display name of the card
1034
+ */
1035
+ name: string;
1036
+ /**
1037
+ * URL to the card's image
1038
+ */
1039
+ imageUrl?: string;
1040
+ /**
1041
+ * Text content on the card
1042
+ */
1043
+ text?: string;
1044
+ /**
1045
+ * Number of copies of this card
1046
+ */
1047
+ count: number;
1048
+ /**
1049
+ * Optional authored card category or subtype identifier
1050
+ */
1051
+ cardType?: string;
1052
+ /**
1053
+ * Optional per-card initial home. Omitted cards use their manual card set's
1054
+ * defaultHome. Compatibility declarations such as allowedCardSetIds never
1055
+ * imply placement. Player-scoped distribution belongs in reducer setup.
1056
+ */
1057
+ home?: ComponentHomeSpec;
1058
+ /**
1059
+ * Default authored visibility for the card inventory
1060
+ */
1061
+ visibility?: ComponentVisibilitySpec;
1062
+ /**
1063
+ * Actual property values for this specific card instance. Keys must match the properties defined in the referenced cardSchema.
1064
+ */
1065
+ properties: {
1066
+ [key: string]: JsonValue;
1067
+ };
1068
+ };
1069
+ type ManualCardSetDefinition = {
1070
+ /**
1071
+ * Unique identifier for the card set
1072
+ */
1073
+ id: string;
1074
+ /**
1075
+ * Display name of the card set
1076
+ */
1077
+ name: string;
1078
+ /**
1079
+ * Type of card set source
1080
+ */
1081
+ type: "manual";
1082
+ /**
1083
+ * Schema definition for authored card properties in this card set
1084
+ */
1085
+ cardSchema: CardPropertySchema;
1086
+ /**
1087
+ * Default initial home for cards that do not declare a per-card home.
1088
+ */
1089
+ defaultHome: ComponentHomeSpec;
1090
+ /**
1091
+ * List of authored cards in this card set
1092
+ */
1093
+ cards: Array<BoardCard>;
1094
+ };
1095
+ type CardSetDefinition = ({
1096
+ type: "preset";
1097
+ } & PresetCardSetDefinition) | ({
1098
+ type: "manual";
1099
+ } & ManualCardSetDefinition);
1100
+ /**
1101
+ * Whether authored topology exists once for the table or once per player
1102
+ */
1103
+ type TopologyScope = "shared" | "perPlayer";
1104
+ /**
1105
+ * Default topology visibility for a zone or slot
1106
+ */
1107
+ type ZoneVisibility = "ownerOnly" | "public" | "hidden";
1108
+ /**
1109
+ * Generic authored container that can hold cards, pieces, or dice
1110
+ */
1111
+ type ZoneSpec = {
1112
+ /**
1113
+ * Stable zone identifier
1114
+ */
1115
+ id: string;
1116
+ /**
1117
+ * Display name for the zone
1118
+ */
1119
+ name: string;
1120
+ scope: TopologyScope;
1121
+ /**
1122
+ * Optional card-set restriction for this zone
1123
+ */
1124
+ allowedCardSetIds?: Array<string>;
1125
+ visibility?: ZoneVisibility;
1126
+ };
1127
+ /**
1128
+ * Stable authored board space or slot anchor
1129
+ */
1130
+ type BoardSpaceSpec = {
1131
+ /**
1132
+ * Stable space identifier local to the board
1133
+ */
1134
+ id: string;
1135
+ /**
1136
+ * Human-readable space name
1137
+ */
1138
+ name?: string;
1139
+ /**
1140
+ * Optional authored space type identifier
1141
+ */
1142
+ typeId?: string;
1143
+ /**
1144
+ * Typed authored fields validated against the board's spaceFieldsSchema
1145
+ */
1146
+ fields?: {
1147
+ [key: string]: JsonValue;
1148
+ };
1149
+ };
1150
+ /**
1151
+ * Named relation between two authored spaces
1152
+ */
1153
+ type BoardRelationSpec = {
1154
+ /**
1155
+ * Optional stable relation identifier
1156
+ */
1157
+ id?: string;
1158
+ /**
1159
+ * Relation type identifier such as adjacent, covers, blocks, or linked
1160
+ */
1161
+ typeId: string;
1162
+ fromSpaceId: string;
1163
+ toSpaceId: string;
1164
+ directed?: boolean;
1165
+ /**
1166
+ * Typed authored relation fields validated against relationFieldsSchema
1167
+ */
1168
+ fields?: {
1169
+ [key: string]: JsonValue;
1170
+ };
1171
+ };
1172
+ type BoardHostSpec = {
1173
+ type: "board";
1174
+ };
1175
+ type SpaceHostSpec = {
1176
+ type: "space";
1177
+ spaceId: string;
1178
+ };
1179
+ type BoardContainerHostSpec = ({
1180
+ type: "board";
1181
+ } & BoardHostSpec) | ({
1182
+ type: "space";
1183
+ } & SpaceHostSpec);
1184
+ /**
1185
+ * Authored board-attached or space-attached container/slot
1186
+ */
1187
+ type BoardContainerSpec = {
1188
+ /**
1189
+ * Stable container identifier local to the board
1190
+ */
1191
+ id: string;
1192
+ /**
1193
+ * Display name for the container
1194
+ */
1195
+ name: string;
1196
+ host: BoardContainerHostSpec;
1197
+ allowedCardSetIds?: Array<string>;
1198
+ /**
1199
+ * Typed authored container fields validated against containerFieldsSchema
1200
+ */
1201
+ fields?: {
1202
+ [key: string]: JsonValue;
1203
+ };
1204
+ };
1205
+ /**
1206
+ * Visual orientation for authored hex coordinates
1207
+ */
1208
+ type HexOrientation = "pointy" | "flat";
1209
+ type HexCoordinate = {
1210
+ q: number;
1211
+ r: number;
1212
+ };
1213
+ type HexShape = {
1214
+ kind: "hexagon" | "spiral";
1215
+ radius: number;
1216
+ center?: HexCoordinate;
1217
+ } | {
1218
+ kind: "ring";
1219
+ radius: number;
1220
+ center?: HexCoordinate;
1221
+ } | {
1222
+ kind: "rectangle";
1223
+ width: number;
1224
+ height: number;
1225
+ start?: HexCoordinate;
1226
+ } | {
1227
+ kind: "coordinates";
1228
+ coordinates: readonly HexCoordinate[];
1229
+ };
1230
+ type HexSpaceOverride = Omit<HexSpaceSpec, "id" | "q" | "r"> & {
1231
+ id?: string;
1232
+ };
1233
+ /**
1234
+ * One authored hex space in axial coordinates
1235
+ */
1236
+ type HexSpaceSpec = {
1237
+ /**
1238
+ * Stable space identifier local to the board
1239
+ */
1240
+ id: string;
1241
+ /**
1242
+ * Axial q coordinate
1243
+ */
1244
+ q: number;
1245
+ /**
1246
+ * Axial r coordinate
1247
+ */
1248
+ r: number;
1249
+ /**
1250
+ * Optional authored space type identifier
1251
+ */
1252
+ typeId?: string;
1253
+ /**
1254
+ * Optional hex-space label for setup or rendering
1255
+ */
1256
+ label?: string;
1257
+ /**
1258
+ * Typed authored fields validated against the board's spaceFieldsSchema
1259
+ */
1260
+ fields?: {
1261
+ [key: string]: JsonValue;
1262
+ };
1263
+ };
1264
+ /**
1265
+ * Hex edge identified by two adjacent hex spaces
1266
+ */
1267
+ type HexEdgeRef = {
1268
+ spaces: [string, string];
1269
+ } | {
1270
+ space: string;
1271
+ side: 0 | 1 | 2 | 3 | 4 | 5;
1272
+ };
1273
+ /**
1274
+ * Authored metadata attached to one derived hex edge
1275
+ */
1276
+ type HexEdgeSpec = {
1277
+ ref: HexEdgeRef;
1278
+ /**
1279
+ * Optional authored edge type identifier
1280
+ */
1281
+ typeId?: string;
1282
+ /**
1283
+ * Optional edge label for setup or rendering
1284
+ */
1285
+ label?: string;
1286
+ tags?: Array<string>;
1287
+ /**
1288
+ * Typed authored edge fields validated against edgeFieldsSchema
1289
+ */
1290
+ fields?: {
1291
+ [key: string]: JsonValue;
1292
+ };
1293
+ };
1294
+ /**
1295
+ * Hex vertex identified by three touching hex spaces
1296
+ */
1297
+ type HexVertexRef = {
1298
+ spaces: [string, string, string];
1299
+ } | {
1300
+ space: string;
1301
+ corner: 0 | 1 | 2 | 3 | 4 | 5;
1302
+ };
1303
+ /**
1304
+ * Authored metadata attached to one derived hex vertex
1305
+ */
1306
+ type HexVertexSpec = {
1307
+ ref: HexVertexRef;
1308
+ /**
1309
+ * Optional authored vertex type identifier
1310
+ */
1311
+ typeId?: string;
1312
+ /**
1313
+ * Optional vertex label for setup or rendering
1314
+ */
1315
+ label?: string;
1316
+ tags?: Array<string>;
1317
+ /**
1318
+ * Typed authored vertex fields validated against vertexFieldsSchema
1319
+ */
1320
+ fields?: {
1321
+ [key: string]: JsonValue;
1322
+ };
1323
+ };
1324
+ /**
1325
+ * One authored square space in row/column coordinates
1326
+ */
1327
+ type SquareSpaceSpec = {
1328
+ /**
1329
+ * Stable space identifier local to the board
1330
+ */
1331
+ id: string;
1332
+ /**
1333
+ * Zero-based row coordinate
1334
+ */
1335
+ row: number;
1336
+ /**
1337
+ * Zero-based column coordinate
1338
+ */
1339
+ col: number;
1340
+ /**
1341
+ * Optional authored space type identifier
1342
+ */
1343
+ typeId?: string;
1344
+ /**
1345
+ * Optional square-space label for setup or rendering
1346
+ */
1347
+ label?: string;
1348
+ /**
1349
+ * Typed authored fields validated against the board's spaceFieldsSchema
1350
+ */
1351
+ fields?: {
1352
+ [key: string]: JsonValue;
1353
+ };
1354
+ };
1355
+ /**
1356
+ * Authored metadata attached to one derived square edge
1357
+ */
1358
+ type SquareEdgeSpec = {
1359
+ ref: BoardEdgeRef;
1360
+ /**
1361
+ * Optional authored edge type identifier
1362
+ */
1363
+ typeId?: string;
1364
+ /**
1365
+ * Optional edge label for setup or rendering
1366
+ */
1367
+ label?: string;
1368
+ tags?: Array<string>;
1369
+ /**
1370
+ * Typed authored edge fields validated against edgeFieldsSchema
1371
+ */
1372
+ fields?: {
1373
+ [key: string]: JsonValue;
1374
+ };
1375
+ };
1376
+ /**
1377
+ * Authored metadata attached to one derived square vertex
1378
+ */
1379
+ type SquareVertexSpec = {
1380
+ ref: BoardVertexRef;
1381
+ /**
1382
+ * Optional authored vertex type identifier
1383
+ */
1384
+ typeId?: string;
1385
+ /**
1386
+ * Optional vertex label for setup or rendering
1387
+ */
1388
+ label?: string;
1389
+ tags?: Array<string>;
1390
+ /**
1391
+ * Typed authored vertex fields validated against vertexFieldsSchema
1392
+ */
1393
+ fields?: {
1394
+ [key: string]: JsonValue;
1395
+ };
1396
+ };
1397
+ /**
1398
+ * Shared or per-player authored board instance shell
1399
+ */
1400
+ type GenericBoardSpec = {
1401
+ /**
1402
+ * Stable board identifier
1403
+ */
1404
+ id: string;
1405
+ name: string;
1406
+ layout: "generic";
1407
+ /**
1408
+ * Optional authored board type identifier such as track, map, tableau, or grid
1409
+ */
1410
+ typeId?: string;
1411
+ scope: TopologyScope;
1412
+ boardFieldsSchema?: ObjectSchema;
1413
+ spaceFieldsSchema?: ObjectSchema;
1414
+ relationFieldsSchema?: ObjectSchema;
1415
+ containerFieldsSchema?: ObjectSchema;
1416
+ /**
1417
+ * Typed authored board fields validated against boardFieldsSchema
1418
+ */
1419
+ fields?: {
1420
+ [key: string]: JsonValue;
1421
+ };
1422
+ spaces?: Array<BoardSpaceSpec>;
1423
+ relations?: Array<BoardRelationSpec>;
1424
+ containers?: Array<BoardContainerSpec>;
1425
+ };
1426
+ /**
1427
+ * Shared or per-player authored hex board instance shell
1428
+ */
1429
+ type HexBoardSpec = {
1430
+ /**
1431
+ * Stable board identifier
1432
+ */
1433
+ id: string;
1434
+ name: string;
1435
+ layout: "hex";
1436
+ /**
1437
+ * Optional authored board type identifier
1438
+ */
1439
+ typeId?: string;
1440
+ scope: TopologyScope;
1441
+ /**
1442
+ * Shape used to generate spaces before exclusions and coordinate overrides
1443
+ */
1444
+ shape: HexShape;
1445
+ exclude?: Array<HexCoordinate>;
1446
+ orientation?: HexOrientation;
1447
+ boardFieldsSchema?: ObjectSchema;
1448
+ spaceFieldsSchema?: ObjectSchema;
1449
+ edgeFieldsSchema?: ObjectSchema;
1450
+ vertexFieldsSchema?: ObjectSchema;
1451
+ /**
1452
+ * Typed authored board fields validated against boardFieldsSchema
1453
+ */
1454
+ fields?: {
1455
+ [key: string]: JsonValue;
1456
+ };
1457
+ spaces?: {
1458
+ [coordinate: `${number},${number}`]: HexSpaceOverride;
1459
+ };
1460
+ edges?: Array<HexEdgeSpec>;
1461
+ vertices?: Array<HexVertexSpec>;
1462
+ };
1463
+ /**
1464
+ * Shared or per-player authored square board instance shell
1465
+ */
1466
+ type SquareBoardSpec = {
1467
+ /**
1468
+ * Stable board identifier
1469
+ */
1470
+ id: string;
1471
+ name: string;
1472
+ layout: "square";
1473
+ /**
1474
+ * Optional authored board type identifier
1475
+ */
1476
+ typeId?: string;
1477
+ scope: TopologyScope;
1478
+ boardFieldsSchema?: ObjectSchema;
1479
+ spaceFieldsSchema?: ObjectSchema;
1480
+ relationFieldsSchema?: ObjectSchema;
1481
+ containerFieldsSchema?: ObjectSchema;
1482
+ edgeFieldsSchema?: ObjectSchema;
1483
+ vertexFieldsSchema?: ObjectSchema;
1484
+ /**
1485
+ * Typed authored board fields validated against boardFieldsSchema
1486
+ */
1487
+ fields?: {
1488
+ [key: string]: JsonValue;
1489
+ };
1490
+ spaces?: Array<SquareSpaceSpec>;
1491
+ relations?: Array<BoardRelationSpec>;
1492
+ containers?: Array<BoardContainerSpec>;
1493
+ edges?: Array<SquareEdgeSpec>;
1494
+ vertices?: Array<SquareVertexSpec>;
1495
+ };
1496
+ type BoardSpec = ({
1497
+ layout: "generic";
1498
+ } & GenericBoardSpec) | ({
1499
+ layout: "hex";
1500
+ } & HexBoardSpec) | ({
1501
+ layout: "square";
1502
+ } & SquareBoardSpec);
1503
+ /**
1504
+ * Named authored slot exposed by a piece or die type
1505
+ */
1506
+ type ComponentSlotSpec = {
1507
+ id: string;
1508
+ name?: string;
1509
+ };
1510
+ /**
1511
+ * Reusable authored piece type
1512
+ */
1513
+ type PieceTypeSpec = {
1514
+ id: string;
1515
+ name: string;
1516
+ fieldsSchema?: ObjectSchema;
1517
+ slots?: Array<ComponentSlotSpec>;
1518
+ };
1519
+ /**
1520
+ * Authored seeded piece inventory or supply definition
1521
+ */
1522
+ type PieceSeedSpec = {
1523
+ /**
1524
+ * Stable piece id seed. When count > 1, runtime ids are generated as '{id}-1', '{id}-2', etc.
1525
+ */
1526
+ id?: string;
1527
+ name?: string;
1528
+ typeId: string;
1529
+ count?: number;
1530
+ ownerId?: string;
1531
+ home?: ComponentHomeSpec;
1532
+ visibility?: ComponentVisibilitySpec;
1533
+ /**
1534
+ * Typed authored piece fields validated against the piece type schema
1535
+ */
1536
+ fields?: {
1537
+ [key: string]: JsonValue;
1538
+ };
1539
+ };
1540
+ /**
1541
+ * Reusable authored die type
1542
+ */
1543
+ type DieTypeSpec = {
1544
+ id: string;
1545
+ name: string;
1546
+ sides?: number;
1547
+ fieldsSchema?: ObjectSchema;
1548
+ slots?: Array<ComponentSlotSpec>;
1549
+ };
1550
+ /**
1551
+ * Authored seeded die inventory or supply definition
1552
+ */
1553
+ type DieSeedSpec = {
1554
+ /**
1555
+ * Stable die id seed. When count > 1, runtime ids are generated as '{id}-1', '{id}-2', etc.
1556
+ */
1557
+ id?: string;
1558
+ name?: string;
1559
+ typeId: string;
1560
+ count?: number;
1561
+ ownerId?: string;
1562
+ home?: ComponentHomeSpec;
1563
+ visibility?: ComponentVisibilitySpec;
1564
+ /**
1565
+ * Typed authored die fields validated against the die type schema
1566
+ */
1567
+ fields?: {
1568
+ [key: string]: JsonValue;
1569
+ };
1570
+ };
1571
+ /**
1572
+ * Definition of a game resource type
1573
+ */
1574
+ type ResourceDefinition = {
1575
+ /**
1576
+ * Unique identifier for the resource. Used as a typed ResourceId.
1577
+ */
1578
+ id: string;
1579
+ /**
1580
+ * Human-readable display name for the resource
1581
+ */
1582
+ name: string;
1583
+ /**
1584
+ * Optional compact icon or emoji rendered by generic UI resource controls.
1585
+ */
1586
+ icon?: string;
1587
+ };
1588
+ /**
1589
+ * One authored setup option choice
1590
+ */
1591
+ /**
1592
+ * Authoritative topology manifest for reducer-native games
1593
+ */
1594
+ type GameTopologyManifest = {
1595
+ players: PlayersDefinition;
1596
+ /**
1597
+ * Authored card catalogs and schemas
1598
+ */
1599
+ cardSets: Array<CardSetDefinition>;
1600
+ /**
1601
+ * Shared and per-player authored containers
1602
+ */
1603
+ zones?: Array<ZoneSpec>;
1604
+ /**
1605
+ * Shared and per-player authored board shells
1606
+ */
1607
+ boards?: Array<BoardSpec>;
1608
+ pieceTypes?: Array<PieceTypeSpec>;
1609
+ pieceSeeds?: Array<PieceSeedSpec>;
1610
+ dieTypes?: Array<DieTypeSpec>;
1611
+ dieSeeds?: Array<DieSeedSpec>;
1612
+ resources?: Array<ResourceDefinition>;
1613
+ };
1614
+
1615
+ declare const boardIdentity: unique symbol;
1616
+ type HexEdgeId<BoardId extends string = string> = `${BoardId}:edge:${string}` & {
1617
+ readonly [boardIdentity]: "edge";
1618
+ };
1619
+ type HexVertexId<BoardId extends string = string> = `${BoardId}:vertex:${string}` & {
1620
+ readonly [boardIdentity]: "vertex";
1621
+ };
1622
+ /** Shape membership is checked at runtime; explicit coordinates retain literals. */
1623
+ type HexSpaceId<Board> = Board extends {
1624
+ shape: infer Shape;
1625
+ } ? Shape extends {
1626
+ coordinates: readonly (infer Coordinate)[];
1627
+ } ? Coordinate extends {
1628
+ q: infer Q extends number;
1629
+ r: infer R extends number;
1630
+ } ? HexCoordinateId<Board, `${Q},${R}`> : never : HexOverrideIds<Board> | `${number},${number}` : never;
1631
+ type HexOverrideIds<Board> = Board extends {
1632
+ spaces: infer Spaces;
1633
+ } ? {
1634
+ [Key in keyof Spaces]: Spaces[Key] extends {
1635
+ id: infer Id extends string;
1636
+ } ? Id : Extract<Key, string>;
1637
+ }[keyof Spaces] : never;
1638
+ type HexCoordinateId<Board, Key extends string> = Board extends {
1639
+ spaces: infer Spaces;
1640
+ } ? Key extends keyof Spaces ? Spaces[Key] extends {
1641
+ id: infer Id extends string;
1642
+ } ? Id : Key : Key : Key;
1643
+
1644
+ type AxialCoordinate = Readonly<HexCoordinate>;
1645
+ declare const hexagon: (options: Omit<Extract<HexShape, {
1646
+ kind: "hexagon" | "spiral";
1647
+ }>, "kind">) => {
1648
+ radius: number;
1649
+ center?: HexCoordinate | undefined;
1650
+ kind: "hexagon";
1651
+ };
1652
+ declare const spiral: (options: Omit<Extract<HexShape, {
1653
+ kind: "hexagon" | "spiral";
1654
+ }>, "kind">) => {
1655
+ radius: number;
1656
+ center?: HexCoordinate | undefined;
1657
+ kind: "spiral";
1658
+ };
1659
+ declare const ring: (options: Omit<Extract<HexShape, {
1660
+ kind: "ring";
1661
+ }>, "kind">) => {
1662
+ radius: number;
1663
+ center?: HexCoordinate | undefined;
1664
+ kind: "ring";
1665
+ };
1666
+ declare const rectangle: (options: Omit<Extract<HexShape, {
1667
+ kind: "rectangle";
1668
+ }>, "kind">) => {
1669
+ width: number;
1670
+ height: number;
1671
+ start?: HexCoordinate | undefined;
1672
+ kind: "rectangle";
1673
+ };
1674
+ declare const fromCoordinates: <const Coordinates extends readonly AxialCoordinate[]>(coordinates: Coordinates) => {
1675
+ kind: "coordinates";
1676
+ coordinates: Coordinates;
1677
+ };
1678
+ type HexBoardOrientation = HexOrientation;
1679
+ type HexBoardSpace<Id extends string = string> = AxialCoordinate & {
1680
+ id: Id;
1681
+ };
1682
+ type HexTopologyEdge<BoardId extends string> = {
1683
+ id: HexEdgeId<BoardId>;
1684
+ spaceIds: string[];
1685
+ vertexIds: [HexVertexId<BoardId>, HexVertexId<BoardId>];
1686
+ };
1687
+ type HexTopologyVertex<BoardId extends string> = {
1688
+ id: HexVertexId<BoardId>;
1689
+ spaceIds: string[];
1690
+ edgeIds: HexEdgeId<BoardId>[];
1691
+ };
1692
+ /** One immutable topology for materialization, rules, layout, and hit testing. */
1693
+ declare function createHexBoardGeometry<const BoardId extends string, SpaceId extends string>(board: {
1694
+ id: BoardId;
1695
+ orientation?: HexBoardOrientation;
1696
+ spaces: readonly HexBoardSpace<SpaceId>[];
1697
+ }): {
1698
+ edges: HexTopologyEdge<BoardId>[];
1699
+ vertices: HexTopologyVertex<BoardId>[];
1700
+ neighbors(id: SpaceId): SpaceId[];
1701
+ distance(from: SpaceId, to: SpaceId): number;
1702
+ ring(id: SpaceId, radius: number): SpaceId[];
1703
+ line(from: SpaceId, to: SpaceId): SpaceId[];
1704
+ edgesOf(id: SpaceId): HexEdgeId<BoardId>[];
1705
+ verticesOf(id: SpaceId): HexVertexId<BoardId>[];
1706
+ edgeAt(id: SpaceId, side: 0 | 1 | 2 | 3 | 4 | 5): HexEdgeId<BoardId>;
1707
+ vertexAt(id: SpaceId, corner: 0 | 1 | 2 | 3 | 4 | 5): HexVertexId<BoardId>;
1708
+ edge(a: SpaceId, b: SpaceId): HexEdgeId<BoardId>;
1709
+ vertex(a: SpaceId, b: SpaceId, c: SpaceId): HexVertexId<BoardId>;
1710
+ incidentEdges(vertexId: HexVertexId<BoardId>): HexEdgeId<BoardId>[];
1711
+ incidentVertices(edgeId: HexEdgeId<BoardId>): [HexVertexId<BoardId>, HexVertexId<BoardId>];
1712
+ spacesAt(vertexId: HexVertexId<BoardId>): SpaceId[];
1713
+ spacesAlong(edgeId: HexEdgeId<BoardId>): SpaceId[];
1714
+ getLayout({ hexSize, origin, }: {
1715
+ hexSize: number;
1716
+ origin?: Point;
1717
+ }): {
1718
+ viewBox: {
1719
+ x: number;
1720
+ y: number;
1721
+ width: number;
1722
+ height: number;
1723
+ };
1724
+ spaces: {
1725
+ id: SpaceId;
1726
+ center: {
1727
+ x: number;
1728
+ y: number;
1729
+ };
1730
+ corners: {
1731
+ x: number;
1732
+ y: number;
1733
+ }[];
1734
+ }[];
1735
+ edges: {
1736
+ id: HexEdgeId<BoardId>;
1737
+ from: {
1738
+ x: number;
1739
+ y: number;
1740
+ };
1741
+ to: {
1742
+ x: number;
1743
+ y: number;
1744
+ };
1745
+ }[];
1746
+ vertices: {
1747
+ id: HexVertexId<BoardId>;
1748
+ center: {
1749
+ x: number;
1750
+ y: number;
1751
+ };
1752
+ }[];
1753
+ pointToSpace(point: Point): SpaceId | undefined;
1754
+ };
1755
+ };
1756
+
1757
+ declare const ReducerContractVersionSchema: z.ZodString;
1758
+ declare const RngOperationParameterSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1759
+ declare const RngOperationSchema: z.ZodObject<{
1760
+ kind: z.ZodString;
1761
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1762
+ }, z.core.$strict>;
1763
+ declare const RngDrawSchema: z.ZodObject<{
1764
+ index: z.ZodNumber;
1765
+ cursorBefore: z.ZodNumber;
1766
+ cursorAfter: z.ZodNumber;
1767
+ operation: z.ZodObject<{
1768
+ kind: z.ZodString;
1769
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1770
+ }, z.core.$strict>;
1771
+ }, z.core.$strict>;
1772
+ declare const RngStateSchema: z.ZodObject<{
1773
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
1774
+ cursor: z.ZodNumber;
1775
+ trace: z.ZodArray<z.ZodString>;
1776
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
1777
+ index: z.ZodNumber;
1778
+ cursorBefore: z.ZodNumber;
1779
+ cursorAfter: z.ZodNumber;
1780
+ operation: z.ZodObject<{
1781
+ kind: z.ZodString;
1782
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1783
+ }, z.core.$strict>;
1784
+ }, z.core.$strict>>>;
1785
+ }, z.core.$strict>;
1786
+ declare const ReducerFlowStateSchema: z.ZodObject<{
1787
+ currentPhase: z.ZodString;
1788
+ turn: z.ZodNumber;
1789
+ round: z.ZodNumber;
1790
+ activePlayers: z.ZodArray<z.ZodString>;
1791
+ }, z.core.$strict>;
1792
+ declare const RuntimeSimultaneousSubmissionSchema: z.ZodObject<{
1793
+ interactionId: z.ZodString;
1794
+ params: z.ZodJSONSchema;
1795
+ }, z.core.$strict>;
1796
+ declare const RuntimeSimultaneousCurrentSchema: z.ZodObject<{
1797
+ phaseName: z.ZodString;
1798
+ actors: z.ZodArray<z.ZodString>;
1799
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
1800
+ interactionId: z.ZodString;
1801
+ params: z.ZodJSONSchema;
1802
+ }, z.core.$strict>>;
1803
+ }, z.core.$strict>;
1804
+ declare const RuntimeSimultaneousStateSchema: z.ZodObject<{
1805
+ current: z.ZodUnion<readonly [z.ZodObject<{
1806
+ phaseName: z.ZodString;
1807
+ actors: z.ZodArray<z.ZodString>;
1808
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
1809
+ interactionId: z.ZodString;
1810
+ params: z.ZodJSONSchema;
1811
+ }, z.core.$strict>>;
1812
+ }, z.core.$strict>, z.ZodNull]>;
1813
+ }, z.core.$strict>;
1814
+ declare const TransitionRecordSchema: z.ZodObject<{
1815
+ from: z.ZodString;
1816
+ to: z.ZodString;
1817
+ }, z.core.$strict>;
1818
+ declare const RuntimePendingInteractionSchema: z.ZodObject<{
1819
+ phaseName: z.ZodString;
1820
+ interactionId: z.ZodString;
1821
+ values: z.ZodArray<z.ZodJSONSchema>;
1822
+ }, z.core.$strict>;
1823
+ declare const GameEventDetailSchema: z.ZodObject<{
1824
+ label: z.ZodString;
1825
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1826
+ }, z.core.$strict>;
1827
+ declare const SystemActionEventSchema: z.ZodObject<{
1828
+ kind: z.ZodLiteral<"systemAction">;
1829
+ procedureId: z.ZodString;
1830
+ title: z.ZodString;
1831
+ summary: z.ZodOptional<z.ZodString>;
1832
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
1833
+ label: z.ZodString;
1834
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1835
+ }, z.core.$strict>>>;
1836
+ }, z.core.$strict>;
1837
+ declare const GameEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1838
+ kind: z.ZodLiteral<"systemAction">;
1839
+ procedureId: z.ZodString;
1840
+ title: z.ZodString;
1841
+ summary: z.ZodOptional<z.ZodString>;
1842
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
1843
+ label: z.ZodString;
1844
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1845
+ }, z.core.$strict>>>;
1846
+ }, z.core.$strict>], "kind">;
1847
+ declare const ReducerRuntimeStateSchema: z.ZodObject<{
1848
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1849
+ kind: z.ZodLiteral<"systemAction">;
1850
+ procedureId: z.ZodString;
1851
+ title: z.ZodString;
1852
+ summary: z.ZodOptional<z.ZodString>;
1853
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
1854
+ label: z.ZodString;
1855
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1856
+ }, z.core.$strict>>>;
1857
+ }, z.core.$strict>], "kind">>;
1858
+ rng: z.ZodObject<{
1859
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
1860
+ cursor: z.ZodNumber;
1861
+ trace: z.ZodArray<z.ZodString>;
1862
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
1863
+ index: z.ZodNumber;
1864
+ cursorBefore: z.ZodNumber;
1865
+ cursorAfter: z.ZodNumber;
1866
+ operation: z.ZodObject<{
1867
+ kind: z.ZodString;
1868
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1869
+ }, z.core.$strict>;
1870
+ }, z.core.$strict>>>;
1871
+ }, z.core.$strict>;
1872
+ pending: z.ZodRecord<z.ZodString, z.ZodObject<{
1873
+ phaseName: z.ZodString;
1874
+ interactionId: z.ZodString;
1875
+ values: z.ZodArray<z.ZodJSONSchema>;
1876
+ }, z.core.$strict>>;
1877
+ simultaneous: z.ZodObject<{
1878
+ current: z.ZodUnion<readonly [z.ZodObject<{
1879
+ phaseName: z.ZodString;
1880
+ actors: z.ZodArray<z.ZodString>;
1881
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
1882
+ interactionId: z.ZodString;
1883
+ params: z.ZodJSONSchema;
1884
+ }, z.core.$strict>>;
1885
+ }, z.core.$strict>, z.ZodNull]>;
1886
+ }, z.core.$strict>;
1887
+ lastTransition: z.ZodUnion<readonly [z.ZodObject<{
1888
+ from: z.ZodString;
1889
+ to: z.ZodString;
1890
+ }, z.core.$strict>, z.ZodNull]>;
1891
+ options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1892
+ }, z.core.$strict>;
1893
+ declare const ReducerDomainStateSchema: z.ZodObject<{
1894
+ table: z.ZodJSONSchema;
1895
+ publicState: z.ZodJSONSchema;
1896
+ privateState: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1897
+ hiddenState: z.ZodJSONSchema;
1898
+ flow: z.ZodObject<{
1899
+ currentPhase: z.ZodString;
1900
+ turn: z.ZodNumber;
1901
+ round: z.ZodNumber;
1902
+ activePlayers: z.ZodArray<z.ZodString>;
1903
+ }, z.core.$strict>;
1904
+ phase: z.ZodJSONSchema;
1905
+ }, z.core.$strict>;
1906
+ declare const ReducerSessionStateSchema: z.ZodObject<{
1907
+ domain: z.ZodObject<{
1908
+ table: z.ZodJSONSchema;
1909
+ publicState: z.ZodJSONSchema;
1910
+ privateState: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1911
+ hiddenState: z.ZodJSONSchema;
1912
+ flow: z.ZodObject<{
1913
+ currentPhase: z.ZodString;
1914
+ turn: z.ZodNumber;
1915
+ round: z.ZodNumber;
1916
+ activePlayers: z.ZodArray<z.ZodString>;
1917
+ }, z.core.$strict>;
1918
+ phase: z.ZodJSONSchema;
1919
+ }, z.core.$strict>;
1920
+ runtime: z.ZodObject<{
1921
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1922
+ kind: z.ZodLiteral<"systemAction">;
1923
+ procedureId: z.ZodString;
1924
+ title: z.ZodString;
1925
+ summary: z.ZodOptional<z.ZodString>;
1926
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
1927
+ label: z.ZodString;
1928
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
1929
+ }, z.core.$strict>>>;
1930
+ }, z.core.$strict>], "kind">>;
1931
+ rng: z.ZodObject<{
1932
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
1933
+ cursor: z.ZodNumber;
1934
+ trace: z.ZodArray<z.ZodString>;
1935
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
1936
+ index: z.ZodNumber;
1937
+ cursorBefore: z.ZodNumber;
1938
+ cursorAfter: z.ZodNumber;
1939
+ operation: z.ZodObject<{
1940
+ kind: z.ZodString;
1941
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1942
+ }, z.core.$strict>;
1943
+ }, z.core.$strict>>>;
1944
+ }, z.core.$strict>;
1945
+ pending: z.ZodRecord<z.ZodString, z.ZodObject<{
1946
+ phaseName: z.ZodString;
1947
+ interactionId: z.ZodString;
1948
+ values: z.ZodArray<z.ZodJSONSchema>;
1949
+ }, z.core.$strict>>;
1950
+ simultaneous: z.ZodObject<{
1951
+ current: z.ZodUnion<readonly [z.ZodObject<{
1952
+ phaseName: z.ZodString;
1953
+ actors: z.ZodArray<z.ZodString>;
1954
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
1955
+ interactionId: z.ZodString;
1956
+ params: z.ZodJSONSchema;
1957
+ }, z.core.$strict>>;
1958
+ }, z.core.$strict>, z.ZodNull]>;
1959
+ }, z.core.$strict>;
1960
+ lastTransition: z.ZodUnion<readonly [z.ZodObject<{
1961
+ from: z.ZodString;
1962
+ to: z.ZodString;
1963
+ }, z.core.$strict>, z.ZodNull]>;
1964
+ options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
1965
+ }, z.core.$strict>;
1966
+ }, z.core.$strict>;
1967
+ declare const GameInputInteractionSchema: z.ZodObject<{
1968
+ kind: z.ZodLiteral<"interaction">;
1969
+ playerId: z.ZodString;
1970
+ interactionId: z.ZodString;
1971
+ params: z.ZodJSONSchema;
1972
+ }, z.core.$strict>;
1973
+ declare const GameInputCancelSchema: z.ZodObject<{
1974
+ kind: z.ZodLiteral<"interaction.cancel">;
1975
+ playerId: z.ZodString;
1976
+ interactionId: z.ZodString;
1977
+ }, z.core.$strict>;
1978
+ declare const GameInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1979
+ kind: z.ZodLiteral<"interaction">;
1980
+ playerId: z.ZodString;
1981
+ interactionId: z.ZodString;
1982
+ params: z.ZodJSONSchema;
1983
+ }, z.core.$strict>, z.ZodObject<{
1984
+ kind: z.ZodLiteral<"interaction.cancel">;
1985
+ playerId: z.ZodString;
1986
+ interactionId: z.ZodString;
1987
+ }, z.core.$strict>], "kind">;
1988
+ declare const GameOutcomeReasonSchema: z.ZodObject<{
1989
+ code: z.ZodString;
1990
+ message: z.ZodOptional<z.ZodString>;
1991
+ }, z.core.$strict>;
1992
+ declare const OutcomeResultSchema: z.ZodEnum<{
1993
+ win: "win";
1994
+ draw: "draw";
1995
+ loss: "loss";
1996
+ eliminated: "eliminated";
1997
+ }>;
1998
+ declare const OutcomeScoreComponentSchema: z.ZodObject<{
1999
+ id: z.ZodString;
2000
+ label: z.ZodString;
2001
+ value: z.ZodNumber;
2002
+ }, z.core.$strict>;
2003
+ declare const OutcomeTieBreakSchema: z.ZodObject<{
2004
+ id: z.ZodString;
2005
+ label: z.ZodString;
2006
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
2007
+ }, z.core.$strict>;
2008
+ declare const OutcomeStandingSchema: z.ZodObject<{
2009
+ playerId: z.ZodString;
2010
+ rank: z.ZodNumber;
2011
+ result: z.ZodEnum<{
2012
+ win: "win";
2013
+ draw: "draw";
2014
+ loss: "loss";
2015
+ eliminated: "eliminated";
2016
+ }>;
2017
+ score: z.ZodOptional<z.ZodNumber>;
2018
+ scoreBreakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
2019
+ id: z.ZodString;
2020
+ label: z.ZodString;
2021
+ value: z.ZodNumber;
2022
+ }, z.core.$strict>>>;
2023
+ tieBreaks: z.ZodOptional<z.ZodArray<z.ZodObject<{
2024
+ id: z.ZodString;
2025
+ label: z.ZodString;
2026
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
2027
+ }, z.core.$strict>>>;
2028
+ }, z.core.$strict>;
2029
+ declare const GameOutcomeSchema: z.ZodObject<{
2030
+ reason: z.ZodObject<{
2031
+ code: z.ZodString;
2032
+ message: z.ZodOptional<z.ZodString>;
2033
+ }, z.core.$strict>;
2034
+ standings: z.ZodArray<z.ZodObject<{
2035
+ playerId: z.ZodString;
2036
+ rank: z.ZodNumber;
2037
+ result: z.ZodEnum<{
2038
+ win: "win";
2039
+ draw: "draw";
2040
+ loss: "loss";
2041
+ eliminated: "eliminated";
2042
+ }>;
2043
+ score: z.ZodOptional<z.ZodNumber>;
2044
+ scoreBreakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
2045
+ id: z.ZodString;
2046
+ label: z.ZodString;
2047
+ value: z.ZodNumber;
2048
+ }, z.core.$strict>>>;
2049
+ tieBreaks: z.ZodOptional<z.ZodArray<z.ZodObject<{
2050
+ id: z.ZodString;
2051
+ label: z.ZodString;
2052
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
2053
+ }, z.core.$strict>>>;
2054
+ }, z.core.$strict>>;
2055
+ }, z.core.$strict>;
2056
+ declare const InitializeResultSchema: z.ZodObject<{
2057
+ state: z.ZodObject<{
2058
+ domain: z.ZodObject<{
2059
+ table: z.ZodJSONSchema;
2060
+ publicState: z.ZodJSONSchema;
2061
+ privateState: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2062
+ hiddenState: z.ZodJSONSchema;
2063
+ flow: z.ZodObject<{
2064
+ currentPhase: z.ZodString;
2065
+ turn: z.ZodNumber;
2066
+ round: z.ZodNumber;
2067
+ activePlayers: z.ZodArray<z.ZodString>;
2068
+ }, z.core.$strict>;
2069
+ phase: z.ZodJSONSchema;
2070
+ }, z.core.$strict>;
2071
+ runtime: z.ZodObject<{
2072
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2073
+ kind: z.ZodLiteral<"systemAction">;
2074
+ procedureId: z.ZodString;
2075
+ title: z.ZodString;
2076
+ summary: z.ZodOptional<z.ZodString>;
2077
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2078
+ label: z.ZodString;
2079
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2080
+ }, z.core.$strict>>>;
2081
+ }, z.core.$strict>], "kind">>;
2082
+ rng: z.ZodObject<{
2083
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
2084
+ cursor: z.ZodNumber;
2085
+ trace: z.ZodArray<z.ZodString>;
2086
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
2087
+ index: z.ZodNumber;
2088
+ cursorBefore: z.ZodNumber;
2089
+ cursorAfter: z.ZodNumber;
2090
+ operation: z.ZodObject<{
2091
+ kind: z.ZodString;
2092
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
2093
+ }, z.core.$strict>;
2094
+ }, z.core.$strict>>>;
2095
+ }, z.core.$strict>;
2096
+ pending: z.ZodRecord<z.ZodString, z.ZodObject<{
2097
+ phaseName: z.ZodString;
2098
+ interactionId: z.ZodString;
2099
+ values: z.ZodArray<z.ZodJSONSchema>;
2100
+ }, z.core.$strict>>;
2101
+ simultaneous: z.ZodObject<{
2102
+ current: z.ZodUnion<readonly [z.ZodObject<{
2103
+ phaseName: z.ZodString;
2104
+ actors: z.ZodArray<z.ZodString>;
2105
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
2106
+ interactionId: z.ZodString;
2107
+ params: z.ZodJSONSchema;
2108
+ }, z.core.$strict>>;
2109
+ }, z.core.$strict>, z.ZodNull]>;
2110
+ }, z.core.$strict>;
2111
+ lastTransition: z.ZodUnion<readonly [z.ZodObject<{
2112
+ from: z.ZodString;
2113
+ to: z.ZodString;
2114
+ }, z.core.$strict>, z.ZodNull]>;
2115
+ options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2116
+ }, z.core.$strict>;
2117
+ }, z.core.$strict>;
2118
+ terminal: z.ZodOptional<z.ZodObject<{
2119
+ reason: z.ZodObject<{
2120
+ code: z.ZodString;
2121
+ message: z.ZodOptional<z.ZodString>;
2122
+ }, z.core.$strict>;
2123
+ standings: z.ZodArray<z.ZodObject<{
2124
+ playerId: z.ZodString;
2125
+ rank: z.ZodNumber;
2126
+ result: z.ZodEnum<{
2127
+ win: "win";
2128
+ draw: "draw";
2129
+ loss: "loss";
2130
+ eliminated: "eliminated";
2131
+ }>;
2132
+ score: z.ZodOptional<z.ZodNumber>;
2133
+ scoreBreakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
2134
+ id: z.ZodString;
2135
+ label: z.ZodString;
2136
+ value: z.ZodNumber;
2137
+ }, z.core.$strict>>>;
2138
+ tieBreaks: z.ZodOptional<z.ZodArray<z.ZodObject<{
2139
+ id: z.ZodString;
2140
+ label: z.ZodString;
2141
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
2142
+ }, z.core.$strict>>>;
2143
+ }, z.core.$strict>>;
2144
+ }, z.core.$strict>>;
2145
+ events: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2146
+ kind: z.ZodLiteral<"systemAction">;
2147
+ procedureId: z.ZodString;
2148
+ title: z.ZodString;
2149
+ summary: z.ZodOptional<z.ZodString>;
2150
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2151
+ label: z.ZodString;
2152
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2153
+ }, z.core.$strict>>>;
2154
+ }, z.core.$strict>], "kind">>>;
2155
+ }, z.core.$strict>;
2156
+ declare const InitializeRequestSchema: z.ZodObject<{
2157
+ table: z.ZodJSONSchema;
2158
+ playerIds: z.ZodArray<z.ZodString>;
2159
+ rngSeed: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>>;
2160
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
2161
+ }, z.core.$strict>;
2162
+ declare const DispatchRequestSchema: z.ZodObject<{
2163
+ state: z.ZodObject<{
2164
+ domain: z.ZodObject<{
2165
+ table: z.ZodJSONSchema;
2166
+ publicState: z.ZodJSONSchema;
2167
+ privateState: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2168
+ hiddenState: z.ZodJSONSchema;
2169
+ flow: z.ZodObject<{
2170
+ currentPhase: z.ZodString;
2171
+ turn: z.ZodNumber;
2172
+ round: z.ZodNumber;
2173
+ activePlayers: z.ZodArray<z.ZodString>;
2174
+ }, z.core.$strict>;
2175
+ phase: z.ZodJSONSchema;
2176
+ }, z.core.$strict>;
2177
+ runtime: z.ZodObject<{
2178
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2179
+ kind: z.ZodLiteral<"systemAction">;
2180
+ procedureId: z.ZodString;
2181
+ title: z.ZodString;
2182
+ summary: z.ZodOptional<z.ZodString>;
2183
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2184
+ label: z.ZodString;
2185
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2186
+ }, z.core.$strict>>>;
2187
+ }, z.core.$strict>], "kind">>;
2188
+ rng: z.ZodObject<{
2189
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
2190
+ cursor: z.ZodNumber;
2191
+ trace: z.ZodArray<z.ZodString>;
2192
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
2193
+ index: z.ZodNumber;
2194
+ cursorBefore: z.ZodNumber;
2195
+ cursorAfter: z.ZodNumber;
2196
+ operation: z.ZodObject<{
2197
+ kind: z.ZodString;
2198
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
2199
+ }, z.core.$strict>;
2200
+ }, z.core.$strict>>>;
2201
+ }, z.core.$strict>;
2202
+ pending: z.ZodRecord<z.ZodString, z.ZodObject<{
2203
+ phaseName: z.ZodString;
2204
+ interactionId: z.ZodString;
2205
+ values: z.ZodArray<z.ZodJSONSchema>;
2206
+ }, z.core.$strict>>;
2207
+ simultaneous: z.ZodObject<{
2208
+ current: z.ZodUnion<readonly [z.ZodObject<{
2209
+ phaseName: z.ZodString;
2210
+ actors: z.ZodArray<z.ZodString>;
2211
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
2212
+ interactionId: z.ZodString;
2213
+ params: z.ZodJSONSchema;
2214
+ }, z.core.$strict>>;
2215
+ }, z.core.$strict>, z.ZodNull]>;
2216
+ }, z.core.$strict>;
2217
+ lastTransition: z.ZodUnion<readonly [z.ZodObject<{
2218
+ from: z.ZodString;
2219
+ to: z.ZodString;
2220
+ }, z.core.$strict>, z.ZodNull]>;
2221
+ options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2222
+ }, z.core.$strict>;
2223
+ }, z.core.$strict>;
2224
+ input: z.ZodDiscriminatedUnion<[z.ZodObject<{
2225
+ kind: z.ZodLiteral<"interaction">;
2226
+ playerId: z.ZodString;
2227
+ interactionId: z.ZodString;
2228
+ params: z.ZodJSONSchema;
2229
+ }, z.core.$strict>, z.ZodObject<{
2230
+ kind: z.ZodLiteral<"interaction.cancel">;
2231
+ playerId: z.ZodString;
2232
+ interactionId: z.ZodString;
2233
+ }, z.core.$strict>], "kind">;
2234
+ }, z.core.$strict>;
2235
+ declare const DispatchTraceAcceptedClientInputSchema: z.ZodObject<{
2236
+ kind: z.ZodLiteral<"acceptedClientInput">;
2237
+ input: z.ZodDiscriminatedUnion<[z.ZodObject<{
2238
+ kind: z.ZodLiteral<"interaction">;
2239
+ playerId: z.ZodString;
2240
+ interactionId: z.ZodString;
2241
+ params: z.ZodJSONSchema;
2242
+ }, z.core.$strict>, z.ZodObject<{
2243
+ kind: z.ZodLiteral<"interaction.cancel">;
2244
+ playerId: z.ZodString;
2245
+ interactionId: z.ZodString;
2246
+ }, z.core.$strict>], "kind">;
2247
+ }, z.core.$strict>;
2248
+ declare const DispatchTracePhaseEnteredSchema: z.ZodObject<{
2249
+ kind: z.ZodLiteral<"phaseEntered">;
2250
+ from: z.ZodString;
2251
+ to: z.ZodString;
2252
+ }, z.core.$strict>;
2253
+ declare const DispatchTraceRngConsumptionSchema: z.ZodObject<{
2254
+ kind: z.ZodLiteral<"rngConsumption">;
2255
+ version: z.ZodLiteral<2>;
2256
+ operation: z.ZodString;
2257
+ drawIndex: z.ZodNumber;
2258
+ traceEntry: z.ZodString;
2259
+ }, z.core.$strict>;
2260
+ declare const DispatchTraceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2261
+ kind: z.ZodLiteral<"acceptedClientInput">;
2262
+ input: z.ZodDiscriminatedUnion<[z.ZodObject<{
2263
+ kind: z.ZodLiteral<"interaction">;
2264
+ playerId: z.ZodString;
2265
+ interactionId: z.ZodString;
2266
+ params: z.ZodJSONSchema;
2267
+ }, z.core.$strict>, z.ZodObject<{
2268
+ kind: z.ZodLiteral<"interaction.cancel">;
2269
+ playerId: z.ZodString;
2270
+ interactionId: z.ZodString;
2271
+ }, z.core.$strict>], "kind">;
2272
+ }, z.core.$strict>, z.ZodObject<{
2273
+ kind: z.ZodLiteral<"phaseEntered">;
2274
+ from: z.ZodString;
2275
+ to: z.ZodString;
2276
+ }, z.core.$strict>, z.ZodObject<{
2277
+ kind: z.ZodLiteral<"rngConsumption">;
2278
+ version: z.ZodLiteral<2>;
2279
+ operation: z.ZodString;
2280
+ drawIndex: z.ZodNumber;
2281
+ traceEntry: z.ZodString;
2282
+ }, z.core.$strict>], "kind">;
2283
+ declare const DispatchResultRejectSchema: z.ZodObject<{
2284
+ kind: z.ZodLiteral<"reject">;
2285
+ errorCode: z.ZodString;
2286
+ message: z.ZodOptional<z.ZodString>;
2287
+ }, z.core.$strict>;
2288
+ declare const DispatchResultAcceptSchema: z.ZodObject<{
2289
+ kind: z.ZodLiteral<"accept">;
2290
+ state: z.ZodObject<{
2291
+ domain: z.ZodObject<{
2292
+ table: z.ZodJSONSchema;
2293
+ publicState: z.ZodJSONSchema;
2294
+ privateState: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2295
+ hiddenState: z.ZodJSONSchema;
2296
+ flow: z.ZodObject<{
2297
+ currentPhase: z.ZodString;
2298
+ turn: z.ZodNumber;
2299
+ round: z.ZodNumber;
2300
+ activePlayers: z.ZodArray<z.ZodString>;
2301
+ }, z.core.$strict>;
2302
+ phase: z.ZodJSONSchema;
2303
+ }, z.core.$strict>;
2304
+ runtime: z.ZodObject<{
2305
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2306
+ kind: z.ZodLiteral<"systemAction">;
2307
+ procedureId: z.ZodString;
2308
+ title: z.ZodString;
2309
+ summary: z.ZodOptional<z.ZodString>;
2310
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2311
+ label: z.ZodString;
2312
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2313
+ }, z.core.$strict>>>;
2314
+ }, z.core.$strict>], "kind">>;
2315
+ rng: z.ZodObject<{
2316
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
2317
+ cursor: z.ZodNumber;
2318
+ trace: z.ZodArray<z.ZodString>;
2319
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
2320
+ index: z.ZodNumber;
2321
+ cursorBefore: z.ZodNumber;
2322
+ cursorAfter: z.ZodNumber;
2323
+ operation: z.ZodObject<{
2324
+ kind: z.ZodString;
2325
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
2326
+ }, z.core.$strict>;
2327
+ }, z.core.$strict>>>;
2328
+ }, z.core.$strict>;
2329
+ pending: z.ZodRecord<z.ZodString, z.ZodObject<{
2330
+ phaseName: z.ZodString;
2331
+ interactionId: z.ZodString;
2332
+ values: z.ZodArray<z.ZodJSONSchema>;
2333
+ }, z.core.$strict>>;
2334
+ simultaneous: z.ZodObject<{
2335
+ current: z.ZodUnion<readonly [z.ZodObject<{
2336
+ phaseName: z.ZodString;
2337
+ actors: z.ZodArray<z.ZodString>;
2338
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
2339
+ interactionId: z.ZodString;
2340
+ params: z.ZodJSONSchema;
2341
+ }, z.core.$strict>>;
2342
+ }, z.core.$strict>, z.ZodNull]>;
2343
+ }, z.core.$strict>;
2344
+ lastTransition: z.ZodUnion<readonly [z.ZodObject<{
2345
+ from: z.ZodString;
2346
+ to: z.ZodString;
2347
+ }, z.core.$strict>, z.ZodNull]>;
2348
+ options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2349
+ }, z.core.$strict>;
2350
+ }, z.core.$strict>;
2351
+ terminal: z.ZodOptional<z.ZodObject<{
2352
+ reason: z.ZodObject<{
2353
+ code: z.ZodString;
2354
+ message: z.ZodOptional<z.ZodString>;
2355
+ }, z.core.$strict>;
2356
+ standings: z.ZodArray<z.ZodObject<{
2357
+ playerId: z.ZodString;
2358
+ rank: z.ZodNumber;
2359
+ result: z.ZodEnum<{
2360
+ win: "win";
2361
+ draw: "draw";
2362
+ loss: "loss";
2363
+ eliminated: "eliminated";
2364
+ }>;
2365
+ score: z.ZodOptional<z.ZodNumber>;
2366
+ scoreBreakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
2367
+ id: z.ZodString;
2368
+ label: z.ZodString;
2369
+ value: z.ZodNumber;
2370
+ }, z.core.$strict>>>;
2371
+ tieBreaks: z.ZodOptional<z.ZodArray<z.ZodObject<{
2372
+ id: z.ZodString;
2373
+ label: z.ZodString;
2374
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
2375
+ }, z.core.$strict>>>;
2376
+ }, z.core.$strict>>;
2377
+ }, z.core.$strict>>;
2378
+ trace: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2379
+ kind: z.ZodLiteral<"acceptedClientInput">;
2380
+ input: z.ZodDiscriminatedUnion<[z.ZodObject<{
2381
+ kind: z.ZodLiteral<"interaction">;
2382
+ playerId: z.ZodString;
2383
+ interactionId: z.ZodString;
2384
+ params: z.ZodJSONSchema;
2385
+ }, z.core.$strict>, z.ZodObject<{
2386
+ kind: z.ZodLiteral<"interaction.cancel">;
2387
+ playerId: z.ZodString;
2388
+ interactionId: z.ZodString;
2389
+ }, z.core.$strict>], "kind">;
2390
+ }, z.core.$strict>, z.ZodObject<{
2391
+ kind: z.ZodLiteral<"phaseEntered">;
2392
+ from: z.ZodString;
2393
+ to: z.ZodString;
2394
+ }, z.core.$strict>, z.ZodObject<{
2395
+ kind: z.ZodLiteral<"rngConsumption">;
2396
+ version: z.ZodLiteral<2>;
2397
+ operation: z.ZodString;
2398
+ drawIndex: z.ZodNumber;
2399
+ traceEntry: z.ZodString;
2400
+ }, z.core.$strict>], "kind">>;
2401
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2402
+ kind: z.ZodLiteral<"systemAction">;
2403
+ procedureId: z.ZodString;
2404
+ title: z.ZodString;
2405
+ summary: z.ZodOptional<z.ZodString>;
2406
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2407
+ label: z.ZodString;
2408
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2409
+ }, z.core.$strict>>>;
2410
+ }, z.core.$strict>], "kind">>;
2411
+ }, z.core.$strict>;
2412
+ declare const DispatchResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2413
+ kind: z.ZodLiteral<"reject">;
2414
+ errorCode: z.ZodString;
2415
+ message: z.ZodOptional<z.ZodString>;
2416
+ }, z.core.$strict>, z.ZodObject<{
2417
+ kind: z.ZodLiteral<"accept">;
2418
+ state: z.ZodObject<{
2419
+ domain: z.ZodObject<{
2420
+ table: z.ZodJSONSchema;
2421
+ publicState: z.ZodJSONSchema;
2422
+ privateState: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2423
+ hiddenState: z.ZodJSONSchema;
2424
+ flow: z.ZodObject<{
2425
+ currentPhase: z.ZodString;
2426
+ turn: z.ZodNumber;
2427
+ round: z.ZodNumber;
2428
+ activePlayers: z.ZodArray<z.ZodString>;
2429
+ }, z.core.$strict>;
2430
+ phase: z.ZodJSONSchema;
2431
+ }, z.core.$strict>;
2432
+ runtime: z.ZodObject<{
2433
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2434
+ kind: z.ZodLiteral<"systemAction">;
2435
+ procedureId: z.ZodString;
2436
+ title: z.ZodString;
2437
+ summary: z.ZodOptional<z.ZodString>;
2438
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2439
+ label: z.ZodString;
2440
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2441
+ }, z.core.$strict>>>;
2442
+ }, z.core.$strict>], "kind">>;
2443
+ rng: z.ZodObject<{
2444
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
2445
+ cursor: z.ZodNumber;
2446
+ trace: z.ZodArray<z.ZodString>;
2447
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
2448
+ index: z.ZodNumber;
2449
+ cursorBefore: z.ZodNumber;
2450
+ cursorAfter: z.ZodNumber;
2451
+ operation: z.ZodObject<{
2452
+ kind: z.ZodString;
2453
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
2454
+ }, z.core.$strict>;
2455
+ }, z.core.$strict>>>;
2456
+ }, z.core.$strict>;
2457
+ pending: z.ZodRecord<z.ZodString, z.ZodObject<{
2458
+ phaseName: z.ZodString;
2459
+ interactionId: z.ZodString;
2460
+ values: z.ZodArray<z.ZodJSONSchema>;
2461
+ }, z.core.$strict>>;
2462
+ simultaneous: z.ZodObject<{
2463
+ current: z.ZodUnion<readonly [z.ZodObject<{
2464
+ phaseName: z.ZodString;
2465
+ actors: z.ZodArray<z.ZodString>;
2466
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
2467
+ interactionId: z.ZodString;
2468
+ params: z.ZodJSONSchema;
2469
+ }, z.core.$strict>>;
2470
+ }, z.core.$strict>, z.ZodNull]>;
2471
+ }, z.core.$strict>;
2472
+ lastTransition: z.ZodUnion<readonly [z.ZodObject<{
2473
+ from: z.ZodString;
2474
+ to: z.ZodString;
2475
+ }, z.core.$strict>, z.ZodNull]>;
2476
+ options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2477
+ }, z.core.$strict>;
2478
+ }, z.core.$strict>;
2479
+ terminal: z.ZodOptional<z.ZodObject<{
2480
+ reason: z.ZodObject<{
2481
+ code: z.ZodString;
2482
+ message: z.ZodOptional<z.ZodString>;
2483
+ }, z.core.$strict>;
2484
+ standings: z.ZodArray<z.ZodObject<{
2485
+ playerId: z.ZodString;
2486
+ rank: z.ZodNumber;
2487
+ result: z.ZodEnum<{
2488
+ win: "win";
2489
+ draw: "draw";
2490
+ loss: "loss";
2491
+ eliminated: "eliminated";
2492
+ }>;
2493
+ score: z.ZodOptional<z.ZodNumber>;
2494
+ scoreBreakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
2495
+ id: z.ZodString;
2496
+ label: z.ZodString;
2497
+ value: z.ZodNumber;
2498
+ }, z.core.$strict>>>;
2499
+ tieBreaks: z.ZodOptional<z.ZodArray<z.ZodObject<{
2500
+ id: z.ZodString;
2501
+ label: z.ZodString;
2502
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
2503
+ }, z.core.$strict>>>;
2504
+ }, z.core.$strict>>;
2505
+ }, z.core.$strict>>;
2506
+ trace: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2507
+ kind: z.ZodLiteral<"acceptedClientInput">;
2508
+ input: z.ZodDiscriminatedUnion<[z.ZodObject<{
2509
+ kind: z.ZodLiteral<"interaction">;
2510
+ playerId: z.ZodString;
2511
+ interactionId: z.ZodString;
2512
+ params: z.ZodJSONSchema;
2513
+ }, z.core.$strict>, z.ZodObject<{
2514
+ kind: z.ZodLiteral<"interaction.cancel">;
2515
+ playerId: z.ZodString;
2516
+ interactionId: z.ZodString;
2517
+ }, z.core.$strict>], "kind">;
2518
+ }, z.core.$strict>, z.ZodObject<{
2519
+ kind: z.ZodLiteral<"phaseEntered">;
2520
+ from: z.ZodString;
2521
+ to: z.ZodString;
2522
+ }, z.core.$strict>, z.ZodObject<{
2523
+ kind: z.ZodLiteral<"rngConsumption">;
2524
+ version: z.ZodLiteral<2>;
2525
+ operation: z.ZodString;
2526
+ drawIndex: z.ZodNumber;
2527
+ traceEntry: z.ZodString;
2528
+ }, z.core.$strict>], "kind">>;
2529
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2530
+ kind: z.ZodLiteral<"systemAction">;
2531
+ procedureId: z.ZodString;
2532
+ title: z.ZodString;
2533
+ summary: z.ZodOptional<z.ZodString>;
2534
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2535
+ label: z.ZodString;
2536
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2537
+ }, z.core.$strict>>>;
2538
+ }, z.core.$strict>], "kind">>;
2539
+ }, z.core.$strict>], "kind">;
2540
+ declare const ReducerRuntimeLogEntryAcceptedClientInputSchema: z.ZodObject<{
2541
+ kind: z.ZodLiteral<"acceptedClientInput">;
2542
+ version: z.ZodNumber;
2543
+ input: z.ZodDiscriminatedUnion<[z.ZodObject<{
2544
+ kind: z.ZodLiteral<"interaction">;
2545
+ playerId: z.ZodString;
2546
+ interactionId: z.ZodString;
2547
+ params: z.ZodJSONSchema;
2548
+ }, z.core.$strict>, z.ZodObject<{
2549
+ kind: z.ZodLiteral<"interaction.cancel">;
2550
+ playerId: z.ZodString;
2551
+ interactionId: z.ZodString;
2552
+ }, z.core.$strict>], "kind">;
2553
+ }, z.core.$strict>;
2554
+ declare const ReducerRuntimeLogEntryPhaseEnteredSchema: z.ZodObject<{
2555
+ kind: z.ZodLiteral<"phaseEntered">;
2556
+ from: z.ZodString;
2557
+ to: z.ZodString;
2558
+ version: z.ZodNumber;
2559
+ }, z.core.$strict>;
2560
+ declare const ReducerRuntimeLogEntryRngConsumptionSchema: z.ZodObject<{
2561
+ kind: z.ZodLiteral<"rngConsumption">;
2562
+ version: z.ZodNumber;
2563
+ operation: z.ZodString;
2564
+ drawIndex: z.ZodOptional<z.ZodNumber>;
2565
+ traceEntry: z.ZodString;
2566
+ }, z.core.$strict>;
2567
+ declare const ReducerRuntimeLogEntryStateCommitSchema: z.ZodObject<{
2568
+ kind: z.ZodLiteral<"stateCommit">;
2569
+ version: z.ZodNumber;
2570
+ state: z.ZodObject<{
2571
+ domain: z.ZodObject<{
2572
+ table: z.ZodJSONSchema;
2573
+ publicState: z.ZodJSONSchema;
2574
+ privateState: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2575
+ hiddenState: z.ZodJSONSchema;
2576
+ flow: z.ZodObject<{
2577
+ currentPhase: z.ZodString;
2578
+ turn: z.ZodNumber;
2579
+ round: z.ZodNumber;
2580
+ activePlayers: z.ZodArray<z.ZodString>;
2581
+ }, z.core.$strict>;
2582
+ phase: z.ZodJSONSchema;
2583
+ }, z.core.$strict>;
2584
+ runtime: z.ZodObject<{
2585
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2586
+ kind: z.ZodLiteral<"systemAction">;
2587
+ procedureId: z.ZodString;
2588
+ title: z.ZodString;
2589
+ summary: z.ZodOptional<z.ZodString>;
2590
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2591
+ label: z.ZodString;
2592
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2593
+ }, z.core.$strict>>>;
2594
+ }, z.core.$strict>], "kind">>;
2595
+ rng: z.ZodObject<{
2596
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
2597
+ cursor: z.ZodNumber;
2598
+ trace: z.ZodArray<z.ZodString>;
2599
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
2600
+ index: z.ZodNumber;
2601
+ cursorBefore: z.ZodNumber;
2602
+ cursorAfter: z.ZodNumber;
2603
+ operation: z.ZodObject<{
2604
+ kind: z.ZodString;
2605
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
2606
+ }, z.core.$strict>;
2607
+ }, z.core.$strict>>>;
2608
+ }, z.core.$strict>;
2609
+ pending: z.ZodRecord<z.ZodString, z.ZodObject<{
2610
+ phaseName: z.ZodString;
2611
+ interactionId: z.ZodString;
2612
+ values: z.ZodArray<z.ZodJSONSchema>;
2613
+ }, z.core.$strict>>;
2614
+ simultaneous: z.ZodObject<{
2615
+ current: z.ZodUnion<readonly [z.ZodObject<{
2616
+ phaseName: z.ZodString;
2617
+ actors: z.ZodArray<z.ZodString>;
2618
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
2619
+ interactionId: z.ZodString;
2620
+ params: z.ZodJSONSchema;
2621
+ }, z.core.$strict>>;
2622
+ }, z.core.$strict>, z.ZodNull]>;
2623
+ }, z.core.$strict>;
2624
+ lastTransition: z.ZodUnion<readonly [z.ZodObject<{
2625
+ from: z.ZodString;
2626
+ to: z.ZodString;
2627
+ }, z.core.$strict>, z.ZodNull]>;
2628
+ options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2629
+ }, z.core.$strict>;
2630
+ }, z.core.$strict>;
2631
+ }, z.core.$strict>;
2632
+ declare const ReducerRuntimeLogEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2633
+ kind: z.ZodLiteral<"acceptedClientInput">;
2634
+ version: z.ZodNumber;
2635
+ input: z.ZodDiscriminatedUnion<[z.ZodObject<{
2636
+ kind: z.ZodLiteral<"interaction">;
2637
+ playerId: z.ZodString;
2638
+ interactionId: z.ZodString;
2639
+ params: z.ZodJSONSchema;
2640
+ }, z.core.$strict>, z.ZodObject<{
2641
+ kind: z.ZodLiteral<"interaction.cancel">;
2642
+ playerId: z.ZodString;
2643
+ interactionId: z.ZodString;
2644
+ }, z.core.$strict>], "kind">;
2645
+ }, z.core.$strict>, z.ZodObject<{
2646
+ kind: z.ZodLiteral<"phaseEntered">;
2647
+ from: z.ZodString;
2648
+ to: z.ZodString;
2649
+ version: z.ZodNumber;
2650
+ }, z.core.$strict>, z.ZodObject<{
2651
+ kind: z.ZodLiteral<"rngConsumption">;
2652
+ version: z.ZodNumber;
2653
+ operation: z.ZodString;
2654
+ drawIndex: z.ZodOptional<z.ZodNumber>;
2655
+ traceEntry: z.ZodString;
2656
+ }, z.core.$strict>, z.ZodObject<{
2657
+ kind: z.ZodLiteral<"stateCommit">;
2658
+ version: z.ZodNumber;
2659
+ state: z.ZodObject<{
2660
+ domain: z.ZodObject<{
2661
+ table: z.ZodJSONSchema;
2662
+ publicState: z.ZodJSONSchema;
2663
+ privateState: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2664
+ hiddenState: z.ZodJSONSchema;
2665
+ flow: z.ZodObject<{
2666
+ currentPhase: z.ZodString;
2667
+ turn: z.ZodNumber;
2668
+ round: z.ZodNumber;
2669
+ activePlayers: z.ZodArray<z.ZodString>;
2670
+ }, z.core.$strict>;
2671
+ phase: z.ZodJSONSchema;
2672
+ }, z.core.$strict>;
2673
+ runtime: z.ZodObject<{
2674
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2675
+ kind: z.ZodLiteral<"systemAction">;
2676
+ procedureId: z.ZodString;
2677
+ title: z.ZodString;
2678
+ summary: z.ZodOptional<z.ZodString>;
2679
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2680
+ label: z.ZodString;
2681
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2682
+ }, z.core.$strict>>>;
2683
+ }, z.core.$strict>], "kind">>;
2684
+ rng: z.ZodObject<{
2685
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
2686
+ cursor: z.ZodNumber;
2687
+ trace: z.ZodArray<z.ZodString>;
2688
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
2689
+ index: z.ZodNumber;
2690
+ cursorBefore: z.ZodNumber;
2691
+ cursorAfter: z.ZodNumber;
2692
+ operation: z.ZodObject<{
2693
+ kind: z.ZodString;
2694
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
2695
+ }, z.core.$strict>;
2696
+ }, z.core.$strict>>>;
2697
+ }, z.core.$strict>;
2698
+ pending: z.ZodRecord<z.ZodString, z.ZodObject<{
2699
+ phaseName: z.ZodString;
2700
+ interactionId: z.ZodString;
2701
+ values: z.ZodArray<z.ZodJSONSchema>;
2702
+ }, z.core.$strict>>;
2703
+ simultaneous: z.ZodObject<{
2704
+ current: z.ZodUnion<readonly [z.ZodObject<{
2705
+ phaseName: z.ZodString;
2706
+ actors: z.ZodArray<z.ZodString>;
2707
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
2708
+ interactionId: z.ZodString;
2709
+ params: z.ZodJSONSchema;
2710
+ }, z.core.$strict>>;
2711
+ }, z.core.$strict>, z.ZodNull]>;
2712
+ }, z.core.$strict>;
2713
+ lastTransition: z.ZodUnion<readonly [z.ZodObject<{
2714
+ from: z.ZodString;
2715
+ to: z.ZodString;
2716
+ }, z.core.$strict>, z.ZodNull]>;
2717
+ options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2718
+ }, z.core.$strict>;
2719
+ }, z.core.$strict>;
2720
+ }, z.core.$strict>], "kind">;
2721
+ /** Authored views are records; boards is reserved for manifest geometry. */
2722
+ declare const AuthoredViewSchema: z.ZodObject<{
2723
+ boards: z.ZodOptional<z.ZodNever>;
2724
+ }, z.core.$catchall<z.ZodJSONSchema>>;
2725
+ declare const SeatProjectionSchema: z.ZodObject<{
2726
+ view: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2727
+ boards: z.ZodOptional<z.ZodNever>;
2728
+ }, z.core.$catchall<z.ZodJSONSchema>>>>;
2729
+ availableInteractionRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
2730
+ zones: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2731
+ cardIds: z.ZodArray<z.ZodString>;
2732
+ cardViewsById: z.ZodRecord<z.ZodString, z.ZodString>;
2733
+ playableByCardId: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
2734
+ }, z.core.$strict>>>;
2735
+ }, z.core.$strict>;
2736
+ declare const SimultaneousPhaseProjectionSchema: z.ZodObject<{
2737
+ phaseName: z.ZodString;
2738
+ interactionId: z.ZodString;
2739
+ actorIds: z.ZodArray<z.ZodString>;
2740
+ sealedPlayerIds: z.ZodArray<z.ZodString>;
2741
+ pendingPlayerIds: z.ZodArray<z.ZodString>;
2742
+ }, z.core.$strict>;
2743
+ declare const SchedulerContinuationDependencySchema: z.ZodObject<{
2744
+ waiterPlayerId: z.ZodString;
2745
+ blockerPlayerIds: z.ZodArray<z.ZodString>;
2746
+ }, z.core.$strict>;
2747
+ declare const SchedulerFlowAuthorityProjectionSchema: z.ZodObject<{
2748
+ version: z.ZodLiteral<1>;
2749
+ activePlayerIds: z.ZodArray<z.ZodString>;
2750
+ pendingPlayerIds: z.ZodArray<z.ZodString>;
2751
+ continuationDependencies: z.ZodArray<z.ZodObject<{
2752
+ waiterPlayerId: z.ZodString;
2753
+ blockerPlayerIds: z.ZodArray<z.ZodString>;
2754
+ }, z.core.$strict>>;
2755
+ }, z.core.$strict>;
2756
+ declare const ProjectionTimingMetadataSchema: z.ZodObject<{
2757
+ resolveAvailableInteractionsMs: z.ZodNumber;
2758
+ resolveViewMs: z.ZodNumber;
2759
+ resolveZoneHandlesMs: z.ZodNumber;
2760
+ descriptorHashMs: z.ZodNumber;
2761
+ }, z.core.$strict>;
2762
+ declare const SeatProjectionBundleSchema: z.ZodObject<{
2763
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2764
+ kind: z.ZodLiteral<"systemAction">;
2765
+ procedureId: z.ZodString;
2766
+ title: z.ZodString;
2767
+ summary: z.ZodOptional<z.ZodString>;
2768
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2769
+ label: z.ZodString;
2770
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2771
+ }, z.core.$strict>>>;
2772
+ }, z.core.$strict>], "kind">>;
2773
+ simultaneousPhase: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
2774
+ phaseName: z.ZodString;
2775
+ interactionId: z.ZodString;
2776
+ actorIds: z.ZodArray<z.ZodString>;
2777
+ sealedPlayerIds: z.ZodArray<z.ZodString>;
2778
+ pendingPlayerIds: z.ZodArray<z.ZodString>;
2779
+ }, z.core.$strict>, z.ZodNull]>>;
2780
+ schedulerFlow: z.ZodOptional<z.ZodObject<{
2781
+ version: z.ZodLiteral<1>;
2782
+ activePlayerIds: z.ZodArray<z.ZodString>;
2783
+ pendingPlayerIds: z.ZodArray<z.ZodString>;
2784
+ continuationDependencies: z.ZodArray<z.ZodObject<{
2785
+ waiterPlayerId: z.ZodString;
2786
+ blockerPlayerIds: z.ZodArray<z.ZodString>;
2787
+ }, z.core.$strict>>;
2788
+ }, z.core.$strict>>;
2789
+ interactionsByRef: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2790
+ phaseName: z.ZodString;
2791
+ interactionKey: z.ZodString;
2792
+ interactionId: z.ZodString;
2793
+ label: z.ZodString;
2794
+ help: z.ZodOptional<z.ZodString>;
2795
+ zoneId: z.ZodOptional<z.ZodString>;
2796
+ zoneIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
2797
+ commit: z.ZodDiscriminatedUnion<[z.ZodObject<{
2798
+ mode: z.ZodLiteral<"manual">;
2799
+ }, z.core.$strict>, z.ZodObject<{
2800
+ mode: z.ZodLiteral<"autoWhenReady">;
2801
+ }, z.core.$strict>], "mode">;
2802
+ descriptorDigest: z.ZodOptional<z.ZodString>;
2803
+ actorSeat: z.ZodOptional<z.ZodNumber>;
2804
+ draftDigest: z.ZodOptional<z.ZodString>;
2805
+ inputs: z.ZodArray<z.ZodObject<{
2806
+ key: z.ZodString;
2807
+ kind: z.ZodEnum<{
2808
+ card: "card";
2809
+ form: "form";
2810
+ "board-vertex": "board-vertex";
2811
+ "board-edge": "board-edge";
2812
+ "board-tile": "board-tile";
2813
+ "board-space": "board-space";
2814
+ rng: "rng";
2815
+ }>;
2816
+ domain: z.ZodDiscriminatedUnion<[z.ZodObject<{
2817
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2818
+ mode: z.ZodLiteral<"single">;
2819
+ }, z.core.$strict>, z.ZodObject<{
2820
+ mode: z.ZodLiteral<"many">;
2821
+ min: z.ZodNumber;
2822
+ max: z.ZodOptional<z.ZodNumber>;
2823
+ distinct: z.ZodOptional<z.ZodBoolean>;
2824
+ }, z.core.$strict>], "mode">>;
2825
+ type: z.ZodLiteral<"cardTarget">;
2826
+ projection: z.ZodLiteral<"resolved">;
2827
+ targetKind: z.ZodLiteral<"card">;
2828
+ zoneIds: z.ZodArray<z.ZodString>;
2829
+ eligibleTargets: z.ZodArray<z.ZodString>;
2830
+ }, z.core.$strict>, z.ZodObject<{
2831
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2832
+ mode: z.ZodLiteral<"single">;
2833
+ }, z.core.$strict>, z.ZodObject<{
2834
+ mode: z.ZodLiteral<"many">;
2835
+ min: z.ZodNumber;
2836
+ max: z.ZodOptional<z.ZodNumber>;
2837
+ distinct: z.ZodOptional<z.ZodBoolean>;
2838
+ }, z.core.$strict>], "mode">>;
2839
+ type: z.ZodLiteral<"boardTarget">;
2840
+ projection: z.ZodLiteral<"resolved">;
2841
+ targetKind: z.ZodEnum<{
2842
+ edge: "edge";
2843
+ vertex: "vertex";
2844
+ space: "space";
2845
+ tile: "tile";
2846
+ }>;
2847
+ boardId: z.ZodString;
2848
+ valueKind: z.ZodOptional<z.ZodEnum<{
2849
+ "board-id": "board-id";
2850
+ "player-board-space": "player-board-space";
2851
+ }>>;
2852
+ eligibleTargets: z.ZodArray<z.ZodString>;
2853
+ }, z.core.$strict>, z.ZodObject<{
2854
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2855
+ mode: z.ZodLiteral<"single">;
2856
+ }, z.core.$strict>, z.ZodObject<{
2857
+ mode: z.ZodLiteral<"many">;
2858
+ min: z.ZodNumber;
2859
+ max: z.ZodOptional<z.ZodNumber>;
2860
+ distinct: z.ZodOptional<z.ZodBoolean>;
2861
+ }, z.core.$strict>], "mode">>;
2862
+ type: z.ZodLiteral<"resourceMap">;
2863
+ resources: z.ZodArray<z.ZodObject<{
2864
+ resourceId: z.ZodString;
2865
+ label: z.ZodOptional<z.ZodString>;
2866
+ icon: z.ZodOptional<z.ZodString>;
2867
+ min: z.ZodNumber;
2868
+ max: z.ZodNumber;
2869
+ }, z.core.$strict>>;
2870
+ }, z.core.$strict>, z.ZodObject<{
2871
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2872
+ mode: z.ZodLiteral<"single">;
2873
+ }, z.core.$strict>, z.ZodObject<{
2874
+ mode: z.ZodLiteral<"many">;
2875
+ min: z.ZodNumber;
2876
+ max: z.ZodOptional<z.ZodNumber>;
2877
+ distinct: z.ZodOptional<z.ZodBoolean>;
2878
+ }, z.core.$strict>], "mode">>;
2879
+ type: z.ZodLiteral<"boundedNumber">;
2880
+ min: z.ZodNumber;
2881
+ max: z.ZodNumber;
2882
+ step: z.ZodOptional<z.ZodNumber>;
2883
+ }, z.core.$strict>, z.ZodObject<{
2884
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2885
+ mode: z.ZodLiteral<"single">;
2886
+ }, z.core.$strict>, z.ZodObject<{
2887
+ mode: z.ZodLiteral<"many">;
2888
+ min: z.ZodNumber;
2889
+ max: z.ZodOptional<z.ZodNumber>;
2890
+ distinct: z.ZodOptional<z.ZodBoolean>;
2891
+ }, z.core.$strict>], "mode">>;
2892
+ type: z.ZodLiteral<"choice">;
2893
+ choices: z.ZodArray<z.ZodObject<{
2894
+ value: z.ZodNullable<z.ZodString>;
2895
+ label: z.ZodString;
2896
+ icon: z.ZodOptional<z.ZodString>;
2897
+ badge: z.ZodOptional<z.ZodString>;
2898
+ description: z.ZodOptional<z.ZodString>;
2899
+ disabled: z.ZodOptional<z.ZodBoolean>;
2900
+ disabledReason: z.ZodOptional<z.ZodString>;
2901
+ }, z.core.$strict>>;
2902
+ }, z.core.$strict>, z.ZodObject<{
2903
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2904
+ mode: z.ZodLiteral<"single">;
2905
+ }, z.core.$strict>, z.ZodObject<{
2906
+ mode: z.ZodLiteral<"many">;
2907
+ min: z.ZodNumber;
2908
+ max: z.ZodOptional<z.ZodNumber>;
2909
+ distinct: z.ZodOptional<z.ZodBoolean>;
2910
+ }, z.core.$strict>], "mode">>;
2911
+ type: z.ZodLiteral<"choiceList">;
2912
+ choices: z.ZodArray<z.ZodObject<{
2913
+ label: z.ZodString;
2914
+ icon: z.ZodOptional<z.ZodString>;
2915
+ badge: z.ZodOptional<z.ZodString>;
2916
+ description: z.ZodOptional<z.ZodString>;
2917
+ disabled: z.ZodOptional<z.ZodBoolean>;
2918
+ disabledReason: z.ZodOptional<z.ZodString>;
2919
+ value: z.ZodString;
2920
+ }, z.core.$strict>>;
2921
+ min: z.ZodOptional<z.ZodNumber>;
2922
+ max: z.ZodOptional<z.ZodNumber>;
2923
+ }, z.core.$strict>], "type">;
2924
+ defaultValue: z.ZodOptional<z.ZodJSONSchema>;
2925
+ }, z.core.$strict>>;
2926
+ step: z.ZodOptional<z.ZodObject<{
2927
+ index: z.ZodNumber;
2928
+ total: z.ZodNumber;
2929
+ selected: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2930
+ canCancel: z.ZodBoolean;
2931
+ }, z.core.$strict>>;
2932
+ availability: z.ZodDiscriminatedUnion<[z.ZodObject<{
2933
+ status: z.ZodLiteral<"available">;
2934
+ }, z.core.$strict>, z.ZodObject<{
2935
+ status: z.ZodLiteral<"notYourTurn">;
2936
+ reason: z.ZodString;
2937
+ }, z.core.$strict>, z.ZodObject<{
2938
+ status: z.ZodLiteral<"blocked">;
2939
+ reason: z.ZodString;
2940
+ code: z.ZodOptional<z.ZodString>;
2941
+ }, z.core.$strict>], "status">;
2942
+ reasons: z.ZodOptional<z.ZodArray<z.ZodObject<{
2943
+ ruleId: z.ZodString;
2944
+ errorCode: z.ZodString;
2945
+ }, z.core.$strict>>>;
2946
+ kind: z.ZodLiteral<"action">;
2947
+ }, z.core.$strict>>>;
2948
+ seats: z.ZodRecord<z.ZodString, z.ZodObject<{
2949
+ view: z.ZodOptional<z.ZodNullable<z.ZodObject<{
2950
+ boards: z.ZodOptional<z.ZodNever>;
2951
+ }, z.core.$catchall<z.ZodJSONSchema>>>>;
2952
+ availableInteractionRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
2953
+ zones: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2954
+ cardIds: z.ZodArray<z.ZodString>;
2955
+ cardViewsById: z.ZodRecord<z.ZodString, z.ZodString>;
2956
+ playableByCardId: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
2957
+ }, z.core.$strict>>>;
2958
+ }, z.core.$strict>>;
2959
+ timing: z.ZodOptional<z.ZodObject<{
2960
+ resolveAvailableInteractionsMs: z.ZodNumber;
2961
+ resolveViewMs: z.ZodNumber;
2962
+ resolveZoneHandlesMs: z.ZodNumber;
2963
+ descriptorHashMs: z.ZodNumber;
2964
+ }, z.core.$strict>>;
2965
+ }, z.core.$strict>;
2966
+ declare const ProjectRequestSchema: z.ZodObject<{
2967
+ state: z.ZodObject<{
2968
+ domain: z.ZodObject<{
2969
+ table: z.ZodJSONSchema;
2970
+ publicState: z.ZodJSONSchema;
2971
+ privateState: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
2972
+ hiddenState: z.ZodJSONSchema;
2973
+ flow: z.ZodObject<{
2974
+ currentPhase: z.ZodString;
2975
+ turn: z.ZodNumber;
2976
+ round: z.ZodNumber;
2977
+ activePlayers: z.ZodArray<z.ZodString>;
2978
+ }, z.core.$strict>;
2979
+ phase: z.ZodJSONSchema;
2980
+ }, z.core.$strict>;
2981
+ runtime: z.ZodObject<{
2982
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2983
+ kind: z.ZodLiteral<"systemAction">;
2984
+ procedureId: z.ZodString;
2985
+ title: z.ZodString;
2986
+ summary: z.ZodOptional<z.ZodString>;
2987
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
2988
+ label: z.ZodString;
2989
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
2990
+ }, z.core.$strict>>>;
2991
+ }, z.core.$strict>], "kind">>;
2992
+ rng: z.ZodObject<{
2993
+ seed: z.ZodUnion<readonly [z.ZodNumber, z.ZodNull]>;
2994
+ cursor: z.ZodNumber;
2995
+ trace: z.ZodArray<z.ZodString>;
2996
+ draws: z.ZodOptional<z.ZodArray<z.ZodObject<{
2997
+ index: z.ZodNumber;
2998
+ cursorBefore: z.ZodNumber;
2999
+ cursorAfter: z.ZodNumber;
3000
+ operation: z.ZodObject<{
3001
+ kind: z.ZodString;
3002
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
3003
+ }, z.core.$strict>;
3004
+ }, z.core.$strict>>>;
3005
+ }, z.core.$strict>;
3006
+ pending: z.ZodRecord<z.ZodString, z.ZodObject<{
3007
+ phaseName: z.ZodString;
3008
+ interactionId: z.ZodString;
3009
+ values: z.ZodArray<z.ZodJSONSchema>;
3010
+ }, z.core.$strict>>;
3011
+ simultaneous: z.ZodObject<{
3012
+ current: z.ZodUnion<readonly [z.ZodObject<{
3013
+ phaseName: z.ZodString;
3014
+ actors: z.ZodArray<z.ZodString>;
3015
+ submissions: z.ZodRecord<z.ZodString, z.ZodObject<{
3016
+ interactionId: z.ZodString;
3017
+ params: z.ZodJSONSchema;
3018
+ }, z.core.$strict>>;
3019
+ }, z.core.$strict>, z.ZodNull]>;
3020
+ }, z.core.$strict>;
3021
+ lastTransition: z.ZodUnion<readonly [z.ZodObject<{
3022
+ from: z.ZodString;
3023
+ to: z.ZodString;
3024
+ }, z.core.$strict>, z.ZodNull]>;
3025
+ options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
3026
+ }, z.core.$strict>;
3027
+ }, z.core.$strict>;
3028
+ playerIds: z.ZodArray<z.ZodString>;
3029
+ }, z.core.$strict>;
3030
+ declare const BoardStaticProjectionSchema: z.ZodObject<{
3031
+ view: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
3032
+ hash: z.ZodString;
3033
+ manifestVersion: z.ZodString;
3034
+ }, z.core.$strict>;
3035
+
3036
+ declare const runtimeSchema_AuthoredViewSchema: typeof AuthoredViewSchema;
3037
+ declare const runtimeSchema_BoardStaticProjectionSchema: typeof BoardStaticProjectionSchema;
3038
+ declare const runtimeSchema_DispatchRequestSchema: typeof DispatchRequestSchema;
3039
+ declare const runtimeSchema_DispatchResultAcceptSchema: typeof DispatchResultAcceptSchema;
3040
+ declare const runtimeSchema_DispatchResultRejectSchema: typeof DispatchResultRejectSchema;
3041
+ declare const runtimeSchema_DispatchResultSchema: typeof DispatchResultSchema;
3042
+ declare const runtimeSchema_DispatchTraceAcceptedClientInputSchema: typeof DispatchTraceAcceptedClientInputSchema;
3043
+ declare const runtimeSchema_DispatchTracePhaseEnteredSchema: typeof DispatchTracePhaseEnteredSchema;
3044
+ declare const runtimeSchema_DispatchTraceRngConsumptionSchema: typeof DispatchTraceRngConsumptionSchema;
3045
+ declare const runtimeSchema_DispatchTraceSchema: typeof DispatchTraceSchema;
3046
+ declare const runtimeSchema_GameEventDetailSchema: typeof GameEventDetailSchema;
3047
+ declare const runtimeSchema_GameEventSchema: typeof GameEventSchema;
3048
+ declare const runtimeSchema_GameInputCancelSchema: typeof GameInputCancelSchema;
3049
+ declare const runtimeSchema_GameInputInteractionSchema: typeof GameInputInteractionSchema;
3050
+ declare const runtimeSchema_GameInputSchema: typeof GameInputSchema;
3051
+ declare const runtimeSchema_GameOutcomeReasonSchema: typeof GameOutcomeReasonSchema;
3052
+ declare const runtimeSchema_GameOutcomeSchema: typeof GameOutcomeSchema;
3053
+ declare const runtimeSchema_InitializeRequestSchema: typeof InitializeRequestSchema;
3054
+ declare const runtimeSchema_InitializeResultSchema: typeof InitializeResultSchema;
3055
+ declare const runtimeSchema_OutcomeResultSchema: typeof OutcomeResultSchema;
3056
+ declare const runtimeSchema_OutcomeScoreComponentSchema: typeof OutcomeScoreComponentSchema;
3057
+ declare const runtimeSchema_OutcomeStandingSchema: typeof OutcomeStandingSchema;
3058
+ declare const runtimeSchema_OutcomeTieBreakSchema: typeof OutcomeTieBreakSchema;
3059
+ declare const runtimeSchema_ProjectRequestSchema: typeof ProjectRequestSchema;
3060
+ declare const runtimeSchema_ProjectionTimingMetadataSchema: typeof ProjectionTimingMetadataSchema;
3061
+ declare const runtimeSchema_ReducerContractVersionSchema: typeof ReducerContractVersionSchema;
3062
+ declare const runtimeSchema_ReducerDomainStateSchema: typeof ReducerDomainStateSchema;
3063
+ declare const runtimeSchema_ReducerFlowStateSchema: typeof ReducerFlowStateSchema;
3064
+ declare const runtimeSchema_ReducerRuntimeLogEntryAcceptedClientInputSchema: typeof ReducerRuntimeLogEntryAcceptedClientInputSchema;
3065
+ declare const runtimeSchema_ReducerRuntimeLogEntryPhaseEnteredSchema: typeof ReducerRuntimeLogEntryPhaseEnteredSchema;
3066
+ declare const runtimeSchema_ReducerRuntimeLogEntryRngConsumptionSchema: typeof ReducerRuntimeLogEntryRngConsumptionSchema;
3067
+ declare const runtimeSchema_ReducerRuntimeLogEntrySchema: typeof ReducerRuntimeLogEntrySchema;
3068
+ declare const runtimeSchema_ReducerRuntimeLogEntryStateCommitSchema: typeof ReducerRuntimeLogEntryStateCommitSchema;
3069
+ declare const runtimeSchema_ReducerRuntimeStateSchema: typeof ReducerRuntimeStateSchema;
3070
+ declare const runtimeSchema_ReducerSessionStateSchema: typeof ReducerSessionStateSchema;
3071
+ declare const runtimeSchema_RngDrawSchema: typeof RngDrawSchema;
3072
+ declare const runtimeSchema_RngOperationParameterSchema: typeof RngOperationParameterSchema;
3073
+ declare const runtimeSchema_RngOperationSchema: typeof RngOperationSchema;
3074
+ declare const runtimeSchema_RngStateSchema: typeof RngStateSchema;
3075
+ declare const runtimeSchema_RuntimePendingInteractionSchema: typeof RuntimePendingInteractionSchema;
3076
+ declare const runtimeSchema_RuntimeSimultaneousCurrentSchema: typeof RuntimeSimultaneousCurrentSchema;
3077
+ declare const runtimeSchema_RuntimeSimultaneousStateSchema: typeof RuntimeSimultaneousStateSchema;
3078
+ declare const runtimeSchema_RuntimeSimultaneousSubmissionSchema: typeof RuntimeSimultaneousSubmissionSchema;
3079
+ declare const runtimeSchema_SchedulerContinuationDependencySchema: typeof SchedulerContinuationDependencySchema;
3080
+ declare const runtimeSchema_SchedulerFlowAuthorityProjectionSchema: typeof SchedulerFlowAuthorityProjectionSchema;
3081
+ declare const runtimeSchema_SeatProjectionBundleSchema: typeof SeatProjectionBundleSchema;
3082
+ declare const runtimeSchema_SeatProjectionSchema: typeof SeatProjectionSchema;
3083
+ declare const runtimeSchema_SimultaneousPhaseProjectionSchema: typeof SimultaneousPhaseProjectionSchema;
3084
+ declare const runtimeSchema_SystemActionEventSchema: typeof SystemActionEventSchema;
3085
+ declare const runtimeSchema_TransitionRecordSchema: typeof TransitionRecordSchema;
3086
+ declare namespace runtimeSchema {
3087
+ export { runtimeSchema_AuthoredViewSchema as AuthoredViewSchema, runtimeSchema_BoardStaticProjectionSchema as BoardStaticProjectionSchema, runtimeSchema_DispatchRequestSchema as DispatchRequestSchema, runtimeSchema_DispatchResultAcceptSchema as DispatchResultAcceptSchema, runtimeSchema_DispatchResultRejectSchema as DispatchResultRejectSchema, runtimeSchema_DispatchResultSchema as DispatchResultSchema, runtimeSchema_DispatchTraceAcceptedClientInputSchema as DispatchTraceAcceptedClientInputSchema, runtimeSchema_DispatchTracePhaseEnteredSchema as DispatchTracePhaseEnteredSchema, runtimeSchema_DispatchTraceRngConsumptionSchema as DispatchTraceRngConsumptionSchema, runtimeSchema_DispatchTraceSchema as DispatchTraceSchema, runtimeSchema_GameEventDetailSchema as GameEventDetailSchema, runtimeSchema_GameEventSchema as GameEventSchema, runtimeSchema_GameInputCancelSchema as GameInputCancelSchema, runtimeSchema_GameInputInteractionSchema as GameInputInteractionSchema, runtimeSchema_GameInputSchema as GameInputSchema, runtimeSchema_GameOutcomeReasonSchema as GameOutcomeReasonSchema, runtimeSchema_GameOutcomeSchema as GameOutcomeSchema, runtimeSchema_InitializeRequestSchema as InitializeRequestSchema, runtimeSchema_InitializeResultSchema as InitializeResultSchema, runtimeSchema_OutcomeResultSchema as OutcomeResultSchema, runtimeSchema_OutcomeScoreComponentSchema as OutcomeScoreComponentSchema, runtimeSchema_OutcomeStandingSchema as OutcomeStandingSchema, runtimeSchema_OutcomeTieBreakSchema as OutcomeTieBreakSchema, runtimeSchema_ProjectRequestSchema as ProjectRequestSchema, runtimeSchema_ProjectionTimingMetadataSchema as ProjectionTimingMetadataSchema, runtimeSchema_ReducerContractVersionSchema as ReducerContractVersionSchema, runtimeSchema_ReducerDomainStateSchema as ReducerDomainStateSchema, runtimeSchema_ReducerFlowStateSchema as ReducerFlowStateSchema, runtimeSchema_ReducerRuntimeLogEntryAcceptedClientInputSchema as ReducerRuntimeLogEntryAcceptedClientInputSchema, runtimeSchema_ReducerRuntimeLogEntryPhaseEnteredSchema as ReducerRuntimeLogEntryPhaseEnteredSchema, runtimeSchema_ReducerRuntimeLogEntryRngConsumptionSchema as ReducerRuntimeLogEntryRngConsumptionSchema, runtimeSchema_ReducerRuntimeLogEntrySchema as ReducerRuntimeLogEntrySchema, runtimeSchema_ReducerRuntimeLogEntryStateCommitSchema as ReducerRuntimeLogEntryStateCommitSchema, runtimeSchema_ReducerRuntimeStateSchema as ReducerRuntimeStateSchema, runtimeSchema_ReducerSessionStateSchema as ReducerSessionStateSchema, runtimeSchema_RngDrawSchema as RngDrawSchema, runtimeSchema_RngOperationParameterSchema as RngOperationParameterSchema, runtimeSchema_RngOperationSchema as RngOperationSchema, runtimeSchema_RngStateSchema as RngStateSchema, runtimeSchema_RuntimePendingInteractionSchema as RuntimePendingInteractionSchema, runtimeSchema_RuntimeSimultaneousCurrentSchema as RuntimeSimultaneousCurrentSchema, runtimeSchema_RuntimeSimultaneousStateSchema as RuntimeSimultaneousStateSchema, runtimeSchema_RuntimeSimultaneousSubmissionSchema as RuntimeSimultaneousSubmissionSchema, runtimeSchema_SchedulerContinuationDependencySchema as SchedulerContinuationDependencySchema, runtimeSchema_SchedulerFlowAuthorityProjectionSchema as SchedulerFlowAuthorityProjectionSchema, runtimeSchema_SeatProjectionBundleSchema as SeatProjectionBundleSchema, runtimeSchema_SeatProjectionSchema as SeatProjectionSchema, runtimeSchema_SimultaneousPhaseProjectionSchema as SimultaneousPhaseProjectionSchema, runtimeSchema_SystemActionEventSchema as SystemActionEventSchema, runtimeSchema_TransitionRecordSchema as TransitionRecordSchema };
3088
+ }
3089
+
3090
+ type ReducerContractVersion = z.infer<typeof ReducerContractVersionSchema>;
3091
+ type RngOperationParameter = z.infer<typeof RngOperationParameterSchema>;
3092
+ type RngOperation = z.infer<typeof RngOperationSchema>;
3093
+ type RngDraw = z.infer<typeof RngDrawSchema>;
3094
+ type RngState = z.infer<typeof RngStateSchema>;
3095
+ type ReducerFlowState = z.infer<typeof ReducerFlowStateSchema>;
3096
+ type RuntimeSimultaneousSubmission$1 = z.infer<typeof RuntimeSimultaneousSubmissionSchema>;
3097
+ type RuntimeSimultaneousCurrent = z.infer<typeof RuntimeSimultaneousCurrentSchema>;
3098
+ type RuntimeSimultaneousState$1 = z.infer<typeof RuntimeSimultaneousStateSchema>;
3099
+ type TransitionRecord = z.infer<typeof TransitionRecordSchema>;
3100
+ type ReducerRuntimeState = z.infer<typeof ReducerRuntimeStateSchema>;
3101
+ type ReducerDomainState = z.infer<typeof ReducerDomainStateSchema>;
3102
+ type ReducerSessionState = z.infer<typeof ReducerSessionStateSchema>;
3103
+ type GameInputInteraction = z.infer<typeof GameInputInteractionSchema>;
3104
+ type GameInput = z.infer<typeof GameInputSchema>;
3105
+ type GameOutcomeReason = z.infer<typeof GameOutcomeReasonSchema>;
3106
+ type OutcomeResult$1 = z.infer<typeof OutcomeResultSchema>;
3107
+ type OutcomeScoreComponent$1 = z.infer<typeof OutcomeScoreComponentSchema>;
3108
+ type OutcomeTieBreak$1 = z.infer<typeof OutcomeTieBreakSchema>;
3109
+ type OutcomeStanding$1 = z.infer<typeof OutcomeStandingSchema>;
3110
+ type GameOutcome$1 = z.infer<typeof GameOutcomeSchema>;
3111
+ type GameEventDetail$1 = z.infer<typeof GameEventDetailSchema>;
3112
+ type SystemActionEvent$1 = z.infer<typeof SystemActionEventSchema>;
3113
+ type GameEvent$1 = z.infer<typeof GameEventSchema>;
3114
+ type InitializeResult = z.infer<typeof InitializeResultSchema>;
3115
+ type InitializeRequest = z.infer<typeof InitializeRequestSchema>;
3116
+ type DispatchRequest = z.infer<typeof DispatchRequestSchema>;
3117
+ type DispatchTraceAcceptedClientInput = z.infer<typeof DispatchTraceAcceptedClientInputSchema>;
3118
+ type DispatchTracePhaseEntered = z.infer<typeof DispatchTracePhaseEnteredSchema>;
3119
+ type DispatchTraceRngConsumption = z.infer<typeof DispatchTraceRngConsumptionSchema>;
3120
+ type DispatchTrace = z.infer<typeof DispatchTraceSchema>;
3121
+ type DispatchResultReject = z.infer<typeof DispatchResultRejectSchema>;
3122
+ type DispatchResultAccept = z.infer<typeof DispatchResultAcceptSchema>;
3123
+ type DispatchResult = z.infer<typeof DispatchResultSchema>;
3124
+ type ReducerRuntimeLogEntryAcceptedClientInput = z.infer<typeof ReducerRuntimeLogEntryAcceptedClientInputSchema>;
3125
+ type ReducerRuntimeLogEntryPhaseEntered = z.infer<typeof ReducerRuntimeLogEntryPhaseEnteredSchema>;
3126
+ type ReducerRuntimeLogEntryRngConsumption = z.infer<typeof ReducerRuntimeLogEntryRngConsumptionSchema>;
3127
+ type ReducerRuntimeLogEntryStateCommit = z.infer<typeof ReducerRuntimeLogEntryStateCommitSchema>;
3128
+ type ReducerRuntimeLogEntry = z.infer<typeof ReducerRuntimeLogEntrySchema>;
3129
+ type SeatProjection = z.infer<typeof SeatProjectionSchema>;
3130
+ type SimultaneousPhaseProjection = z.infer<typeof SimultaneousPhaseProjectionSchema>;
3131
+ type SchedulerContinuationDependency = z.infer<typeof SchedulerContinuationDependencySchema>;
3132
+ type SchedulerFlowAuthorityProjection = z.infer<typeof SchedulerFlowAuthorityProjectionSchema>;
3133
+ type ProjectionTimingMetadata = z.infer<typeof ProjectionTimingMetadataSchema>;
3134
+ type SeatProjectionBundle = z.infer<typeof SeatProjectionBundleSchema>;
3135
+ type ProjectRequest = z.infer<typeof ProjectRequestSchema>;
3136
+ type BoardStaticProjection = z.infer<typeof BoardStaticProjectionSchema>;
3137
+ type RuntimePendingInteraction = z.infer<typeof RuntimePendingInteractionSchema>;
3138
+ type GameInputCancel = z.infer<typeof GameInputCancelSchema>;
3139
+ type AuthoredView = z.infer<typeof AuthoredViewSchema>;
3140
+
3141
+ type runtimeTypes_AuthoredView = AuthoredView;
3142
+ type runtimeTypes_BoardStaticProjection = BoardStaticProjection;
3143
+ type runtimeTypes_DispatchRequest = DispatchRequest;
3144
+ type runtimeTypes_DispatchResult = DispatchResult;
3145
+ type runtimeTypes_DispatchResultAccept = DispatchResultAccept;
3146
+ type runtimeTypes_DispatchResultReject = DispatchResultReject;
3147
+ type runtimeTypes_DispatchTrace = DispatchTrace;
3148
+ type runtimeTypes_DispatchTraceAcceptedClientInput = DispatchTraceAcceptedClientInput;
3149
+ type runtimeTypes_DispatchTracePhaseEntered = DispatchTracePhaseEntered;
3150
+ type runtimeTypes_DispatchTraceRngConsumption = DispatchTraceRngConsumption;
3151
+ type runtimeTypes_GameInput = GameInput;
3152
+ type runtimeTypes_GameInputCancel = GameInputCancel;
3153
+ type runtimeTypes_GameInputInteraction = GameInputInteraction;
3154
+ type runtimeTypes_GameOutcomeReason = GameOutcomeReason;
3155
+ type runtimeTypes_InitializeRequest = InitializeRequest;
3156
+ type runtimeTypes_InitializeResult = InitializeResult;
3157
+ type runtimeTypes_ProjectRequest = ProjectRequest;
3158
+ type runtimeTypes_ProjectionTimingMetadata = ProjectionTimingMetadata;
3159
+ type runtimeTypes_ReducerContractVersion = ReducerContractVersion;
3160
+ type runtimeTypes_ReducerDomainState = ReducerDomainState;
3161
+ type runtimeTypes_ReducerFlowState = ReducerFlowState;
3162
+ type runtimeTypes_ReducerRuntimeLogEntry = ReducerRuntimeLogEntry;
3163
+ type runtimeTypes_ReducerRuntimeLogEntryAcceptedClientInput = ReducerRuntimeLogEntryAcceptedClientInput;
3164
+ type runtimeTypes_ReducerRuntimeLogEntryPhaseEntered = ReducerRuntimeLogEntryPhaseEntered;
3165
+ type runtimeTypes_ReducerRuntimeLogEntryRngConsumption = ReducerRuntimeLogEntryRngConsumption;
3166
+ type runtimeTypes_ReducerRuntimeLogEntryStateCommit = ReducerRuntimeLogEntryStateCommit;
3167
+ type runtimeTypes_ReducerRuntimeState = ReducerRuntimeState;
3168
+ type runtimeTypes_ReducerSessionState = ReducerSessionState;
3169
+ type runtimeTypes_RngDraw = RngDraw;
3170
+ type runtimeTypes_RngOperation = RngOperation;
3171
+ type runtimeTypes_RngOperationParameter = RngOperationParameter;
3172
+ type runtimeTypes_RngState = RngState;
3173
+ type runtimeTypes_RuntimePendingInteraction = RuntimePendingInteraction;
3174
+ type runtimeTypes_RuntimeSimultaneousCurrent = RuntimeSimultaneousCurrent;
3175
+ type runtimeTypes_SchedulerContinuationDependency = SchedulerContinuationDependency;
3176
+ type runtimeTypes_SchedulerFlowAuthorityProjection = SchedulerFlowAuthorityProjection;
3177
+ type runtimeTypes_SeatProjection = SeatProjection;
3178
+ type runtimeTypes_SeatProjectionBundle = SeatProjectionBundle;
3179
+ type runtimeTypes_SimultaneousPhaseProjection = SimultaneousPhaseProjection;
3180
+ type runtimeTypes_TransitionRecord = TransitionRecord;
3181
+ declare namespace runtimeTypes {
3182
+ export type { runtimeTypes_AuthoredView as AuthoredView, runtimeTypes_BoardStaticProjection as BoardStaticProjection, runtimeTypes_DispatchRequest as DispatchRequest, runtimeTypes_DispatchResult as DispatchResult, runtimeTypes_DispatchResultAccept as DispatchResultAccept, runtimeTypes_DispatchResultReject as DispatchResultReject, runtimeTypes_DispatchTrace as DispatchTrace, runtimeTypes_DispatchTraceAcceptedClientInput as DispatchTraceAcceptedClientInput, runtimeTypes_DispatchTracePhaseEntered as DispatchTracePhaseEntered, runtimeTypes_DispatchTraceRngConsumption as DispatchTraceRngConsumption, GameEvent$1 as GameEvent, GameEventDetail$1 as GameEventDetail, runtimeTypes_GameInput as GameInput, runtimeTypes_GameInputCancel as GameInputCancel, runtimeTypes_GameInputInteraction as GameInputInteraction, GameOutcome$1 as GameOutcome, runtimeTypes_GameOutcomeReason as GameOutcomeReason, runtimeTypes_InitializeRequest as InitializeRequest, runtimeTypes_InitializeResult as InitializeResult, OutcomeResult$1 as OutcomeResult, OutcomeScoreComponent$1 as OutcomeScoreComponent, OutcomeStanding$1 as OutcomeStanding, OutcomeTieBreak$1 as OutcomeTieBreak, runtimeTypes_ProjectRequest as ProjectRequest, runtimeTypes_ProjectionTimingMetadata as ProjectionTimingMetadata, runtimeTypes_ReducerContractVersion as ReducerContractVersion, runtimeTypes_ReducerDomainState as ReducerDomainState, runtimeTypes_ReducerFlowState as ReducerFlowState, runtimeTypes_ReducerRuntimeLogEntry as ReducerRuntimeLogEntry, runtimeTypes_ReducerRuntimeLogEntryAcceptedClientInput as ReducerRuntimeLogEntryAcceptedClientInput, runtimeTypes_ReducerRuntimeLogEntryPhaseEntered as ReducerRuntimeLogEntryPhaseEntered, runtimeTypes_ReducerRuntimeLogEntryRngConsumption as ReducerRuntimeLogEntryRngConsumption, runtimeTypes_ReducerRuntimeLogEntryStateCommit as ReducerRuntimeLogEntryStateCommit, runtimeTypes_ReducerRuntimeState as ReducerRuntimeState, runtimeTypes_ReducerSessionState as ReducerSessionState, runtimeTypes_RngDraw as RngDraw, runtimeTypes_RngOperation as RngOperation, runtimeTypes_RngOperationParameter as RngOperationParameter, runtimeTypes_RngState as RngState, runtimeTypes_RuntimePendingInteraction as RuntimePendingInteraction, runtimeTypes_RuntimeSimultaneousCurrent as RuntimeSimultaneousCurrent, RuntimeSimultaneousState$1 as RuntimeSimultaneousState, RuntimeSimultaneousSubmission$1 as RuntimeSimultaneousSubmission, runtimeTypes_SchedulerContinuationDependency as SchedulerContinuationDependency, runtimeTypes_SchedulerFlowAuthorityProjection as SchedulerFlowAuthorityProjection, runtimeTypes_SeatProjection as SeatProjection, runtimeTypes_SeatProjectionBundle as SeatProjectionBundle, runtimeTypes_SimultaneousPhaseProjection as SimultaneousPhaseProjection, SystemActionEvent$1 as SystemActionEvent, runtimeTypes_TransitionRecord as TransitionRecord };
3183
+ }
3184
+
3185
+ type GameEventDetail = Readonly<GameEventDetail$1>;
3186
+ type SystemActionEvent = Readonly<Omit<SystemActionEvent$1, "details">> & {
3187
+ readonly details?: readonly GameEventDetail[];
3188
+ };
3189
+ /** Public display information only. Never include hidden cards, resources, or private state. */
3190
+ type GameEvent = SystemActionEvent;
3191
+ type OutcomeResult = OutcomeResult$1;
3192
+ type OutcomeScoreComponent = Readonly<OutcomeScoreComponent$1>;
3193
+ type OutcomeTieBreak = Readonly<OutcomeTieBreak$1>;
3194
+ type OutcomeStanding<Player extends string = string> = Readonly<Omit<OutcomeStanding$1, "playerId" | "scoreBreakdown" | "tieBreaks">> & {
3195
+ readonly playerId: Player;
3196
+ readonly scoreBreakdown?: readonly OutcomeScoreComponent[];
3197
+ readonly tieBreaks?: readonly OutcomeTieBreak[];
3198
+ };
3199
+ type GameOutcome<Player extends string = string> = {
3200
+ readonly reason: Readonly<GameOutcome$1["reason"]>;
3201
+ readonly standings: readonly OutcomeStanding<Player>[];
3202
+ };
3203
+
3204
+ type RuntimePhaseState = object;
3205
+ type PhaseAccessor<PhaseStates extends Record<string, object>, CurrentPhase extends keyof PhaseStates & string = keyof PhaseStates & string> = {
3206
+ get<PhaseName extends keyof PhaseStates & string>(phaseName: PhaseName): CurrentPhase extends PhaseName ? PhaseStates[PhaseName] : PhaseStates[PhaseName] | null;
3207
+ };
3208
+ type FlowState<PhaseName extends string, PlayerId extends string> = {
3209
+ currentPhase: PhaseName;
3210
+ turn: number;
3211
+ round: number;
3212
+ activePlayers: PlayerId[];
3213
+ };
3214
+ type RuntimeRngState = {
3215
+ seed?: number | null;
3216
+ cursor: number;
3217
+ trace: string[];
3218
+ draws: RuntimeRngDraw[];
3219
+ };
3220
+ type RuntimeRngOperationParameter = string | number | boolean;
3221
+ type RuntimeRngOperation = {
3222
+ kind: string;
3223
+ parameters: Record<string, RuntimeRngOperationParameter>;
3224
+ };
3225
+ /**
3226
+ * Public, persisted identity for one deterministic RNG cursor advance.
3227
+ *
3228
+ * Sampled values deliberately remain absent. Their consequences are exposed
3229
+ * only through the normal public/player projections.
3230
+ */
3231
+ type RuntimeRngDraw = {
3232
+ index: number;
3233
+ cursorBefore: number;
3234
+ cursorAfter: number;
3235
+ operation: RuntimeRngOperation;
3236
+ };
3237
+ type RuntimeSimultaneousSubmission = {
3238
+ interactionId: string;
3239
+ params: RuntimePayload;
3240
+ };
3241
+ type RuntimeSimultaneousState<PhaseName extends string, PlayerId extends string> = {
3242
+ current: {
3243
+ phaseName: PhaseName;
3244
+ actors: PlayerId[];
3245
+ submissions: Partial<Record<PlayerId, RuntimeSimultaneousSubmission>>;
3246
+ } | null;
3247
+ };
3248
+ type RuntimeState<PhaseName extends string, PlayerId extends string, Options extends RuntimeRecord = RuntimeRecord> = {
3249
+ /** Latest accepted public display-event batch; snapshot data, not history. */
3250
+ events: readonly GameEvent[];
3251
+ rng: RuntimeRngState;
3252
+ options: Options;
3253
+ simultaneous: RuntimeSimultaneousState<PhaseName, PlayerId>;
3254
+ pending: Partial<Record<PlayerId, {
3255
+ phaseName: PhaseName;
3256
+ interactionId: string;
3257
+ values: RuntimePayload[];
3258
+ }>>;
3259
+ lastTransition: {
3260
+ from: PhaseName;
3261
+ to: PhaseName;
3262
+ } | null;
3263
+ };
3264
+ type ReducerRuntimeStateForState<State extends {
3265
+ table: RuntimeTableRecord;
3266
+ flow: {
3267
+ currentPhase: string;
3268
+ };
3269
+ }, Options extends RuntimeRecord = RuntimeRecord> = RuntimeState<PhaseNameOfState<State>, PlayerIdOfState<State>, Options>;
3270
+ type ReducerGameState<Table extends RuntimeTableRecord, PublicState extends object, PrivateState extends object, HiddenState extends object, PhaseState extends RuntimePhaseState, PhaseName extends string, PhaseStates extends Record<PhaseName, object> = Record<PhaseName, PhaseState>> = {
3271
+ table: Table;
3272
+ publicState: PublicState;
3273
+ privateState: Record<PlayerIdOfTable<Table>, PrivateState>;
3274
+ hiddenState: HiddenState;
3275
+ flow: FlowState<PhaseName, PlayerIdOfTable<Table>>;
3276
+ phase: PhaseState & PhaseAccessor<PhaseStates>;
3277
+ };
3278
+ type ReducerValidationResult = {
3279
+ valid: true;
3280
+ } | {
3281
+ valid: false;
3282
+ errorCode: string;
3283
+ message?: string;
3284
+ };
3285
+ type ReducerReject = {
3286
+ type: "reject";
3287
+ errorCode: string;
3288
+ message?: string;
3289
+ };
3290
+
3291
+ type ReducerAccept<State> = {
3292
+ type: "accept";
3293
+ state: State;
3294
+ transition?: PhaseNameOfState<State>;
3295
+ events?: readonly GameEvent[];
3296
+ terminal?: GameOutcome<PlayerIdOfState<State>>;
3297
+ };
3298
+ type ReducerResult<State> = ReducerAccept<State> | ReducerReject;
3299
+
3300
+ type RotatePlayerZoneArgs<State extends {
3301
+ table: RuntimeTableRecord;
3302
+ }, ZoneId extends PlayerZoneIdOfTable<TableOfState<State>> = PlayerZoneIdOfTable<TableOfState<State>>, PlayerId extends PlayerIdOfTable<TableOfState<State>> = PlayerIdOfTable<TableOfState<State>>> = {
3303
+ zoneId: ZoneId;
3304
+ direction: "left" | "right";
3305
+ players?: readonly PlayerId[];
3306
+ cardIdsByPlayer?: Partial<Record<PlayerId, readonly CardIdOfTable<TableOfState<State>>[]>>;
3307
+ position?: "top" | "bottom";
3308
+ };
3309
+ /**
3310
+ * Shallow patch or functional updater for one state slice. The updater is a
3311
+ * method-style callable so a transaction over a phase-scoped state stays
3312
+ * assignable to one over the base game state; a plain function type would be
3313
+ * invariant in `T` under `strictFunctionTypes`.
3314
+ */
3315
+ type StatePatch<T> = Partial<T> | {
3316
+ update(prev: T): T;
3317
+ }["update"];
3318
+ /**
3319
+ * Mutations available on a transaction-owned draft.
3320
+ */
3321
+ interface TransactionMutations<State extends {
3322
+ table: RuntimeTableRecord;
3323
+ }> {
3324
+ /** Set the list of players whose turn is currently active. */
3325
+ setActivePlayers(activePlayers: ReadonlyArray<PlayerIdOfState<State>>): State;
3326
+ /**
3327
+ * Advance `flow.activePlayers` to the single next seat in `playerOrder`.
3328
+ *
3329
+ * Uses `state.flow.activePlayers[0]` as the current seat (or the first
3330
+ * seat in `playerOrder` when `activePlayers` is empty) and sets
3331
+ * `activePlayers` to `[q.player.nextInOrder(current)]`. No-op when the
3332
+ * player order is empty.
3333
+ */
3334
+ advanceActivePlayer(): State;
3335
+ /**
3336
+ * Update the current phase's local state.
3337
+ *
3338
+ * Accepts either a `Partial<PhaseState>` which is shallow-merged into the
3339
+ * previous value, or a functional updater `(prev) => next` which must
3340
+ * return a complete `PhaseState`.
3341
+ */
3342
+ patchPhaseState(patch: StatePatch<PhaseStateOfState<State>>): State;
3343
+ /**
3344
+ * Update `state.publicState`.
3345
+ *
3346
+ * Accepts either a `Partial<PublicState>` which is shallow-merged into the
3347
+ * previous value, or a functional updater `(prev) => next` which must
3348
+ * return a complete `PublicState`.
3349
+ */
3350
+ patchPublicState(patch: StatePatch<PublicStateOfState<State>>): State;
3351
+ /**
3352
+ * Update `state.hiddenState`.
3353
+ *
3354
+ * Accepts either a `Partial<HiddenState>` or a functional updater.
3355
+ */
3356
+ patchHiddenState(patch: StatePatch<HiddenStateOfState<State>>): State;
3357
+ /**
3358
+ * Update a single player's entry in `state.privateState`.
3359
+ *
3360
+ * Accepts either a `Partial<PrivateState>` or a functional updater.
3361
+ */
3362
+ patchPlayerPrivateState(args: {
3363
+ playerId: PlayerIdOfState<State>;
3364
+ patch: StatePatch<PrivateStateOfState<State>>;
3365
+ }): State;
3366
+ /**
3367
+ * Append a card to a shared zone (deck). Defaults to placing the card at the
3368
+ * bottom; pass `position: "top"` for top-of-deck placement (e.g. Bureaucrat-style).
3369
+ */
3370
+ addCardToSharedZone<DeckId extends SharedZoneIdOfTable<TableOfState<State>>>(args: {
3371
+ deckId: DeckId;
3372
+ cardId: DeckCardsOfTable<TableOfState<State>, DeckId>[number];
3373
+ playedBy?: PlayerIdOfTable<TableOfState<State>> | null;
3374
+ position?: "top" | "bottom";
3375
+ }): State;
3376
+ /** Remove a card from a shared zone (deck). */
3377
+ removeCardFromSharedZone<DeckId extends DeckIdOfTable<TableOfState<State>>>(args: {
3378
+ deckId: DeckId;
3379
+ cardId: DeckCardsOfTable<TableOfState<State>, DeckId>[number];
3380
+ }): State;
3381
+ /**
3382
+ * Move a card between two shared zones (decks). Defaults to placing the card
3383
+ * at the bottom of the destination; pass `position: "top"` for top placement.
3384
+ */
3385
+ moveCardBetweenSharedZones<FromZoneId extends SharedZoneIdOfTable<TableOfState<State>>, ToZoneId extends SharedZoneIdOfTable<TableOfState<State>>>(args: {
3386
+ fromZoneId: FromZoneId;
3387
+ toZoneId: ToZoneId;
3388
+ cardId: DeckCardsOfTable<TableOfState<State>, FromZoneId>[number];
3389
+ playedBy?: PlayerIdOfTable<TableOfState<State>> | null;
3390
+ position?: "top" | "bottom";
3391
+ }): State;
3392
+ /**
3393
+ * Draw the top `count` cards from one perPlayer zone into another for the
3394
+ * same player (e.g. deck → hand at the start of a turn). Companion to
3395
+ * {@link deal} for the perPlayer → perPlayer case. Stops
3396
+ * silently if the source runs out before `count` is reached.
3397
+ */
3398
+ dealCardsBetweenPlayerZones<FromZoneId extends PlayerZoneIdOfTable<TableOfState<State>>, ToZoneId extends PlayerZoneIdOfTable<TableOfState<State>>, PlayerId extends PlayerIdOfTable<TableOfState<State>>>(args: {
3399
+ playerId: PlayerId;
3400
+ fromZoneId: FromZoneId;
3401
+ toZoneId: ToZoneId;
3402
+ count: number;
3403
+ }): State;
3404
+ /**
3405
+ * Move a card between two perPlayer zones owned by the same player (e.g.
3406
+ * hand → in-play → discard). Owner is preserved; visibility is recomputed
3407
+ * from the destination zone.
3408
+ */
3409
+ moveCardBetweenPlayerZones<FromZoneId extends PlayerZoneIdOfTable<TableOfState<State>>, ToZoneId extends PlayerZoneIdOfTable<TableOfState<State>>, PlayerId extends PlayerIdOfTable<TableOfState<State>>>(args: {
3410
+ playerId: PlayerId;
3411
+ fromZoneId: FromZoneId;
3412
+ toZoneId: ToZoneId;
3413
+ cardId: CompatibleCardIdForTwoPlayerZones<TableOfState<State>, FromZoneId, ToZoneId>;
3414
+ position?: "top" | "bottom";
3415
+ }): State;
3416
+ /**
3417
+ * Move a card from a player zone (hand) to a shared zone (deck). Defaults to
3418
+ * placing the card at the bottom; pass `position: "top"` to topdeck.
3419
+ */
3420
+ moveCardFromPlayerZoneToSharedZone<FromZoneId extends PlayerZoneIdOfTable<TableOfState<State>>, ToZoneId extends SharedZoneIdOfTable<TableOfState<State>>, PlayerId extends PlayerIdOfTable<TableOfState<State>>>(args: {
3421
+ playerId: PlayerId;
3422
+ fromZoneId: FromZoneId;
3423
+ toZoneId: ToZoneId;
3424
+ cardId: CompatibleCardIdForHandAndDeck<TableOfState<State>, FromZoneId, ToZoneId>;
3425
+ playedBy?: PlayerIdOfTable<TableOfState<State>> | null;
3426
+ position?: "top" | "bottom";
3427
+ }): State;
3428
+ /**
3429
+ * Move a named card from a shared zone (supply pile, deck) to a perPlayer
3430
+ * zone (e.g. discard). The "gain" verb in deck-builders. Distinct from
3431
+ * {@link deal}, which draws unspecified top-N cards from a
3432
+ * deck. Owner flips to the receiving player; visibility is recomputed.
3433
+ */
3434
+ moveCardFromSharedZoneToPlayerZone<FromZoneId extends SharedZoneIdOfTable<TableOfState<State>>, ToZoneId extends PlayerZoneIdOfTable<TableOfState<State>>, PlayerId extends PlayerIdOfTable<TableOfState<State>>>(args: {
3435
+ playerId: PlayerId;
3436
+ fromZoneId: FromZoneId;
3437
+ toZoneId: ToZoneId;
3438
+ cardId: CompatibleCardIdForHandAndDeck<TableOfState<State>, ToZoneId, FromZoneId>;
3439
+ position?: "top" | "bottom";
3440
+ }): State;
3441
+ /**
3442
+ * Deal the top `count` cards from a shared deck into a player's hand zone.
3443
+ *
3444
+ * Dealing does not consume RNG. Shuffle first with `tx.shuffle({ zoneId })`
3445
+ * when the deck needs a random order, then call `tx.deal(...)`.
3446
+ */
3447
+ deal<FromZoneId extends DeckIdOfTable<TableOfState<State>>, PlayerId extends PlayerIdOfTable<TableOfState<State>>, ToZoneId extends CompatibleHandIdForDeck<TableOfState<State>, FromZoneId> & HandIdOfTable<TableOfState<State>>>(args: {
3448
+ fromZoneId: FromZoneId;
3449
+ playerId: PlayerId;
3450
+ toZoneId: ToZoneId;
3451
+ count: number;
3452
+ }): State;
3453
+ /**
3454
+ * Atomically rotate cards in a per-player zone around the table.
3455
+ *
3456
+ * Defaults to rotating every card currently in `zoneId` for every player in
3457
+ * turn order. Pass `players` to use a smaller explicit order, or
3458
+ * `cardIdsByPlayer` to rotate only selected cards such as Hearts passes.
3459
+ */
3460
+ rotatePlayerZone<ZoneId extends PlayerZoneIdOfTable<TableOfState<State>>, PlayerId extends PlayerIdOfTable<TableOfState<State>>>(args: RotatePlayerZoneArgs<State, ZoneId, PlayerId>): State;
3461
+ /** Move a component onto a board space. */
3462
+ moveComponentToSpace<BoardId extends BoardIdOfTable<TableOfState<State>>, SpaceId extends SpaceIdOfTable<TableOfState<State>, BoardId>, ComponentId extends ComponentIdOfTable<TableOfState<State>>>(args: {
3463
+ componentId: ComponentId;
3464
+ boardId: BoardId;
3465
+ spaceId: SpaceId;
3466
+ }): State;
3467
+ /** Move a component into a board container. */
3468
+ moveComponentToContainer<BoardId extends BoardIdOfTable<TableOfState<State>>, ContainerId extends BoardContainerIdOfTable<TableOfState<State>, BoardId>, ComponentId extends ComponentIdOfTable<TableOfState<State>>>(args: {
3469
+ componentId: ComponentId;
3470
+ boardId: BoardId;
3471
+ containerId: ContainerId;
3472
+ }): State;
3473
+ /** Move a component onto a tiled board edge. */
3474
+ moveComponentToEdge<BoardId extends TiledBoardIdOfTable<TableOfState<State>>, EdgeId extends TiledEdgeIdOfTable<TableOfState<State>, BoardId>, ComponentId extends ComponentIdOfTable<TableOfState<State>>>(args: {
3475
+ componentId: ComponentId;
3476
+ boardId: BoardId;
3477
+ edgeId: EdgeId;
3478
+ }): State;
3479
+ /** Move a component onto a tiled board vertex. */
3480
+ moveComponentToVertex<BoardId extends TiledBoardIdOfTable<TableOfState<State>>, VertexId extends TiledVertexIdOfTable<TableOfState<State>, BoardId>, ComponentId extends ComponentIdOfTable<TableOfState<State>>>(args: {
3481
+ componentId: ComponentId;
3482
+ boardId: BoardId;
3483
+ vertexId: VertexId;
3484
+ }): State;
3485
+ /** Move a component back to the detached pool. */
3486
+ moveComponentToDetached<ComponentId extends ComponentIdOfTable<TableOfState<State>>>(args: {
3487
+ componentId: ComponentId;
3488
+ }): State;
3489
+ /**
3490
+ * Credit the specified resources to a player.
3491
+ *
3492
+ * Amounts must be non-negative; use {@link spendResources} for deductions
3493
+ * so that affordability is checked explicitly.
3494
+ *
3495
+ * tx.addResources({ playerId, amounts: { wood: 1, brick: 1 } });
3496
+ */
3497
+ addResources(args: {
3498
+ playerId: PlayerIdOfTable<TableOfState<State>>;
3499
+ amounts: ResourceAmountsOfTable<TableOfState<State>>;
3500
+ }): State;
3501
+ /**
3502
+ * Debit the specified resources from a player.
3503
+ *
3504
+ * Throws when the player cannot afford the full cost — gate with
3505
+ * `q.player.canAfford(...)` in your `validate` step before invoking.
3506
+ *
3507
+ * tx.spendResources({ playerId, amounts: COST_DEV_CARD });
3508
+ * tx.deal({ ... });
3509
+ */
3510
+ spendResources(args: {
3511
+ playerId: PlayerIdOfTable<TableOfState<State>>;
3512
+ amounts: ResourceAmountsOfTable<TableOfState<State>>;
3513
+ }): State;
3514
+ /**
3515
+ * Transfer the specified resources from one player to another.
3516
+ *
3517
+ * Throws when the source cannot afford the full amount. On success the
3518
+ * destination gains exactly what the source loses.
3519
+ */
3520
+ transferResources(args: {
3521
+ fromPlayerId: PlayerIdOfTable<TableOfState<State>>;
3522
+ toPlayerId: PlayerIdOfTable<TableOfState<State>>;
3523
+ amounts: ResourceAmountsOfTable<TableOfState<State>>;
3524
+ }): State;
3525
+ /**
3526
+ * Overwrite a single resource balance for a player. Prefer
3527
+ * {@link addResources} / {@link spendResources} — use this only when the
3528
+ * new balance is an absolute (e.g. scripted setup).
3529
+ */
3530
+ setResource(args: {
3531
+ playerId: PlayerIdOfTable<TableOfState<State>>;
3532
+ resourceId: ResourceIdOfTable<TableOfState<State>>;
3533
+ amount: number;
3534
+ }): State;
3535
+ }
3536
+
3537
+ type IsAny<Value> = 0 extends 1 & Value ? true : false;
3538
+ /** Phase names a transaction may transition to; `string` when state is erased. */
3539
+ type TransitionTarget<State> = IsAny<State> extends true ? string : PhaseNameOfState<State>;
3540
+
3541
+ /**
3542
+ * Result builders on the transaction. A mutation callback ends with one of
3543
+ * these or with a bare `return` (accept the transaction as it stands).
3544
+ */
3545
+ type ReducerTransactionOutcome<State extends {
3546
+ table: RuntimeTableRecord;
3547
+ }, ErrorCode extends string = string> = {
3548
+ /** Emit public display events for every seat. Private details belong in the authored seat view. */
3549
+ emit(...events: GameEvent[]): void;
3550
+ /** Accept with the current transaction state. Same as a bare `return`. */
3551
+ accept(): ReducerAccept<State>;
3552
+ /** Accept and move the flow to another declared phase. */
3553
+ transition<To extends TransitionTarget<State>>(to: To): ReducerAccept<State>;
3554
+ /**
3555
+ * Accept and end the game with a terminal outcome. Pass `transition` to
3556
+ * also move the flow to a terminal phase in the same result.
3557
+ */
3558
+ endGame(outcome: GameOutcome<PlayerIdOfState<State>>, options?: {
3559
+ transition?: TransitionTarget<State>;
3560
+ }): ReducerAccept<State>;
3561
+ /** Reject with a declared error code. The transaction is discarded. */
3562
+ reject(errorCode: ErrorCode, message?: string): ReducerReject;
3563
+ };
3564
+ type ReducerTransaction<State extends {
3565
+ table: RuntimeTableRecord;
3566
+ }, ErrorCode extends string = string> = TransactionMutations<State> & ReducerTransactionOutcome<State, ErrorCode> & {
3567
+ readonly state: State;
3568
+ readonly q: TableQueriesOfState<State>;
3569
+ roll(dieId: StringKeyOf<TableOfState<State>["dice"]>): number;
3570
+ shuffle(args: {
3571
+ zoneId: DeckIdOfState<State>;
3572
+ } | {
3573
+ zoneId: PlayerZoneIdOfState<State>;
3574
+ playerId: PlayerIdOfTable<TableOfState<State>>;
3575
+ }): void;
3576
+ };
3577
+
3578
+ type PhaseEnterContext = {
3579
+ event: "initialize" | "transition";
3580
+ };
3581
+ type BivariantCallback<Args, Result> = {
3582
+ bivarianceHack(args: Args): Result;
3583
+ }["bivarianceHack"];
3584
+ type ActionContext<State extends {
3585
+ table: RuntimeTableRecord;
3586
+ flow: {
3587
+ currentPhase: string;
3588
+ };
3589
+ }, Manifest extends ManifestContract<TableOfState<State>>> = {
3590
+ currentPhase: PhaseNameOfState<State>;
3591
+ manifest: Manifest;
3592
+ playerOrder: PlayerIdOfState<State>[];
3593
+ activePlayers: PlayerIdOfState<State>[];
3594
+ runtime: Omit<ReducerRuntimeStateForState<State>, "rng">;
3595
+ };
3596
+ type ValidationIssue<ErrorCode extends string = string> = {
3597
+ errorCode: ErrorCode;
3598
+ message?: string;
3599
+ };
3600
+ /**
3601
+ * Read-only helpers available to every callback, including views, actor
3602
+ * selectors, and interaction rules.
3603
+ */
3604
+ type ReadHelpers<State extends {
3605
+ table: RuntimeTableRecord;
3606
+ flow: {
3607
+ currentPhase: string;
3608
+ };
3609
+ }> = {
3610
+ q: TableQueriesOfState<State>;
3611
+ };
3612
+ type RandomHelpers = {
3613
+ integer(options: {
3614
+ minInclusive: number;
3615
+ maxInclusive: number;
3616
+ }): number;
3617
+ subset<const Values extends readonly unknown[]>(options: {
3618
+ from: Values;
3619
+ count: number;
3620
+ }): readonly Values[number][];
3621
+ };
3622
+ /**
3623
+ * Helpers available only to mutation callbacks (`enter`, `reduce`, `resolve`). `tx` is the open transaction: mutate through it and end the
3624
+ * callback with a bare `return`, `tx.transition(...)`, `tx.endGame(...)`, or
3625
+ * `tx.reject(...)`.
3626
+ */
3627
+ type MutationHelpers<State extends {
3628
+ table: RuntimeTableRecord;
3629
+ flow: {
3630
+ currentPhase: string;
3631
+ };
3632
+ }, ErrorCode extends string = string> = {
3633
+ tx: ReducerTransaction<State, ErrorCode>;
3634
+ random: RandomHelpers;
3635
+ };
3636
+ type PhaseEnterArgs<State extends {
3637
+ table: RuntimeTableRecord;
3638
+ flow: {
3639
+ currentPhase: string;
3640
+ };
3641
+ }, Manifest extends ManifestContract<TableOfState<State>>, ErrorCode extends string = string> = ActionContext<State, Manifest> & ReadHelpers<State> & MutationHelpers<State, ErrorCode> & PhaseEnterContext & {
3642
+ state: State;
3643
+ };
3644
+ type ActorSelectorArgs<State extends {
3645
+ table: RuntimeTableRecord;
3646
+ flow: {
3647
+ currentPhase: string;
3648
+ };
3649
+ }, Manifest extends ManifestContract<TableOfState<State>>> = ActionContext<State, Manifest> & ReadHelpers<State> & {
3650
+ state: State;
3651
+ };
3652
+ type ActorSelection<State extends {
3653
+ table: RuntimeTableRecord;
3654
+ flow: {
3655
+ currentPhase: string;
3656
+ };
3657
+ }> = PlayerIdOfState<State> | readonly PlayerIdOfState<State>[] | null | undefined;
3658
+ type ActorSelector<State extends {
3659
+ table: RuntimeTableRecord;
3660
+ flow: {
3661
+ currentPhase: string;
3662
+ };
3663
+ }, Manifest extends ManifestContract<TableOfState<State>>> = BivariantCallback<ActorSelectorArgs<State, Manifest>, ActorSelection<State>>;
3664
+ type ScopedPhaseState<State extends {
3665
+ table: RuntimeTableRecord;
3666
+ flow: {
3667
+ currentPhase: string;
3668
+ };
3669
+ phase: object;
3670
+ }, PhaseState extends object> = State & {
3671
+ phase: PhaseState;
3672
+ };
3673
+
3674
+ type InputCollectorKind = InteractionInputDescriptor["kind"];
3675
+ type TargetKind = Extract<InputDomain, {
3676
+ type: "cardTarget" | "boardTarget";
3677
+ }>["targetKind"];
3678
+ type BoardInputCollectorKind = Exclude<InputCollectorKind, "form" | "card" | "rng">;
3679
+ type CardInputCollectorMeta = {
3680
+ readonly zoneId: string;
3681
+ readonly zoneIds?: readonly string[];
3682
+ readonly targetKind: "card";
3683
+ };
3684
+ type BoardInputCollectorMeta = {
3685
+ readonly targetKind: TargetKind;
3686
+ readonly boardId: string;
3687
+ readonly valueKind?: "board-id" | "player-board-space";
3688
+ };
3689
+ type RngInputCollectorMeta = {
3690
+ readonly rng: "d6";
3691
+ readonly count: number;
3692
+ } | {
3693
+ readonly rng: "coin";
3694
+ };
3695
+ type InputCollectorMetaForKind<Kind extends InputCollectorKind> = Kind extends "card" ? CardInputCollectorMeta : Kind extends BoardInputCollectorKind ? BoardInputCollectorMeta : Kind extends "rng" ? RngInputCollectorMeta : never;
3696
+ type InputSelectionDescriptor = InputSelection;
3697
+ type InputDomainDescriptor = InputDomain;
3698
+ type CardTargetDomainDescriptor = Extract<InputDomain, {
3699
+ type: "cardTarget";
3700
+ }>;
3701
+ type BoardTargetDomainDescriptor = Extract<InputDomain, {
3702
+ type: "boardTarget";
3703
+ }>;
3704
+ type DomainProjector<Domain extends InputDomainDescriptor> = (state: CollectorState, playerId: string, q: unknown) => Domain;
3705
+ type InputDomainForCollectorKind<Kind extends InputCollectorKind> = Kind extends "card" ? CardTargetDomainDescriptor : Kind extends BoardInputCollectorKind ? BoardTargetDomainDescriptor : Exclude<InputDomainDescriptor, CardTargetDomainDescriptor | BoardTargetDomainDescriptor>;
3706
+ /**
3707
+ * Base state shape every collector is generic over. Collectors that need
3708
+ * narrowed ids (card / player) use `PlayerIdOfState<State>` etc. to thread
3709
+ * the manifest's branded types.
3710
+ */
3711
+ type CollectorState = {
3712
+ table: RuntimeTableRecord;
3713
+ flow: {
3714
+ currentPhase: string;
3715
+ };
3716
+ };
3717
+ /**
3718
+ * An input collector declares:
3719
+ * - a Zod schema for the parameter value the interaction expects. The
3720
+ * schema's `z.infer` feeds `ParamsOf<Collectors>`, so downstream
3721
+ * `reduce({ input: { params } })` sees branded ids from `cardInput` /
3722
+ * `boardInput` without a second declaration.
3723
+ * - an optional `eligibleTargets(state, playerId, q)` hook that the runtime
3724
+ * calls to enumerate server-authoritative, submit-ready values accepted by
3725
+ * the collector schema. The hook receives
3726
+ * the same `q` table-queries helper that `validate` / `reduce` see, so
3727
+ * board/card/form collectors can reuse whatever board-graph or zone
3728
+ * lookups they already use for validation without rebuilding them from
3729
+ * raw state. Each collector helper narrows the return type to its own
3730
+ * branded id (`CardIdOfState<State>` for `cardInput`, the caller-supplied
3731
+ * `Id extends string` for `boardInput.*`, etc.). At the generic interface
3732
+ * level we keep inputs weak (`CollectorState`, `string`, `unknown`) and
3733
+ * the return `ReadonlyArray<unknown>` so the runtime can treat all
3734
+ * collectors uniformly; per-helper signatures provide the author-facing
3735
+ * strong typing.
3736
+ * - optional `meta` for collector-kind-specific routing (e.g. `cardInput`
3737
+ * stores the `zoneId` the card must come from).
3738
+ *
3739
+ * Collectors without meaningful eligibility (`form`, `rng`) leave
3740
+ * `eligibleTargets` undefined.
3741
+ */
3742
+ type InputCollectorMetaSlot<Kind extends InputCollectorKind> = [
3743
+ InputCollectorMetaForKind<Kind>
3744
+ ] extends [never] ? {
3745
+ readonly meta?: never;
3746
+ } : undefined extends InputCollectorMetaForKind<Kind> ? {
3747
+ readonly meta?: Exclude<InputCollectorMetaForKind<Kind>, undefined>;
3748
+ } : {
3749
+ readonly meta: InputCollectorMetaForKind<Kind>;
3750
+ };
3751
+ type InputCollectorBase<Schema extends SchemaLike<unknown> = SchemaLike<unknown>, State extends CollectorState = CollectorState, Kind extends InputCollectorKind = InputCollectorKind> = {
3752
+ readonly kind: Kind;
3753
+ readonly schema: Schema;
3754
+ readonly defaultValue?: z.infer<Schema>;
3755
+ readonly selection?: InputSelectionDescriptor;
3756
+ readonly eligibleTargets?: (state: CollectorState, playerId: string, q: unknown) => ReadonlyArray<unknown>;
3757
+ readonly validateTarget?: (state: CollectorState, playerId: string, q: unknown, targetId: unknown) => ValidationIssue | null | undefined;
3758
+ readonly resolveDefaultValue?: (state: CollectorState, playerId: string, q: unknown, domain: InputDomainDescriptor) => z.infer<Schema> | undefined;
3759
+ } & (Kind extends "rng" ? {
3760
+ readonly domain?: never;
3761
+ } : Kind extends "card" | BoardInputCollectorKind ? {
3762
+ readonly domain: DomainProjector<InputDomainForCollectorKind<Kind>>;
3763
+ } : {
3764
+ readonly domain?: DomainProjector<InputDomainForCollectorKind<Kind>>;
3765
+ }) & InputCollectorMetaSlot<Kind>;
3766
+ type InputCollector<Schema extends SchemaLike<unknown> = SchemaLike<unknown>, State extends CollectorState = CollectorState, Kind extends InputCollectorKind = InputCollectorKind> = Kind extends InputCollectorKind ? InputCollectorBase<Schema, State, Kind> : never;
3767
+ type ParamsOf<Collectors extends Record<string, InputCollector>> = {
3768
+ [K in keyof Collectors]: Collectors[K] extends InputCollector<infer S> ? S extends SchemaLike<infer V> ? V : never : never;
3769
+ };
3770
+ type EngineSampledCollectorKeys<Collectors extends Record<string, InputCollector>> = {
3771
+ [K in keyof Collectors]: Collectors[K] extends InputCollector & {
3772
+ kind: "rng";
3773
+ } ? K : never;
3774
+ }[keyof Collectors];
3775
+ type ClientCollectorValue<Collector> = Collector extends InputCollector<infer S> ? S extends SchemaLike<infer V> ? V : never : never;
3776
+ type ClientCollectorKeys<Collectors extends Record<string, InputCollector>> = Exclude<keyof Collectors, EngineSampledCollectorKeys<Collectors>>;
3777
+ type OptionalClientCollectorKeys<Collectors extends Record<string, InputCollector>> = {
3778
+ [K in ClientCollectorKeys<Collectors>]: undefined extends ClientCollectorValue<Collectors[K]> ? K : never;
3779
+ }[ClientCollectorKeys<Collectors>];
3780
+ type ClientParamsOf<Collectors extends Record<string, InputCollector>> = {
3781
+ [K in Exclude<ClientCollectorKeys<Collectors>, OptionalClientCollectorKeys<Collectors>>]: ClientCollectorValue<Collectors[K]>;
3782
+ } & {
3783
+ [K in OptionalClientCollectorKeys<Collectors>]?: Exclude<ClientCollectorValue<Collectors[K]>, undefined>;
3784
+ };
3785
+
3786
+ type StepCollector = Exclude<InputCollector, {
3787
+ readonly kind: "rng";
3788
+ }>;
3789
+ type StepFactoryArgs<State extends CollectorState, Collectors extends Record<string, InputCollector>> = {
3790
+ readonly state: State;
3791
+ readonly playerId: PlayerIdOfState<State>;
3792
+ readonly q: TableQueriesOfState<State>;
3793
+ readonly selected: Readonly<ParamsOf<Collectors>>;
3794
+ };
3795
+ type InputStep<State extends CollectorState> = {
3796
+ readonly key: string;
3797
+ readonly resolve: {
3798
+ invoke(args: StepFactoryArgs<State, Record<string, InputCollector>>): InputCollector;
3799
+ }["invoke"];
3800
+ };
3801
+ type StepDefinition<Collectors extends Record<string, InputCollector>> = {
3802
+ readonly collectors: Collectors;
3803
+ readonly entries: readonly InputStep<CollectorState>[];
3804
+ };
3805
+ /** Ordered authoring definition. Only the committed values are persisted. */
3806
+ declare class InteractionSteps<State extends CollectorState, Collectors extends Record<string, InputCollector> = Record<never, never>> {
3807
+ readonly entries: readonly InputStep<State>[];
3808
+ readonly collectors: Collectors;
3809
+ constructor(entries?: readonly InputStep<State>[]);
3810
+ input<const Key extends string, Collector extends StepCollector>(key: Key extends keyof Collectors ? never : Key, collector: Collector | ((args: StepFactoryArgs<State, Collectors>) => Collector)): InteractionSteps<State, Collectors & Record<Key, Collector>>;
3811
+ }
3812
+
3813
+ type InteractionReduceInput<Collectors extends Record<string, InputCollector>, State extends {
3814
+ table: RuntimeTableRecord;
3815
+ flow: {
3816
+ currentPhase: string;
3817
+ };
3818
+ }> = {
3819
+ playerId: PlayerIdOfState<State>;
3820
+ params: ParamsOf<Collectors>;
3821
+ };
3822
+ type InteractionValidateArgs<Collectors extends Record<string, InputCollector>, State extends {
3823
+ table: RuntimeTableRecord;
3824
+ flow: {
3825
+ currentPhase: string;
3826
+ };
3827
+ }, Manifest extends ManifestContract<TableOfState<State>>> = ActionContext<State, Manifest> & ReadHelpers<State> & {
3828
+ state: State;
3829
+ input: {
3830
+ playerId: PlayerIdOfState<State>;
3831
+ params: ClientParamsOf<Collectors>;
3832
+ };
3833
+ };
3834
+ type InteractionReduceArgs<Collectors extends Record<string, InputCollector>, State extends {
3835
+ table: RuntimeTableRecord;
3836
+ flow: {
3837
+ currentPhase: string;
3838
+ };
3839
+ }, Manifest extends ManifestContract<TableOfState<State>>, ErrorCode extends string = string> = Omit<InteractionValidateArgs<Collectors, State, Manifest>, "input"> & {
3840
+ input: InteractionReduceInput<Collectors, State>;
3841
+ } & MutationHelpers<State, ErrorCode>;
3842
+ type InteractionAvailabilityArgs<State extends {
3843
+ table: RuntimeTableRecord;
3844
+ flow: {
3845
+ currentPhase: string;
3846
+ };
3847
+ }, Manifest extends ManifestContract<TableOfState<State>>> = ActionContext<State, Manifest> & ReadHelpers<State> & {
3848
+ state: State;
3849
+ input: {
3850
+ playerId: PlayerIdOfState<State>;
3851
+ };
3852
+ };
3853
+ type InteractionRuleValidationResult<ErrorCode extends string = string> = boolean | string | ValidationIssue<ErrorCode> | null | undefined;
3854
+ type InteractionRule<Collectors extends Record<string, InputCollector> = Record<string, InputCollector>, State extends {
3855
+ table: RuntimeTableRecord;
3856
+ flow: {
3857
+ currentPhase: string;
3858
+ };
3859
+ } = {
3860
+ table: RuntimeTableRecord;
3861
+ flow: {
3862
+ currentPhase: string;
3863
+ };
3864
+ }, Manifest extends ManifestContract<TableOfState<State>> = ManifestContract<TableOfState<State>>, ErrorCode extends string = string> = {
3865
+ /**
3866
+ * Stable rule id for diagnostics and tests. Rule ids are author-owned and
3867
+ * should be unique within one interaction.
3868
+ */
3869
+ id: string;
3870
+ /**
3871
+ * Error code used when the rule fails. The same code is used for descriptor
3872
+ * availability and submit-time validation unless `validate` returns a
3873
+ * specific ValidationIssue.
3874
+ */
3875
+ errorCode: ErrorCode;
3876
+ message?: string;
3877
+ /**
3878
+ * Projection-time rule. Runs without submitted params, so UI descriptors can
3879
+ * reflect action availability before the user clicks.
3880
+ */
3881
+ available?: BivariantCallback<InteractionAvailabilityArgs<State, Manifest>, boolean>;
3882
+ /**
3883
+ * Submit-time rule. Runs with parsed params and may return false, a concrete
3884
+ * ValidationIssue, null, or undefined.
3885
+ */
3886
+ validate?: BivariantCallback<InteractionValidateArgs<Collectors, State, Manifest>, InteractionRuleValidationResult<ErrorCode>>;
3887
+ };
3888
+ type InteractionCommitPolicy = {
3889
+ mode: "manual";
3890
+ } | {
3891
+ mode: "autoWhenReady";
3892
+ };
3893
+ type HasManyInputCollector<Collectors extends Record<string, InputCollector>> = Extract<Collectors[keyof Collectors], {
3894
+ readonly selection: {
3895
+ readonly mode: "many";
3896
+ };
3897
+ }> extends never ? false : true;
3898
+ type InteractionCommitPolicyFor<Collectors extends Record<string, InputCollector>> = HasManyInputCollector<Collectors> extends true ? {
3899
+ mode: "manual";
3900
+ } : InteractionCommitPolicy;
3901
+ type InteractionPresentation = {
3902
+ label: string;
3903
+ help?: string;
3904
+ };
3905
+ type InteractionSpec<Collectors extends Record<string, InputCollector> = Record<string, InputCollector>, State extends {
3906
+ table: RuntimeTableRecord;
3907
+ flow: {
3908
+ currentPhase: string;
3909
+ };
3910
+ } = {
3911
+ table: RuntimeTableRecord;
3912
+ flow: {
3913
+ currentPhase: string;
3914
+ };
3915
+ }, Manifest extends ManifestContract<TableOfState<State>> = ManifestContract<TableOfState<State>>, ErrorCode extends string = string> = ({
3916
+ inputs: Collectors;
3917
+ steps?: never;
3918
+ } | {
3919
+ inputs?: never;
3920
+ steps: StepDefinition<Collectors>;
3921
+ }) & {
3922
+ paramsSchema?: SchemaLike<ClientParamsOf<Collectors>>;
3923
+ presentation?: InteractionPresentation;
3924
+ /**
3925
+ * Draft commit policy. The input collectors still own value shape and
3926
+ * validation; this only controls whether a ready draft may be submitted
3927
+ * automatically by SDK controls.
3928
+ *
3929
+ * Multi-value collectors created with `many(...)` are always manual draft
3930
+ * interactions. They represent a selection set that should be committed by
3931
+ * explicit player intent, so `autoWhenReady` is intentionally not accepted.
3932
+ */
3933
+ commit?: InteractionCommitPolicyFor<Collectors>;
3934
+ /** Overrides the phase actor and limits input domains to the selected seats. */
3935
+ actor?: ActorSelector<State, Manifest>;
3936
+ errorCodes?: readonly ErrorCode[];
3937
+ rules?: readonly InteractionRule<NoInfer<Collectors>, State, Manifest, ErrorCode>[];
3938
+ reduce: BivariantCallback<InteractionReduceArgs<Collectors, State, Manifest, ErrorCode>, ReducerResult<State> | void>;
3939
+ };
3940
+ type AnyInteractionRule = Omit<InteractionRule<any, any, any, any>, "available" | "validate"> & {
3941
+ available?: BivariantCallback<any, boolean>;
3942
+ validate?: BivariantCallback<any, InteractionRuleValidationResult<any>>;
3943
+ };
3944
+ /**
3945
+ * Type-safe erasure of {@link InteractionSpec} used by the runtime when it
3946
+ * stores heterogeneous interactions in a single map. The collectors generic is
3947
+ * intentionally erased with `any`: each authored interaction keeps a specific
3948
+ * params shape, but phase registries need to store all of them together.
3949
+ */
3950
+ type AnyInteractionSpec<State extends {
3951
+ table: RuntimeTableRecord;
3952
+ flow: {
3953
+ currentPhase: string;
3954
+ };
3955
+ }, Manifest extends ManifestContract<TableOfState<State>>> = Omit<InteractionSpec<any, State, Manifest, any>, "actor" | "rules" | "reduce"> & {
3956
+ actor?: BivariantCallback<any, any>;
3957
+ rules?: readonly AnyInteractionRule[];
3958
+ reduce: BivariantCallback<any, ReducerResult<any> | void>;
3959
+ };
3960
+ type InteractionMap<State extends {
3961
+ table: RuntimeTableRecord;
3962
+ flow: {
3963
+ currentPhase: string;
3964
+ };
3965
+ }, Manifest extends ManifestContract<TableOfState<State>>> = Record<string, AnyInteractionSpec<State, Manifest>>;
3966
+
3967
+ type SimultaneousSubmission<Collectors extends Record<string, InputCollector>, State extends {
3968
+ table: RuntimeTableRecord;
3969
+ flow: {
3970
+ currentPhase: string;
3971
+ };
3972
+ }> = {
3973
+ playerId: PlayerIdOfState<State>;
3974
+ params: ParamsOf<Collectors>;
3975
+ };
3976
+ type SimultaneousResolveArgs<Collectors extends Record<string, InputCollector>, State extends {
3977
+ table: RuntimeTableRecord;
3978
+ flow: {
3979
+ currentPhase: string;
3980
+ };
3981
+ }, Manifest extends ManifestContract<TableOfState<State>>, ErrorCode extends string = string> = ActionContext<State, Manifest> & ReadHelpers<State> & MutationHelpers<State, ErrorCode> & {
3982
+ state: State;
3983
+ submissions: Record<PlayerIdOfState<State>, SimultaneousSubmission<Collectors, State>>;
3984
+ submittedPlayerIds: PlayerIdOfState<State>[];
3985
+ waitingPlayerIds: PlayerIdOfState<State>[];
3986
+ };
3987
+ type SimultaneousSubmitSpec<Collectors extends Record<string, InputCollector> = Record<string, InputCollector>, State extends {
3988
+ table: RuntimeTableRecord;
3989
+ flow: {
3990
+ currentPhase: string;
3991
+ };
3992
+ } = {
3993
+ table: RuntimeTableRecord;
3994
+ flow: {
3995
+ currentPhase: string;
3996
+ };
3997
+ }, Manifest extends ManifestContract<TableOfState<State>> = ManifestContract<TableOfState<State>>> = Omit<InteractionSpec<Collectors, State, Manifest>, "reduce"> & {
3998
+ /**
3999
+ * Optional compatibility slot for callers that reuse `defineInteraction`.
4000
+ * The simultaneous phase barrier stores submissions and invokes the
4001
+ * phase-level `resolve`; this per-submission reducer is intentionally
4002
+ * ignored when present.
4003
+ */
4004
+ reduce?: InteractionSpec<Collectors, State, Manifest>["reduce"];
4005
+ };
4006
+
4007
+ type PhaseDefinitionCommon<PhaseStateSchema extends SchemaLike<object>, State extends {
4008
+ table: RuntimeTableRecord;
4009
+ flow: {
4010
+ currentPhase: string;
4011
+ };
4012
+ phase: object;
4013
+ }, Manifest extends ManifestContract<TableOfState<State>>, ErrorCode extends string = string, Options extends RuntimeRecord = RuntimeRecord> = {
4014
+ name?: string;
4015
+ state: PhaseStateSchema;
4016
+ initialState?: (ctx: {
4017
+ manifest: Manifest;
4018
+ state: State;
4019
+ playerIds: PlayerIdOfState<State>[];
4020
+ options: Options;
4021
+ }) => z.infer<PhaseStateSchema>;
4022
+ enter?: BivariantCallback<PhaseEnterArgs<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest, ErrorCode>, ReducerResult<ScopedPhaseState<State, z.infer<PhaseStateSchema>>> | void>;
4023
+ };
4024
+ type AutoPhaseDefinition<PhaseStateSchema extends SchemaLike<object>, State extends {
4025
+ table: RuntimeTableRecord;
4026
+ flow: {
4027
+ currentPhase: string;
4028
+ };
4029
+ phase: object;
4030
+ }, Manifest extends ManifestContract<TableOfState<State>>, ErrorCode extends string = string, Options extends RuntimeRecord = RuntimeRecord> = PhaseDefinitionCommon<PhaseStateSchema, State, Manifest, ErrorCode, Options> & {
4031
+ kind: "auto";
4032
+ actor?: never;
4033
+ actors?: never;
4034
+ submit?: never;
4035
+ canResubmit?: never;
4036
+ resolve?: never;
4037
+ interactions?: never;
4038
+ };
4039
+ type PlayerPhaseDefinition<PhaseStateSchema extends SchemaLike<object>, State extends {
4040
+ table: RuntimeTableRecord;
4041
+ flow: {
4042
+ currentPhase: string;
4043
+ };
4044
+ phase: object;
4045
+ }, Manifest extends ManifestContract<TableOfState<State>>, Interactions extends InteractionMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>, Options extends RuntimeRecord = RuntimeRecord, ErrorCode extends string = string> = PhaseDefinitionCommon<PhaseStateSchema, State, Manifest, ErrorCode, Options> & {
4046
+ kind: "player";
4047
+ /**
4048
+ * Default actor selector for interactions in this phase. When omitted the
4049
+ * runtime falls back to `flow.activePlayers`, preserving the existing turn
4050
+ * ownership model. Returning multiple players models simultaneous actors.
4051
+ */
4052
+ actor?: ActorSelector<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest>;
4053
+ actors?: never;
4054
+ submit?: never;
4055
+ canResubmit?: never;
4056
+ resolve?: never;
4057
+ interactions?: Interactions;
4058
+ };
4059
+ type SimultaneousPlayerPhaseDefinition<PhaseStateSchema extends SchemaLike<object>, State extends {
4060
+ table: RuntimeTableRecord;
4061
+ flow: {
4062
+ currentPhase: string;
4063
+ };
4064
+ phase: object;
4065
+ }, Manifest extends ManifestContract<TableOfState<State>>, SubmitCollectors extends Record<string, InputCollector> = Record<string, InputCollector>, Interactions extends InteractionMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>, Options extends RuntimeRecord = RuntimeRecord, ErrorCode extends string = string> = PhaseDefinitionCommon<PhaseStateSchema, State, Manifest, ErrorCode, Options> & {
4066
+ kind: "simultaneousPlayer";
4067
+ actor?: never;
4068
+ /**
4069
+ * Actor selector for `kind: "simultaneousPlayer"` phases. This is an alias
4070
+ * of `actor` with wording that matches simultaneous submission semantics.
4071
+ */
4072
+ actors: ActorSelector<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest>;
4073
+ /**
4074
+ * Canonical sealed submission interaction for simultaneous phases. It is
4075
+ * projected like a normal interaction, but the trusted runtime stores the
4076
+ * parsed params until every actor has submitted, then calls `resolve`.
4077
+ */
4078
+ submit: SimultaneousSubmitSpec<SubmitCollectors, ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest>;
4079
+ /**
4080
+ * When false or omitted, each actor can submit once per simultaneous
4081
+ * barrier. Set true to allow replacing the sealed submission before every
4082
+ * required actor has submitted.
4083
+ */
4084
+ canResubmit?: boolean;
4085
+ /**
4086
+ * Batch resolver invoked once all simultaneous actors have submitted. The
4087
+ * submitted params are passed together so game state mutates from one
4088
+ * deterministic base state instead of one player at a time.
4089
+ */
4090
+ resolve: BivariantCallback<SimultaneousResolveArgs<SubmitCollectors, ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest, ErrorCode>, ReducerResult<ScopedPhaseState<State, z.infer<PhaseStateSchema>>> | void>;
4091
+ interactions?: Interactions;
4092
+ };
4093
+ type PhaseDefinition<PhaseStateSchema extends SchemaLike<object>, State extends {
4094
+ table: RuntimeTableRecord;
4095
+ flow: {
4096
+ currentPhase: string;
4097
+ };
4098
+ phase: object;
4099
+ }, Manifest extends ManifestContract<TableOfState<State>>, SubmitCollectors extends Record<string, InputCollector> = Record<string, InputCollector>, Interactions extends InteractionMap<ScopedPhaseState<State, z.infer<PhaseStateSchema>>, Manifest> = Record<string, never>, Options extends RuntimeRecord = RuntimeRecord, ErrorCode extends string = string> = AutoPhaseDefinition<PhaseStateSchema, State, Manifest, ErrorCode, Options> | PlayerPhaseDefinition<PhaseStateSchema, State, Manifest, Interactions, Options, ErrorCode> | SimultaneousPlayerPhaseDefinition<PhaseStateSchema, State, Manifest, SubmitCollectors, Interactions, Options, ErrorCode>;
4100
+
4101
+ type SpaceId<Board extends RuntimeBoardState> = keyof Board["spaces"] & string;
4102
+ type CommonBoardQueries<Board extends RuntimeBoardState, ComponentId extends string> = {
4103
+ state: Board;
4104
+ space<Id extends SpaceId<Board>>(id: Id): Board["spaces"][Id];
4105
+ container<Id extends keyof Board["containers"] & string>(id: Id): Board["containers"][Id];
4106
+ spacesByType(id: Extract<Board["spaces"][keyof Board["spaces"]]["typeId"], string>): SpaceId<Board>[];
4107
+ relatedSpaces(id: SpaceId<Board>, typeId: Board["relations"][number]["typeId"]): SpaceId<Board>[];
4108
+ neighbors(id: SpaceId<Board>): SpaceId<Board>[];
4109
+ distance(from: SpaceId<Board>, to: SpaceId<Board>): number;
4110
+ spaceOccupants(id: SpaceId<Board>): ComponentId[];
4111
+ containerOccupants(id: keyof Board["containers"] & string): ComponentId[];
4112
+ };
4113
+ type HexQueries<Board extends RuntimeBoardState> = ReturnType<typeof createHexBoardGeometry<Extract<Board["baseId"], string>, SpaceId<Board>>>;
4114
+ type BoundBoardQueries<Board extends RuntimeBoardState, ComponentId extends string> = CommonBoardQueries<Board, ComponentId> & (Board extends {
4115
+ layout: "hex";
4116
+ } ? Omit<HexQueries<Board>, "edgesOf" | "verticesOf" | "incidentEdges" | "incidentVertices"> & {
4117
+ spaceEdges: HexQueries<Board>["edgesOf"];
4118
+ spaceVertices: HexQueries<Board>["verticesOf"];
4119
+ edgesOf: HexQueries<Board>["incidentEdges"];
4120
+ verticesOf: HexQueries<Board>["incidentVertices"];
4121
+ } : Board extends {
4122
+ layout: "square";
4123
+ edges: readonly {
4124
+ id: infer EdgeId extends string;
4125
+ }[];
4126
+ vertices: readonly {
4127
+ id: infer VertexId extends string;
4128
+ }[];
4129
+ } ? {
4130
+ edgesOf(id: VertexId): EdgeId[];
4131
+ verticesOf(id: EdgeId): VertexId[];
4132
+ spaceEdges(id: SpaceId<Board>): EdgeId[];
4133
+ spaceVertices(id: SpaceId<Board>): VertexId[];
4134
+ spacesAt(id: VertexId): SpaceId<Board>[];
4135
+ spacesAlong(id: EdgeId): SpaceId<Board>[];
4136
+ neighbors(id: SpaceId<Board>, options?: {
4137
+ mode?: "orthogonal" | "diagonal" | "all";
4138
+ }): SpaceId<Board>[];
4139
+ distance(from: SpaceId<Board>, to: SpaceId<Board>, options?: {
4140
+ metric?: "manhattan" | "chebyshev";
4141
+ }): number;
4142
+ } : unknown);
4143
+
4144
+ interface ViewCard<CardIdValue extends string = string, CardTypeValue extends string = string, Properties extends Record<string, unknown> = Record<string, unknown>> {
4145
+ id: CardIdValue;
4146
+ cardType: CardTypeValue;
4147
+ name?: string;
4148
+ text?: string;
4149
+ properties: Properties;
4150
+ }
4151
+ interface CardCollection<CardIdValue extends string = string, Card extends ViewCard<CardIdValue> = ViewCard<CardIdValue>> {
4152
+ cardIds: readonly CardIdValue[];
4153
+ cardsById: Readonly<Record<CardIdValue, Card | undefined>>;
4154
+ }
4155
+
4156
+ interface ViewSlotOccupant<PieceIdValue extends string = string, PlayerIdValue extends string = string, SlotIdValue extends string = string, Data extends Record<string, unknown> = Record<string, unknown>> {
4157
+ pieceId: PieceIdValue;
4158
+ playerId: PlayerIdValue | null;
4159
+ slotId: SlotIdValue;
4160
+ data?: Data;
4161
+ }
4162
+
4163
+ type BoardRecord<Table extends RuntimeTableRecord, BoardId extends BoardIdOfTable<Table>> = Table["boards"]["byId"][BoardId];
4164
+ type TiledBoardRecord<Table extends RuntimeTableRecord, BoardId extends TiledBoardIdOfTable<Table>> = Extract<BoardRecord<Table, BoardId>, {
4165
+ layout: "hex" | "square";
4166
+ }>;
4167
+ type ViewCardOfTable<Table extends RuntimeTableRecord, CardId extends CardIdOfTable<Table>> = CardId extends CardIdOfTable<Table> ? ViewCard<CardId & string, Table["cards"][CardId]["cardType"] & string, Extract<Table["cards"][CardId]["properties"], Record<string, unknown>>> : never;
4168
+ type CardsByIdOfTable<Table extends RuntimeTableRecord, CardIds extends readonly CardIdOfTable<Table>[]> = Readonly<{
4169
+ [Id in CardIds[number]]: ViewCardOfTable<Table, Id> | undefined;
4170
+ }>;
4171
+ type DeckCardsForZone<Table extends RuntimeTableRecord, ZoneId extends DeckIdOfTable<Table>> = ZoneId extends infer Each extends DeckIdOfTable<Table> ? DeckCardsOfTable<Table, Each> : never;
4172
+ type HandCardsForZone<Table extends RuntimeTableRecord, ZoneId extends HandIdOfTable<Table>> = ZoneId extends infer Each extends HandIdOfTable<Table> ? HandCardsOfTable<Table, Each> : never;
4173
+ type CardCollectionOfTable<Table extends RuntimeTableRecord> = CardCollection<CardIdOfTable<Table> & string, ViewCardOfTable<Table, CardIdOfTable<Table>>>;
4174
+ type SlotOccupantOfTable<Table extends RuntimeTableRecord> = ViewSlotOccupant<ComponentIdOfTable<Table> & string, PlayerIdOfTable<Table> & string, string, Record<string, unknown>>;
4175
+ type SlotOccupantsOfTable<Table extends RuntimeTableRecord> = ReadonlyArray<SlotOccupantOfTable<Table>>;
4176
+ type SlotOccupantsBySlotIdOfTable<Table extends RuntimeTableRecord> = Readonly<Record<string, SlotOccupantsOfTable<Table>>>;
4177
+ type ComponentLocationOfTable<Table, ComponentId extends ComponentIdOfTable<Table>> = Table extends {
4178
+ componentLocations: infer ComponentLocations extends Record<string, unknown>;
4179
+ } ? ComponentLocations[ComponentId] : never;
4180
+ type ComponentDataOfTable<Table, ComponentId extends ComponentIdOfTable<Table>> = Table extends {
4181
+ cards: infer Cards extends Record<string, unknown>;
4182
+ pieces: infer Pieces extends Record<string, unknown>;
4183
+ dice: infer Dice extends Record<string, unknown>;
4184
+ } ? ComponentId extends keyof Cards ? Cards[ComponentId] : ComponentId extends keyof Pieces ? Pieces[ComponentId] : ComponentId extends keyof Dice ? Dice[ComponentId] : never : never;
4185
+ type ComponentLocationByTypeOfTable<Table, ComponentId extends ComponentIdOfTable<Table>, Type extends RuntimeComponentLocation["type"]> = Extract<ComponentLocationOfTable<Table, ComponentId>, {
4186
+ type: Type;
4187
+ }>;
4188
+ type ResolvedDeckLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
4189
+ [DeckId in DeckIdOfTable<Table>]: {
4190
+ componentId: ComponentId;
4191
+ deckId: DeckId;
4192
+ cards: DeckCardsOfTable<Table, DeckId>;
4193
+ location: ComponentLocationByTypeOfTable<Table, ComponentId, "InDeck"> & {
4194
+ deckId: DeckId;
4195
+ };
4196
+ };
4197
+ }[DeckIdOfTable<Table>];
4198
+ type ResolvedHandLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
4199
+ [HandId in HandIdOfTable<Table>]: {
4200
+ [PlayerId in PlayerIdOfTable<Table>]: {
4201
+ componentId: ComponentId;
4202
+ handId: HandId;
4203
+ playerId: PlayerId;
4204
+ cards: HandCardsOfTable<Table, HandId>;
4205
+ location: ComponentLocationByTypeOfTable<Table, ComponentId, "InHand"> & {
4206
+ handId: HandId;
4207
+ playerId: PlayerId;
4208
+ };
4209
+ };
4210
+ }[PlayerIdOfTable<Table>];
4211
+ }[HandIdOfTable<Table>];
4212
+ type ResolvedZoneLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = ComponentLocationByTypeOfTable<Table, ComponentId, "InZone"> extends infer Location ? Location extends {
4213
+ type: "InZone";
4214
+ zoneId: infer ZoneId extends string;
4215
+ } ? {
4216
+ componentId: ComponentId;
4217
+ zoneId: ZoneId;
4218
+ location: Location;
4219
+ } : never : never;
4220
+ type ResolvedSpaceLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
4221
+ [BoardId in BoardIdOfTable<Table>]: {
4222
+ [SpaceId in SpaceIdOfTable<Table, BoardId>]: {
4223
+ componentId: ComponentId;
4224
+ boardId: BoardId;
4225
+ board: BoardRecord<Table, BoardId>;
4226
+ spaceId: SpaceId;
4227
+ space: Table["boards"]["byId"][BoardId]["spaces"][SpaceId];
4228
+ location: ComponentLocationByTypeOfTable<Table, ComponentId, "OnSpace"> & {
4229
+ boardId: BoardId;
4230
+ spaceId: SpaceId;
4231
+ };
4232
+ };
4233
+ }[SpaceIdOfTable<Table, BoardId>];
4234
+ }[BoardIdOfTable<Table>];
4235
+ type ResolvedContainerLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
4236
+ [BoardId in BoardIdOfTable<Table>]: {
4237
+ [ContainerId in BoardContainerIdOfTable<Table, BoardId>]: {
4238
+ componentId: ComponentId;
4239
+ boardId: BoardId;
4240
+ board: BoardRecord<Table, BoardId>;
4241
+ containerId: ContainerId;
4242
+ container: Table["boards"]["byId"][BoardId]["containers"][ContainerId];
4243
+ location: ComponentLocationByTypeOfTable<Table, ComponentId, "InContainer"> & {
4244
+ boardId: BoardId;
4245
+ containerId: ContainerId;
4246
+ };
4247
+ };
4248
+ }[BoardContainerIdOfTable<Table, BoardId>];
4249
+ }[BoardIdOfTable<Table>];
4250
+ type ResolvedEdgeLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
4251
+ [BoardId in TiledBoardIdOfTable<Table>]: {
4252
+ [EdgeId in TiledEdgeIdOfTable<Table, BoardId>]: {
4253
+ componentId: ComponentId;
4254
+ boardId: BoardId;
4255
+ board: TiledBoardRecord<Table, BoardId>;
4256
+ edgeId: EdgeId;
4257
+ edge: Extract<Table["boards"]["byId"][BoardId], {
4258
+ layout: "hex" | "square";
4259
+ }>["edges"][number];
4260
+ location: ComponentLocationByTypeOfTable<Table, ComponentId, "OnEdge"> & {
4261
+ boardId: BoardId;
4262
+ edgeId: EdgeId;
4263
+ };
4264
+ };
4265
+ }[TiledEdgeIdOfTable<Table, BoardId>];
4266
+ }[TiledBoardIdOfTable<Table>];
4267
+ type ResolvedVertexLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = {
4268
+ [BoardId in TiledBoardIdOfTable<Table>]: {
4269
+ [VertexId in TiledVertexIdOfTable<Table, BoardId>]: {
4270
+ componentId: ComponentId;
4271
+ boardId: BoardId;
4272
+ board: TiledBoardRecord<Table, BoardId>;
4273
+ vertexId: VertexId;
4274
+ vertex: Extract<Table["boards"]["byId"][BoardId], {
4275
+ layout: "hex" | "square";
4276
+ }>["vertices"][number];
4277
+ location: ComponentLocationByTypeOfTable<Table, ComponentId, "OnVertex"> & {
4278
+ boardId: BoardId;
4279
+ vertexId: VertexId;
4280
+ };
4281
+ };
4282
+ }[TiledVertexIdOfTable<Table, BoardId>];
4283
+ }[TiledBoardIdOfTable<Table>];
4284
+ type ResolvedSlotLocation<Table extends RuntimeTableRecord, ComponentId extends ComponentIdOfTable<Table>> = ComponentLocationByTypeOfTable<Table, ComponentId, "InSlot"> extends infer Location ? Location extends {
4285
+ type: "InSlot";
4286
+ host: infer Host extends RuntimeSlotHostRef;
4287
+ slotId: infer SlotId extends string;
4288
+ } ? {
4289
+ componentId: ComponentId;
4290
+ host: Host;
4291
+ slotId: SlotId;
4292
+ location: Location;
4293
+ } : never : never;
4294
+ type TableQueries<Table extends RuntimeTableRecord> = {
4295
+ board<BoardId extends BoardIdOfTable<Table>>(boardId: BoardId): BoundBoardQueries<Table["boards"]["byId"][BoardId], ComponentIdOfTable<Table>>;
4296
+ zone: {
4297
+ sharedCards: <ZoneId extends DeckIdOfTable<Table>>(zoneId: ZoneId) => DeckCardsForZone<Table, ZoneId>;
4298
+ sharedCardCollection: <ZoneId extends DeckIdOfTable<Table>>(zoneId: ZoneId) => CardCollectionOfTable<Table>;
4299
+ allSharedCards: () => {
4300
+ readonly [Z in DeckIdOfTable<Table>]: DeckCardsOfTable<Table, Z>;
4301
+ };
4302
+ playerCards: <PlayerId extends PlayerIdOfTable<Table>, ZoneId extends HandIdOfTable<Table>>(playerId: PlayerId, zoneId: ZoneId) => HandCardsForZone<Table, ZoneId>;
4303
+ playerCardCollection: <PlayerId extends PlayerIdOfTable<Table>, ZoneId extends HandIdOfTable<Table>>(playerId: PlayerId, zoneId: ZoneId) => CardCollectionOfTable<Table>;
4304
+ allPlayerCards: <ZoneId extends HandIdOfTable<Table>>(zoneId: ZoneId) => {
4305
+ readonly [P in PlayerIdOfTable<Table>]: HandCardsOfTable<Table, ZoneId>;
4306
+ };
4307
+ };
4308
+ card: {
4309
+ get: <CardId extends CardIdOfTable<Table>>(cardId: CardId) => ViewCardOfTable<Table, CardId>;
4310
+ byIds: <CardIds extends readonly CardIdOfTable<Table>[]>(cardIds: CardIds) => CardsByIdOfTable<Table, CardIds>;
4311
+ owner: <CardId extends CardIdOfTable<Table>>(cardId: CardId) => Table["ownerOfCard"][CardId];
4312
+ visibility: <CardId extends CardIdOfTable<Table>>(cardId: CardId) => Table["visibility"][CardId];
4313
+ };
4314
+ slot: {
4315
+ occupants: (host: RuntimeSlotHostRef, slotId: string) => SlotOccupantsOfTable<Table>;
4316
+ occupantsByHost: (host: RuntimeSlotHostRef) => SlotOccupantsBySlotIdOfTable<Table>;
4317
+ pieceOccupants: (hostId: string, slotId: string) => SlotOccupantsOfTable<Table>;
4318
+ pieceOccupantsByHost: (hostId: string) => SlotOccupantsBySlotIdOfTable<Table>;
4319
+ dieOccupants: (hostId: string, slotId: string) => SlotOccupantsOfTable<Table>;
4320
+ dieOccupantsByHost: (hostId: string) => SlotOccupantsBySlotIdOfTable<Table>;
4321
+ };
4322
+ player: {
4323
+ /** Seating order from the manifest / setup profile. */
4324
+ order: () => Table["playerOrder"];
4325
+ /**
4326
+ * Next player id in seating order after `playerId`, wrapping around to
4327
+ * the first seat. Returns `null` when `playerId` is unknown or the
4328
+ * order is empty. Convenient for "whose turn is next" logic.
4329
+ */
4330
+ nextInOrder: (playerId: PlayerIdOfTable<Table>) => PlayerIdOfTable<Table> | null;
4331
+ /** All resource balances for a player, as the manifest-typed record. */
4332
+ resources: <PlayerId extends PlayerIdOfTable<Table>>(playerId: PlayerId) => ResourceBalancesOfTable<Table>;
4333
+ /** Balance of a single resource; returns `0` when unset. */
4334
+ resource: (playerId: PlayerIdOfTable<Table>, resourceId: ResourceIdOfTable<Table>) => number;
4335
+ /**
4336
+ * Sum of every resource amount held by a player (e.g. "total cards in
4337
+ * hand" checks). Returns `0` for unknown players or empty balances.
4338
+ */
4339
+ resourceTotal: (playerId: PlayerIdOfTable<Table>) => number;
4340
+ /** `true` when the player can pay every non-zero amount in `amounts`. */
4341
+ canAfford: (playerId: PlayerIdOfTable<Table>, amounts: ResourceAmountsOfTable<Table>) => boolean;
4342
+ /** Shortfall per resource when the player cannot afford `amounts`. */
4343
+ missingResources: (playerId: PlayerIdOfTable<Table>, amounts: ResourceAmountsOfTable<Table>) => Partial<Record<ResourceIdOfTable<Table>, number>>;
4344
+ };
4345
+ component: {
4346
+ data: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ComponentDataOfTable<Table, ComponentId> | undefined;
4347
+ location: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ComponentLocationOfTable<Table, ComponentId> | undefined;
4348
+ deck: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedDeckLocation<Table, ComponentId> | null;
4349
+ hand: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedHandLocation<Table, ComponentId> | null;
4350
+ zone: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedZoneLocation<Table, ComponentId> | null;
4351
+ space: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedSpaceLocation<Table, ComponentId> | null;
4352
+ container: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedContainerLocation<Table, ComponentId> | null;
4353
+ edge: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedEdgeLocation<Table, ComponentId> | null;
4354
+ vertex: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedVertexLocation<Table, ComponentId> | null;
4355
+ slot: <ComponentId extends ComponentIdOfTable<Table>>(componentId: ComponentId) => ResolvedSlotLocation<Table, ComponentId> | null;
4356
+ };
4357
+ };
4358
+ type TableQueriesOfState<State extends {
4359
+ table: RuntimeTableRecord;
4360
+ }> = TableQueries<TableOfState<State>>;
4361
+
4362
+ declare const manifestIdSchemaBrand: unique symbol;
4363
+ type ManifestIdFamily = keyof ManifestIds<string, string, string, string, string>;
4364
+ type ManifestIdSchema<Output = unknown, Family extends ManifestIdFamily | undefined = ManifestIdFamily | undefined> = z.ZodType<Output> & {
4365
+ readonly [manifestIdSchemaBrand]: Family;
4366
+ };
4367
+ type ManifestLiterals<PlayerId extends string, DeckId extends string, HandId extends string, CardId extends string, PhaseName extends string = string> = {
4368
+ playerIds: readonly PlayerId[];
4369
+ phaseNames: readonly PhaseName[];
4370
+ boardLayouts: readonly ("generic" | "hex" | "square")[];
4371
+ cardSetIds: readonly string[];
4372
+ cardTypes: readonly string[];
4373
+ deckIds: readonly DeckId[];
4374
+ handIds: readonly HandId[];
4375
+ sharedZoneIds: readonly DeckId[];
4376
+ playerZoneIds: readonly HandId[];
4377
+ zoneIds: readonly (DeckId | HandId)[];
4378
+ cardIds: readonly CardId[];
4379
+ resourceIds: readonly string[];
4380
+ resourcePresentationById?: Record<string, {
4381
+ label: string;
4382
+ icon?: string | null;
4383
+ }>;
4384
+ pieceTypeIds: readonly string[];
4385
+ pieceIds: readonly string[];
4386
+ dieTypeIds: readonly string[];
4387
+ dieIds: readonly string[];
4388
+ boardTemplateIds: readonly string[];
4389
+ boardTypeIds: readonly string[];
4390
+ boardBaseIds: readonly string[];
4391
+ boardIds: readonly string[];
4392
+ boardContainerIds: readonly string[];
4393
+ relationTypeIds: readonly string[];
4394
+ edgeIds: readonly string[];
4395
+ edgeTypeIds: readonly string[];
4396
+ vertexIds: readonly string[];
4397
+ vertexTypeIds: readonly string[];
4398
+ spaceIds: readonly string[];
4399
+ spaceTypeIds: readonly string[];
4400
+ handVisibilityById: Record<HandId, RuntimeHandVisibilityMode>;
4401
+ zoneVisibilityById: Record<DeckId | HandId, RuntimeHandVisibilityMode>;
4402
+ cardSetIdByCardId: Record<CardId, string>;
4403
+ cardTypeByCardId: Record<CardId, string>;
4404
+ cardSetIdsBySharedZoneId: Record<DeckId, readonly string[]>;
4405
+ cardSetIdsByPlayerZoneId: Record<HandId, readonly string[]>;
4406
+ };
4407
+ type ManifestIds<PlayerId extends string, DeckId extends string, HandId extends string, CardId extends string, PhaseName extends string = string> = {
4408
+ playerId: z.ZodType<PlayerId>;
4409
+ phaseName: z.ZodType<PhaseName>;
4410
+ boardLayout: AnySchema;
4411
+ cardSetId: AnySchema;
4412
+ cardType: AnySchema;
4413
+ cardId: z.ZodType<CardId>;
4414
+ deckId: z.ZodType<DeckId>;
4415
+ handId: z.ZodType<HandId>;
4416
+ sharedZoneId: AnySchema;
4417
+ playerZoneId: AnySchema;
4418
+ zoneId: AnySchema;
4419
+ resourceId: AnySchema;
4420
+ pieceTypeId: AnySchema;
4421
+ pieceId: AnySchema;
4422
+ dieId: AnySchema;
4423
+ dieTypeId: AnySchema;
4424
+ boardTypeId: AnySchema;
4425
+ boardId: AnySchema;
4426
+ boardBaseId: AnySchema;
4427
+ boardContainerId: AnySchema;
4428
+ relationTypeId: AnySchema;
4429
+ edgeId: AnySchema;
4430
+ edgeTypeId: AnySchema;
4431
+ vertexId: AnySchema;
4432
+ vertexTypeId: AnySchema;
4433
+ spaceId: AnySchema;
4434
+ spaceTypeId: AnySchema;
4435
+ };
4436
+ type ManifestDefaults<Table extends RuntimeTableRecord> = {
4437
+ zones: (playerIds?: readonly string[]) => Table["zones"];
4438
+ decks: (playerIds?: readonly string[]) => Table["decks"];
4439
+ hands: (playerIds?: readonly string[]) => Table["hands"];
4440
+ handVisibility: (playerIds?: readonly string[]) => Table["handVisibility"];
4441
+ ownerOfCard: (playerIds?: readonly string[]) => Table["ownerOfCard"];
4442
+ visibility: (playerIds?: readonly string[]) => Table["visibility"];
4443
+ resources: (playerIds?: readonly string[]) => Table["resources"];
4444
+ };
4445
+ type ManifestNormalSetup<Table extends RuntimeTableRecord> = {
4446
+ readonly minPlayers: number;
4447
+ readonly maxPlayers: number;
4448
+ readonly createInitialTable: (options: {
4449
+ readonly playerIds: readonly string[];
4450
+ }) => Table;
4451
+ };
4452
+ type StaticBoards<Table extends RuntimeTableRecord> = Pick<Table["boards"], "byId" | "hex" | "square">;
4453
+ type ReducerManifestContract<Table extends RuntimeTableRecord, PhaseName extends string, PlayerId extends string, DeckId extends string, HandId extends string, CardId extends string> = {
4454
+ literals: ManifestLiterals<PlayerId, DeckId, HandId, CardId, PhaseName>;
4455
+ ids: ManifestIds<PlayerId, DeckId, HandId, CardId, PhaseName>;
4456
+ defaults: ManifestDefaults<Table>;
4457
+ /**
4458
+ * Normal-session setup capability supplied by the manifest compiler.
4459
+ *
4460
+ * This remains optional on the structural contract so small handwritten
4461
+ * manifests can model focused reducer tests without recreating generated
4462
+ * topology metadata. Compiled manifests always provide it.
4463
+ */
4464
+ normalSetup?: ManifestNormalSetup<Table>;
4465
+ staticBoards?: StaticBoards<Table>;
4466
+ tableSchema: z.ZodType<Table>;
4467
+ runtimeSchema: AnySchema;
4468
+ createGameStateSchema: (config: {
4469
+ phaseNameSchema: AnySchema;
4470
+ publicSchema: AnySchema;
4471
+ privateSchema: AnySchema;
4472
+ hiddenSchema: AnySchema;
4473
+ phasesSchema: AnySchema;
4474
+ }) => AnySchema;
4475
+ };
4476
+ type ReducerManifestContractLike<Table extends RuntimeTableRecord = RuntimeTableRecord, PhaseName extends string = string, PlayerId extends string = string, DeckId extends string = string, HandId extends string = string, CardId extends string = string> = ReducerManifestContract<Table, PhaseName, PlayerId, DeckId, HandId, CardId>;
4477
+ type ManifestContract<Table extends RuntimeTableRecord> = ReducerManifestContract<Table, string, PlayerIdOfTable<Table>, DeckIdOfTable<Table>, HandIdOfTable<Table>, CardIdOfTable<Table>>;
4478
+ type StateDefinition<PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>> = {
4479
+ public: PublicSchema;
4480
+ private: PrivateSchema;
4481
+ hidden: HiddenSchema;
4482
+ };
4483
+ type InitContext<Table extends RuntimeTableRecord, Manifest extends ReducerManifestContract<Table, string, string, string, string, string> = ManifestContract<Table>, Options extends RuntimeRecord = RuntimeRecord> = {
4484
+ manifest: Manifest;
4485
+ table: Table;
4486
+ playerIds: PlayerIdOfTable<Table>[];
4487
+ rngSeed?: number | null;
4488
+ options: Options;
4489
+ q: TableQueriesOfState<{
4490
+ table: Table;
4491
+ }>;
4492
+ };
4493
+
4494
+ /** Authored fields retain their domain types; wire admission validates JSON. */
4495
+ type ViewData = Record<string, unknown> & {
4496
+ readonly boards?: never;
4497
+ };
4498
+ /** A JSON record for exactly one seat. `boards` is reserved for manifest geometry. */
4499
+ type ViewDefinition<State extends {
4500
+ table: RuntimeTableRecord;
4501
+ flow: {
4502
+ currentPhase: string;
4503
+ };
4504
+ }, Manifest extends ManifestContract<TableOfState<State>>, Projection extends ViewData = ViewData> = (args: ActionContext<State, Manifest> & ReadHelpers<State> & {
4505
+ state: State;
4506
+ playerId: PlayerIdOfState<State>;
4507
+ }) => Projection;
4508
+
4509
+ type ReducerGameContract<Table extends RuntimeTableRecord, Manifest extends ReducerManifestContract<Table, string, string, string, string, string>, PublicSchema extends SchemaLike<object>, PrivateSchema extends SchemaLike<object>, HiddenSchema extends SchemaLike<object>, Phases extends Record<string, SchemaLike<object>>, Errors extends Record<string, string> | undefined = undefined, OptionsSchema extends SchemaLike<RuntimeRecord> = SchemaLike<Record<string, never>>> = {
4510
+ manifest: Manifest;
4511
+ state: StateDefinition<PublicSchema, PrivateSchema, HiddenSchema>;
4512
+ phases: Phases;
4513
+ errors?: Errors;
4514
+ options: OptionsSchema;
4515
+ /** Derived from `phases`; retained as an internal runtime convenience. */
4516
+ phaseNames: readonly string[];
4517
+ };
4518
+ type BaseGameStateOfContract<Contract> = ReducerGameState<TableOfManifest<ManifestContractOf<Contract>>, z.infer<PublicSchemaOfContract<Contract>>, z.infer<PrivateSchemaOfContract<Contract>>, z.infer<HiddenSchemaOfContract<Contract>>, PhaseStateMapOfContract<Contract>[PhaseNameOfContract<Contract>], PhaseNameOfContract<Contract>, PhaseStateMapOfContract<Contract>>;
4519
+ /**
4520
+ * Heterogeneous phase map for a contract. Each phase carries its own local
4521
+ * `PhaseStateSchema` plus authoring-time Actions/Flows/Interactions/
4522
+ * interaction and zone maps. The registries are bound to the contract's base state +
4523
+ * manifest so the runtime can iterate them through a single index type
4524
+ * without reaching for `any`.
4525
+ */
4526
+ type PhaseMapOf<Contract> = {
4527
+ [Name in PhaseNameOfContract<Contract>]: PhaseDefinition<SchemaLike<object>, BaseGameStateOfContract<Contract>, ManifestContractOf<Contract>, Record<string, InputCollector>, InteractionMap<BaseGameStateOfContract<Contract>, ManifestContractOf<Contract>>, OptionsOfContract<Contract>>;
4528
+ };
4529
+ type PhaseStateOfDefinitions<Definitions extends Record<string, PhaseDefinition<SchemaLike<object>, any, any, Record<string, InputCollector>, InteractionMap<any, any>, any>>> = {
4530
+ [Name in keyof Definitions & string]: Definitions[Name] extends {
4531
+ state: infer PhaseStateSchema extends SchemaLike<object>;
4532
+ } ? z.infer<PhaseStateSchema> : never;
4533
+ }[keyof Definitions & string];
4534
+ type ResolvedGameStateOf<Contract, Definitions extends PhaseMapOf<Contract>> = {
4535
+ [Name in keyof Definitions & string]: ReducerGameState<TableOfManifest<ManifestContractOf<Contract>>, z.infer<PublicSchemaOfContract<Contract>>, z.infer<PrivateSchemaOfContract<Contract>>, z.infer<HiddenSchemaOfContract<Contract>>, Definitions[Name] extends {
4536
+ state: infer PhaseStateSchema extends SchemaLike<object>;
4537
+ } ? z.infer<PhaseStateSchema> : never, PhaseNameOfContract<Contract>> & {
4538
+ flow: ReducerGameState<TableOfManifest<ManifestContractOf<Contract>>, z.infer<PublicSchemaOfContract<Contract>>, z.infer<PrivateSchemaOfContract<Contract>>, z.infer<HiddenSchemaOfContract<Contract>>, PhaseStateOfDefinitions<Definitions>, PhaseNameOfContract<Contract>>["flow"] & {
4539
+ currentPhase: Name;
4540
+ };
4541
+ };
4542
+ }[keyof Definitions & string];
4543
+ type ViewOfContract<Contract, Projection extends ViewData = ViewData> = ViewDefinition<BaseGameStateOfContract<Contract>, ManifestContractOf<Contract>, Projection>;
4544
+ type PhasesOfDefinition<Definition> = Definition extends {
4545
+ phases: infer Definitions extends Record<string, unknown>;
4546
+ } ? Definitions : never;
4547
+ type NonNeverKeys<Registry> = {
4548
+ [Key in keyof Registry]-?: [Registry[Key]] extends [never] ? never : Key;
4549
+ }[keyof Registry];
4550
+ type ViewOfDefinition<Definition> = Definition extends {
4551
+ view: (...args: never[]) => infer Projection;
4552
+ } ? Projection : never;
4553
+ type PhaseNamesOfDefinition<Definition> = keyof PhasesOfDefinition<Definition> & string;
4554
+ type PhaseDefinitionByName<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseName extends keyof PhasesOfDefinition<Definition> & string ? PhasesOfDefinition<Definition>[PhaseName] : never;
4555
+ type GameStateOf<Source> = Source extends {
4556
+ contract: infer Contract extends ReducerGameContractLike;
4557
+ phases: infer Definitions;
4558
+ } ? Definitions extends PhaseMapOf<Contract> ? ResolvedGameStateOf<Contract, Definitions> : never : Source extends ReducerGameContract<any, any, any, any, any, any, any, any> ? BaseGameStateOfContract<Source> : never;
4559
+ /**
4560
+ * Public structural upper bound for a reducer game contract.
4561
+ *
4562
+ * The `manifest` slot is intentionally erased with `any` because concrete
4563
+ * manifests bind per-contract branded literals (e.g. `PlayerId` unions with
4564
+ * specific string literals). Using a ground `ManifestContract<...>` type
4565
+ * here would prevent assignability from contract-bound manifests in a
4566
+ * contravariant position.
4567
+ */
4568
+ type ReducerGameContractLike = {
4569
+ manifest: any;
4570
+ options: SchemaLike<RuntimeRecord>;
4571
+ state: StateDefinition<SchemaLike<object>, SchemaLike<object>, SchemaLike<object>>;
4572
+ };
4573
+ type InitialStateContextOf<Contract extends ReducerGameContractLike> = InitContext<TableOfManifest<ManifestOf<Contract>>, ExactManifestContractOf<Contract>, OptionsOfContract<Contract>>;
4574
+ type InitialStateCallbacks<Contract extends ReducerGameContractLike> = {
4575
+ public?: (ctx: InitialStateContextOf<Contract>) => z.infer<PublicSchemaOfContract<Contract>>;
4576
+ private?: (ctx: InitialStateContextOf<Contract> & {
4577
+ playerId: PlayerIdOfTable<TableOfManifest<ManifestOf<Contract>>>;
4578
+ }) => z.infer<PrivateSchemaOfContract<Contract>>;
4579
+ hidden?: (ctx: InitialStateContextOf<Contract>) => z.infer<HiddenSchemaOfContract<Contract>>;
4580
+ };
4581
+ type ReducerGameDefinition<Contract extends ReducerGameContractLike, Definitions extends PhaseMapOf<Contract>, View extends ViewOfContract<Contract>> = {
4582
+ contract: Contract;
4583
+ initial?: InitialStateCallbacks<NoInfer<Contract>>;
4584
+ initialPhase?: keyof Definitions & string;
4585
+ phases: Definitions;
4586
+ view: View;
4587
+ };
4588
+ type RegistryKeys<Registry> = Registry extends Record<string, unknown> ? NonNeverKeys<Registry> & string : never;
4589
+ type InteractionRegistryOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseDefinitionByName<Definition, PhaseName> extends {
4590
+ interactions?: infer Interactions;
4591
+ } ? NonNullable<Interactions> : Record<string, never>;
4592
+ type SimultaneousSubmitRegistryOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseDefinitionByName<Definition, PhaseName> extends {
4593
+ submit?: infer Submit;
4594
+ } ? {
4595
+ submit: NonNullable<Submit>;
4596
+ } : Record<string, never>;
4597
+ type NonNeverRegistryValue<Registry, Key extends string> = Registry extends Record<string, unknown> ? Key extends keyof Registry ? [Registry[Key]] extends [never] ? never : Registry[Key] : never : never;
4598
+ type InteractionIdOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>> = PhaseDefinitionByName<Definition, PhaseName> extends {
4599
+ kind: "auto";
4600
+ } ? never : InteractionRegistryOfDefinitionPhase<Definition, PhaseName> extends infer Interactions ? SimultaneousSubmitRegistryOfDefinitionPhase<Definition, PhaseName> extends infer Submit ? RegistryKeys<Interactions> | RegistryKeys<Submit> : never : never;
4601
+ type InteractionSpecByNameOfDefinitionPhase<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, InteractionId extends InteractionIdOfDefinitionPhase<Definition, PhaseName>> = NonNeverRegistryValue<InteractionRegistryOfDefinitionPhase<Definition, PhaseName>, InteractionId> | NonNeverRegistryValue<SimultaneousSubmitRegistryOfDefinitionPhase<Definition, PhaseName>, InteractionId>;
4602
+ type CollectorsOfInteractionDefinition<Spec> = Spec extends {
4603
+ readonly steps: {
4604
+ readonly collectors: infer Collectors extends Record<string, InputCollector>;
4605
+ };
4606
+ } ? Collectors : Spec extends {
4607
+ readonly inputs?: infer Collectors;
4608
+ } ? NonNullable<Collectors> extends Record<string, InputCollector> ? NonNullable<Collectors> : Record<string, never> : Record<string, never>;
4609
+ type ClientParamsOfCollectors<Collectors> = Collectors extends Record<string, InputCollector> ? {
4610
+ [K in keyof Collectors as Collectors[K] extends {
4611
+ readonly kind: "rng";
4612
+ } ? never : K]: Collectors[K] extends InputCollector<infer S> ? S extends SchemaLike<infer V> ? V : never : never;
4613
+ } : never;
4614
+ /**
4615
+ * Client-facing params shape for an interaction. Omits engine-sampled
4616
+ * collectors (`rngInput.*`) — clients never supply those fields; the
4617
+ * trusted reducer bundle fills them during `submitInteraction`.
4618
+ *
4619
+ * This is the type that drives `submit(playerId, id, params)`,
4620
+ * `handle.submit(params)`, and the generated `InteractionParams` surface
4621
+ * through `createGameUi(game)`. The `reduce`-input counterpart is
4622
+ * {@link ParamsOfInteractionOfDefinition}, which includes every field
4623
+ * because the engine has already filled the sampled ones by then.
4624
+ */
4625
+ type CurrentStepParams<Collectors extends Record<string, InputCollector>> = {
4626
+ [Key in keyof Collectors]: Pick<ClientParamsOfCollectors<Collectors>, Key & keyof ClientParamsOfCollectors<Collectors>> & {
4627
+ [Other in Exclude<keyof Collectors, Key>]?: never;
4628
+ };
4629
+ }[keyof Collectors];
4630
+ type ClientParamsOfInteractionOfDefinition<Definition, PhaseName extends PhaseNamesOfDefinition<Definition>, InteractionId extends InteractionIdOfDefinitionPhase<Definition, PhaseName>> = InteractionSpecByNameOfDefinitionPhase<Definition, PhaseName, InteractionId> extends infer Spec ? Spec extends {
4631
+ readonly steps: unknown;
4632
+ } ? CurrentStepParams<CollectorsOfInteractionDefinition<Spec>> : Spec extends {
4633
+ readonly cardType: unknown;
4634
+ readonly playFrom: unknown;
4635
+ } ? {
4636
+ cardId: string;
4637
+ } & ClientParamsOfCollectors<CollectorsOfInteractionDefinition<Spec>> : ClientParamsOfCollectors<CollectorsOfInteractionDefinition<Spec>> : never;
4638
+
4639
+ export { type OutcomeResult as $, type InteractionChoiceOption as A, type BaseGameStateOfContract as B, type CardIdOfManifest as C, type DieTypeSpec as D, type ErrorCodeOfContract as E, FrameworkErrorCodes as F, type GameEvent as G, type HexEdgeId as H, type InitializeRequest as I, type InteractionCommitPolicy$1 as J, InteractionCommitPolicySchema as K, type InteractionDescriptor as L, InteractionDescriptorSchema as M, type InteractionDiagnosticReason as N, type InteractionIdOfDefinitionPhase as O, type InteractionInputDescriptor as P, InteractionInputDescriptorSchema as Q, type InteractionMap as R, type InteractionRule as S, type InteractionSpec as T, type InteractionSpecByNameOfDefinitionPhase as U, InteractionSteps as V, type JsonValue as W, type ManifestContractOf as X, type ManifestIdSchema as Y, type ObjectSchema as Z, type OptionsOfContract as _, type BoardContainerIdOfTable as a, rectangle as a$, type OutcomeScoreComponent as a0, type OutcomeStanding as a1, type OutcomeTieBreak as a2, type PhaseDefinition as a3, type PhaseMapOf as a4, type PhaseNameOfContract as a5, type PhaseNamesOfDefinition as a6, type PhaseSchemasOfContract as a7, type PlayerIdOfState as a8, type ProjectRequest as a9, type RuntimeSquareBoardState as aA, type RuntimeSquareSpaceState as aB, type RuntimeTableRecord as aC, type RuntimeTiledEdgeState as aD, type RuntimeTiledVertexState as aE, type SchemaLike as aF, type ScopedPhaseState as aG, type SeatProjectionBundle as aH, type SimultaneousPhaseProjection as aI, type SquareBoardSpec as aJ, type StateDefinition as aK, type SystemActionEvent as aL, type TableOfManifest as aM, type TableQueries as aN, type TableQueriesOfState as aO, type TiledBoardIdOfTable as aP, type TiledEdgeIdOfTable as aQ, type TiledSpaceIdOfTable as aR, type TiledVertexIdOfTable as aS, type ValidationIssue as aT, type ViewCard as aU, type ViewData as aV, type ViewDefinition as aW, type ViewOfContract as aX, type ViewOfDefinition as aY, fromCoordinates as aZ, hexagon as a_, type PropertySchema as aa, type ReducerAccept as ab, type ReducerContractVersion as ac, type ReducerGameContract as ad, type ReducerGameContractLike as ae, type ReducerGameDefinition as af, type ReducerManifestContract as ag, type ReducerManifestContractLike as ah, type ReducerReject as ai, type ReducerResult as aj, type ReducerSessionState as ak, type ReducerTransaction as al, type ReducerTransactionOutcome as am, type ReducerValidationResult as an, type RotatePlayerZoneArgs as ao, type RuntimeBoardState as ap, type RuntimeCardData as aq, type RuntimeDieData as ar, type RuntimeGenericBoardState as as, type RuntimeHexBoardState as at, type RuntimeHexSpaceState as au, type RuntimeJson as av, RuntimeJsonSchema as aw, type RuntimePayload as ax, type RuntimePieceData as ay, type RuntimeRecord as az, type BoardEdgeRef as b, ring as b0, runtimeSchema as b1, runtimeTypes as b2, spiral as b3, type BoardIdOfTable as c, type BoardStaticProjection as d, type BoardVertexRef as e, type Brand as f, type ClientParamsOfInteractionOfDefinition as g, type CollectorState as h, type DispatchRequest as i, type DispatchResult as j, type GameEventDetail as k, type GameInput as l, type GameOutcome as m, type GameOutcome$1 as n, type GameStateOf as o, type GameTopologyManifest as p, type HexSpaceId as q, type HexVertexId as r, type InitializeResult as s, type InputCollector as t, type InputDomain as u, InputDomainSchema as v, type InputSelection as w, type InputSelectionDescriptor as x, type InteractionAvailability as y, InteractionAvailabilitySchema as z };