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

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 (113) hide show
  1. package/README.md +127 -0
  2. package/dist/browser-interaction.d.ts +22 -22
  3. package/dist/{chunk-VRRR6QZT.js → chunk-32PFKDV7.js} +170 -406
  4. package/dist/chunk-32PFKDV7.js.map +1 -0
  5. package/dist/{chunk-N33CGX2F.js → chunk-3BAD4VC2.js} +3 -3
  6. package/dist/{chunk-LMHCGCA6.js → chunk-3SKDNDPG.js} +2 -2
  7. package/dist/chunk-5YV2WHJ4.js +25 -0
  8. package/dist/chunk-5YV2WHJ4.js.map +1 -0
  9. package/dist/{chunk-VWTKGIYF.js → chunk-ANRB4XKA.js} +1 -1
  10. package/dist/chunk-ANRB4XKA.js.map +1 -0
  11. package/dist/{chunk-EOEA3I64.js → chunk-BI4G3PM2.js} +7 -7
  12. package/dist/chunk-BI4G3PM2.js.map +1 -0
  13. package/dist/{chunk-KRJPRYEA.js → chunk-EVCLTY4Q.js} +21 -8
  14. package/dist/chunk-EVCLTY4Q.js.map +1 -0
  15. package/dist/{chunk-DQS2EG5E.js → chunk-GDPKTBUR.js} +2 -2
  16. package/dist/{chunk-FL67RDID.js → chunk-H6VDGFL5.js} +128 -128
  17. package/dist/chunk-H6VDGFL5.js.map +1 -0
  18. package/dist/{chunk-6LMESVGT.js → chunk-LR3ZTWQF.js} +3 -3
  19. package/dist/chunk-LR3ZTWQF.js.map +1 -0
  20. package/dist/{chunk-TXELBVTG.js → chunk-PN5O6GG2.js} +2 -2
  21. package/dist/{chunk-533O7C4L.js → chunk-S2JEDVWH.js} +500 -430
  22. package/dist/chunk-S2JEDVWH.js.map +1 -0
  23. package/dist/{chunk-2GQIALJL.js → chunk-UGH54WZ2.js} +6 -2
  24. package/dist/chunk-UGH54WZ2.js.map +1 -0
  25. package/dist/chunk-VCDWP5VL.js +746 -0
  26. package/dist/chunk-VCDWP5VL.js.map +1 -0
  27. package/dist/{chunk-ZSTCUJKZ.js → chunk-Y75CFE77.js} +2 -6
  28. package/dist/chunk-Y75CFE77.js.map +1 -0
  29. package/dist/chunk-Z7QCREWI.js +3435 -0
  30. package/dist/chunk-Z7QCREWI.js.map +1 -0
  31. package/dist/chunk-ZZGN2ATS.js +1941 -0
  32. package/dist/chunk-ZZGN2ATS.js.map +1 -0
  33. package/dist/{components-CNAt5J1p.d.ts → components-gAbIz7hK.d.ts} +2 -18
  34. package/dist/{definitions-bZSBaPjj.d.ts → definitions-BgmV_GhC.d.ts} +3 -3
  35. package/dist/digest.d.ts +2 -2
  36. package/dist/game-CsZScpcn.d.ts +763 -0
  37. package/dist/{index-CR69MyWr.d.ts → index-CcT9Q7N7.d.ts} +1 -1
  38. package/dist/{index.d-Bw8AOcgp.d.ts → index.d-DjzoK7zn.d.ts} +67 -2
  39. package/dist/index.js +1 -2
  40. package/dist/package-set.js +1 -2
  41. package/dist/plugin-runtime-contract.d.ts +4 -4
  42. package/dist/plugin-runtime-contract.js +13 -15
  43. package/dist/{protocol-CVaSqPgX.d.ts → protocol-dYgafTYY.d.ts} +1 -7
  44. package/dist/reducer/advanced.d.ts +12 -11
  45. package/dist/reducer/advanced.js +10 -4
  46. package/dist/reducer-contract.d.ts +10 -2
  47. package/dist/reducer-contract.js +4 -4
  48. package/dist/reducer.d.ts +12 -689
  49. package/dist/reducer.js +19 -1293
  50. package/dist/reducer.js.map +1 -1
  51. package/dist/runtime/primitives.d.ts +4 -4
  52. package/dist/runtime/primitives.js +5 -5
  53. package/dist/runtime/runtime-api.d.ts +2 -2
  54. package/dist/runtime/workspace-contract.d.ts +50 -17
  55. package/dist/runtime/workspace-contract.js +15 -10
  56. package/dist/{runtime-C7Z2acNU.d.ts → runtime-RJ5orDJU.d.ts} +23 -30
  57. package/dist/{plugin-state-BRH3UiUp.d.ts → runtime-api-Bz5pwNU_.d.ts} +86 -4
  58. package/dist/runtime.d.ts +8 -8
  59. package/dist/runtime.js +19 -17
  60. package/dist/runtime.js.map +1 -1
  61. package/dist/schema.d.ts +2 -28
  62. package/dist/testing-compiler.d.ts +4 -4
  63. package/dist/testing-runtime.d.ts +7 -7
  64. package/dist/testing-runtime.js +6 -6
  65. package/dist/testing.d.ts +17 -17
  66. package/dist/testing.js +14 -14
  67. package/dist/{types-q1Guidm5.d.ts → types-DR7DoB1x.d.ts} +1 -1
  68. package/dist/{types-DN4O7kH_.d.ts → types-JWCYHmu7.d.ts} +2 -2
  69. package/dist/types.js +6 -18
  70. package/dist/types.js.map +1 -1
  71. package/dist/ui/components.d.ts +3 -4
  72. package/dist/ui/components.js +1 -5
  73. package/dist/{ui-contract-BC4JpysE.d.ts → ui-contract-GTUPkf8z.d.ts} +175 -176
  74. package/dist/ui.d.ts +4 -5
  75. package/dist/ui.js +2 -6
  76. package/dist/{views-D2Cfzr3h.d.ts → views-BpuWcOyN.d.ts} +101 -48
  77. package/package.json +3 -22
  78. package/dist/authoring/index.d.ts +0 -59
  79. package/dist/authoring/index.js +0 -24
  80. package/dist/authoring/index.js.map +0 -1
  81. package/dist/authoring-compiler.d.ts +0 -27
  82. package/dist/authoring-compiler.js +0 -11
  83. package/dist/authoring-compiler.js.map +0 -1
  84. package/dist/authoring-materialize-cli.d.ts +0 -1
  85. package/dist/authoring-materialize-cli.js +0 -45
  86. package/dist/authoring-materialize-cli.js.map +0 -1
  87. package/dist/chunk-2GQIALJL.js.map +0 -1
  88. package/dist/chunk-533O7C4L.js.map +0 -1
  89. package/dist/chunk-6LMESVGT.js.map +0 -1
  90. package/dist/chunk-EOEA3I64.js.map +0 -1
  91. package/dist/chunk-FL67RDID.js.map +0 -1
  92. package/dist/chunk-HIH6Y4FA.js +0 -7802
  93. package/dist/chunk-HIH6Y4FA.js.map +0 -1
  94. package/dist/chunk-HUK4234C.js +0 -166
  95. package/dist/chunk-HUK4234C.js.map +0 -1
  96. package/dist/chunk-KGV2EUNN.js +0 -532
  97. package/dist/chunk-KGV2EUNN.js.map +0 -1
  98. package/dist/chunk-KRJPRYEA.js.map +0 -1
  99. package/dist/chunk-KWHOFBDM.js +0 -9
  100. package/dist/chunk-KWHOFBDM.js.map +0 -1
  101. package/dist/chunk-VRRR6QZT.js.map +0 -1
  102. package/dist/chunk-VWTKGIYF.js.map +0 -1
  103. package/dist/chunk-XFMSLL3P.js +0 -637
  104. package/dist/chunk-XFMSLL3P.js.map +0 -1
  105. package/dist/chunk-ZSTCUJKZ.js.map +0 -1
  106. package/dist/codegen.d.ts +0 -941
  107. package/dist/codegen.js +0 -44
  108. package/dist/codegen.js.map +0 -1
  109. package/dist/runtime-api-CgPuEVeF.d.ts +0 -86
  110. /package/dist/{chunk-N33CGX2F.js.map → chunk-3BAD4VC2.js.map} +0 -0
  111. /package/dist/{chunk-LMHCGCA6.js.map → chunk-3SKDNDPG.js.map} +0 -0
  112. /package/dist/{chunk-DQS2EG5E.js.map → chunk-GDPKTBUR.js.map} +0 -0
  113. /package/dist/{chunk-TXELBVTG.js.map → chunk-PN5O6GG2.js.map} +0 -0
@@ -1,22 +1,27 @@
1
1
  import {
2
+ createGameUi,
2
3
  createGameUiContract,
3
4
  createWorkspaceUIContract
4
- } from "../chunk-KRJPRYEA.js";
5
- import "../chunk-VWTKGIYF.js";
6
- import "../chunk-6LMESVGT.js";
5
+ } from "../chunk-EVCLTY4Q.js";
6
+ import "../chunk-ANRB4XKA.js";
7
+ import "../chunk-PN5O6GG2.js";
8
+ import "../chunk-LR3ZTWQF.js";
7
9
  import "../chunk-T3ZKNUZ7.js";
8
- import "../chunk-DQS2EG5E.js";
9
- import "../chunk-TXELBVTG.js";
10
- import "../chunk-FL67RDID.js";
11
- import "../chunk-LMHCGCA6.js";
12
- import "../chunk-VRRR6QZT.js";
10
+ import "../chunk-GDPKTBUR.js";
11
+ import "../chunk-3SKDNDPG.js";
12
+ import "../chunk-32PFKDV7.js";
13
13
  import "../chunk-VDXOF4FW.js";
14
14
  import "../chunk-WHR5UW3F.js";
15
+ import "../chunk-VCDWP5VL.js";
16
+ import "../chunk-ZZGN2ATS.js";
17
+ import "../chunk-H6VDGFL5.js";
18
+ import "../chunk-5YV2WHJ4.js";
15
19
  import "../chunk-PF7L4BMG.js";
16
- import "../chunk-XFMSLL3P.js";
17
- import "../chunk-2GQIALJL.js";
20
+ import "../chunk-Z7QCREWI.js";
21
+ import "../chunk-UGH54WZ2.js";
18
22
  import "../chunk-PZ5AY32C.js";
19
23
  export {
24
+ createGameUi,
20
25
  createGameUiContract,
21
26
  createWorkspaceUIContract
22
27
  };
@@ -1,12 +1,11 @@
1
1
  import { z } from 'zod';
2
2
  import { CardCollection, ViewCard, ViewSlotOccupant } from './types.js';
