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

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