@dreamboard-games/sdk 0.5.0-alpha.31 → 0.5.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/{board-element-DXLPBVk-.d.ts → board-element-BZ9e3pLb.d.ts} +1 -1
- package/dist/{chunk-CWANHA4C.js → chunk-F46EZJCX.js} +117 -55
- package/dist/chunk-F46EZJCX.js.map +1 -0
- package/dist/{chunk-63GWNBZX.js → chunk-M7GZANGG.js} +28 -10
- package/dist/chunk-M7GZANGG.js.map +1 -0
- package/dist/{chunk-IEMZ26FI.js → chunk-VCQ23Z5U.js} +2 -1
- package/dist/{diagnostics-D3mzqjxL.d.ts → diagnostics-BYGF8kfA.d.ts} +1 -1
- package/dist/{extract-Bi6_tzUr.d.ts → extract-BG3V3c2c.d.ts} +45 -1
- package/dist/index.d.ts +332 -434
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +3 -3
- package/dist/reducer.d.ts +5 -5
- package/dist/reducer.js +2 -2
- package/dist/{shortcuts-CuQXWAMv.d.ts → shortcuts-BFbp5Y3C.d.ts} +2 -2
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +3 -3
- package/dist/{types-BlvVQ9WL.d.ts → types-Bfg8s5dP.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-63GWNBZX.js.map +0 -1
- package/dist/chunk-CWANHA4C.js.map +0 -1
- /package/dist/{chunk-IEMZ26FI.js.map → chunk-VCQ23Z5U.js.map} +0 -0
package/README.md
CHANGED
|
@@ -524,6 +524,19 @@ and gameplay websocket schemas plus `materializePluginGameplayFrame` live at the
|
|
|
524
524
|
root. Materialize the requested seat directly from its projection before publishing it;
|
|
525
525
|
sources publish the canonical seat view and submit the exact frame basis.
|
|
526
526
|
|
|
527
|
+
Hosted WebSockets require `GAMEPLAY_WIRE_PROTOCOL_VERSION` (2) in both
|
|
528
|
+
`auth.connect` and `auth.accepted`. Their `session.snapshot.frame` is a
|
|
529
|
+
self-contained `CompactGameplayFrame`: `interactionsByRef` contains exactly the
|
|
530
|
+
descriptors referenced by that seat's `availableInteractionRefs` and zone card
|
|
531
|
+
references. There is no cross-frame registry or delta state. Hosts call
|
|
532
|
+
`materializeCompactGameplayFrame` with a schema-validated all-seat projection;
|
|
533
|
+
it checks the projection basis and prunes the registry to the selected seat.
|
|
534
|
+
At the receiving boundary, parse `SessionSnapshotFrameSchema` (or
|
|
535
|
+
`ServerGameplayFrameSchema`) before calling `hydrateCompactGameplayFrame`.
|
|
536
|
+
`hostSource` performs this admission and hydration automatically. Hydration
|
|
537
|
+
retains shared descriptor objects and produces the existing `PluginGameplayFrame`;
|
|
538
|
+
the authored iframe protocol remains version 11.
|
|
539
|
+
|
|
527
540
|
Visible cards share one complete `ViewCard` shape: `id`, `cardType`, and JSON
|
|
528
541
|
`properties`, plus optional `name`, `text`, `frontImage`, and `backImage`.
|
|
529
542
|
`ViewCardSchema` validates this shape. Reducer and gameplay `cardViewsById` maps
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as BoardEdgeId, n as BoardVertexId } from './extract-
|
|
1
|
+
import { f as BoardEdgeId, n as BoardVertexId } from './extract-BG3V3c2c.js';
|
|
2
2
|
|
|
3
3
|
declare function boardEdgeId<BoardId extends string>(layout: "hex" | "square", boardId: BoardId, latticeId: string): BoardEdgeId<BoardId>;
|
|
4
4
|
declare function boardVertexId<BoardId extends string>(layout: "hex" | "square", boardId: BoardId, latticeId: string): BoardVertexId<BoardId>;
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
SeatProjectionBundleSchema,
|
|
7
7
|
SimultaneousPhaseProjectionSchema,
|
|
8
8
|
SystemActionEventSchema,
|
|
9
|
-
ViewCardSchema
|
|
10
|
-
|
|
9
|
+
ViewCardSchema,
|
|
10
|
+
ZoneInteractionRefsSchema
|
|
11
|
+
} from "./chunk-VCQ23Z5U.js";
|
|
11
12
|
import {
|
|
12
13
|
BoardProjectionSchema,
|
|
13
14
|
PlayerIdSchema,
|
|
@@ -219,6 +220,89 @@ function playerSeatColor(seatIndex) {
|
|
|
219
220
|
return PLAYER_SEAT_COLORS[seatIndex % PLAYER_SEAT_COLORS.length];
|
|
220
221
|
}
|
|
221
222
|
|
|
223
|
+
// src/shared/protocol/compact-frame.ts
|
|
224
|
+
import * as z3 from "zod";
|
|
225
|
+
var CompactGameplayFrameSchema = PluginGameplayFrameSchema.omit({
|
|
226
|
+
availableInteractions: true,
|
|
227
|
+
zones: true
|
|
228
|
+
}).extend({
|
|
229
|
+
interactionsByRef: z3.record(z3.string(), InteractionDescriptorSchema),
|
|
230
|
+
availableInteractionRefs: z3.array(z3.string()),
|
|
231
|
+
zones: z3.record(
|
|
232
|
+
z3.string(),
|
|
233
|
+
z3.record(z3.string(), ZoneInteractionRefsSchema)
|
|
234
|
+
)
|
|
235
|
+
}).superRefine((frame, context) => {
|
|
236
|
+
const reachable = /* @__PURE__ */ new Set();
|
|
237
|
+
visitInteractionRefs(frame, (ref, path) => {
|
|
238
|
+
reachable.add(ref);
|
|
239
|
+
if (!Object.hasOwn(frame.interactionsByRef, ref)) {
|
|
240
|
+
context.addIssue({
|
|
241
|
+
code: "custom",
|
|
242
|
+
path,
|
|
243
|
+
message: `Missing interaction reference '${ref}'.`
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
for (const ref of Object.keys(frame.interactionsByRef)) {
|
|
248
|
+
if (!reachable.has(ref)) {
|
|
249
|
+
context.addIssue({
|
|
250
|
+
code: "custom",
|
|
251
|
+
path: ["interactionsByRef", ref],
|
|
252
|
+
message: `Unused interaction reference '${ref}'.`
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
function visitInteractionRefs(frame, visit) {
|
|
258
|
+
frame.availableInteractionRefs.forEach(
|
|
259
|
+
(ref, index) => visit(ref, ["availableInteractionRefs", index])
|
|
260
|
+
);
|
|
261
|
+
for (const [zoneId, hosts] of Object.entries(frame.zones)) {
|
|
262
|
+
for (const [hostId, zone] of Object.entries(hosts)) {
|
|
263
|
+
for (const [cardId, refs] of Object.entries(zone.playableByCardId)) {
|
|
264
|
+
refs.forEach(
|
|
265
|
+
(ref, index) => visit(ref, [
|
|
266
|
+
"zones",
|
|
267
|
+
zoneId,
|
|
268
|
+
hostId,
|
|
269
|
+
"playableByCardId",
|
|
270
|
+
cardId,
|
|
271
|
+
index
|
|
272
|
+
])
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function hydrateCompactGameplayFrame(frame) {
|
|
279
|
+
const { interactionsByRef, availableInteractionRefs, zones, ...base } = frame;
|
|
280
|
+
const hydrate = (refs) => refs.map((ref) => interactionsByRef[ref]);
|
|
281
|
+
return {
|
|
282
|
+
...base,
|
|
283
|
+
availableInteractions: hydrate(availableInteractionRefs),
|
|
284
|
+
zones: Object.fromEntries(
|
|
285
|
+
Object.entries(zones).map(([zoneId, hosts]) => [
|
|
286
|
+
zoneId,
|
|
287
|
+
Object.fromEntries(
|
|
288
|
+
Object.entries(hosts).map(([hostId, zone]) => [
|
|
289
|
+
hostId,
|
|
290
|
+
{
|
|
291
|
+
...zone,
|
|
292
|
+
playableByCardId: Object.fromEntries(
|
|
293
|
+
Object.entries(zone.playableByCardId).map(([cardId, refs]) => [
|
|
294
|
+
cardId,
|
|
295
|
+
hydrate(refs)
|
|
296
|
+
])
|
|
297
|
+
)
|
|
298
|
+
}
|
|
299
|
+
])
|
|
300
|
+
)
|
|
301
|
+
])
|
|
302
|
+
)
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
222
306
|
// src/shared/protocol/digest.ts
|
|
223
307
|
function computePluginActionSetVersion(input) {
|
|
224
308
|
return digestPluginRuntimeJson({
|
|
@@ -245,19 +329,33 @@ function materializePluginGameplayFrame(input) {
|
|
|
245
329
|
const dynamicProjection = SeatProjectionBundleSchema2.parse(
|
|
246
330
|
canonicalizePluginRuntimeJson(input.dynamicProjection)
|
|
247
331
|
);
|
|
332
|
+
return PluginGameplayFrameSchema.parse(
|
|
333
|
+
hydrateCompactGameplayFrame(
|
|
334
|
+
materializeCompactGameplayFrame({ ...input, dynamicProjection })
|
|
335
|
+
)
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
function materializeCompactGameplayFrame(input) {
|
|
339
|
+
const { dynamicProjection } = input;
|
|
248
340
|
if (dynamicProjection.referenceBasis.sessionId !== input.sessionId || dynamicProjection.referenceBasis.version !== input.version) {
|
|
249
341
|
throw new Error(
|
|
250
342
|
"Projection reference basis does not match the frame basis."
|
|
251
343
|
);
|
|
252
344
|
}
|
|
253
345
|
const registry = dynamicProjection.interactionsByRef ?? {};
|
|
254
|
-
const seat = dynamicProjection.seats[input.perspectivePlayerId]
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
346
|
+
const seat = dynamicProjection.seats[input.perspectivePlayerId];
|
|
347
|
+
const availableInteractionRefs = seat?.availableInteractionRefs ?? [];
|
|
348
|
+
const zones = seat?.zones ?? {};
|
|
349
|
+
const selected = /* @__PURE__ */ new Map();
|
|
350
|
+
visitInteractionRefs({ availableInteractionRefs, zones }, (ref, path) => {
|
|
351
|
+
if (selected.has(ref)) return;
|
|
352
|
+
if (!Object.hasOwn(registry, ref)) {
|
|
353
|
+
throw new Error(
|
|
354
|
+
`Seat projection ${path.join(".")} references '${ref}', which is missing from interactionsByRef.`
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
selected.set(ref, registry[ref]);
|
|
358
|
+
});
|
|
261
359
|
const frame = {
|
|
262
360
|
players: input.players,
|
|
263
361
|
...input.causedBy === void 0 ? {} : { causedBy: input.causedBy },
|
|
@@ -274,10 +372,11 @@ function materializePluginGameplayFrame(input) {
|
|
|
274
372
|
activePlayers: [...input.activePlayers],
|
|
275
373
|
simultaneousPhase: dynamicProjection.simultaneousPhase ?? null
|
|
276
374
|
},
|
|
277
|
-
|
|
375
|
+
interactionsByRef: Object.fromEntries(selected),
|
|
376
|
+
availableInteractionRefs,
|
|
278
377
|
zones
|
|
279
378
|
};
|
|
280
|
-
return
|
|
379
|
+
return frame;
|
|
281
380
|
}
|
|
282
381
|
function materializeView(seatView, seatBoards) {
|
|
283
382
|
const parts = [
|
|
@@ -287,46 +386,6 @@ function materializeView(seatView, seatBoards) {
|
|
|
287
386
|
if (parts.length === 0) return null;
|
|
288
387
|
return Object.assign({}, ...parts);
|
|
289
388
|
}
|
|
290
|
-
function hydrateZones(registry, value, path) {
|
|
291
|
-
return Object.fromEntries(
|
|
292
|
-
Object.entries(value).map(([zoneId, hosts]) => [
|
|
293
|
-
zoneId,
|
|
294
|
-
Object.fromEntries(
|
|
295
|
-
Object.entries(hosts).map(([hostId, zone]) => [
|
|
296
|
-
hostId,
|
|
297
|
-
{
|
|
298
|
-
tiles: zone.tiles,
|
|
299
|
-
cardIds: zone.cardIds,
|
|
300
|
-
cardViewsById: zone.cardViewsById,
|
|
301
|
-
cardBacksById: zone.cardBacksById,
|
|
302
|
-
playableByCardId: Object.fromEntries(
|
|
303
|
-
Object.entries(zone.playableByCardId).map(([cardId, refs]) => [
|
|
304
|
-
cardId,
|
|
305
|
-
hydrateInteractionRefs(
|
|
306
|
-
registry,
|
|
307
|
-
refs,
|
|
308
|
-
`${path}.${zoneId}.${hostId}.playableByCardId.${cardId}`
|
|
309
|
-
)
|
|
310
|
-
])
|
|
311
|
-
),
|
|
312
|
-
...zone.shuffled ? { shuffled: true } : {}
|
|
313
|
-
}
|
|
314
|
-
])
|
|
315
|
-
)
|
|
316
|
-
])
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
function hydrateInteractionRefs(registry, value, path) {
|
|
320
|
-
return value.map((ref, index) => {
|
|
321
|
-
const descriptor = registry[ref];
|
|
322
|
-
if (!descriptor) {
|
|
323
|
-
throw new Error(
|
|
324
|
-
`Seat projection ${path}[${index}] references '${ref}', which is missing from interactionsByRef.`
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
return descriptor;
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
389
|
|
|
331
390
|
// src/headless/sources/lifecycle.ts
|
|
332
391
|
import { createStore as createStore2 } from "@tanstack/store";
|
|
@@ -470,9 +529,9 @@ function createSourceLifecycle(options) {
|
|
|
470
529
|
])
|
|
471
530
|
);
|
|
472
531
|
},
|
|
473
|
-
|
|
532
|
+
// Transport adapters admit frames before entering this shared lifecycle.
|
|
533
|
+
frame(parsed, acknowledgedClientActionId) {
|
|
474
534
|
if (closed) return;
|
|
475
|
-
const parsed = PluginGameplayFrameSchema.parse(value);
|
|
476
535
|
if (!session) {
|
|
477
536
|
fail(new Error("Gameplay frame arrived before session metadata."));
|
|
478
537
|
return;
|
|
@@ -649,9 +708,12 @@ export {
|
|
|
649
708
|
PLAYER_SEAT_COLORS,
|
|
650
709
|
playerSeatColor,
|
|
651
710
|
createSourceLifecycle,
|
|
711
|
+
CompactGameplayFrameSchema,
|
|
712
|
+
hydrateCompactGameplayFrame,
|
|
652
713
|
computePluginActionSetVersion,
|
|
653
714
|
digestPluginGameplayFrame,
|
|
654
715
|
digestPluginCommandRequest,
|
|
655
|
-
materializePluginGameplayFrame
|
|
716
|
+
materializePluginGameplayFrame,
|
|
717
|
+
materializeCompactGameplayFrame
|
|
656
718
|
};
|
|
657
|
-
//# sourceMappingURL=chunk-
|
|
719
|
+
//# sourceMappingURL=chunk-F46EZJCX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/shared/protocol/protocol.ts","../src/shared/protocol/schema.ts","../src/headless/sources/static.ts","../src/shared/protocol/players.ts","../src/shared/protocol/compact-frame.ts","../src/shared/protocol/digest.ts","../src/shared/protocol/projection.ts","../src/headless/sources/lifecycle.ts"],"sourcesContent":["import type {\n GameplayBasis,\n InteractionDescriptor,\n PluginGameplayFrame,\n PluginSessionDescriptor,\n} from \"./frame.js\";\nimport type { RuntimeJson } from \"../runtime-json.js\";\n\nexport const DREAMBOARD_PLUGIN_PROTOCOL = \"dreamboard-plugin\" as const;\nexport const DREAMBOARD_PLUGIN_PROTOCOL_VERSION = 11 as const;\n\nexport type InteractionResult =\n | {\n readonly clientActionId: string;\n readonly accepted: true;\n }\n | {\n readonly type: \"interaction.result\";\n readonly clientActionId: string;\n readonly accepted: false;\n readonly errorCode: string;\n readonly message?: string;\n };\n\nexport interface SubmitInteractionCommand {\n readonly type: \"interaction.submit\";\n readonly clientActionId: string;\n readonly basis: GameplayBasis;\n readonly interactionId: string;\n readonly params: RuntimeJson;\n}\n\nexport interface CancelInteractionCommand {\n readonly type: \"interaction.cancel\";\n readonly clientActionId: string;\n readonly basis: GameplayBasis;\n readonly interactionId: string;\n}\n\nexport type HostToPluginPayload =\n | {\n readonly type: \"runtime.init\";\n readonly session: PluginSessionDescriptor;\n }\n | {\n readonly type: \"gameplay.frame\";\n readonly frame: PluginGameplayFrame;\n /** Confirms a durable action covered by this frame. Independent of causedBy. */\n readonly acknowledgedClientActionId?: string;\n }\n | Extract<InteractionResult, { accepted: false }>;\n\nexport type PluginToHostPayload =\n | { readonly type: \"runtime.ready\" }\n | { readonly type: \"runtime.resume\"; readonly pendingClientActionId?: string }\n | {\n readonly type: \"runtime.ack\";\n /** Echoes the host envelope sequence. It is delivery order only. */\n readonly sequence: number;\n readonly clientReceivedAtMs?: number;\n readonly clientRenderedAtMs?: number;\n }\n | SubmitInteractionCommand\n | CancelInteractionCommand\n | {\n readonly type: \"runtime.error\";\n readonly message: string;\n readonly code?: string;\n };\n\nexport interface PluginProtocolEnvelope<Payload> {\n readonly protocol: typeof DREAMBOARD_PLUGIN_PROTOCOL;\n readonly version: typeof DREAMBOARD_PLUGIN_PROTOCOL_VERSION;\n readonly channelId: string;\n /** Delivery order only. It is not a game revision. */\n readonly sequence: number;\n readonly payload: Payload;\n}\n\nexport type HostToPluginEnvelope = PluginProtocolEnvelope<HostToPluginPayload>;\nexport type PluginToHostEnvelope = PluginProtocolEnvelope<PluginToHostPayload>;\n\nexport type ActionSetVersionInput = {\n readonly version: number;\n readonly availableInteractions: readonly InteractionDescriptor[];\n};\n","import { PlayerIdSchema } from \"../domain/player-identity.js\";\nimport { ViewCardSchema } from \"../domain/cards.js\";\nimport * as ReducerWireZod from \"../runtime-schema\";\nimport * as z from \"zod\";\nimport {\n DREAMBOARD_PLUGIN_PROTOCOL,\n DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n} from \"./protocol.js\";\nimport { RuntimeJsonSchema } from \"../runtime-json.js\";\nimport {\n BoardProjectionSchema,\n ProjectedTileSchema,\n} from \"../seat-topology-schema.js\";\nimport type {\n GameOutcome,\n GameplayBasis,\n PluginGameplayFrame,\n PluginSessionDescriptor,\n ZoneHandlesSnapshot,\n} from \"./frame.js\";\nimport type {\n HostToPluginPayload,\n InteractionResult,\n PluginProtocolEnvelope,\n PluginToHostPayload,\n} from \"./protocol.js\";\n\nexport const GameEventDetailSchema =\n ReducerWireZod.ProjectedGameEventDetailSchema;\nexport const SystemActionEventSchema = ReducerWireZod.SystemActionEventSchema;\nexport const GameEventSchema = ReducerWireZod.ProjectedGameEventSchema;\nexport const SeatProjectionBundleSchema =\n ReducerWireZod.SeatProjectionBundleSchema;\n\nexport { PlayerIdSchema } from \"../domain/player-identity.js\";\n\nexport const PluginPlayerSummarySchema = z\n .object({\n playerId: PlayerIdSchema,\n displayName: z.string(),\n color: z.string().optional(),\n })\n .strict();\n\nexport const PluginSessionDescriptorSchema = z\n .object({\n sessionId: z.string().min(1),\n players: z.array(PluginPlayerSummarySchema),\n assets: z.record(z.string(), z.instanceof(Blob)).optional(),\n })\n .strict() satisfies z.ZodType<PluginSessionDescriptor>;\n\nexport {\n InteractionCommitPolicySchema,\n InputSelectionSchema,\n InputDomainSchema,\n InteractionChoiceOptionSchema,\n InteractionInputDescriptorSchema,\n InteractionAvailabilitySchema,\n InteractionDescriptorSchema,\n} from \"../interaction-schema.js\";\nimport { InteractionDescriptorSchema } from \"../interaction-schema.js\";\n\nexport const ZoneHandlesSnapshotSchema = z\n .object({\n tiles: z.array(ProjectedTileSchema),\n cardIds: z.array(z.string()),\n cardViewsById: z.record(z.string(), ViewCardSchema),\n cardBacksById: z.record(z.string(), z.string()),\n playableByCardId: z.record(\n z.string(),\n z.array(InteractionDescriptorSchema),\n ),\n shuffled: z.literal(true).optional(),\n })\n .strict() satisfies z.ZodType<ZoneHandlesSnapshot>;\n\nexport const SimultaneousPhaseSnapshotSchema =\n ReducerWireZod.SimultaneousPhaseProjectionSchema;\n\nexport const GameplayBasisSchema = z\n .object({\n sessionId: z.string().min(1),\n version: z.number().int().nonnegative(),\n actionSetVersion: z.string().min(1),\n perspectivePlayerId: PlayerIdSchema,\n })\n .strict() satisfies z.ZodType<GameplayBasis>;\n\nexport const GameOutcomeSchema =\n ReducerWireZod.GameOutcomeSchema satisfies z.ZodType<GameOutcome>;\n\nconst ProjectedViewSchema = z\n .record(z.string(), RuntimeJsonSchema)\n .superRefine((view, context) => {\n if (!Object.hasOwn(view, \"boards\")) return;\n const boards = BoardProjectionSchema.safeParse(view.boards);\n if (!boards.success) {\n for (const issue of boards.error.issues) {\n context.addIssue({\n code: \"custom\",\n path: [\"boards\", ...issue.path],\n message: issue.message,\n });\n }\n }\n });\n\nexport const SeatFrameSchema = z\n .object({\n players: z.array(PlayerIdSchema),\n causedBy: z.string().min(1).optional(),\n events: z.array(GameEventSchema).max(32),\n view: ProjectedViewSchema.nullable(),\n flow: z\n .object({\n currentPhase: z.string().nullable(),\n activePlayers: z.array(PlayerIdSchema),\n simultaneousPhase: SimultaneousPhaseSnapshotSchema.nullable(),\n })\n .strict(),\n availableInteractions: z.array(InteractionDescriptorSchema),\n zones: z.record(\n z.string(),\n z.record(z.string(), ZoneHandlesSnapshotSchema),\n ),\n })\n .strict();\n\nexport const PluginGameplayFrameSchema = SeatFrameSchema.extend({\n basis: GameplayBasisSchema,\n}) satisfies z.ZodType<PluginGameplayFrame>;\n\n/** Only rejections are standalone wire results; success accompanies a frame. */\nexport const InteractionResultSchema = z\n .object({\n type: z.literal(\"interaction.result\"),\n clientActionId: z.string().min(1),\n accepted: z.literal(false),\n errorCode: z.string().min(1),\n message: z.string().optional(),\n })\n .strict() satisfies z.ZodType<\n Extract<InteractionResult, { accepted: false }>\n>;\n\nexport const SubmitInteractionCommandSchema = z\n .object({\n type: z.literal(\"interaction.submit\"),\n clientActionId: z.string().min(1),\n basis: GameplayBasisSchema,\n interactionId: z.string().min(1),\n params: RuntimeJsonSchema,\n })\n .strict();\n\nexport const CancelInteractionCommandSchema =\n SubmitInteractionCommandSchema.omit({ params: true })\n .extend({ type: z.literal(\"interaction.cancel\") })\n .strict();\n\nexport const HostToPluginPayloadSchema = z.discriminatedUnion(\"type\", [\n z\n .object({\n type: z.literal(\"runtime.init\"),\n session: PluginSessionDescriptorSchema,\n })\n .strict(),\n z\n .object({\n type: z.literal(\"gameplay.frame\"),\n frame: PluginGameplayFrameSchema,\n acknowledgedClientActionId: z.string().min(1).optional(),\n })\n .strict(),\n InteractionResultSchema,\n]) satisfies z.ZodType<HostToPluginPayload>;\n\nexport const PluginToHostPayloadSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"runtime.ready\") }).strict(),\n z\n .object({\n type: z.literal(\"runtime.resume\"),\n pendingClientActionId: z.string().min(1).optional(),\n })\n .strict(),\n z\n .object({\n type: z.literal(\"runtime.ack\"),\n sequence: z.number().int().nonnegative(),\n clientReceivedAtMs: z.number().finite().optional(),\n clientRenderedAtMs: z.number().finite().optional(),\n })\n .strict(),\n SubmitInteractionCommandSchema,\n CancelInteractionCommandSchema,\n z\n .object({\n type: z.literal(\"runtime.error\"),\n message: z.string(),\n code: z.string().optional(),\n })\n .strict(),\n]) satisfies z.ZodType<PluginToHostPayload>;\n\nexport function createPluginProtocolEnvelopeSchema<Payload>(\n payloadSchema: z.ZodType<Payload>,\n): z.ZodType<PluginProtocolEnvelope<Payload>> {\n return z\n .object({\n protocol: z.literal(DREAMBOARD_PLUGIN_PROTOCOL),\n version: z.literal(DREAMBOARD_PLUGIN_PROTOCOL_VERSION),\n channelId: z.string().min(1),\n sequence: z.number().int().nonnegative(),\n payload: payloadSchema,\n })\n .strict();\n}\n\nexport const HostToPluginEnvelopeSchema = createPluginProtocolEnvelopeSchema(\n HostToPluginPayloadSchema,\n);\n\nexport const PluginToHostEnvelopeSchema = createPluginProtocolEnvelopeSchema(\n PluginToHostPayloadSchema,\n);\n\nexport function parsePluginSessionDescriptor(\n value: unknown,\n): PluginSessionDescriptor {\n return PluginSessionDescriptorSchema.parse(value);\n}\n\nexport function parsePluginGameplayFrame(value: unknown): PluginGameplayFrame {\n return PluginGameplayFrameSchema.parse(value);\n}\n\nexport function parseHostToPluginEnvelope(\n value: unknown,\n): PluginProtocolEnvelope<HostToPluginPayload> {\n return HostToPluginEnvelopeSchema.parse(value);\n}\n\nexport function parsePluginToHostEnvelope(\n value: unknown,\n): PluginProtocolEnvelope<PluginToHostPayload> {\n return PluginToHostEnvelopeSchema.parse(value);\n}\n","import { createStore } from \"@tanstack/store\";\nimport * as z from \"zod\";\nimport {\n SeatFrameSchema,\n PluginPlayerSummarySchema,\n} from \"../../shared/protocol/schema.js\";\nimport { immutableCopy } from \"../../shared/immutable.js\";\nimport type { GameSource, SourceSnapshot, SourceState } from \"./types.js\";\n\nexport const SourceSnapshotSchema = z\n .object({\n me: z.string().min(1),\n causedBy: z.string().min(1).optional(),\n players: z.array(PluginPlayerSummarySchema),\n frame: SeatFrameSchema,\n version: z.number().int().nonnegative(),\n })\n .strict();\n\n/** A read-only fixture source accepts the public seat snapshot, never wire basis. */\nexport function staticSource(input: SourceSnapshot): GameSource {\n const snapshot = immutableCopy(SourceSnapshotSchema.parse(input));\n if (!snapshot.players.some((player) => player.playerId === snapshot.me))\n throw new Error(\"Gameplay seat is absent from session.\");\n const store = createStore<SourceState>(\n Object.freeze({\n snapshot,\n connection: \"ready\",\n request: null,\n failure: null,\n }),\n );\n return {\n store: {\n get: () => store.get(),\n subscribe: (listener) => store.subscribe(listener),\n },\n dispose() {\n store.setState((state) =>\n Object.freeze({\n snapshot: state.snapshot,\n connection: \"closed\",\n request: null,\n failure: null,\n }),\n );\n },\n };\n}\n","/** Stable seat colors shared by hosted and local gameplay. */\nexport const PLAYER_SEAT_COLORS = [\n \"#2563EB\",\n \"#DC2626\",\n \"#059669\",\n \"#7C3AED\",\n \"#DB2777\",\n \"#0891B2\",\n \"#65A30D\",\n \"#EA580C\",\n] as const;\n\nexport function playerSeatColor(seatIndex: number): string {\n return PLAYER_SEAT_COLORS[seatIndex % PLAYER_SEAT_COLORS.length];\n}\n","import * as z from \"zod\";\nimport {\n InteractionDescriptorSchema,\n ZoneInteractionRefsSchema,\n} from \"../interaction-schema.js\";\nimport type { ZoneInteractionRefs } from \"../interaction-schema.js\";\nimport type { InteractionDescriptor, PluginGameplayFrame } from \"./frame.js\";\nimport { PluginGameplayFrameSchema } from \"./schema.js\";\n\n/** Self-contained hosted snapshot. References are local to this frame. */\nexport type CompactGameplayFrame = Omit<\n PluginGameplayFrame,\n \"availableInteractions\" | \"zones\"\n> & {\n readonly interactionsByRef: Readonly<Record<string, InteractionDescriptor>>;\n readonly availableInteractionRefs: readonly string[];\n readonly zones: Readonly<\n Record<string, Readonly<Record<string, ZoneInteractionRefs>>>\n >;\n};\n\nexport const CompactGameplayFrameSchema = PluginGameplayFrameSchema.omit({\n availableInteractions: true,\n zones: true,\n})\n .extend({\n interactionsByRef: z.record(z.string(), InteractionDescriptorSchema),\n availableInteractionRefs: z.array(z.string()),\n zones: z.record(\n z.string(),\n z.record(z.string(), ZoneInteractionRefsSchema),\n ),\n })\n .superRefine((frame, context) => {\n const reachable = new Set<string>();\n visitInteractionRefs(frame, (ref, path) => {\n reachable.add(ref);\n if (!Object.hasOwn(frame.interactionsByRef, ref)) {\n context.addIssue({\n code: \"custom\",\n path,\n message: `Missing interaction reference '${ref}'.`,\n });\n }\n });\n for (const ref of Object.keys(frame.interactionsByRef)) {\n if (!reachable.has(ref)) {\n context.addIssue({\n code: \"custom\",\n path: [\"interactionsByRef\", ref],\n message: `Unused interaction reference '${ref}'.`,\n });\n }\n }\n }) satisfies z.ZodType<CompactGameplayFrame>;\n\n/** Traverses references without reparsing descriptors for every card. */\nexport function visitInteractionRefs(\n frame: Pick<CompactGameplayFrame, \"availableInteractionRefs\" | \"zones\">,\n visit: (ref: string, path: (string | number)[]) => void,\n): void {\n frame.availableInteractionRefs.forEach((ref, index) =>\n visit(ref, [\"availableInteractionRefs\", index]),\n );\n for (const [zoneId, hosts] of Object.entries(frame.zones)) {\n for (const [hostId, zone] of Object.entries(hosts)) {\n for (const [cardId, refs] of Object.entries(zone.playableByCardId)) {\n refs.forEach((ref, index) =>\n visit(ref, [\n \"zones\",\n zoneId,\n hostId,\n \"playableByCardId\",\n cardId,\n index,\n ]),\n );\n }\n }\n }\n}\n\n/** Hydrates a schema-admitted frame, retaining the shared descriptor objects. */\nexport function hydrateCompactGameplayFrame(\n frame: CompactGameplayFrame,\n): PluginGameplayFrame {\n const { interactionsByRef, availableInteractionRefs, zones, ...base } = frame;\n const hydrate = (refs: readonly string[]) =>\n refs.map((ref) => interactionsByRef[ref]);\n return {\n ...base,\n availableInteractions: hydrate(availableInteractionRefs),\n zones: Object.fromEntries(\n Object.entries(zones).map(([zoneId, hosts]) => [\n zoneId,\n Object.fromEntries(\n Object.entries(hosts).map(([hostId, zone]) => [\n hostId,\n {\n ...zone,\n playableByCardId: Object.fromEntries(\n Object.entries(zone.playableByCardId).map(([cardId, refs]) => [\n cardId,\n hydrate(refs),\n ]),\n ),\n },\n ]),\n ),\n ]),\n ),\n };\n}\n","import type { PluginGameplayFrame } from \"./frame.js\";\nimport {\n type ActionSetVersionInput,\n type SubmitInteractionCommand,\n type CancelInteractionCommand,\n} from \"./protocol.js\";\nimport {\n canonicalizePluginRuntimeJson,\n digestPluginRuntimeJson,\n encodeCanonicalPluginRuntimeJson,\n} from \"./json.js\";\n\nexport {\n canonicalizePluginRuntimeJson,\n digestPluginRuntimeJson,\n encodeCanonicalPluginRuntimeJson,\n};\n\nexport function computePluginActionSetVersion(\n input: ActionSetVersionInput,\n): string {\n return digestPluginRuntimeJson({\n digestVersion: \"plugin-action-set@6\",\n version: input.version,\n availableInteractions: input.availableInteractions,\n });\n}\n\nexport function digestPluginGameplayFrame(frame: PluginGameplayFrame): string {\n return digestPluginRuntimeJson({\n digestVersion: \"plugin-gameplay-frame@6\",\n frame,\n });\n}\n\nexport function digestPluginCommandRequest(\n command: SubmitInteractionCommand | CancelInteractionCommand,\n): string {\n return digestPluginRuntimeJson({\n digestVersion: \"plugin-command-request@6\",\n command,\n });\n}\n","import { canonicalizePluginRuntimeJson } from \"./json\";\nimport {\n PluginGameplayFrameSchema,\n SeatProjectionBundleSchema,\n} from \"./schema.js\";\nimport type {\n InteractionDescriptor,\n PlayerId,\n PluginGameplayFrame,\n ReducerSeatProjectionBundle,\n} from \"./frame.js\";\nimport {\n hydrateCompactGameplayFrame,\n visitInteractionRefs,\n type CompactGameplayFrame,\n} from \"./compact-frame.js\";\nimport type * as Wire from \"../runtime-types.js\";\nimport type { RuntimeJson } from \"../runtime-json.js\";\n\nexport interface MaterializePluginGameplayFrameInput {\n readonly players: readonly PlayerId[];\n readonly causedBy?: string;\n readonly currentPhase: string | null;\n readonly activePlayers: readonly PlayerId[];\n readonly dynamicProjection: ReducerSeatProjectionBundle;\n readonly perspectivePlayerId: PlayerId;\n\n readonly sessionId: string;\n readonly version: number;\n readonly actionSetVersion: string;\n}\n\nexport function materializePluginGameplayFrame(\n input: MaterializePluginGameplayFrameInput,\n): PluginGameplayFrame {\n const dynamicProjection = SeatProjectionBundleSchema.parse(\n canonicalizePluginRuntimeJson(input.dynamicProjection),\n );\n return PluginGameplayFrameSchema.parse(\n hydrateCompactGameplayFrame(\n materializeCompactGameplayFrame({ ...input, dynamicProjection }),\n ),\n );\n}\n\n/** Selects one seat from an already schema-validated all-seat projection. */\nexport function materializeCompactGameplayFrame(\n input: Omit<MaterializePluginGameplayFrameInput, \"dynamicProjection\"> & {\n readonly dynamicProjection: Wire.SeatProjectionBundle;\n },\n): CompactGameplayFrame {\n const { dynamicProjection } = input;\n if (\n dynamicProjection.referenceBasis.sessionId !== input.sessionId ||\n dynamicProjection.referenceBasis.version !== input.version\n ) {\n throw new Error(\n \"Projection reference basis does not match the frame basis.\",\n );\n }\n const registry = dynamicProjection.interactionsByRef ?? {};\n const seat = dynamicProjection.seats[input.perspectivePlayerId];\n const availableInteractionRefs = seat?.availableInteractionRefs ?? [];\n const zones = seat?.zones ?? {};\n const selected = new Map<string, InteractionDescriptor>();\n visitInteractionRefs({ availableInteractionRefs, zones }, (ref, path) => {\n if (selected.has(ref)) return;\n if (!Object.hasOwn(registry, ref)) {\n throw new Error(\n `Seat projection ${path.join(\".\")} references '${ref}', which is missing from interactionsByRef.`,\n );\n }\n selected.set(ref, registry[ref]);\n });\n\n const frame = {\n players: input.players,\n ...(input.causedBy === undefined ? {} : { causedBy: input.causedBy }),\n events: seat?.events ?? [],\n basis: {\n sessionId: input.sessionId,\n version: input.version,\n actionSetVersion: input.actionSetVersion,\n perspectivePlayerId: input.perspectivePlayerId,\n },\n view: materializeView(seat?.view, seat?.boards),\n flow: {\n currentPhase: input.currentPhase,\n activePlayers: [...input.activePlayers],\n simultaneousPhase: dynamicProjection.simultaneousPhase ?? null,\n },\n interactionsByRef: Object.fromEntries(selected),\n availableInteractionRefs,\n zones,\n } satisfies CompactGameplayFrame;\n\n return frame;\n}\n\nfunction materializeView(\n seatView: unknown,\n seatBoards: ReducerSeatProjectionBundle[\"seats\"][string][\"boards\"],\n): RuntimeJson | null {\n const parts = [\n seatView,\n seatBoards === undefined ? undefined : { boards: seatBoards },\n ].filter((part) => part !== undefined && part !== null);\n if (parts.length === 0) return null;\n // Admitting schemas guarantee records and reject authored `boards` fields.\n return Object.assign({}, ...parts) as Record<string, RuntimeJson>;\n}\n","import { playerSeatColor } from \"../../shared/protocol/players.js\";\nimport { createStore } from \"@tanstack/store\";\nimport {\n PluginSessionDescriptorSchema,\n InteractionResultSchema,\n PluginToHostPayloadSchema,\n} from \"../../shared/protocol/schema.js\";\nimport type {\n GameplayBasis,\n PluginGameplayFrame,\n PluginSessionDescriptor,\n PluginPlayerSummary,\n} from \"../../shared/protocol/frame.js\";\nimport { immutableCopy } from \"../../shared/immutable.js\";\nimport type {\n CommandSource,\n SourceCommand,\n SourceContext,\n SourceState,\n SubmitResult,\n} from \"./types.js\";\n\ninterface Pending {\n readonly command: SourceCommand;\n readonly resolve: (result: SubmitResult) => void;\n readonly reject: (error: Error) => void;\n}\n\n/** Adapter-private lifecycle. Transport callbacks must belong to this lifetime. */\nexport function createSourceLifecycle(options: {\n context?: SourceContext;\n send(command: SourceCommand): void;\n recover(pendingClientActionId?: string): void;\n close(): void;\n timeoutMs?: number;\n followHostSeat?: boolean;\n}) {\n let context = options.context ? immutableCopy(options.context) : null;\n const store = createStore<SourceState>(\n Object.freeze({\n snapshot: null,\n connection: \"connecting\",\n request: null,\n failure: null,\n }),\n );\n let session: Omit<PluginSessionDescriptor, \"assets\"> | null = null;\n let assetUrls: Readonly<Record<string, string>> | null = null;\n const playerSummaries = new Map<string, PluginPlayerSummary>();\n let basis: GameplayBasis | null = null;\n let pending: Pending | null = null;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let recovered = false;\n let closed = false;\n const clearTimer = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n const publish = (state: SourceState) => {\n if (state.request) Object.freeze(state.request);\n store.setState(() => Object.freeze(state));\n };\n const recovering = () => {\n if (closed) return;\n publish({ ...store.get(), connection: \"recovering\", failure: null });\n };\n const close = (failure: Error | null) => {\n if (closed) return;\n closed = true;\n clearTimer();\n for (const url of Object.values(assetUrls ?? {})) URL.revokeObjectURL(url);\n pending?.reject(failure ?? new Error(\"Gameplay source disposed.\"));\n pending = null;\n options.close();\n const snapshot = store.get().snapshot;\n publish(\n failure\n ? {\n connection: \"failed\",\n snapshot,\n request: null,\n failure: Object.freeze(failure),\n }\n : { connection: \"closed\", snapshot, request: null, failure: null },\n );\n };\n const fail = (error: Error) => close(error);\n const arm = () => {\n clearTimer();\n timer = setTimeout(() => {\n if (recovered) {\n fail(new Error(\"Gameplay source recovery timed out.\"));\n return;\n }\n recovered = true;\n recovering();\n try {\n options.recover(pending?.command.clientActionId);\n if (pending) options.send(pending.command);\n if (pending) arm();\n } catch (error) {\n fail(asError(error));\n }\n }, options.timeoutMs ?? 10_000);\n };\n const start = async (\n operation: \"submit\" | \"cancel\",\n interactionId: string,\n params?: unknown,\n ) => {\n const state = store.get();\n if (closed || state.connection !== \"ready\" || !basis)\n return Promise.reject(new Error(\"Gameplay source is not open.\"));\n if (pending)\n return Promise.reject(\n new Error(\"A gameplay interaction is already pending.\"),\n );\n const command = immutableCopy(\n PluginToHostPayloadSchema.parse({\n type:\n operation === \"cancel\" ? \"interaction.cancel\" : \"interaction.submit\",\n clientActionId: crypto.randomUUID(),\n basis,\n interactionId,\n ...(operation === \"cancel\" ? {} : { params }),\n }) as SourceCommand,\n );\n recovered = false;\n const promise = new Promise<SubmitResult>((resolve, reject) => {\n pending = { command, resolve, reject };\n });\n publish({\n ...state,\n request: {\n clientActionId: command.clientActionId,\n interactionId,\n operation,\n },\n });\n arm();\n try {\n options.send(command);\n } catch (error) {\n fail(asError(error));\n }\n return promise;\n };\n const source: CommandSource = {\n store: {\n get: () => store.get(),\n subscribe: (listener) => store.subscribe(listener),\n },\n submit: (interactionId, params) => start(\"submit\", interactionId, params),\n cancel: (interactionId) => start(\"cancel\", interactionId),\n dispose: () => close(null),\n };\n return {\n source,\n retry() {\n if (closed || !pending) return;\n try {\n options.send(pending.command);\n } catch (error) {\n fail(asError(error));\n }\n },\n fail,\n recovering,\n session(value: unknown) {\n if (closed) return;\n const { assets, ...parsed } = PluginSessionDescriptorSchema.parse(value);\n if (\n (context?.sessionId ?? session?.sessionId) &&\n parsed.sessionId !== (context?.sessionId ?? session?.sessionId)\n ) {\n fail(new Error(\"Gameplay session changed.\"));\n return;\n }\n session ??= immutableCopy(parsed);\n // Hosts repeat initialization until ready; the first delivery wins.\n assetUrls ??= Object.fromEntries(\n Object.entries(assets ?? {}).map(([path, blob]) => [\n path,\n URL.createObjectURL(blob),\n ]),\n );\n },\n // Transport adapters admit frames before entering this shared lifecycle.\n frame(parsed: PluginGameplayFrame, acknowledgedClientActionId?: string) {\n if (closed) return;\n if (!session) {\n fail(new Error(\"Gameplay frame arrived before session metadata.\"));\n return;\n }\n context ??= {\n sessionId: session.sessionId,\n playerId: parsed.basis.perspectivePlayerId,\n };\n if (parsed.basis.sessionId !== context.sessionId) {\n fail(new Error(\"Gameplay authority session changed.\"));\n return;\n }\n const changedSeat = parsed.basis.perspectivePlayerId !== context.playerId;\n if (changedSeat && !options.followHostSeat) {\n fail(new Error(\"Gameplay perspective changed.\"));\n return;\n }\n if (!parsed.players.includes(parsed.basis.perspectivePlayerId)) {\n fail(new Error(\"Gameplay seat is absent from session.\"));\n return;\n }\n if (changedSeat) {\n clearTimer();\n pending?.reject(new Error(\"Gameplay perspective changed.\"));\n pending = null;\n recovered = false;\n context = { ...context, playerId: parsed.basis.perspectivePlayerId };\n }\n const confirmed =\n pending && pending.command.clientActionId === acknowledgedClientActionId\n ? pending\n : null;\n if (confirmed) {\n clearTimer();\n pending = null;\n recovered = false;\n }\n if (!changedSeat && basis && parsed.basis.version <= basis.version) {\n if (confirmed || store.get().connection === \"recovering\") {\n publish({\n ...store.get(),\n snapshot: store.get().snapshot!,\n request: confirmed ? null : store.get().request,\n connection: \"ready\",\n failure: null,\n });\n }\n confirmed?.resolve({ accepted: true });\n return;\n }\n const { basis: nextBasis, ...frame } = immutableCopy(\n withCardImageUrls(parsed, assetUrls),\n );\n basis = nextBasis;\n publish({\n failure: null,\n request: changedSeat || confirmed ? null : store.get().request,\n snapshot: Object.freeze({\n me: context.playerId,\n players: Object.freeze(\n frame.players.map((playerId, index) => {\n let summary = playerSummaries.get(playerId);\n if (!summary) {\n const metadata = session!.players.find(\n (player) => player.playerId === playerId,\n );\n summary = Object.freeze({\n playerId,\n displayName: metadata?.displayName ?? `Player ${index + 1}`,\n color: metadata?.color ?? playerSeatColor(index),\n });\n playerSummaries.set(playerId, summary);\n }\n return summary;\n }),\n ),\n ...(frame.causedBy === undefined ? {} : { causedBy: frame.causedBy }),\n frame: Object.freeze(frame),\n version: basis.version,\n }),\n connection: \"ready\",\n });\n confirmed?.resolve({ accepted: true });\n },\n result(value: unknown) {\n if (closed) return;\n const result = InteractionResultSchema.parse(value);\n if (!pending || result.clientActionId !== pending.command.clientActionId)\n return;\n const rejected = pending;\n clearTimer();\n pending = null;\n publish({\n snapshot: store.get().snapshot!,\n request: null,\n connection: \"ready\",\n failure: null,\n });\n rejected.resolve(\n immutableCopy({\n accepted: false,\n errorCode: result.errorCode,\n ...(result.message === undefined ? {} : { message: result.message }),\n }),\n );\n },\n };\n}\nfunction asError(error: unknown): Error {\n return error instanceof Error ? error : new Error(String(error));\n}\n\n/** Replaces card image paths in card views and hidden card backs with delivered URLs. */\nfunction withCardImageUrls(\n frame: PluginGameplayFrame,\n urls: Readonly<Record<string, string>> | null,\n): PluginGameplayFrame {\n if (urls === null || Object.keys(urls).length === 0) return frame;\n return {\n ...frame,\n zones: Object.fromEntries(\n Object.entries(frame.zones).map(([zoneId, hosts]) => [\n zoneId,\n Object.fromEntries(\n Object.entries(hosts).map(([hostId, zone]) => [\n hostId,\n {\n ...zone,\n cardViewsById: Object.fromEntries(\n Object.entries(zone.cardViewsById).map(([cardId, card]) => [\n cardId,\n {\n ...card,\n frontImage:\n card.frontImage === undefined\n ? undefined\n : (urls[card.frontImage] ?? card.frontImage),\n backImage:\n card.backImage === undefined\n ? undefined\n : (urls[card.backImage] ?? card.backImage),\n },\n ]),\n ),\n cardBacksById: Object.fromEntries(\n Object.entries(zone.cardBacksById).map(([cardId, path]) => [\n cardId,\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AAe,OAAO;AAAA,gBACpB,OAAO,QAAQ,KAAK,aAAa,EAAE,IAAI,CAAC,CAAC,QAAQ,IAAI,MAAM;AAAA,kBACzD;AAAA,kBACA;AAAA,oBACE,GAAG;AAAA,oBACH,YACE,KAAK,eAAe,SAChB,SACC,KAAK,KAAK,UAAU,KAAK,KAAK;AAAA,oBACrC,WACE,KAAK,cAAc,SACf,SACC,KAAK,KAAK,SAAS,KAAK,KAAK;AAAA,kBACtC;AAAA,gBACF,CAAC;AAAA,cACH;AAAA,cACA,eAAe,OAAO;AAAA,gBACpB,OAAO,QAAQ,KAAK,aAAa,EAAE,IAAI,CAAC,CAAC,QAAQ,IAAI,MAAM;AAAA,kBACzD;AAAA,kBACA,KAAK,IAAI,KAAK;AAAA,gBAChB,CAAC;AAAA,cACH;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["SystemActionEventSchema","SeatProjectionBundleSchema","GameOutcomeSchema","z","z","SeatProjectionBundleSchema","createStore","createStore"]}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
boardSpaceHostId,
|
|
10
10
|
isCardReferenceNamespace,
|
|
11
11
|
parseBoardSpaceHostId
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-VCQ23Z5U.js";
|
|
13
13
|
import {
|
|
14
14
|
AuthoredTileDisclosureSchema,
|
|
15
15
|
BoardProjectionSchema,
|
|
@@ -4275,13 +4275,30 @@ function buildInteractionDescriptor(scope, state, playerId, interactionId, inter
|
|
|
4275
4275
|
scope.manifest
|
|
4276
4276
|
);
|
|
4277
4277
|
const shouldMaterializeInputDomains = decision.available || decision.code === FrameworkErrorCodes.NO_LEGAL_INPUT;
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4278
|
+
let inputs = [];
|
|
4279
|
+
if (shouldMaterializeInputDomains) {
|
|
4280
|
+
const cache = options.projection?.inputDomains;
|
|
4281
|
+
let playerInputs = cache?.get(projectedInteraction);
|
|
4282
|
+
const cached = playerInputs?.get(playerId);
|
|
4283
|
+
if (cached) {
|
|
4284
|
+
inputs = cached;
|
|
4285
|
+
} else {
|
|
4286
|
+
inputs = enrichResourceInputPresentation(
|
|
4287
|
+
collectInteractionInputs(projectedInteraction, domainState, playerId, {
|
|
4288
|
+
queries,
|
|
4289
|
+
definitions: scope.manifest
|
|
4290
|
+
}),
|
|
4291
|
+
scope.manifest
|
|
4292
|
+
);
|
|
4293
|
+
if (cache) {
|
|
4294
|
+
if (!playerInputs) {
|
|
4295
|
+
playerInputs = /* @__PURE__ */ new Map();
|
|
4296
|
+
cache.set(projectedInteraction, playerInputs);
|
|
4297
|
+
}
|
|
4298
|
+
playerInputs.set(playerId, inputs);
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4285
4302
|
const baseDescriptor = {
|
|
4286
4303
|
phaseName,
|
|
4287
4304
|
interactionKey: `${phaseName}.${interactionId}`,
|
|
@@ -6496,7 +6513,8 @@ function createProjectionContext(options) {
|
|
|
6496
6513
|
const q = createStateQueries(options.domainState, options.definitions);
|
|
6497
6514
|
return {
|
|
6498
6515
|
domainState: options.domainState,
|
|
6499
|
-
q
|
|
6516
|
+
q,
|
|
6517
|
+
inputDomains: /* @__PURE__ */ new WeakMap()
|
|
6500
6518
|
};
|
|
6501
6519
|
}
|
|
6502
6520
|
|
|
@@ -7222,4 +7240,4 @@ export {
|
|
|
7222
7240
|
createProjectionBuilder,
|
|
7223
7241
|
createReducerBundle
|
|
7224
7242
|
};
|
|
7225
|
-
//# sourceMappingURL=chunk-
|
|
7243
|
+
//# sourceMappingURL=chunk-M7GZANGG.js.map
|