3
- import { d, O, s, t, u } from './protocol-CVaSqPgX.js';
3
+ import { d, O, s, t, u } from './protocol-dYgafTYY.js';
4
4
 
5
5
  /**
6
6
  * Opaque brand applied to a runtime player identifier.
7
7
  *
8
- * Generators produce a workspace-specific `PlayerId` alias (e.g.
9
- * `Brand<string, "PlayerId">` in `shared/manifest-contract.ts`). Authors
8
+ * The reducer owns the branded `PlayerId` identity. Authors
10
9
  * obtain `PlayerId` values only through:
11
10
  * - `q.player.order()` / `q.player.current()` (reducer queries),
12
11
  * - engine-injected callback arguments (actions, phases, prompts),
@@ -421,7 +420,7 @@ type TableOfState<State> = State extends {
421
420
  } ? Table : never;
422
421
  type TableOfManifest<Manifest> = Manifest extends {
423
422
  tableSchema: z.ZodType<infer Table extends RuntimeTableRecord>;
424
- } ? Table : Manifest extends GeneratedManifestContractLike<infer Table> ? Table : never;
423
+ } ? Table : Manifest extends ReducerManifestContractLike<infer Table> ? Table : never;
425
424
  type PhaseNameOfState<State> = State extends {
426
425
  flow: {
427
426
  currentPhase: infer PhaseName;
@@ -823,9 +822,9 @@ type SetupSelectionOfManifest<Manifest> = {
823
822
  profileId: SetupProfileIdOfManifest<Manifest>;
824
823
  optionValues: Record<SetupOptionIdOfManifest<Manifest>, string | null>;
825
824
  };
826
- type RuntimeSetupSelectionInput<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupSelectionInputOfManifest<Manifest>;
827
- type RuntimeSetupSelection<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupSelectionOfManifest<Manifest>;
828
- type RuntimeSetupSelectionOverride<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupSelectionInputOfManifest<Manifest>;
825
+ type RuntimeSetupSelectionInput<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = SetupSelectionInputOfManifest<Manifest>;
826
+ type RuntimeSetupSelection<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = SetupSelectionOfManifest<Manifest>;
827
+ type RuntimeSetupSelectionOverride<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = SetupSelectionInputOfManifest<Manifest>;
829
828
  type StateDefinitionOfContract<Contract> = Contract extends {
830
829
  state: infer StateDefinitionValue;
831
830
  } ? StateDefinitionValue : never;
@@ -840,7 +839,7 @@ type PrivateSchemaOfContract<Contract> = StateDefinitionOfContract<Contract> ext
840
839
  type HiddenSchemaOfContract<Contract> = StateDefinitionOfContract<Contract> extends StateDefinition<SchemaLike<object>, SchemaLike<object>, infer HiddenSchema> ? HiddenSchema : never;
841
840
  type PhaseNameOfContract<Contract> = keyof PhaseSchemasOfContract<Contract> extends string ? keyof PhaseSchemasOfContract<Contract> & string : PhaseNameOfManifest<ManifestOf<Contract>>;
842
841
  type ManifestContractOf<Contract> = ManifestContract<TableOfManifest<ManifestOf<Contract>>>;
843
- type ExactManifestContractOf<Contract> = ManifestOf<Contract> & GeneratedManifestContractLike<TableOfManifest<ManifestOf<Contract>>>;
842
+ type ExactManifestContractOf<Contract> = ManifestOf<Contract> & ReducerManifestContractLike<TableOfManifest<ManifestOf<Contract>>>;
844
843
  type PhaseNameOf<Source> = Source extends {
845
844
  flow: {
846
845
  currentPhase: infer PhaseName;
@@ -1204,12 +1203,6 @@ type ManifestNormalSetup<Table extends RuntimeTableRecord> = {
1204
1203
  }) => Table;
1205
1204
  };
1206
1205
  type StaticBoards<Table extends RuntimeTableRecord> = Pick<Table["boards"], "byId" | "hex" | "square">;
1207
- type StaticBoardsJsonEnvelope<Table extends RuntimeTableRecord = RuntimeTableRecord> = {
1208
- formatVersion: 1;
1209
- generatedBy: "@dreamboard-games/sdk/codegen";
1210
- boards: StaticBoards<Table>;
1211
- initialTable: Table;
1212
- };
1213
1206
  type SetupOptionChoiceMetadata = {
1214
1207
  id: string;
1215
1208
  label: string;
@@ -1240,11 +1233,11 @@ type ReducerManifestContract<Table extends RuntimeTableRecord, PhaseName extends
1240
1233
  ids: ManifestIds<PlayerId, DeckId, HandId, CardId, PhaseName>;
1241
1234
  defaults: ManifestDefaults<Table>;
1242
1235
  /**
1243
- * Generic normal-session setup capability emitted by workspace codegen.
1236
+ * Normal-session setup capability supplied by the manifest compiler.
1244
1237
  *
1245
1238
  * This remains optional on the structural contract so small handwritten
1246
1239
  * manifests can model focused reducer tests without recreating generated
1247
- * topology metadata. Generated workspace manifests always provide it.
1240
+ * topology metadata. Compiled manifests always provide it.
1248
1241
  */
1249
1242
  normalSetup?: ManifestNormalSetup<Table>;
1250
1243
  staticBoards?: StaticBoards<Table>;
@@ -1261,7 +1254,7 @@ type ReducerManifestContract<Table extends RuntimeTableRecord, PhaseName extends
1261
1254
  phasesSchema: AnySchema;
1262
1255
  }) => AnySchema;
1263
1256
  };
1264
- type GeneratedManifestContractLike<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>;
1257
+ 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>;
1265
1258
  type ManifestContract<Table extends RuntimeTableRecord> = ReducerManifestContract<Table, string, PlayerIdOfTable<Table>, DeckIdOfTable<Table>, HandIdOfTable<Table>, CardIdOfTable<Table>>;
1266
1259
  declare function markManifestScopedSchema<Schema extends z.ZodTypeAny, const Family extends ManifestIdFamily | undefined = undefined>(schema: Schema, family?: Family): Schema & ManifestIdSchema<z.infer<Schema>, Family>;
1267
1260
  declare function isManifestScopedSchema(schema: unknown): boolean;
@@ -1412,41 +1405,41 @@ type InitContext<Table extends RuntimeTableRecord, Manifest extends ReducerManif
1412
1405
  table: Table;
1413
1406
  }>;
1414
1407
  };
1415
- type InitSetupSelectionInput<Manifest extends ReducerManifestContract<RuntimeTableRecord, string, string, string, string, string> = GeneratedManifestContractLike> = SetupSelectionInputOfManifest<Manifest>;
1416
- type SetupBootstrapSharedZoneRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
1408
+ type InitSetupSelectionInput<Manifest extends ReducerManifestContract<RuntimeTableRecord, string, string, string, string, string> = ReducerManifestContractLike> = SetupSelectionInputOfManifest<Manifest>;
1409
+ type SetupBootstrapSharedZoneRef<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = {
1417
1410
  type: "sharedZone";
1418
1411
  zoneId: SharedZoneIdOfManifest<Manifest>;
1419
1412
  };
1420
- type SetupBootstrapPerPlayerZoneRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
1413
+ type SetupBootstrapPerPlayerZoneRef<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = {
1421
1414
  type: "playerZone";
1422
1415
  zoneId: PlayerZoneIdOfManifest<Manifest>;
1423
1416
  playerId: PlayerIdOfManifest<Manifest>;
1424
1417
  };
1425
- type SetupBootstrapSharedBoardContainerRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
1418
+ type SetupBootstrapSharedBoardContainerRef<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = {
1426
1419
  type: "sharedBoardContainer";
1427
1420
  boardId: BoardBaseIdOfManifest<Manifest>;
1428
1421
  containerId: BoardContainerIdOfManifest<Manifest>;
1429
1422
  };
1430
- type SetupBootstrapPerPlayerBoardContainerRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
1423
+ type SetupBootstrapPerPlayerBoardContainerRef<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = {
1431
1424
  type: "playerBoardContainer";
1432
1425
  boardId: BoardBaseIdOfManifest<Manifest>;
1433
1426
  playerId: PlayerIdOfManifest<Manifest>;
1434
1427
  containerId: BoardContainerIdOfManifest<Manifest>;
1435
1428
  };
1436
- type SetupBootstrapSharedBoardSpaceRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
1429
+ type SetupBootstrapSharedBoardSpaceRef<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = {
1437
1430
  type: "sharedBoardSpace";
1438
1431
  boardId: BoardBaseIdOfManifest<Manifest>;
1439
1432
  spaceId: SpaceIdOfManifest<Manifest>;
1440
1433
  };
1441
- type SetupBootstrapPerPlayerBoardSpaceRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
1434
+ type SetupBootstrapPerPlayerBoardSpaceRef<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = {
1442
1435
  type: "playerBoardSpace";
1443
1436
  boardId: BoardBaseIdOfManifest<Manifest>;
1444
1437
  playerId: PlayerIdOfManifest<Manifest>;
1445
1438
  spaceId: SpaceIdOfManifest<Manifest>;
1446
1439
  };
1447
- type SetupBootstrapContainerRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupBootstrapSharedZoneRef<Manifest> | SetupBootstrapPerPlayerZoneRef<Manifest> | SetupBootstrapSharedBoardContainerRef<Manifest> | SetupBootstrapPerPlayerBoardContainerRef<Manifest>;
1448
- type SetupBootstrapDestinationRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = SetupBootstrapContainerRef<Manifest> | SetupBootstrapSharedBoardSpaceRef<Manifest> | SetupBootstrapPerPlayerBoardSpaceRef<Manifest>;
1449
- type SetupBootstrapPerPlayerContainerTemplateRef<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
1440
+ type SetupBootstrapContainerRef<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = SetupBootstrapSharedZoneRef<Manifest> | SetupBootstrapPerPlayerZoneRef<Manifest> | SetupBootstrapSharedBoardContainerRef<Manifest> | SetupBootstrapPerPlayerBoardContainerRef<Manifest>;
1441
+ type SetupBootstrapDestinationRef<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = SetupBootstrapContainerRef<Manifest> | SetupBootstrapSharedBoardSpaceRef<Manifest> | SetupBootstrapPerPlayerBoardSpaceRef<Manifest>;
1442
+ type SetupBootstrapPerPlayerContainerTemplateRef<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = {
1450
1443
  type: "playerZone";
1451
1444
  zoneId: PlayerZoneIdOfManifest<Manifest>;
1452
1445
  } | {
@@ -1454,7 +1447,7 @@ type SetupBootstrapPerPlayerContainerTemplateRef<Manifest extends GeneratedManif
1454
1447
  boardId: BoardBaseIdOfManifest<Manifest>;
1455
1448
  containerId: BoardContainerIdOfManifest<Manifest>;
1456
1449
  };
1457
- type SetupBootstrapStep<Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
1450
+ type SetupBootstrapStep<Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = {
1458
1451
  type: "shuffle";
1459
1452
  container: SetupBootstrapContainerRef<Manifest>;
1460
1453
  } | {
@@ -1470,7 +1463,7 @@ type SetupBootstrapStep<Manifest extends GeneratedManifestContractLike = Generat
1470
1463
  count: number;
1471
1464
  playerIds?: readonly PlayerIdOfManifest<Manifest>[];
1472
1465
  };
1473
- type SetupProfileDefinition<PhaseName extends string = string, Manifest extends GeneratedManifestContractLike = GeneratedManifestContractLike> = {
1466
+ type SetupProfileDefinition<PhaseName extends string = string, Manifest extends ReducerManifestContractLike = ReducerManifestContractLike> = {
1474
1467
  initialPhase?: PhaseName;
1475
1468
  bootstrap?: readonly SetupBootstrapStep<Manifest>[];
1476
1469
  };
@@ -1703,4 +1696,4 @@ type ReducerAccept<State> = {
1703
1696
  };
1704
1697
  type ReducerResult<State> = ReducerAccept<State> | ReducerReject;
1705
1698
 
1706
- export { type HexEdgeIdOfTable as $, type AnyContinuationToken as A, type BoardBaseIdOfManifest as B, type CardIdOfDeck as C, type ContinuationResponseOf as D, type ContinuationToken as E, type DeckCardsOfTable as F, type DeckIdOfState as G, type DeckIdOfTable as H, type DieIdOfManifest as I, type EdgeTypeIdOfManifest as J, type EffectInvokeOptions as K, type EffectSpecLike as L, type EffectTypeTag as M, type ErrorCodeOfContract as N, type ExactManifestContractOf as O, type FlowState as P, type FrameworkErrorCode as Q, FrameworkErrorCodes as R, type GameEvent as S, type GameEventDetail as T, type GameOutcome as U, type GeneratedManifestContractLike as V, type HandCardsOfTable as W, type HandIdOfState as X, type HandIdOfTable as Y, type HexBoardIdOfTable as Z, type HexBoardStateOfTable as _, type AnySchema as a, type ResolvedContainerLocation as a$, type HexEdgeStateOfTable as a0, type HexEdgeTypeIdOfTable as a1, type HexSpaceIdOfTable as a2, type HexSpaceTypeIdOfTable as a3, type HexVertexIdOfTable as a4, type HexVertexStateOfTable as a5, type HexVertexTypeIdOfTable as a6, type HiddenSchemaOfContract as a7, type HiddenStateOfState as a8, type InitContext as a9, type PhaseStateMapOfContract as aA, type PhaseStateOfState as aB, type PhaseStepOfState as aC, type PieceIdOfManifest as aD, type PlayerId as aE, type PlayerIdOfManifest as aF, type PlayerIdOfState as aG, type PlayerIdOfTable as aH, type PlayerZoneIdOfManifest as aI, type PlayerZoneIdOfState as aJ, type PlayerZoneIdOfTable as aK, type PrivateSchemaOfContract as aL, type PrivateStateOfState as aM, type PublicSchemaOfContract as aN, type PublicStateOfState as aO, type ReducerAccept as aP, type ReducerAcceptOptions as aQ, type ReducerFx as aR, type ReducerGameState as aS, type ReducerManifestContract as aT, type ReducerReject as aU, type ReducerResult as aV, type ReducerRuntimeStateForState as aW, type ReducerSessionState as aX, type ReducerValidationResult as aY, type RelationTypeIdOfManifest as aZ, type RelationTypeIdOfTable as a_, type InitSetupSelectionInput as aa, type ManifestContract as ab, type ManifestContractOf as ac, type ManifestDefaults as ad, type ManifestIdFamily as ae, type ManifestIdSchema as af, type ManifestIds as ag, type ManifestLiterals as ah, type ManifestNormalSetup as ai, type ManifestOf as aj, type NonEmptyReadonlyArray as ak, type OutcomeResult as al, type OutcomeScoreComponent as am, type OutcomeStanding as an, type OutcomeTieBreak as ao, type PerPlayer as ap, type PerPlayerBoardRef as aq, type PerPlayerSchemaOptions as ar, type PhaseAccessor as as, type PhaseMapOfState as at, type PhaseNameOf as au, type PhaseNameOfContract as av, type PhaseNameOfManifest as aw, type PhaseNameOfState as ax, type PhasePayload as ay, type PhaseSchemasOfContract as az, type BoardContainerIdOfManifest as b, type RuntimeVisibilityMap as b$, type ResolvedDeckLocation as b0, type ResolvedEdgeLocation as b1, type ResolvedHandLocation as b2, type ResolvedSlotLocation as b3, type ResolvedSpaceLocation as b4, type ResolvedVertexLocation as b5, type ResolvedZoneLocation as b6, type ResourceAmountsOfTable as b7, type ResourceBalancesOfState as b8, type ResourceBalancesOfTable as b9, type RuntimePayload as bA, type RuntimePhaseState as bB, type RuntimePieceData as bC, type RuntimeRecord as bD, type RuntimeResourceMap as bE, type RuntimeRngDraw as bF, type RuntimeRngOperation as bG, type RuntimeRngOperationParameter as bH, type RuntimeRngState as bI, type RuntimeScalar as bJ, type RuntimeSetupSelection as bK, type RuntimeSetupSelectionInput as bL, type RuntimeSetupSelectionOverride as bM, type RuntimeSimultaneousState as bN, type RuntimeSimultaneousSubmission as bO, type RuntimeSlotHostRef as bP, type RuntimeSquareBoardState as bQ, type RuntimeSquareEdgeState as bR, type RuntimeSquareSpaceState as bS, type RuntimeSquareVertexState as bT, type RuntimeState as bU, type RuntimeTableRecord as bV, type RuntimeTiledBoardBaseState as bW, type RuntimeTiledBoardState as bX, type RuntimeTiledEdgeState as bY, type RuntimeTiledSpaceState as bZ, type RuntimeTiledVertexState as b_, type ResourceIdOfManifest as ba, type ResourceIdOfState as bb, type ResourceIdOfTable as bc, type RuntimeBoardBaseState as bd, type RuntimeBoardCollections as be, type RuntimeBoardCompatibilityState as bf, type RuntimeBoardContainerState as bg, type RuntimeBoardRelationState as bh, type RuntimeBoardSpaceState as bi, type RuntimeBoardState as bj, type RuntimeCardData as bk, type RuntimeCardVisibility as bl, type RuntimeComponentLocation as bm, type RuntimeComponentLocationMap as bn, type RuntimeDeckMap as bo, type RuntimeDieData as bp, type RuntimeGenericBoardState as bq, type RuntimeHandMap as br, type RuntimeHandVisibilityMode as bs, type RuntimeHexBoardState as bt, type RuntimeHexEdgeState as bu, type RuntimeHexOrientation as bv, type RuntimeHexSpaceState as bw, type RuntimeHexVertexState as bx, type RuntimeOwnerMap as by, type RuntimeParams as bz, type BoardContainerIdOfTable as c, boardRef as c$, type RuntimeZoneMap as c0, type SchemaLike as c1, type SetupBootstrapContainerRef as c2, type SetupBootstrapDestinationRef as c3, type SetupBootstrapPerPlayerBoardContainerRef as c4, type SetupBootstrapPerPlayerBoardSpaceRef as c5, type SetupBootstrapPerPlayerContainerTemplateRef as c6, type SetupBootstrapPerPlayerZoneRef as c7, type SetupBootstrapSharedBoardContainerRef as c8, type SetupBootstrapSharedBoardSpaceRef as c9, type SquareVertexStateOfTable as cA, type SquareVertexTypeIdOfTable as cB, type StateDefinition as cC, type StateDefinitionOfContract as cD, type StaticBoards as cE, type StaticBoardsJsonEnvelope as cF, type StringKeyOf as cG, type SystemActionEvent as cH, type TableOfManifest as cI, type TableOfState as cJ, type TableQueries as cK, type TableQueriesOfState as cL, type TiledBoardIdOfTable as cM, type TiledBoardStateOfTable as cN, type TiledEdgeIdOfTable as cO, type TiledEdgeMap as cP, type TiledEdgeStateOfTable as cQ, type TiledEdgeTypeIdOfTable as cR, type TiledSpaceIdOfTable as cS, type TiledSpaceMap as cT, type TiledVertexIdOfTable as cU, type TiledVertexMap as cV, type TiledVertexStateOfTable as cW, type TiledVertexTypeIdOfTable as cX, type VertexTypeIdOfManifest as cY, asPlayerId as cZ, assumeManifestSchema as c_, type SetupBootstrapSharedZoneRef as ca, type SetupBootstrapStep as cb, type SetupOptionChoiceMetadata as cc, type SetupOptionIdOfManifest as cd, type SetupOptionMetadata as ce, type SetupProfileDefinition as cf, type SetupProfileIdOfManifest as cg, type SetupProfileMetadata as ch, type SetupSelectionInputOfManifest as ci, type SetupSelectionOfManifest as cj, type SharedBoardRef as ck, type SharedZoneIdOfManifest as cl, type SharedZoneIdOfState as cm, type SharedZoneIdOfTable as cn, type SpaceIdOfManifest as co, type SpaceIdOfTable as cp, type SpaceTypeIdOfManifest as cq, type SpaceTypeIdOfTable as cr, type SquareBoardIdOfTable as cs, type SquareBoardStateOfTable as ct, type SquareEdgeIdOfTable as cu, type SquareEdgeStateOfTable as cv, type SquareEdgeTypeIdOfTable as cw, type SquareSpaceIdOfTable as cx, type SquareSpaceTypeIdOfTable as cy, type SquareVertexIdOfTable as cz, type BoardIdOfManifest as d, boardRefKey as d0, boardRefSchema as d1, cloneManifestDefault as d2, createManifestGameStateSchema as d3, createManifestRuntimeSchema as d4, createManifestStringLiteralSchema as d5, isManifestScopedSchema as d6, isPerPlayer as d7, isPerPlayerBoardRef as d8, isPlayerId as d9, isSharedBoardRef as da, manifestSchemaFamily as db, markManifestScopedSchema as dc, parseBoardRefKey as dd, perPlayer as de, perPlayerBoardRef as df, perPlayerEntries as dg, perPlayerGet as dh, perPlayerHas as di, perPlayerKeys as dj, perPlayerMap as dk, perPlayerRequire as dl, perPlayerSchema as dm, perPlayerSet as dn, perPlayerSize as dp, perPlayerValues as dq, resolveManifestPlayerIds as dr, sharedBoardRef as ds, type BoardIdOfTable as e, type BoardLayoutOfManifest as f, type BoardMapOfTable as g, type BoardRef as h, type BoardStateOfTable as i, type BoardTypeIdOfManifest as j, type BoardTypeIdOfTable as k, type Brand as l, type CardIdOfHand as m, type CardIdOfManifest as n, type CardIdOfState as o, type CardIdOfTable as p, type CardTypeOfState as q, type CardTypeOfTable as r, type ChoiceOption as s, type CompatibleCardIdForHandAndDeck as t, type CompatibleCardIdForTwoPlayerZones as u, type CompatibleHandIdForDeck as v, type ComponentDataOfTable as w, type ComponentIdOfTable as x, type ComponentLocationByTypeOfTable as y, type ComponentLocationOfTable as z };
1699
+ export { type HexEdgeStateOfTable as $, type AnyContinuationToken as A, type BoardBaseIdOfManifest as B, type CardIdOfDeck as C, type ContinuationResponseOf as D, type ContinuationToken as E, type DeckCardsOfTable as F, type DeckIdOfState as G, type DeckIdOfTable as H, type DieIdOfManifest as I, type EdgeTypeIdOfManifest as J, type EffectInvokeOptions as K, type EffectSpecLike as L, type EffectTypeTag as M, type ErrorCodeOfContract as N, type ExactManifestContractOf as O, type FlowState as P, type FrameworkErrorCode as Q, FrameworkErrorCodes as R, type GameEvent as S, type GameEventDetail as T, type GameOutcome as U, type HandCardsOfTable as V, type HandIdOfState as W, type HandIdOfTable as X, type HexBoardIdOfTable as Y, type HexBoardStateOfTable as Z, type HexEdgeIdOfTable as _, type AnySchema as a, type ResolvedContainerLocation as a$, type HexEdgeTypeIdOfTable as a0, type HexSpaceIdOfTable as a1, type HexSpaceTypeIdOfTable as a2, type HexVertexIdOfTable as a3, type HexVertexStateOfTable as a4, type HexVertexTypeIdOfTable as a5, type HiddenSchemaOfContract as a6, type HiddenStateOfState as a7, type InitContext as a8, type InitSetupSelectionInput as a9, type PhaseStateOfState as aA, type PhaseStepOfState as aB, type PieceIdOfManifest as aC, type PlayerId as aD, type PlayerIdOfManifest as aE, type PlayerIdOfState as aF, type PlayerIdOfTable as aG, type PlayerZoneIdOfManifest as aH, type PlayerZoneIdOfState as aI, type PlayerZoneIdOfTable as aJ, type PrivateSchemaOfContract as aK, type PrivateStateOfState as aL, type PublicSchemaOfContract as aM, type PublicStateOfState as aN, type ReducerAccept as aO, type ReducerAcceptOptions as aP, type ReducerFx as aQ, type ReducerGameState as aR, type ReducerManifestContract as aS, type ReducerManifestContractLike as aT, type ReducerReject as aU, type ReducerResult as aV, type ReducerRuntimeStateForState as aW, type ReducerSessionState as aX, type ReducerValidationResult as aY, type RelationTypeIdOfManifest as aZ, type RelationTypeIdOfTable as a_, type ManifestContract as aa, type ManifestContractOf as ab, type ManifestDefaults as ac, type ManifestIdFamily as ad, type ManifestIdSchema as ae, type ManifestIds as af, type ManifestLiterals as ag, type ManifestNormalSetup as ah, type ManifestOf as ai, type NonEmptyReadonlyArray as aj, type OutcomeResult as ak, type OutcomeScoreComponent as al, type OutcomeStanding as am, type OutcomeTieBreak as an, type PerPlayer as ao, type PerPlayerBoardRef as ap, type PerPlayerSchemaOptions as aq, type PhaseAccessor as ar, type PhaseMapOfState as as, type PhaseNameOf as at, type PhaseNameOfContract as au, type PhaseNameOfManifest as av, type PhaseNameOfState as aw, type PhasePayload as ax, type PhaseSchemasOfContract as ay, type PhaseStateMapOfContract as az, type BoardContainerIdOfManifest as b, type RuntimeTiledVertexState as b$, type ResolvedDeckLocation as b0, type ResolvedEdgeLocation as b1, type ResolvedHandLocation as b2, type ResolvedSlotLocation as b3, type ResolvedSpaceLocation as b4, type ResolvedVertexLocation as b5, type ResolvedZoneLocation as b6, type ResourceAmountsOfTable as b7, type ResourceBalancesOfState as b8, type ResourceBalancesOfTable as b9, type RuntimeParams as bA, type RuntimePayload as bB, type RuntimePhaseState as bC, type RuntimePieceData as bD, type RuntimeRecord as bE, type RuntimeResourceMap as bF, type RuntimeRngDraw as bG, type RuntimeRngOperation as bH, type RuntimeRngOperationParameter as bI, type RuntimeRngState as bJ, type RuntimeScalar as bK, type RuntimeSetupSelection as bL, type RuntimeSetupSelectionInput as bM, type RuntimeSetupSelectionOverride as bN, type RuntimeSimultaneousState as bO, type RuntimeSimultaneousSubmission as bP, type RuntimeSlotHostRef as bQ, type RuntimeSquareBoardState as bR, type RuntimeSquareEdgeState as bS, type RuntimeSquareSpaceState as bT, type RuntimeSquareVertexState as bU, type RuntimeState as bV, type RuntimeTableRecord as bW, type RuntimeTiledBoardBaseState as bX, type RuntimeTiledBoardState as bY, type RuntimeTiledEdgeState as bZ, type RuntimeTiledSpaceState as b_, type ResourceIdOfManifest as ba, type ResourceIdOfState as bb, type ResourceIdOfTable as bc, type RuntimeBoardBaseState as bd, type RuntimeBoardCollections as be, type RuntimeBoardCompatibilityState as bf, type RuntimeBoardContainerState as bg, type RuntimeBoardRelationState as bh, type RuntimeBoardSpaceState as bi, type RuntimeBoardState as bj, type RuntimeCardData as bk, type RuntimeCardVisibility as bl, type RuntimeComponentLocation as bm, type RuntimeComponentLocationMap as bn, type RuntimeDeckMap as bo, type RuntimeDieData as bp, type RuntimeGenericBoardState as bq, type RuntimeHandMap as br, type RuntimeHandVisibilityMode as bs, type RuntimeHexBoardState as bt, type RuntimeHexEdgeState as bu, type RuntimeHexOrientation as bv, type RuntimeHexSpaceState as bw, type RuntimeHexVertexState as bx, type RuntimeInstructionForState as by, type RuntimeOwnerMap as bz, type BoardContainerIdOfTable as c, boardRef as c$, type RuntimeVisibilityMap as c0, type RuntimeZoneMap as c1, type SchemaLike as c2, type SetupBootstrapContainerRef as c3, type SetupBootstrapDestinationRef as c4, type SetupBootstrapPerPlayerBoardContainerRef as c5, type SetupBootstrapPerPlayerBoardSpaceRef as c6, type SetupBootstrapPerPlayerContainerTemplateRef as c7, type SetupBootstrapPerPlayerZoneRef as c8, type SetupBootstrapSharedBoardContainerRef as c9, type SquareVertexIdOfTable as cA, type SquareVertexStateOfTable as cB, type SquareVertexTypeIdOfTable as cC, type StateDefinition as cD, type StateDefinitionOfContract as cE, type StaticBoards as cF, type StringKeyOf as cG, type SystemActionEvent as cH, type TableOfManifest as cI, type TableOfState as cJ, type TableQueries as cK, type TableQueriesOfState as cL, type TiledBoardIdOfTable as cM, type TiledBoardStateOfTable as cN, type TiledEdgeIdOfTable as cO, type TiledEdgeMap as cP, type TiledEdgeStateOfTable as cQ, type TiledEdgeTypeIdOfTable as cR, type TiledSpaceIdOfTable as cS, type TiledSpaceMap as cT, type TiledVertexIdOfTable as cU, type TiledVertexMap as cV, type TiledVertexStateOfTable as cW, type TiledVertexTypeIdOfTable as cX, type VertexTypeIdOfManifest as cY, asPlayerId as cZ, assumeManifestSchema as c_, type SetupBootstrapSharedBoardSpaceRef as ca, type SetupBootstrapSharedZoneRef as cb, type SetupBootstrapStep as cc, type SetupOptionChoiceMetadata as cd, type SetupOptionIdOfManifest as ce, type SetupOptionMetadata as cf, type SetupProfileDefinition as cg, type SetupProfileIdOfManifest as ch, type SetupProfileMetadata as ci, type SetupSelectionInputOfManifest as cj, type SetupSelectionOfManifest as ck, type SharedBoardRef as cl, type SharedZoneIdOfManifest as cm, type SharedZoneIdOfState as cn, type SharedZoneIdOfTable as co, type SpaceIdOfManifest as cp, type SpaceIdOfTable as cq, type SpaceTypeIdOfManifest as cr, type SpaceTypeIdOfTable as cs, type SquareBoardIdOfTable as ct, type SquareBoardStateOfTable as cu, type SquareEdgeIdOfTable as cv, type SquareEdgeStateOfTable as cw, type SquareEdgeTypeIdOfTable as cx, type SquareSpaceIdOfTable as cy, type SquareSpaceTypeIdOfTable as cz, type BoardIdOfManifest as d, boardRefKey as d0, boardRefSchema as d1, cloneManifestDefault as d2, createManifestGameStateSchema as d3, createManifestRuntimeSchema as d4, createManifestStringLiteralSchema as d5, isManifestScopedSchema as d6, isPerPlayer as d7, isPerPlayerBoardRef as d8, isPlayerId as d9, isSharedBoardRef as da, manifestSchemaFamily as db, markManifestScopedSchema as dc, parseBoardRefKey as dd, perPlayer as de, perPlayerBoardRef as df, perPlayerEntries as dg, perPlayerGet as dh, perPlayerHas as di, perPlayerKeys as dj, perPlayerMap as dk, perPlayerRequire as dl, perPlayerSchema as dm, perPlayerSet as dn, perPlayerSize as dp, perPlayerValues as dq, resolveManifestPlayerIds as dr, sharedBoardRef as ds, type BoardIdOfTable as e, type BoardLayoutOfManifest as f, type BoardMapOfTable as g, type BoardRef as h, type BoardStateOfTable as i, type BoardTypeIdOfManifest as j, type BoardTypeIdOfTable as k, type Brand as l, type CardIdOfHand as m, type CardIdOfManifest as n, type CardIdOfState as o, type CardIdOfTable as p, type CardTypeOfState as q, type CardTypeOfTable as r, type ChoiceOption as s, type CompatibleCardIdForHandAndDeck as t, type CompatibleCardIdForTwoPlayerZones as u, type CompatibleHandIdForDeck as v, type ComponentDataOfTable as w, type ComponentIdOfTable as x, type ComponentLocationByTypeOfTable as y, type ComponentLocationOfTable as z };
@@ -1,3 +1,8 @@
1
+ import { w } from './protocol-dYgafTYY.js';
2
+
3
+ /** Player identity received through the host protocol. */
4
+ type PlayerId = w["playerId"];
5
+
1
6
  /** Choice option surfaced on a prompt-kind interaction's structured context. */
2
7
  interface InteractionContextOption {
3
8
  id: string;
@@ -206,9 +211,86 @@ interface SystemActionEvent {
206
211
  details?: readonly GameEventDetail[];
207
212
  }
208
213
  type GameEvent = SystemActionEvent;
209
- type ProjectedGameEvent = GameEvent & {
210
- version: number;
211
- index: number;
214
+
215
+ /**
216
+ * Result of validating a player action
217
+ */
218
+ interface ValidationResult {
219
+ /** Whether the action is valid */
220
+ valid: boolean;
221
+ /** Machine-readable error code if validation failed */
222
+ errorCode?: string;
223
+ /** Human-readable error message if validation failed */
224
+ message?: string;
225
+ }
226
+ /**
227
+ * Structured authoritative submission failure returned by runtime submit APIs.
228
+ */
229
+ interface SubmissionError extends Error {
230
+ /** Machine-readable error code when available */
231
+ errorCode?: string;
232
+ }
233
+ type RuntimeDiagnosticEvent = {
234
+ type: "runtimeLog";
235
+ level: "log" | "warn" | "error";
236
+ message: string;
237
+ details?: readonly unknown[];
238
+ } | {
239
+ type: "internalError";
240
+ code: string;
241
+ message: string;
242
+ stack?: string;
212
243
  };
244
+ type RuntimeDiagnosticHandler = (event: RuntimeDiagnosticEvent) => void;
245
+ /**
246
+ * Plugin session state
247
+ */
248
+ interface PluginSessionState {
249
+ /** Session initialization status */
250
+ status: "loading" | "ready";
251
+ /** Current session ID (null if not initialized) */
252
+ sessionId: string | null;
253
+ /** The player perspective represented by the current gameplay frame */
254
+ controllingPlayerId: PlayerId | null;
255
+ }
256
+ /**
257
+ * RuntimeAPI provides the interface between plugin code and the game runtime.
258
+ * This API is exposed to plugin iframes for subscribing to game events and submitting actions.
259
+ */
260
+ interface RuntimeAPI {
261
+ /**
262
+ * Submit a player interaction to the game server. `submitInteraction`
263
+ * is the single submission verb for every interaction kind — authors
264
+ * do not split between "action" and "prompt response" calls.
265
+ *
266
+ * @param interactionId - Identifier of the interaction
267
+ * @param params - Interaction-specific runtime JSON payload; prompt
268
+ * collectors may submit scalars while ordinary collectors submit objects.
269
+ * @throws SubmissionError if submission is rejected by the authority.
270
+ */
271
+ submitInteraction: (interactionId: string, params: unknown) => Promise<void>;
272
+ emitDiagnostic?: (event: RuntimeDiagnosticEvent) => void;
273
+ setDiagnosticHandler?: (handler: RuntimeDiagnosticHandler | undefined) => void;
274
+ /**
275
+ * Get the current plugin session state.
276
+ * Returns initialization status and session/player IDs.
277
+ *
278
+ * @returns Current plugin session state
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * const { status, sessionId, playerId } = runtime.getSessionState();
283
+ * if (status === "ready") {
284
+ * console.log('Connected to session:', sessionId);
285
+ * }
286
+ * ```
287
+ */
288
+ getSessionState: () => PluginSessionState;
289
+ /**
290
+ * Disconnect from the runtime and clean up all listeners.
291
+ * Should be called when the plugin is unmounting.
292
+ */
293
+ disconnect: () => void;
294
+ }
213
295
 
214
- export type { GameEvent as G, InputDomain as I, ProjectedGameEvent as P, SystemActionEvent as S, ZoneHandlesSnapshot as Z, GameEventDetail as a, InteractionDescriptor as b, InteractionInputDescriptor as c };
296
+ export type { GameEvent as G, InputDomain as I, PlayerId as P, RuntimeAPI as R, SubmissionError as S, ValidationResult as V, ZoneHandlesSnapshot as Z, GameEventDetail as a, InteractionDescriptor as b, InteractionInputDescriptor as c, PluginSessionState as d, RuntimeDiagnosticEvent as e, RuntimeDiagnosticHandler as f, SystemActionEvent as g };
package/dist/runtime.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { b5 as UIContract$1, G as DreamboardUI$1, b3 as TypedGame$1 } from './ui-contract-BC4JpysE.js';
2
- export { c as BoardGridInteractionFilter, g as BoardHexGridProps, i as BoardHexViewProps, m as BoardSpaceTargetProps, o as BoardSquareGridInteractionFilter, p as BoardSquareGridProps, M as GameMeState, Q as GamePlayersState, R as GameRenderState, U as GameTurnState, b7 as UIRootProps, bh as ZoneCardRenderItem, bl as ZoneListProps } from './ui-contract-BC4JpysE.js';
3
- export { a as ClientParamSchemaMap, W as WorkspaceBoardSurface, b as WorkspaceBoardSurfaceDescriptor, c as WorkspaceBoardTargetInputSlot, d as WorkspaceCardCollectionSurface, e as WorkspaceCardCollectionSurfaceDescriptor, f as WorkspaceCardInputSlot, g as WorkspaceFormInputSlot, h as WorkspaceHandSurface, i as WorkspaceHandSurfaceDescriptor, j as WorkspaceInteractionFormDescriptor, k as WorkspaceInteractionFormsDescriptor, l as WorkspaceInteractionSlotComponent, m as WorkspacePileSurface, n as WorkspacePileSurfaceDescriptor, o as WorkspacePilesSurfaceDescriptor, p as WorkspaceSurfaceSpec, q as createWorkspaceUIContract } from './index-CR69MyWr.js';
1
+ import { b5 as UIContract$1, G as DreamboardUI$1, b3 as TypedGame$1 } from './ui-contract-GTUPkf8z.js';
2
+ export { c as BoardGridInteractionFilter, g as BoardHexGridProps, i as BoardHexViewProps, m as BoardSpaceTargetProps, o as BoardSquareGridInteractionFilter, p as BoardSquareGridProps, M as GameMeState, Q as GamePlayersState, R as GameRenderState, U as GameTurnState, b7 as UIRootProps, bh as ZoneCardRenderItem, bl as ZoneListProps } from './ui-contract-GTUPkf8z.js';
3
+ export { a as ClientParamSchemaMap, W as WorkspaceBoardSurface, b as WorkspaceBoardSurfaceDescriptor, c as WorkspaceBoardTargetInputSlot, d as WorkspaceCardCollectionSurface, e as WorkspaceCardCollectionSurfaceDescriptor, f as WorkspaceCardInputSlot, g as WorkspaceFormInputSlot, h as WorkspaceHandSurface, i as WorkspaceHandSurfaceDescriptor, j as WorkspaceInteractionFormDescriptor, k as WorkspaceInteractionFormsDescriptor, l as WorkspaceInteractionSlotComponent, m as WorkspacePileSurface, n as WorkspacePileSurfaceDescriptor, o as WorkspacePilesSurfaceDescriptor, p as WorkspaceSurfaceSpec, q as createWorkspaceUIContract } from './index-CcT9Q7N7.js';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import react__default from 'react';
6
- import { c as RuntimeDiagnosticHandler } from './runtime-api-CgPuEVeF.js';
7
- import { P as PluginRuntimeClient, a as PluginRuntimeClientOptions, b as PluginTransport } from './types-q1Guidm5.js';
8
- export { R as RuntimeClock, c as RuntimeIdFactory } from './types-q1Guidm5.js';
9
- export { G as GameEvent, a as GameEventDetail, b as InteractionDescriptor, P as ProjectedGameEvent, S as SystemActionEvent } from './plugin-state-BRH3UiUp.js';
6
+ import { f as RuntimeDiagnosticHandler } from './runtime-api-Bz5pwNU_.js';
7
+ export { G as GameEvent, a as GameEventDetail, b as InteractionDescriptor, g as SystemActionEvent } from './runtime-api-Bz5pwNU_.js';
8
+ import { P as PluginRuntimeClient, a as PluginRuntimeClientOptions, b as PluginTransport } from './types-DR7DoB1x.js';
9
+ export { R as RuntimeClock, c as RuntimeIdFactory } from './types-DR7DoB1x.js';
10
10
  export { b as ResourceCounterComponents } from './ResourceCounter-BFxJknqp.js';
11
11
  import './hex-board-view-aKkblDp6.js';
12
12
  import './player-state-Cqpyeql0.js';
@@ -15,7 +15,7 @@ import './ThemeProvider-CElaL2ik.js';
15
15
  import './primitive-props-BNHDkgd7.js';
16
16
  import './attributes-DbvyMbXw.js';
17
17
  import './types-DJj5MJkl.js';
18
- import './protocol-CVaSqPgX.js';
18
+ import './protocol-dYgafTYY.js';
19
19
 
20
20
  interface PluginRuntimeProps {
21
21
  /** Child components to render after gameplay frame has started */
package/dist/runtime.js CHANGED
@@ -1,33 +1,35 @@
1
- import {
2
- createWorkspaceUIContract
3
- } from "./chunk-KRJPRYEA.js";
4
- import "./chunk-VWTKGIYF.js";
5
- import "./chunk-6LMESVGT.js";
6
- import "./chunk-T3ZKNUZ7.js";
7
1
  import {
8
2
  PluginRuntimeBoundary,
9
3
  createPluginRuntimeClient
10
- } from "./chunk-N33CGX2F.js";
11
- import "./chunk-DQS2EG5E.js";
12
- import "./chunk-TXELBVTG.js";
13
- import "./chunk-FL67RDID.js";
14
- import "./chunk-LMHCGCA6.js";
4
+ } from "./chunk-3BAD4VC2.js";
5
+ import {
6
+ createWorkspaceUIContract
7
+ } from "./chunk-EVCLTY4Q.js";
8
+ import "./chunk-ANRB4XKA.js";
9
+ import "./chunk-PN5O6GG2.js";
10
+ import "./chunk-LR3ZTWQF.js";
11
+ import "./chunk-T3ZKNUZ7.js";
12
+ import "./chunk-GDPKTBUR.js";
13
+ import "./chunk-3SKDNDPG.js";
15
14
  import {
16
15
  GameSkeleton
17
- } from "./chunk-VRRR6QZT.js";
16
+ } from "./chunk-32PFKDV7.js";
18
17
  import "./chunk-VDXOF4FW.js";
19
18
  import "./chunk-WHR5UW3F.js";
20
- import "./chunk-PF7L4BMG.js";
21
19
  import {
22
20
  DREAMBOARD_SDK_VERSION
23
- } from "./chunk-ZSTCUJKZ.js";
24
- import "./chunk-KWHOFBDM.js";
21
+ } from "./chunk-Y75CFE77.js";
25
22
  import {
26
23
  DREAMBOARD_PLUGIN_PROTOCOL,
27
24
  DREAMBOARD_PLUGIN_PROTOCOL_VERSION,
28
25
  HostToPluginEnvelopeSchema
29
- } from "./chunk-XFMSLL3P.js";
30
- import "./chunk-2GQIALJL.js";
26
+ } from "./chunk-VCDWP5VL.js";
27
+ import "./chunk-ZZGN2ATS.js";
28
+ import "./chunk-H6VDGFL5.js";
29
+ import "./chunk-5YV2WHJ4.js";
30
+ import "./chunk-PF7L4BMG.js";
31
+ import "./chunk-Z7QCREWI.js";
32
+ import "./chunk-UGH54WZ2.js";
31
33
  import "./chunk-PZ5AY32C.js";
32
34
 
33
35
  // src/runtime/hooks/usePluginRuntime.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/runtime/hooks/usePluginRuntime.ts","../src/runtime/browser/post-message-transport.ts","../src/runtime/components/PluginRuntime.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport { DREAMBOARD_SDK_VERSION } from \"../../package-set.js\";\nimport { createPostMessagePluginTransport } from \"../browser/post-message-transport.js\";\nimport { createPluginRuntimeClient } from \"../core/create-plugin-runtime-client.js\";\nimport type { PluginRuntimeClient } from \"../core/types.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\n\nconst BUNDLED_SDK_VERSION = DREAMBOARD_SDK_VERSION;\n\nexport interface UsePluginRuntimeOptions {\n /**\n * Timeout in milliseconds to wait for the first gameplay frame.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\nexport interface UsePluginRuntimeResult {\n /** The transport-agnostic plugin runtime client. */\n runtime: PluginRuntimeClient;\n /** Whether the initial reducer-native snapshot is available and ready */\n isReady: boolean;\n /**\n * True when the plugin was ready before but the current snapshot has no\n * projected view — e.g. you've acted and are waiting on the rest of the\n * table in a simultaneous phase. Lets the loading affordance read as a\n * mid-game wait rather than a cold \"still loading\" stall.\n */\n waiting: boolean;\n /** Error message if initialization failed */\n error: string | null;\n}\n\nfunction hasProjectedView(runtime: PluginRuntimeClient): boolean {\n const frame = runtime.getFrame();\n return (\n frame !== null && frame.view !== null && typeof frame.view !== \"undefined\"\n );\n}\n\n/**\n * Hook that creates and manages a PluginRuntimeClient instance.\n *\n * This hook handles:\n * 1. Creating the runtime client\n * 2. Waiting for the first gameplay frame before setting isReady\n *\n * In the new architecture, the host only renders the plugin when a reducer-native\n * snapshot is available, so isReady should become true quickly after init.\n *\n * @example\n * ```tsx\n * function PluginRuntime({ children }: { children: React.ReactNode }) {\n * const { runtime, isReady, error } = usePluginRuntime();\n *\n * if (error) {\n * return <div>Error: {error}</div>;\n * }\n *\n * if (!isReady) {\n * return <GameSkeleton message=\"Waiting for game state...\" />;\n * }\n *\n * return <RuntimeProvider runtime={runtime}>{children}</RuntimeProvider>;\n * }\n * ```\n */\nexport function usePluginRuntime(\n options: UsePluginRuntimeOptions = {},\n): UsePluginRuntimeResult {\n const { timeout = 10000, onDiagnostic } = options;\n const [error, setError] = useState<string | null>(null);\n\n // Create runtime once and keep stable reference\n const [runtime] = useState<PluginRuntimeClient>(() =>\n createPluginRuntimeClient({\n transport: createPostMessagePluginTransport({\n bundledSdkVersion: BUNDLED_SDK_VERSION,\n onInvalidMessage: (reason, value) => {\n const message =\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${BUNDLED_SDK_VERSION}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\";\n setError(message);\n onDiagnostic?.({\n type: \"runtimeLog\",\n level: \"warn\",\n message,\n details: [value],\n });\n },\n }),\n }),\n );\n const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));\n // Latches once we've shown a view, so a later view-less snapshot reads as a\n // mid-game wait rather than a fresh load. (A ref, so it never re-triggers a\n // render on its own.)\n const hasBeenReadyRef = useRef(false);\n if (isReady) hasBeenReadyRef.current = true;\n\n useEffect(() => {\n void onDiagnostic;\n }, [onDiagnostic]);\n\n // Subscribe to gameplay frames and set isReady when the first projected view arrives.\n useEffect(() => {\n const markReadyFromFrame = () => {\n if (!hasProjectedView(runtime)) {\n return false;\n }\n setError(null);\n setIsReady(true);\n return true;\n };\n\n if (markReadyFromFrame()) {\n return;\n }\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n if (!markReadyFromFrame()) {\n setError(\n `Timed out waiting for the initial projected view after ${timeout}ms. ` +\n \"Ensure the host sends a gameplay frame with a seat view.\",\n );\n }\n }, timeout);\n\n // Fallback poll for dev/HMR flows where the runtime frame may already\n // exist but the first subscribe callback is missed.\n const pollId = setInterval(() => {\n if (markReadyFromFrame()) {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n }\n }, 100);\n\n const unsubscribe = runtime.subscribeFrame(() => {\n if (!hasProjectedView(runtime)) {\n setIsReady(false);\n return;\n }\n clearInterval(pollId);\n clearTimeout(timeoutId);\n setError(null);\n setIsReady(true);\n });\n\n return () => {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n unsubscribe?.();\n };\n }, [runtime, timeout]);\n\n return {\n runtime,\n isReady,\n waiting: hasBeenReadyRef.current && !isReady,\n error,\n };\n}\n","import {\n DREAMBOARD_PLUGIN_PROTOCOL,\n DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n HostToPluginEnvelopeSchema,\n type HostToPluginEnvelope,\n type PluginToHostPayload,\n} from \"@dreamboard-games/plugin-runtime-contract\";\nimport type { PluginTransport } from \"../core/types.js\";\n\nexport interface PostMessagePluginTransportOptions {\n readonly targetWindow?: Window;\n readonly parentWindow?: Window;\n readonly bundledSdkVersion?: string;\n readonly onInvalidMessage?: (reason: string, value: unknown) => void;\n}\n\nexport function createPostMessagePluginTransport(\n options: PostMessagePluginTransportOptions = {},\n): PluginTransport {\n const targetWindow = options.targetWindow ?? window;\n const parentWindow = options.parentWindow ?? targetWindow.parent;\n const bundledSdkVersion = options.bundledSdkVersion?.trim() || \"unknown\";\n let channel: {\n readonly channelId: string;\n readonly hostOrigin: string;\n readonly hostWindow: Window;\n } | null = null;\n let outboundSequence = 0;\n let invalidEnvelopeReported = false;\n\n const reportInvalidEnvelope = (reason: string, value: unknown) => {\n options.onInvalidMessage?.(reason, value);\n\n if (!channel || invalidEnvelopeReported) {\n return;\n }\n\n invalidEnvelopeReported = true;\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload: {\n type: \"runtime.error\",\n code: \"host-runtime-protocol-mismatch\",\n message:\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${bundledSdkVersion}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\",\n },\n },\n channel.hostOrigin,\n );\n };\n\n return {\n start(onMessage) {\n const handleMessage = (event: MessageEvent) => {\n if (event.source !== parentWindow) {\n return;\n }\n const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);\n if (!parseResult.success) {\n reportInvalidEnvelope(\"invalid-envelope\", event.data);\n return;\n }\n const envelope = parseResult.data;\n if (!channel) {\n if (envelope.payload.type !== \"runtime.init\") {\n return;\n }\n channel = {\n channelId: envelope.channelId,\n hostOrigin: event.origin,\n hostWindow: event.source as Window,\n };\n }\n if (\n envelope.channelId !== channel.channelId ||\n event.origin !== channel.hostOrigin ||\n event.source !== channel.hostWindow\n ) {\n reportInvalidEnvelope(\"channel-mismatch\", event.data);\n return;\n }\n onMessage(envelope as HostToPluginEnvelope);\n };\n\n targetWindow.addEventListener(\"message\", handleMessage);\n return () => {\n targetWindow.removeEventListener(\"message\", handleMessage);\n channel = null;\n };\n },\n send(payload: PluginToHostPayload) {\n if (!channel) {\n throw new Error(\"Plugin transport is not initialized.\");\n }\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload,\n },\n channel.hostOrigin,\n );\n },\n };\n}\n","import React from \"react\";\nimport { usePluginRuntime } from \"../hooks/usePluginRuntime.js\";\nimport { GameSkeleton } from \"../../ui.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\nimport { PluginRuntimeBoundary } from \"./PluginRuntimeBoundary.js\";\n\nexport interface PluginRuntimeProps {\n /** Child components to render after gameplay frame has started */\n children: React.ReactNode;\n /**\n * Timeout in milliseconds to wait for the first gameplay-frame snapshot.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n /** Custom loading component to show while waiting for gameplay frame */\n loadingComponent?: React.ReactNode;\n /** Custom error component to show when initialization fails */\n errorComponent?: (error: string) => React.ReactNode;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\n/**\n * PluginRuntime provides the RuntimeContext for plugin components.\n *\n * This component:\n * - Creates a transport-backed runtime client\n * - Waits for the first projected gameplay frame before rendering children\n * - Provides runtime commands plus session/frame state to all child components\n *\n * @example\n * ```tsx\n * // In your plugin's index.tsx\n * import { PluginRuntime } from \"./components/dreamboard\";\n * import App from './App';\n *\n * ReactDOM.createRoot(document.getElementById('root')!).render(\n * <PluginRuntime>\n * <App />\n * </PluginRuntime>\n * );\n * ```\n */\nexport function PluginRuntime({\n children,\n timeout = 10000,\n loadingComponent,\n errorComponent,\n onDiagnostic,\n}: PluginRuntimeProps) {\n const { runtime, isReady, waiting, error } = usePluginRuntime({\n timeout,\n onDiagnostic,\n });\n\n if (error) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n return (\n <div className=\"flex h-full w-full items-center justify-center bg-gray-50\">\n <div className=\"text-center p-6\">\n <p className=\"text-red-600 font-medium mb-2\">Failed to load game</p>\n <p className=\"text-gray-600 text-sm\">{error}</p>\n </div>\n </div>\n );\n }\n\n if (!isReady) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Once the game has rendered, a view-less snapshot is a mid-game wait (you\n // acted and are waiting on the table), not a cold load — say so rather than\n // reading as a stalled \"Waiting for game state\".\n return (\n <GameSkeleton\n message={\n waiting\n ? \"Waiting for the other players…\"\n : \"Waiting for game state...\"\n }\n />\n );\n }\n\n return (\n <PluginRuntimeBoundary runtime={runtime}>{children}</PluginRuntimeBoundary>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,WAAW,cAAc;;;ACgBrC,SAAS,iCACd,UAA6C,CAAC,GAC7B;AACjB,QAAM,eAAe,QAAQ,gBAAgB;AAC7C,QAAM,eAAe,QAAQ,gBAAgB,aAAa;AAC1D,QAAM,oBAAoB,QAAQ,mBAA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E,oBAAC,OAAE,WAAU,yBAAyB,iBAAM;AAAA,OAC9C,GACF;AAAA,EAEJ;AAEA,MAAI,CAAC,SAAS;AACZ,QAAI,kBAAkB;AACpB,aAAO,gCAAG,4BAAiB;AAAA,IAC7B;AAIA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SACE,UACI,wCACA;AAAA;AAAA,IAER;AAAA,EAEJ;AAEA,SACE,oBAAC,yBAAsB,SAAmB,UAAS;AAEvD;","names":[]}
1
+ {"version":3,"sources":["../src/runtime/hooks/usePluginRuntime.ts","../src/runtime/browser/post-message-transport.ts","../src/runtime/components/PluginRuntime.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport { DREAMBOARD_SDK_VERSION } from \"../../package-set.js\";\nimport { createPostMessagePluginTransport } from \"../browser/post-message-transport.js\";\nimport { createPluginRuntimeClient } from \"../core/create-plugin-runtime-client.js\";\nimport type { PluginRuntimeClient } from \"../core/types.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\n\nconst BUNDLED_SDK_VERSION = DREAMBOARD_SDK_VERSION;\n\nexport interface UsePluginRuntimeOptions {\n /**\n * Timeout in milliseconds to wait for the first gameplay frame.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\nexport interface UsePluginRuntimeResult {\n /** The transport-agnostic plugin runtime client. */\n runtime: PluginRuntimeClient;\n /** Whether the initial reducer-native snapshot is available and ready */\n isReady: boolean;\n /**\n * True when the plugin was ready before but the current snapshot has no\n * projected view — e.g. you've acted and are waiting on the rest of the\n * table in a simultaneous phase. Lets the loading affordance read as a\n * mid-game wait rather than a cold \"still loading\" stall.\n */\n waiting: boolean;\n /** Error message if initialization failed */\n error: string | null;\n}\n\nfunction hasProjectedView(runtime: PluginRuntimeClient): boolean {\n const frame = runtime.getFrame();\n return (\n frame !== null && frame.view !== null && typeof frame.view !== \"undefined\"\n );\n}\n\n/**\n * Hook that creates and manages a PluginRuntimeClient instance.\n *\n * This hook handles:\n * 1. Creating the runtime client\n * 2. Waiting for the first gameplay frame before setting isReady\n *\n * In the new architecture, the host only renders the plugin when a reducer-native\n * snapshot is available, so isReady should become true quickly after init.\n *\n * @example\n * ```tsx\n * function PluginRuntime({ children }: { children: React.ReactNode }) {\n * const { runtime, isReady, error } = usePluginRuntime();\n *\n * if (error) {\n * return <div>Error: {error}</div>;\n * }\n *\n * if (!isReady) {\n * return <GameSkeleton message=\"Waiting for game state...\" />;\n * }\n *\n * return <RuntimeProvider runtime={runtime}>{children}</RuntimeProvider>;\n * }\n * ```\n */\nexport function usePluginRuntime(\n options: UsePluginRuntimeOptions = {},\n): UsePluginRuntimeResult {\n const { timeout = 10000, onDiagnostic } = options;\n const [error, setError] = useState<string | null>(null);\n\n // Create runtime once and keep stable reference\n const [runtime] = useState<PluginRuntimeClient>(() =>\n createPluginRuntimeClient({\n transport: createPostMessagePluginTransport({\n bundledSdkVersion: BUNDLED_SDK_VERSION,\n onInvalidMessage: (reason, value) => {\n const message =\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${BUNDLED_SDK_VERSION}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\";\n setError(message);\n onDiagnostic?.({\n type: \"runtimeLog\",\n level: \"warn\",\n message,\n details: [value],\n });\n },\n }),\n }),\n );\n const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));\n // Latches once we've shown a view, so a later view-less snapshot reads as a\n // mid-game wait rather than a fresh load. (A ref, so it never re-triggers a\n // render on its own.)\n const hasBeenReadyRef = useRef(false);\n if (isReady) hasBeenReadyRef.current = true;\n\n useEffect(() => {\n void onDiagnostic;\n }, [onDiagnostic]);\n\n // Subscribe to gameplay frames and set isReady when the first projected view arrives.\n useEffect(() => {\n const markReadyFromFrame = () => {\n if (!hasProjectedView(runtime)) {\n return false;\n }\n setError(null);\n setIsReady(true);\n return true;\n };\n\n if (markReadyFromFrame()) {\n return;\n }\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n if (!markReadyFromFrame()) {\n setError(\n `Timed out waiting for the initial projected view after ${timeout}ms. ` +\n \"Ensure the host sends a gameplay frame with a seat view.\",\n );\n }\n }, timeout);\n\n // Fallback poll for dev/HMR flows where the runtime frame may already\n // exist but the first subscribe callback is missed.\n const pollId = setInterval(() => {\n if (markReadyFromFrame()) {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n }\n }, 100);\n\n const unsubscribe = runtime.subscribeFrame(() => {\n if (!hasProjectedView(runtime)) {\n setIsReady(false);\n return;\n }\n clearInterval(pollId);\n clearTimeout(timeoutId);\n setError(null);\n setIsReady(true);\n });\n\n return () => {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n unsubscribe?.();\n };\n }, [runtime, timeout]);\n\n return {\n runtime,\n isReady,\n waiting: hasBeenReadyRef.current && !isReady,\n error,\n };\n}\n","import {\n DREAMBOARD_PLUGIN_PROTOCOL,\n DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n HostToPluginEnvelopeSchema,\n type HostToPluginEnvelope,\n type PluginToHostPayload,\n} from \"@dreamboard-games/plugin-runtime-contract\";\nimport type { PluginTransport } from \"../core/types.js\";\n\nexport interface PostMessagePluginTransportOptions {\n readonly targetWindow?: Window;\n readonly parentWindow?: Window;\n readonly bundledSdkVersion?: string;\n readonly onInvalidMessage?: (reason: string, value: unknown) => void;\n}\n\nexport function createPostMessagePluginTransport(\n options: PostMessagePluginTransportOptions = {},\n): PluginTransport {\n const targetWindow = options.targetWindow ?? window;\n const parentWindow = options.parentWindow ?? targetWindow.parent;\n const bundledSdkVersion = options.bundledSdkVersion?.trim() || \"unknown\";\n let channel: {\n readonly channelId: string;\n readonly hostOrigin: string;\n readonly hostWindow: Window;\n } | null = null;\n let outboundSequence = 0;\n let invalidEnvelopeReported = false;\n\n const reportInvalidEnvelope = (reason: string, value: unknown) => {\n options.onInvalidMessage?.(reason, value);\n\n if (!channel || invalidEnvelopeReported) {\n return;\n }\n\n invalidEnvelopeReported = true;\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload: {\n type: \"runtime.error\",\n code: \"host-runtime-protocol-mismatch\",\n message:\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${bundledSdkVersion}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\",\n },\n },\n channel.hostOrigin,\n );\n };\n\n return {\n start(onMessage) {\n const handleMessage = (event: MessageEvent) => {\n if (event.source !== parentWindow) {\n return;\n }\n const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);\n if (!parseResult.success) {\n reportInvalidEnvelope(\"invalid-envelope\", event.data);\n return;\n }\n const envelope = parseResult.data;\n if (!channel) {\n if (envelope.payload.type !== \"runtime.init\") {\n return;\n }\n channel = {\n channelId: envelope.channelId,\n hostOrigin: event.origin,\n hostWindow: event.source as Window,\n };\n }\n if (\n envelope.channelId !== channel.channelId ||\n event.origin !== channel.hostOrigin ||\n event.source !== channel.hostWindow\n ) {\n reportInvalidEnvelope(\"channel-mismatch\", event.data);\n return;\n }\n onMessage(envelope as HostToPluginEnvelope);\n };\n\n targetWindow.addEventListener(\"message\", handleMessage);\n return () => {\n targetWindow.removeEventListener(\"message\", handleMessage);\n channel = null;\n };\n },\n send(payload: PluginToHostPayload) {\n if (!channel) {\n throw new Error(\"Plugin transport is not initialized.\");\n }\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload,\n },\n channel.hostOrigin,\n );\n },\n };\n}\n","import React from \"react\";\nimport { usePluginRuntime } from \"../hooks/usePluginRuntime.js\";\nimport { GameSkeleton } from \"../../ui.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\nimport { PluginRuntimeBoundary } from \"./PluginRuntimeBoundary.js\";\n\nexport interface PluginRuntimeProps {\n /** Child components to render after gameplay frame has started */\n children: React.ReactNode;\n /**\n * Timeout in milliseconds to wait for the first gameplay-frame snapshot.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n /** Custom loading component to show while waiting for gameplay frame */\n loadingComponent?: React.ReactNode;\n /** Custom error component to show when initialization fails */\n errorComponent?: (error: string) => React.ReactNode;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\n/**\n * PluginRuntime provides the RuntimeContext for plugin components.\n *\n * This component:\n * - Creates a transport-backed runtime client\n * - Waits for the first projected gameplay frame before rendering children\n * - Provides runtime commands plus session/frame state to all child components\n *\n * @example\n * ```tsx\n * // In your plugin's index.tsx\n * import { PluginRuntime } from \"./components/dreamboard\";\n * import App from './App';\n *\n * ReactDOM.createRoot(document.getElementById('root')!).render(\n * <PluginRuntime>\n * <App />\n * </PluginRuntime>\n * );\n * ```\n */\nexport function PluginRuntime({\n children,\n timeout = 10000,\n loadingComponent,\n errorComponent,\n onDiagnostic,\n}: PluginRuntimeProps) {\n const { runtime, isReady, waiting, error } = usePluginRuntime({\n timeout,\n onDiagnostic,\n });\n\n if (error) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n return (\n <div className=\"flex h-full w-full items-center justify-center bg-gray-50\">\n <div className=\"text-center p-6\">\n <p className=\"text-red-600 font-medium mb-2\">Failed to load game</p>\n <p className=\"text-gray-600 text-sm\">{error}</p>\n </div>\n </div>\n );\n }\n\n if (!isReady) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Once the game has rendered, a view-less snapshot is a mid-game wait (you\n // acted and are waiting on the table), not a cold load — say so rather than\n // reading as a stalled \"Waiting for game state\".\n return (\n <GameSkeleton\n message={\n waiting\n ? \"Waiting for the other players…\"\n : \"Waiting for game state...\"\n }\n />\n );\n }\n\n return (\n <PluginRuntimeBoundary runtime={runtime}>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S,MAAM,IAAI,iBAAiB;AAAA,IAC5D;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,OAAO;AACT,QAAI,gBAAgB;AAClB,aAAO,gCAAG,yBAAe,KAAK,GAAE;AAAA,IAClC;AACA,WACE,oBAAC,SAAI,WAAU,6DACb,+BAAC,SAAI,WAAU,mBACb;AAAA,0BAAC,OAAE,WAAU,iCAAgC,iCAAmB;AAAA,MAChE,oBAAC,OAAE,WAAU,yBAAyB,iBAAM;AAAA,OAC9C,GACF;AAAA,EAEJ;AAEA,MAAI,CAAC,SAAS;AACZ,QAAI,kBAAkB;AACpB,aAAO,gCAAG,4BAAiB;AAAA,IAC7B;AAIA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SACE,UACI,wCACA;AAAA;AAAA,IAER;AAAA,EAEJ;AAEA,SACE,oBAAC,yBAAsB,SAAmB,UAAS;AAEvD;","names":[]}
package/dist/schema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { N as RuntimeJson, x as PluginProtocolEnvelope, f as HostToPluginPayload, o as InteractionDescriptor, v as PluginGameplayFrame, B as PluginProtocolTape, Z as ZoneHandlesSnapshot, E as PluginSessionDescriptor, J as PluginToHostPayload } from './protocol-CVaSqPgX.js';
2
+ import { M as RuntimeJson, x as PluginProtocolEnvelope, f as HostToPluginPayload, o as InteractionDescriptor, v as PluginGameplayFrame, B as PluginProtocolTape, Z as ZoneHandlesSnapshot, E as PluginSessionDescriptor, J as PluginToHostPayload } from './protocol-dYgafTYY.js';
3
3
 
4
4
  declare const RuntimeJsonSchema: z.ZodType<RuntimeJson>;
5
5
  declare const BoardStaticProjectionSchema: z.ZodObject<{
@@ -54,19 +54,6 @@ declare const GameEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
54
54
  value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
55
55
  }, z.core.$strict>>>;
56
56
  }, z.core.$strict>], "kind">;
57
- declare const ProjectedGameEventSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
58
- kind: z.ZodLiteral<"systemAction">;
59
- procedureId: z.ZodString;
60
- title: z.ZodString;
61
- summary: z.ZodOptional<z.ZodString>;
62
- details: z.ZodOptional<z.ZodArray<z.ZodObject<{
63
- label: z.ZodString;
64
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
65
- }, z.core.$strict>>>;
66
- }, z.core.$strict>], "kind">, z.ZodObject<{
67
- version: z.ZodNumber;
68
- index: z.ZodNumber;
69
- }, z.core.$strict>>;
70
57
  declare const SeatProjectionBundleSchema: z.ZodObject<{
71
58
  currentStage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
59
  stageSeats: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -98,19 +85,6 @@ declare const SeatProjectionBundleSchema: z.ZodObject<{
98
85
  }, z.core.$strict>>;
99
86
  }, z.core.$strict>>;
100
87
  }, z.core.$strict>>>;
101
- recentEvents: z.ZodOptional<z.ZodArray<z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
102
- kind: z.ZodLiteral<"systemAction">;
103
- procedureId: z.ZodString;
104
- title: z.ZodString;
105
- summary: z.ZodOptional<z.ZodString>;
106
- details: z.ZodOptional<z.ZodArray<z.ZodObject<{
107
- label: z.ZodString;
108
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
109
- }, z.core.$strict>>>;
110
- }, z.core.$strict>], "kind">, z.ZodObject<{
111
- version: z.ZodNumber;
112
- index: z.ZodNumber;
113
- }, z.core.$strict>>>>;
114
88
  sharedView: z.ZodOptional<z.ZodUnknown>;
115
89
  interactionsByRef: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
116
90
  seats: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -402,4 +376,4 @@ declare function parsePluginGameplayFrame(value: unknown): PluginGameplayFrame;
402
376
  declare function parseHostToPluginEnvelope(value: unknown): PluginProtocolEnvelope<HostToPluginPayload>;
403
377
  declare function parsePluginToHostEnvelope(value: unknown): PluginProtocolEnvelope<PluginToHostPayload>;
404
378
 
405
- export { BoardStaticProjectionSchema, GameEventDetailSchema, GameEventSchema, GameGuidanceProjectionSchema, GameOutcomeSchema, GameplayBasisSchema, HostToPluginEnvelopeSchema, HostToPluginPayloadSchema, InputDomainDependenciesSchema, InputDomainSchema, InputSelectionSchema, InteractionAvailabilitySchema, InteractionChoiceOptionSchema, InteractionCommitPolicySchema, InteractionContextSchema, InteractionDescriptorSchema, InteractionInputDescriptorSchema, InteractionResultSchema, PlayerIdSchema, PluginGameplayFrameSchema, PluginPlayerSummarySchema, PluginProtocolFrameSchema, PluginProtocolStepSchema, PluginProtocolTapeSchema, PluginSessionDescriptorSchema, PluginToHostEnvelopeSchema, PluginToHostPayloadSchema, ProjectedGameEventSchema, RuntimeJsonSchema, SeatProjectionBundleSchema, SetupGuidanceStepSchema, SimultaneousPhaseSnapshotSchema, SubmitInteractionCommandSchema, SystemActionEventSchema, ZoneHandlesSnapshotSchema, createPluginProtocolEnvelopeSchema, parseHostToPluginEnvelope, parsePluginGameplayFrame, parsePluginSessionDescriptor, parsePluginToHostEnvelope };
379
+ export { BoardStaticProjectionSchema, GameEventDetailSchema, GameEventSchema, GameGuidanceProjectionSchema, GameOutcomeSchema, GameplayBasisSchema, HostToPluginEnvelopeSchema, HostToPluginPayloadSchema, InputDomainDependenciesSchema, InputDomainSchema, InputSelectionSchema, InteractionAvailabilitySchema, InteractionChoiceOptionSchema, InteractionCommitPolicySchema, InteractionContextSchema, InteractionDescriptorSchema, InteractionInputDescriptorSchema, InteractionResultSchema, PlayerIdSchema, PluginGameplayFrameSchema, PluginPlayerSummarySchema, PluginProtocolFrameSchema, PluginProtocolStepSchema, PluginProtocolTapeSchema, PluginSessionDescriptorSchema, PluginToHostEnvelopeSchema, PluginToHostPayloadSchema, RuntimeJsonSchema, SeatProjectionBundleSchema, SetupGuidanceStepSchema, SimultaneousPhaseSnapshotSchema, SubmitInteractionCommandSchema, SystemActionEventSchema, ZoneHandlesSnapshotSchema, createPluginProtocolEnvelopeSchema, parseHostToPluginEnvelope, parsePluginGameplayFrame, parsePluginSessionDescriptor, parsePluginToHostEnvelope };
@@ -1,9 +1,9 @@
1
- import { j as ScenarioCheckpointSelector, o as ScenarioDefinitionGameLike, x as ScenarioReplayDefinition, h as ScenarioCheckpoint } from './definitions-bZSBaPjj.js';
1
+ import { j as ScenarioCheckpointSelector, o as ScenarioDefinitionGameLike, x as ScenarioReplayDefinition, h as ScenarioCheckpoint } from './definitions-BgmV_GhC.js';
2
2
  import 'zod';
3
- import './views-D2Cfzr3h.js';
4
- import './runtime-C7Z2acNU.js';
3
+ import './views-BpuWcOyN.js';
4
+ import './runtime-RJ5orDJU.js';
5
5
  import './types.js';
6
- import './protocol-CVaSqPgX.js';
6
+ import './protocol-dYgafTYY.js';
7
7
  import './diagnostics-DIi3ina7.js';
8
8
 
9
9
  type CompiledScenarioReplay<Game extends ScenarioDefinitionGameLike = ScenarioDefinitionGameLike> = {
@@ -1,13 +1,13 @@
1
1
  import { D as DispatchTraceSummaryEntry } from './diagnostics-DIi3ina7.js';
2
- import { o as ScenarioDefinitionGameLike, n as ScenarioDefinition } from './definitions-bZSBaPjj.js';
3
- import { i as Sha256Digest, d as InspectNode } from './types-DN4O7kH_.js';
4
- export { h as ScenarioRuntimeCheckpointMaterialization, m as materializeScenarioRuntimeCheckpoint } from './types-DN4O7kH_.js';
2
+ import { o as ScenarioDefinitionGameLike, n as ScenarioDefinition } from './definitions-BgmV_GhC.js';
3
+ import { i as Sha256Digest, d as InspectNode } from './types-JWCYHmu7.js';
4
+ export { h as ScenarioRuntimeCheckpointMaterialization, m as materializeScenarioRuntimeCheckpoint } from './types-JWCYHmu7.js';
5
5
  import 'zod';
6
- import './views-D2Cfzr3h.js';
7
- import './runtime-C7Z2acNU.js';
6
+ import './views-BpuWcOyN.js';
7
+ import './runtime-RJ5orDJU.js';
8
8
  import './types.js';
9
- import './protocol-CVaSqPgX.js';
10
- import './index.d-Bw8AOcgp.js';
9
+ import './protocol-dYgafTYY.js';
10
+ import './index.d-DjzoK7zn.js';
11
11
 
12
12
  type GameLike = {
13
13
  readonly phases: Readonly<Record<string, unknown>>;
@@ -5,15 +5,15 @@ import {
5
5
  materializeScenarioRuntimeCheckpoint,
6
6
  replayScenario,
7
7
  resolveScenarioCommandParams
8
- } from "./chunk-EOEA3I64.js";
8
+ } from "./chunk-BI4G3PM2.js";
9
9
  import {
10
10
  interactionDomainEligibleCount
11
- } from "./chunk-533O7C4L.js";
12
- import "./chunk-TXELBVTG.js";
13
- import "./chunk-FL67RDID.js";
11
+ } from "./chunk-S2JEDVWH.js";
12
+ import "./chunk-PN5O6GG2.js";
13
+ import "./chunk-VCDWP5VL.js";
14
+ import "./chunk-H6VDGFL5.js";
14
15
  import "./chunk-PF7L4BMG.js";
15
- import "./chunk-XFMSLL3P.js";
16
- import "./chunk-2GQIALJL.js";
16
+ import "./chunk-UGH54WZ2.js";
17
17
  import "./chunk-PZ5AY32C.js";
18
18
 
19
19
  // src/testing/scenario-projection-digest.ts