@dreamboard-games/sdk 0.4.0-alpha.7 → 0.4.0-alpha.9

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 (112) hide show
  1. package/REFERENCE.md +1292 -287
  2. package/dist/authoring/index.d.ts +4 -9
  3. package/dist/authoring/index.js +11 -547
  4. package/dist/authoring/index.js.map +1 -1
  5. package/dist/authoring-compiler.d.ts +27 -0
  6. package/dist/authoring-compiler.js +12 -0
  7. package/dist/authoring-compiler.js.map +1 -0
  8. package/dist/authoring-materialize-cli.d.ts +1 -0
  9. package/dist/authoring-materialize-cli.js +46 -0
  10. package/dist/authoring-materialize-cli.js.map +1 -0
  11. package/dist/browser-interaction.d.ts +1 -1
  12. package/dist/{chunk-TGMXBRKY.js → chunk-3PFDHTR7.js} +19 -7
  13. package/dist/chunk-3PFDHTR7.js.map +1 -0
  14. package/dist/chunk-45P5CEGH.js +176 -0
  15. package/dist/chunk-45P5CEGH.js.map +1 -0
  16. package/dist/chunk-5XTAQ4EQ.js +32 -0
  17. package/dist/chunk-5XTAQ4EQ.js.map +1 -0
  18. package/dist/chunk-7ADPYKFT.js +532 -0
  19. package/dist/chunk-7ADPYKFT.js.map +1 -0
  20. package/dist/{chunk-RKGJ64UN.js → chunk-BUOODBVO.js} +2 -2
  21. package/dist/{chunk-VLG4YST5.js → chunk-GMOBG7Y7.js} +4 -4
  22. package/dist/{chunk-Q322XCY2.js → chunk-JRGP6W4V.js} +3 -3
  23. package/dist/chunk-L3W2FPRQ.js +1793 -0
  24. package/dist/chunk-L3W2FPRQ.js.map +1 -0
  25. package/dist/{chunk-3QIZKXJ2.js → chunk-NGYFBNBP.js} +3 -3
  26. package/dist/chunk-P6IJ5YVY.js +154 -0
  27. package/dist/chunk-P6IJ5YVY.js.map +1 -0
  28. package/dist/{chunk-5IHU5CUK.js → chunk-QQNL4WTX.js} +25 -22
  29. package/dist/chunk-QQNL4WTX.js.map +1 -0
  30. package/dist/{chunk-52DH7VQF.js → chunk-SACZWUA6.js} +143 -47
  31. package/dist/chunk-SACZWUA6.js.map +1 -0
  32. package/dist/{chunk-KYEWGZ2Y.js → chunk-SFOAY5H4.js} +2 -2
  33. package/dist/{chunk-KYEWGZ2Y.js.map → chunk-SFOAY5H4.js.map} +1 -1
  34. package/dist/chunk-UNVCT5Z7.js +73 -0
  35. package/dist/chunk-UNVCT5Z7.js.map +1 -0
  36. package/dist/{chunk-NO537WSS.js → chunk-WDR7SKBM.js} +2 -2
  37. package/dist/chunk-XDGRC6OR.js +7039 -0
  38. package/dist/chunk-XDGRC6OR.js.map +1 -0
  39. package/dist/chunk-XLHLFTLI.js +399 -0
  40. package/dist/chunk-XLHLFTLI.js.map +1 -0
  41. package/dist/{chunk-B2YBS3SG.js → chunk-YNW3KBDE.js} +41 -13
  42. package/dist/chunk-YNW3KBDE.js.map +1 -0
  43. package/dist/codegen.js +1 -1
  44. package/dist/{components-BTwSIjXj.d.ts → components-BPzsSRs8.d.ts} +1 -1
  45. package/dist/definitions-0kjPV9wh.d.ts +294 -0
  46. package/dist/{diagnostics-1BWjRo6-.d.ts → diagnostics-DIi3ina7.d.ts} +2 -1
  47. package/dist/{index-CFTjJIXd.d.ts → index-CWzWpQzM.d.ts} +1 -1
  48. package/dist/{index.d-DMASeF6M.d.ts → index.d-C7Ztirg6.d.ts} +234 -5
  49. package/dist/index.js +2 -2
  50. package/dist/package-set.d.ts +2 -2
  51. package/dist/package-set.js +2 -2
  52. package/dist/{protocol-835hEGne.d.ts → protocol-B2LWcqB4.d.ts} +14 -0
  53. package/dist/reducer/advanced.d.ts +4 -4
  54. package/dist/reducer/advanced.js +7 -26
  55. package/dist/reducer/advanced.js.map +1 -1
  56. package/dist/reducer-contract.d.ts +1 -1
  57. package/dist/reducer-contract.js +2 -2
  58. package/dist/reducer.d.ts +37 -28
  59. package/dist/reducer.js +43 -6018
  60. package/dist/reducer.js.map +1 -1
  61. package/dist/reference-game-compiler.d.ts +45 -0
  62. package/dist/reference-game-compiler.js +25 -0
  63. package/dist/reference-game-compiler.js.map +1 -0
  64. package/dist/reference-game-source-manifest-cli.d.ts +1 -0
  65. package/dist/reference-game-source-manifest-cli.js +84 -0
  66. package/dist/reference-game-source-manifest-cli.js.map +1 -0
  67. package/dist/reference-games/index.d.ts +7 -217
  68. package/dist/reference-games/index.js +28 -208
  69. package/dist/reference-games/index.js.map +1 -1
  70. package/dist/runtime/primitives.d.ts +3 -3
  71. package/dist/runtime/primitives.js +3 -3
  72. package/dist/runtime/runtime-api.d.ts +1 -1
  73. package/dist/runtime/workspace-contract.d.ts +4 -4
  74. package/dist/runtime/workspace-contract.js +4 -4
  75. package/dist/{runtime-Dkfm1x2r.d.ts → runtime-B_w9AO2n.d.ts} +60 -5
  76. package/dist/{runtime-api-C6aWo9c0.d.ts → runtime-api-xCWLMQRT.d.ts} +2 -0
  77. package/dist/runtime.d.ts +7 -7
  78. package/dist/runtime.js +13 -13
  79. package/dist/schema-9jZzlEWZ.d.ts +220 -0
  80. package/dist/{stale-contract-artifact-error-C5AaZPJ8.d.ts → stale-contract-artifact-error-XLaweZtF.d.ts} +1 -1
  81. package/dist/testing-compiler.d.ts +36 -0
  82. package/dist/testing-compiler.js +236 -0
  83. package/dist/testing-compiler.js.map +1 -0
  84. package/dist/testing-runtime.d.ts +97 -21
  85. package/dist/testing-runtime.js +154 -95
  86. package/dist/testing-runtime.js.map +1 -1
  87. package/dist/testing.d.ts +178 -60
  88. package/dist/testing.js +641 -26
  89. package/dist/testing.js.map +1 -1
  90. package/dist/types-Bvptkukh.d.ts +122 -0
  91. package/dist/{types-aI4V9CWe.d.ts → types-_zfC_7CD.d.ts} +1 -1
  92. package/dist/types.d.ts +4 -0
  93. package/dist/ui/components.d.ts +2 -2
  94. package/dist/ui/plugin-styles.css +1 -1
  95. package/dist/{ui-contract-Ue6SywvO.d.ts → ui-contract-CUC7Lyoc.d.ts} +1 -1
  96. package/dist/ui.d.ts +3 -3
  97. package/dist/{views-32rSsfeU.d.ts → views-DE2eZxPz.d.ts} +42 -13
  98. package/package.json +22 -3
  99. package/dist/chunk-3OZMHZK3.js +0 -40
  100. package/dist/chunk-3OZMHZK3.js.map +0 -1
  101. package/dist/chunk-52DH7VQF.js.map +0 -1
  102. package/dist/chunk-5IHU5CUK.js.map +0 -1
  103. package/dist/chunk-B2YBS3SG.js.map +0 -1
  104. package/dist/chunk-IU6KGPY7.js +0 -659
  105. package/dist/chunk-IU6KGPY7.js.map +0 -1
  106. package/dist/chunk-TGMXBRKY.js.map +0 -1
  107. package/dist/types-DcADVHe9.d.ts +0 -192
  108. /package/dist/{chunk-RKGJ64UN.js.map → chunk-BUOODBVO.js.map} +0 -0
  109. /package/dist/{chunk-VLG4YST5.js.map → chunk-GMOBG7Y7.js.map} +0 -0
  110. /package/dist/{chunk-Q322XCY2.js.map → chunk-JRGP6W4V.js.map} +0 -0
  111. /package/dist/{chunk-3QIZKXJ2.js.map → chunk-NGYFBNBP.js.map} +0 -0
  112. /package/dist/{chunk-NO537WSS.js.map → chunk-WDR7SKBM.js.map} +0 -0
@@ -0,0 +1,27 @@
1
+ type MaterializeWorkspaceOptions = {
2
+ readonly manifestPath: string;
3
+ readonly projectRoot?: string;
4
+ /** Scaffolding-only. Existing build/test paths leave seed files untouched. */
5
+ readonly writeMissingSeeds?: boolean;
6
+ };
7
+ type MaterializedWorkspaceReceipt = {
8
+ readonly schemaVersion: 1;
9
+ readonly projectRoot: string;
10
+ readonly authoritativeFiles: number;
11
+ readonly seededFiles: number;
12
+ readonly artifacts: readonly {
13
+ readonly path: string;
14
+ readonly ownership: "authoritative";
15
+ readonly sha256: `sha256:${string}`;
16
+ }[];
17
+ readonly digest: `sha256:${string}`;
18
+ };
19
+ /**
20
+ * Materialize SDK-owned workspace contracts from authored manifest source.
21
+ * Authoritative files are always replaced. Seed files are untouched unless a
22
+ * scaffolding caller explicitly opts in. No test state or projection artifact
23
+ * is emitted.
24
+ */
25
+ declare function materializeWorkspace(options: MaterializeWorkspaceOptions): Promise<MaterializedWorkspaceReceipt>;
26
+
27
+ export { type MaterializeWorkspaceOptions, type MaterializedWorkspaceReceipt, materializeWorkspace };
@@ -0,0 +1,12 @@
1
+ import {
2
+ materializeWorkspace
3
+ } from "./chunk-P6IJ5YVY.js";
4
+ import "./chunk-7ADPYKFT.js";
5
+ import "./chunk-UNVCT5Z7.js";
6
+ import "./chunk-SFOAY5H4.js";
7
+ import "./chunk-SACZWUA6.js";
8
+ import "./chunk-PZ5AY32C.js";
9
+ export {
10
+ materializeWorkspace
11
+ };
12
+ //# sourceMappingURL=authoring-compiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ materializeWorkspace
4
+ } from "./chunk-P6IJ5YVY.js";
5
+ import "./chunk-7ADPYKFT.js";
6
+ import "./chunk-UNVCT5Z7.js";
7
+ import "./chunk-SFOAY5H4.js";
8
+ import "./chunk-SACZWUA6.js";
9
+ import "./chunk-PZ5AY32C.js";
10
+
11
+ // src/authoring-materialize-cli.ts
12
+ var options = parseArgs(process.argv.slice(2));
13
+ var receipt = await materializeWorkspace(options);
14
+ console.log(JSON.stringify(receipt, null, 2));
15
+ function parseArgs(argv) {
16
+ let manifestPath;
17
+ let projectRoot;
18
+ let writeMissingSeeds = false;
19
+ for (let index = 0; index < argv.length; index += 1) {
20
+ const arg = argv[index];
21
+ if (arg === "--manifest") {
22
+ manifestPath = argv[index + 1];
23
+ index += 1;
24
+ continue;
25
+ }
26
+ if (arg === "--project-root") {
27
+ projectRoot = argv[index + 1];
28
+ index += 1;
29
+ continue;
30
+ }
31
+ if (arg === "--write-missing-seeds") {
32
+ writeMissingSeeds = true;
33
+ continue;
34
+ }
35
+ throw new Error(`Unknown argument '${arg}'.`);
36
+ }
37
+ if (!manifestPath) {
38
+ throw new Error("--manifest is required.");
39
+ }
40
+ return {
41
+ manifestPath,
42
+ ...projectRoot === void 0 ? {} : { projectRoot },
43
+ ...writeMissingSeeds ? { writeMissingSeeds: true } : {}
44
+ };
45
+ }
46
+ //# sourceMappingURL=authoring-materialize-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/authoring-materialize-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { materializeWorkspace } from \"./authoring/materialize-workspace.js\";\n\nconst options = parseArgs(process.argv.slice(2));\nconst receipt = await materializeWorkspace(options);\nconsole.log(JSON.stringify(receipt, null, 2));\n\nfunction parseArgs(argv: readonly string[]): {\n readonly manifestPath: string;\n readonly projectRoot?: string;\n readonly writeMissingSeeds?: boolean;\n} {\n let manifestPath: string | undefined;\n let projectRoot: string | undefined;\n let writeMissingSeeds = false;\n for (let index = 0; index < argv.length; index += 1) {\n const arg = argv[index];\n if (arg === \"--manifest\") {\n manifestPath = argv[index + 1];\n index += 1;\n continue;\n }\n if (arg === \"--project-root\") {\n projectRoot = argv[index + 1];\n index += 1;\n continue;\n }\n if (arg === \"--write-missing-seeds\") {\n writeMissingSeeds = true;\n continue;\n }\n throw new Error(`Unknown argument '${arg}'.`);\n }\n if (!manifestPath) {\n throw new Error(\"--manifest is required.\");\n }\n return {\n manifestPath,\n ...(projectRoot === undefined ? {} : { projectRoot }),\n ...(writeMissingSeeds ? { writeMissingSeeds: true } : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;AAGA,IAAM,UAAU,UAAU,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC/C,IAAM,UAAU,MAAM,qBAAqB,OAAO;AAClD,QAAQ,IAAI,KAAK,UAAU,SAAS,MAAM,CAAC,CAAC;AAE5C,SAAS,UAAU,MAIjB;AACA,MAAI;AACJ,MAAI;AACJ,MAAI,oBAAoB;AACxB,WAAS,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;AACnD,UAAM,MAAM,KAAK,KAAK;AACtB,QAAI,QAAQ,cAAc;AACxB,qBAAe,KAAK,QAAQ,CAAC;AAC7B,eAAS;AACT;AAAA,IACF;AACA,QAAI,QAAQ,kBAAkB;AAC5B,oBAAc,KAAK,QAAQ,CAAC;AAC5B,eAAS;AACT;AAAA,IACF;AACA,QAAI,QAAQ,yBAAyB;AACnC,0BAAoB;AACpB;AAAA,IACF;AACA,UAAM,IAAI,MAAM,qBAAqB,GAAG,IAAI;AAAA,EAC9C;AACA,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC3C;AACA,SAAO;AAAA,IACL;AAAA,IACA,GAAI,gBAAgB,SAAY,CAAC,IAAI,EAAE,YAAY;AAAA,IACnD,GAAI,oBAAoB,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAAA,EACzD;AACF;","names":[]}
@@ -29,7 +29,7 @@ declare function gameplayCommitEffect(): GameplaySemanticEffect;
29
29
  declare function gameplayInvokeEffect(): GameplaySemanticEffect;
30
30
 
31
31
  declare function defineBrowserInteractionSurface<Surface extends BrowserInteractionSurface, Intent extends BrowserInteractionIntent>(definition: BrowserInteractionSurfaceDefinition<Surface, Intent>): BrowserInteractionSurfaceDefinition<Surface, Intent>;
32
- declare const gameplayBrowserInteractionSurface: BrowserInteractionSurfaceDefinition<"gameplay", "arm" | "reveal" | "invoke" | "select" | "toggle" | "increment" | "decrement" | "fill" | "submit", string>;
32
+ declare const gameplayBrowserInteractionSurface: BrowserInteractionSurfaceDefinition<"gameplay", "fill" | "arm" | "reveal" | "invoke" | "select" | "toggle" | "increment" | "decrement" | "submit", string>;
33
33
  declare function createBrowserInteractionRegistry(definitions?: readonly BrowserInteractionSurfaceDefinition[]): BrowserInteractionRegistry;
34
34
  declare const defaultBrowserInteractionRegistry: BrowserInteractionRegistry;
35
35
 
@@ -36,6 +36,7 @@ __export(zod_exports, {
36
36
  OutcomeStandingSchema: () => OutcomeStandingSchema,
37
37
  OutcomeTieBreakSchema: () => OutcomeTieBreakSchema,
38
38
  ProjectSeatsDynamicRequestSchema: () => ProjectSeatsDynamicRequestSchema,
39
+ ProjectionTimingMetadataSchema: () => ProjectionTimingMetadataSchema,
39
40
  ReduceRequestSchema: () => ReduceRequestSchema,
40
41
  ReduceResultAcceptSchema: () => ReduceResultAcceptSchema,
41
42
  ReduceResultRejectSchema: () => ReduceResultRejectSchema,
@@ -53,10 +54,15 @@ __export(zod_exports, {
53
54
  ReducerSessionMetaSchema: () => ReducerSessionMetaSchema,
54
55
  ReducerSessionStateSchema: () => ReducerSessionStateSchema,
55
56
  ReducerSetupSelectionSchema: () => ReducerSetupSelectionSchema,
57
+ RngDrawSchema: () => RngDrawSchema,
58
+ RngOperationParameterSchema: () => RngOperationParameterSchema,
59
+ RngOperationSchema: () => RngOperationSchema,
56
60
  RngStateSchema: () => RngStateSchema,
57
61
  RuntimeSimultaneousCurrentSchema: () => RuntimeSimultaneousCurrentSchema,
58
62
  RuntimeSimultaneousStateSchema: () => RuntimeSimultaneousStateSchema,
59
63
  RuntimeSimultaneousSubmissionSchema: () => RuntimeSimultaneousSubmissionSchema,
64
+ SchedulerContinuationDependencySchema: () => SchedulerContinuationDependencySchema,
65
+ SchedulerFlowAuthorityProjectionSchema: () => SchedulerFlowAuthorityProjectionSchema,
60
66
  SeatProjectionBundleSchema: () => SeatProjectionBundleSchema,
61
67
  SeatProjectionSchema: () => SeatProjectionSchema,
62
68
  SimultaneousPhaseProjectionSchema: () => SimultaneousPhaseProjectionSchema,
@@ -73,7 +79,10 @@ var JsonValueSchema = JsonValueSchemaInternal;
73
79
  var ContinuationTokenSchema = z.object({ "id": z.string().min(1), "data": JsonValueSchema }).strict();
74
80
  var ContinuationMapSchema = z.record(z.string(), ContinuationTokenSchema);
75
81
  var ReducerSetupSelectionSchema = z.object({ "profileId": z.string().min(1), "optionValues": z.record(z.string(), z.union([z.string(), z.null()])) }).strict();
76
- var RngStateSchema = z.object({ "seed": z.union([z.number().refine(Number.isInteger, { message: "Expected integer" }), z.null()]), "cursor": z.number().int(), "trace": z.array(z.string()) }).strict();
82
+ var RngOperationParameterSchema = z.union([z.string(), z.number().finite(), z.boolean()]);
83
+ var RngOperationSchema = z.object({ "kind": z.string().min(1), "parameters": z.record(z.string(), RngOperationParameterSchema) }).strict();
84
+ var RngDrawSchema = z.object({ "index": z.number().int().gte(0), "cursorBefore": z.number().int().gte(0), "cursorAfter": z.number().int().gte(0), "operation": RngOperationSchema }).strict();
85
+ var RngStateSchema = z.object({ "seed": z.union([z.number().refine(Number.isInteger, { message: "Expected integer" }), z.null()]), "cursor": z.number().int(), "trace": z.array(z.string()), "draws": z.array(RngDrawSchema).optional() }).strict();
77
86
  var ReducerFlowStateSchema = z.object({ "currentPhase": z.string().min(1), "turn": z.number().int(), "round": z.number().int(), "activePlayers": z.array(z.string().min(1)) }).strict();
78
87
  var RuntimeSimultaneousSubmissionSchema = z.object({ "interactionId": z.string().min(1), "params": JsonValueSchema }).strict();
79
88
  var RuntimeSimultaneousCurrentSchema = z.object({ "phaseName": z.string().min(1), "actors": z.array(z.string().min(1)), "submissions": z.record(z.string(), RuntimeSimultaneousSubmissionSchema) }).strict();
@@ -110,24 +119,27 @@ var ReduceResultAcceptSchema = z.object({ "kind": z.literal("accept"), "state":
110
119
  var ReduceResultSchema = z.discriminatedUnion("kind", [ReduceResultRejectSchema, ReduceResultAcceptSchema]);
111
120
  var DispatchTraceAcceptedClientInputSchema = z.object({ "kind": z.literal("acceptedClientInput"), "input": GameInputSchema }).strict();
112
121
  var DispatchTraceAppliedEffectSchema = z.object({ "kind": z.literal("appliedEffect"), "effect": EffectSchema, "continuation": ContinuationTokenSchema.optional() }).strict();
113
- var DispatchTraceRngConsumptionSchema = z.object({ "kind": z.literal("rngConsumption"), "operation": z.string().min(1), "traceEntry": z.string() }).strict();
122
+ var DispatchTraceRngConsumptionSchema = z.object({ "kind": z.literal("rngConsumption"), "version": z.literal(2), "operation": z.string().min(1), "drawIndex": z.number().int().gte(0), "traceEntry": z.string() }).strict();
114
123
  var DispatchTraceSchema = z.discriminatedUnion("kind", [DispatchTraceAcceptedClientInputSchema, DispatchTraceAppliedEffectSchema, DispatchTraceRngConsumptionSchema]);
115
124
  var DispatchResultRejectSchema = z.object({ "kind": z.literal("reject"), "errorCode": z.string().min(1), "message": z.string().optional() }).strict();
116
125
  var DispatchResultAcceptSchema = z.object({ "kind": z.literal("accept"), "state": ReducerSessionStateSchema, "terminal": GameOutcomeSchema.optional(), "trace": z.array(DispatchTraceSchema), "events": z.array(GameEventSchema).max(32) }).strict();
117
126
  var DispatchResultSchema = z.discriminatedUnion("kind", [DispatchResultRejectSchema, DispatchResultAcceptSchema]);
118
127
  var ReducerRuntimeLogEntryAcceptedClientInputSchema = z.object({ "kind": z.literal("acceptedClientInput"), "version": z.number().int(), "input": GameInputSchema }).strict();
119
128
  var ReducerRuntimeLogEntryAppliedEffectSchema = z.object({ "kind": z.literal("appliedEffect"), "version": z.number().int(), "effect": EffectSchema, "continuation": z.union([ContinuationTokenSchema, z.null()]) }).strict();
120
- var ReducerRuntimeLogEntryRngConsumptionSchema = z.object({ "kind": z.literal("rngConsumption"), "version": z.number().int(), "operation": z.string().min(1), "traceEntry": z.string() }).strict();
129
+ var ReducerRuntimeLogEntryRngConsumptionSchema = z.object({ "kind": z.literal("rngConsumption"), "version": z.number().int(), "operation": z.string().min(1), "drawIndex": z.number().int().gte(0).optional(), "traceEntry": z.string() }).strict();
121
130
  var ReducerRuntimeLogEntryStateCommitSchema = z.object({ "kind": z.literal("stateCommit"), "version": z.number().int(), "state": ReducerSessionStateSchema }).strict();
122
131
  var ReducerRuntimeLogEntrySchema = z.discriminatedUnion("kind", [ReducerRuntimeLogEntryAcceptedClientInputSchema, ReducerRuntimeLogEntryAppliedEffectSchema, ReducerRuntimeLogEntryRngConsumptionSchema, ReducerRuntimeLogEntryStateCommitSchema]);
123
132
  var SeatProjectionSchema = z.object({ "view": JsonValueSchema.optional(), "availableInteractionRefs": JsonValueSchema.optional(), "zones": JsonValueSchema.optional() }).strict();
124
133
  var SimultaneousPhaseProjectionSchema = z.object({ "phaseName": z.string().min(1), "interactionId": z.string().min(1), "actorIds": z.array(z.string().min(1)), "sealedPlayerIds": z.array(z.string().min(1)), "pendingPlayerIds": z.array(z.string().min(1)) }).strict();
125
- var SeatProjectionBundleSchema = z.object({ "currentStage": z.union([z.string().min(1), z.null()]).optional(), "stageSeats": z.array(z.string().min(1)).optional(), "simultaneousPhase": z.union([SimultaneousPhaseProjectionSchema, z.null()]).optional(), "interactionsByRef": JsonValueSchema.optional(), "seats": z.record(z.string(), SeatProjectionSchema) }).strict();
126
- var ProjectSeatsDynamicRequestSchema = z.object({ "state": ReducerSessionStateSchema, "playerIds": z.array(z.string().min(1)), "viewId": z.string().min(1).optional(), "projectionMode": z.union([z.enum(["full", "actionsOnly"]), z.null()]).optional() }).strict();
134
+ var SchedulerContinuationDependencySchema = z.object({ "waiterPlayerId": z.string().min(1), "blockerPlayerIds": z.array(z.string().min(1)) }).strict();
135
+ var SchedulerFlowAuthorityProjectionSchema = z.object({ "version": z.literal(1), "activePlayerIds": z.array(z.string().min(1)), "pendingPlayerIds": z.array(z.string().min(1)), "continuationDependencies": z.array(SchedulerContinuationDependencySchema) }).strict();
136
+ var ProjectionTimingMetadataSchema = z.object({ "resolveAvailableInteractionsMs": z.number().finite().gte(0), "resolveViewMs": z.number().finite().gte(0), "resolveZoneHandlesMs": z.number().finite().gte(0), "descriptorHashMs": z.number().finite().gte(0) }).strict();
137
+ var SeatProjectionBundleSchema = z.object({ "currentStage": z.union([z.string().min(1), z.null()]).optional(), "stageSeats": z.array(z.string().min(1)).optional(), "simultaneousPhase": z.union([SimultaneousPhaseProjectionSchema, z.null()]).optional(), "schedulerFlow": SchedulerFlowAuthorityProjectionSchema.optional(), "sharedView": JsonValueSchema.optional(), "interactionsByRef": JsonValueSchema.optional(), "seats": z.record(z.string(), SeatProjectionSchema), "timing": ProjectionTimingMetadataSchema.optional() }).strict();
138
+ var ProjectSeatsDynamicRequestSchema = z.object({ "state": ReducerSessionStateSchema, "playerIds": z.array(z.string().min(1)), "projectionMode": z.union([z.enum(["full", "actionsOnly"]), z.null()]).optional() }).strict();
127
139
  var BoardStaticProjectionSchema = z.object({ "view": JsonValueSchema, "hash": z.string().min(1), "manifestVersion": z.string() }).strict();
128
140
 
129
141
  // ../reducer-contract/generated/version.ts
130
- var REDUCER_CONTRACT_VERSION = "0.3.0";
142
+ var REDUCER_CONTRACT_VERSION = "0.4.0";
131
143
 
132
144
  // ../reducer-contract/generated/builders.ts
133
145
  var builders_exports = {};
@@ -178,4 +190,4 @@ export {
178
190
  builders_exports,
179
191
  REDUCER_CONTRACT_VERSION
180
192
  };
181
- //# sourceMappingURL=chunk-TGMXBRKY.js.map
193
+ //# sourceMappingURL=chunk-3PFDHTR7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../reducer-contract/generated/zod.ts","../../reducer-contract/generated/version.ts","../../reducer-contract/generated/builders.ts"],"sourcesContent":["// @generated by packages/reducer-contract/scripts/generate-ts.mjs\n// DO NOT EDIT BY HAND. Edit schema/reducer-runtime.schema.json and rerun `pnpm generate`.\n\n/* eslint-disable */\nimport { z } from \"zod\";\n\nexport const ReducerContractVersionSchema = z.string().regex(new RegExp(\"^[0-9]+\\\\.[0-9]+\\\\.[0-9]+$\"));\n\nexport const EffectIdSchema = z.string().min(1);\n\nlet JsonValueSchemaInternal: z.ZodType<unknown>;\nJsonValueSchemaInternal = z.lazy(() => z.union([z.record(z.string(), JsonValueSchemaInternal), z.array(JsonValueSchemaInternal), z.string(), z.number(), z.boolean(), z.null()]));\nexport const JsonValueSchema = JsonValueSchemaInternal;\n\nexport const ContinuationTokenSchema = z.object({ \"id\": z.string().min(1), \"data\": JsonValueSchema }).strict();\n\nexport const ContinuationMapSchema = z.record(z.string(), ContinuationTokenSchema);\n\nexport const ReducerSetupSelectionSchema = z.object({ \"profileId\": z.string().min(1), \"optionValues\": z.record(z.string(), z.union([z.string(), z.null()])) }).strict();\n\nexport const RngOperationParameterSchema = z.union([z.string(), z.number().finite(), z.boolean()]);\n\nexport const RngOperationSchema = z.object({ \"kind\": z.string().min(1), \"parameters\": z.record(z.string(), RngOperationParameterSchema) }).strict();\n\nexport const RngDrawSchema = z.object({ \"index\": z.number().int().gte(0), \"cursorBefore\": z.number().int().gte(0), \"cursorAfter\": z.number().int().gte(0), \"operation\": RngOperationSchema }).strict();\n\nexport const RngStateSchema = z.object({ \"seed\": z.union([z.number().refine(Number.isInteger, { message: \"Expected integer\" }), z.null()]), \"cursor\": z.number().int(), \"trace\": z.array(z.string()), \"draws\": z.array(RngDrawSchema).optional() }).strict();\n\nexport const ReducerFlowStateSchema = z.object({ \"currentPhase\": z.string().min(1), \"turn\": z.number().int(), \"round\": z.number().int(), \"activePlayers\": z.array(z.string().min(1)) }).strict();\n\nexport const RuntimeSimultaneousSubmissionSchema = z.object({ \"interactionId\": z.string().min(1), \"params\": JsonValueSchema }).strict();\n\nexport const RuntimeSimultaneousCurrentSchema = z.object({ \"phaseName\": z.string().min(1), \"actors\": z.array(z.string().min(1)), \"submissions\": z.record(z.string(), RuntimeSimultaneousSubmissionSchema) }).strict();\n\nexport const RuntimeSimultaneousStateSchema = z.object({ \"current\": z.union([RuntimeSimultaneousCurrentSchema, z.null()]) }).strict();\n\nexport const TransitionRecordSchema = z.object({ \"from\": z.string().min(1), \"to\": z.string().min(1) }).strict();\n\nexport const ReducerRuntimeStateSchema = z.object({ \"rng\": RngStateSchema, \"setup\": z.union([ReducerSetupSelectionSchema, z.null()]), \"simultaneous\": RuntimeSimultaneousStateSchema, \"lastTransition\": z.union([TransitionRecordSchema, z.null()]) }).strict();\n\nexport const ReducerDomainStateSchema = z.object({ \"table\": JsonValueSchema, \"publicState\": JsonValueSchema, \"privateState\": z.record(z.string(), JsonValueSchema), \"hiddenState\": JsonValueSchema, \"flow\": ReducerFlowStateSchema, \"phase\": JsonValueSchema }).strict();\n\nexport const ReducerSessionMetaSchema = z.object({ \"contractFingerprint\": z.string().regex(new RegExp(\"^cfp[0-9]+:[a-f0-9]{16}$\")) }).strict();\n\nexport const ReducerSessionStateSchema = z.object({ \"meta\": ReducerSessionMetaSchema.optional(), \"domain\": ReducerDomainStateSchema, \"runtime\": ReducerRuntimeStateSchema }).strict();\n\nexport const GameInputInteractionSchema = z.object({ \"kind\": z.literal(\"interaction\"), \"playerId\": z.string().min(1), \"interactionId\": z.string().min(1), \"params\": JsonValueSchema }).strict();\n\nexport const GameInputSchema = z.discriminatedUnion(\"kind\", [GameInputInteractionSchema]);\n\nexport const EffectTransitionSchema = z.object({ \"effectId\": EffectIdSchema, \"type\": z.literal(\"transition\"), \"to\": z.string().min(1) }).strict();\n\nexport const EffectRollDieSchema = z.object({ \"effectId\": EffectIdSchema, \"type\": z.literal(\"rollDie\"), \"dieId\": z.string().min(1) }).strict();\n\nexport const EffectShuffleSharedZoneSchema = z.object({ \"effectId\": EffectIdSchema, \"type\": z.literal(\"shuffleSharedZone\"), \"zoneId\": z.string().min(1) }).strict();\n\nexport const EffectShufflePlayerZoneSchema = z.object({ \"effectId\": EffectIdSchema, \"type\": z.literal(\"shufflePlayerZone\"), \"zoneId\": z.string().min(1), \"playerId\": z.string().min(1) }).strict();\n\nexport const EffectSchema = z.discriminatedUnion(\"type\", [EffectTransitionSchema, EffectRollDieSchema, EffectShuffleSharedZoneSchema, EffectShufflePlayerZoneSchema]);\n\nexport const ReducerInputValidationResultSchema = z.object({ \"valid\": z.boolean(), \"errorCode\": z.string().optional(), \"message\": z.string().optional() }).strict();\n\nexport const InitializeRequestSchema = z.object({ \"table\": JsonValueSchema, \"playerIds\": z.array(z.string().min(1)), \"rngSeed\": z.union([z.number().refine(Number.isInteger, { message: \"Expected integer\" }), z.null()]).optional(), \"setup\": z.union([ReducerSetupSelectionSchema, z.null()]).optional() }).strict();\n\nexport const InitializePhaseRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"to\": z.string().min(1) }).strict();\n\nexport const ValidateInputRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"input\": GameInputSchema }).strict();\n\nexport const ReduceRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"input\": GameInputSchema }).strict();\n\nexport const DispatchRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"input\": GameInputSchema }).strict();\n\nexport const ReduceResultRejectSchema = z.object({ \"kind\": z.literal(\"reject\"), \"errorCode\": z.string().min(1), \"message\": z.string().optional() }).strict();\n\nexport const GameOutcomeReasonSchema = z.object({ \"code\": z.string().min(1), \"message\": z.string().min(1).optional() }).strict();\n\nexport const OutcomeResultSchema = z.enum([\"win\", \"draw\", \"loss\", \"eliminated\"]);\n\nexport const OutcomeScoreComponentSchema = z.object({ \"id\": z.string().min(1), \"label\": z.string().min(1), \"value\": z.number().finite() }).strict();\n\nexport const OutcomeTieBreakSchema = z.object({ \"id\": z.string().min(1), \"label\": z.string().min(1), \"value\": z.union([z.number().finite(), z.string()]) }).strict();\n\nexport const OutcomeStandingSchema = z.object({ \"playerId\": z.string().min(1), \"rank\": z.number().int().gte(1), \"result\": OutcomeResultSchema, \"score\": z.number().finite().optional(), \"scoreBreakdown\": z.array(OutcomeScoreComponentSchema).optional(), \"tieBreaks\": z.array(OutcomeTieBreakSchema).optional() }).strict();\n\nexport const GameOutcomeSchema = z.object({ \"reason\": GameOutcomeReasonSchema, \"standings\": z.array(OutcomeStandingSchema).min(1) }).strict();\n\nexport const GameEventDetailSchema = z.object({ \"label\": z.string().min(1), \"value\": z.union([z.string(), z.number().finite(), z.boolean()]) }).strict();\n\nexport const SystemActionEventSchema = z.object({ \"kind\": z.literal(\"systemAction\"), \"procedureId\": z.string().min(1), \"title\": z.string().min(1), \"summary\": z.string().min(1).optional(), \"details\": z.array(GameEventDetailSchema).max(16).optional() }).strict();\n\nexport const GameEventSchema = z.discriminatedUnion(\"kind\", [SystemActionEventSchema]);\n\nexport const ReduceResultAcceptSchema = z.object({ \"kind\": z.literal(\"accept\"), \"state\": ReducerSessionStateSchema, \"terminal\": GameOutcomeSchema.optional(), \"effects\": z.array(EffectSchema), \"continuations\": ContinuationMapSchema, \"events\": z.array(GameEventSchema).max(32) }).strict();\n\nexport const ReduceResultSchema = z.discriminatedUnion(\"kind\", [ReduceResultRejectSchema, ReduceResultAcceptSchema]);\n\nexport const DispatchTraceAcceptedClientInputSchema = z.object({ \"kind\": z.literal(\"acceptedClientInput\"), \"input\": GameInputSchema }).strict();\n\nexport const DispatchTraceAppliedEffectSchema = z.object({ \"kind\": z.literal(\"appliedEffect\"), \"effect\": EffectSchema, \"continuation\": ContinuationTokenSchema.optional() }).strict();\n\nexport const DispatchTraceRngConsumptionSchema = z.object({ \"kind\": z.literal(\"rngConsumption\"), \"version\": z.literal(2), \"operation\": z.string().min(1), \"drawIndex\": z.number().int().gte(0), \"traceEntry\": z.string() }).strict();\n\nexport const DispatchTraceSchema = z.discriminatedUnion(\"kind\", [DispatchTraceAcceptedClientInputSchema, DispatchTraceAppliedEffectSchema, DispatchTraceRngConsumptionSchema]);\n\nexport const DispatchResultRejectSchema = z.object({ \"kind\": z.literal(\"reject\"), \"errorCode\": z.string().min(1), \"message\": z.string().optional() }).strict();\n\nexport const DispatchResultAcceptSchema = z.object({ \"kind\": z.literal(\"accept\"), \"state\": ReducerSessionStateSchema, \"terminal\": GameOutcomeSchema.optional(), \"trace\": z.array(DispatchTraceSchema), \"events\": z.array(GameEventSchema).max(32) }).strict();\n\nexport const DispatchResultSchema = z.discriminatedUnion(\"kind\", [DispatchResultRejectSchema, DispatchResultAcceptSchema]);\n\nexport const ReducerRuntimeLogEntryAcceptedClientInputSchema = z.object({ \"kind\": z.literal(\"acceptedClientInput\"), \"version\": z.number().int(), \"input\": GameInputSchema }).strict();\n\nexport const ReducerRuntimeLogEntryAppliedEffectSchema = z.object({ \"kind\": z.literal(\"appliedEffect\"), \"version\": z.number().int(), \"effect\": EffectSchema, \"continuation\": z.union([ContinuationTokenSchema, z.null()]) }).strict();\n\nexport const ReducerRuntimeLogEntryRngConsumptionSchema = z.object({ \"kind\": z.literal(\"rngConsumption\"), \"version\": z.number().int(), \"operation\": z.string().min(1), \"drawIndex\": z.number().int().gte(0).optional(), \"traceEntry\": z.string() }).strict();\n\nexport const ReducerRuntimeLogEntryStateCommitSchema = z.object({ \"kind\": z.literal(\"stateCommit\"), \"version\": z.number().int(), \"state\": ReducerSessionStateSchema }).strict();\n\nexport const ReducerRuntimeLogEntrySchema = z.discriminatedUnion(\"kind\", [ReducerRuntimeLogEntryAcceptedClientInputSchema, ReducerRuntimeLogEntryAppliedEffectSchema, ReducerRuntimeLogEntryRngConsumptionSchema, ReducerRuntimeLogEntryStateCommitSchema]);\n\nexport const SeatProjectionSchema = z.object({ \"view\": JsonValueSchema.optional(), \"availableInteractionRefs\": JsonValueSchema.optional(), \"zones\": JsonValueSchema.optional() }).strict();\n\nexport const SimultaneousPhaseProjectionSchema = z.object({ \"phaseName\": z.string().min(1), \"interactionId\": z.string().min(1), \"actorIds\": z.array(z.string().min(1)), \"sealedPlayerIds\": z.array(z.string().min(1)), \"pendingPlayerIds\": z.array(z.string().min(1)) }).strict();\n\nexport const SchedulerContinuationDependencySchema = z.object({ \"waiterPlayerId\": z.string().min(1), \"blockerPlayerIds\": z.array(z.string().min(1)) }).strict();\n\nexport const SchedulerFlowAuthorityProjectionSchema = z.object({ \"version\": z.literal(1), \"activePlayerIds\": z.array(z.string().min(1)), \"pendingPlayerIds\": z.array(z.string().min(1)), \"continuationDependencies\": z.array(SchedulerContinuationDependencySchema) }).strict();\n\nexport const ProjectionTimingMetadataSchema = z.object({ \"resolveAvailableInteractionsMs\": z.number().finite().gte(0), \"resolveViewMs\": z.number().finite().gte(0), \"resolveZoneHandlesMs\": z.number().finite().gte(0), \"descriptorHashMs\": z.number().finite().gte(0) }).strict();\n\nexport const SeatProjectionBundleSchema = z.object({ \"currentStage\": z.union([z.string().min(1), z.null()]).optional(), \"stageSeats\": z.array(z.string().min(1)).optional(), \"simultaneousPhase\": z.union([SimultaneousPhaseProjectionSchema, z.null()]).optional(), \"schedulerFlow\": SchedulerFlowAuthorityProjectionSchema.optional(), \"sharedView\": JsonValueSchema.optional(), \"interactionsByRef\": JsonValueSchema.optional(), \"seats\": z.record(z.string(), SeatProjectionSchema), \"timing\": ProjectionTimingMetadataSchema.optional() }).strict();\n\nexport const ProjectSeatsDynamicRequestSchema = z.object({ \"state\": ReducerSessionStateSchema, \"playerIds\": z.array(z.string().min(1)), \"projectionMode\": z.union([z.enum([\"full\", \"actionsOnly\"]), z.null()]).optional() }).strict();\n\nexport const BoardStaticProjectionSchema = z.object({ \"view\": JsonValueSchema, \"hash\": z.string().min(1), \"manifestVersion\": z.string() }).strict();\n","// @generated by packages/reducer-contract/scripts/generate-ts.mjs\n// DO NOT EDIT BY HAND. Edit schema/reducer-runtime.schema.json and rerun `pnpm generate`.\n\n/**\n * The wire-protocol version this package implements. Bumped in lockstep with\n * any breaking change to schema/reducer-runtime.schema.json. At bundle load\n * time hosts refuse bundles whose major version differs.\n */\nexport const REDUCER_CONTRACT_VERSION = \"0.4.0\" as const;\n","// @generated by packages/reducer-contract/scripts/generate-ts.mjs\n// DO NOT EDIT BY HAND. Edit schema/reducer-runtime.schema.json and rerun `pnpm generate`.\n\n/* eslint-disable */\nimport type * as Wire from \"./wire\";\n\n/**\n * Typed effect constructors. Authors MUST go through these; hand-constructing\n * Wire.Effect objects is banned by convention because it's how wire drift\n * re-enters the codebase.\n *\n * The `effectId` is minted by the runtime (see createEffectIdMinter below),\n * not by the author. Each builder returns a `PendingEffect` that carries\n * the optional continuation; the reducer bundle's accept materializer splits\n * pending effects into the wire's `effects[]` + `continuations` map.\n */\n\nexport type PendingEffect = Wire.Effect & {\n readonly __continuation?: Wire.ContinuationToken;\n};\n\nexport type EffectIdMinter = () => Wire.EffectId;\n\n/**\n * Produces sequential, deterministic effect ids scoped to a single accept\n * payload: \"ef0\", \"ef1\", ... . Uniqueness only needs to be local to the\n * payload because the host consumes and discards them per dispatch.\n */\nexport function createEffectIdMinter(): EffectIdMinter {\n let i = 0;\n return () => `ef${i++}` as Wire.EffectId;\n}\n\nexport type EffectBuilders = {\n transition(args: { to: string }, continuation?: Wire.ContinuationToken): PendingEffect;\n rollDie(args: { dieId: string }, continuation?: Wire.ContinuationToken): PendingEffect;\n shuffleSharedZone(args: { zoneId: string }, continuation?: Wire.ContinuationToken): PendingEffect;\n shufflePlayerZone(args: { zoneId: string; playerId: string }, continuation?: Wire.ContinuationToken): PendingEffect;\n};\n\nexport function createEffectBuilders(mint: EffectIdMinter): EffectBuilders {\n return {\n transition(args, continuation) {\n const effect = { effectId: mint(), type: \"transition\" as const, to: args.to };\n return continuation === undefined\n ? (effect as PendingEffect)\n : Object.assign(effect, { __continuation: continuation });\n },\n rollDie(args, continuation) {\n const effect = { effectId: mint(), type: \"rollDie\" as const, dieId: args.dieId };\n return continuation === undefined\n ? (effect as PendingEffect)\n : Object.assign(effect, { __continuation: continuation });\n },\n shuffleSharedZone(args, continuation) {\n const effect = { effectId: mint(), type: \"shuffleSharedZone\" as const, zoneId: args.zoneId };\n return continuation === undefined\n ? (effect as PendingEffect)\n : Object.assign(effect, { __continuation: continuation });\n },\n shufflePlayerZone(args, continuation) {\n const effect = { effectId: mint(), type: \"shufflePlayerZone\" as const, zoneId: args.zoneId, playerId: args.playerId };\n return continuation === undefined\n ? (effect as PendingEffect)\n : Object.assign(effect, { __continuation: continuation });\n },\n };\n}\n\n/**\n * Takes a list of PendingEffects and splits them into the canonical wire\n * shape: `effects[]` (stripped of `__continuation`) + `continuations` map\n * keyed by effectId. Use at the boundary where reduce/dispatch results leave\n * author code and enter the wire.\n */\nexport function materializeAccept(pending: ReadonlyArray<PendingEffect>): {\n effects: Wire.Effect[];\n continuations: Wire.ContinuationMap;\n} {\n const effects: Wire.Effect[] = [];\n const continuations: Wire.ContinuationMap = {};\n for (const pe of pending) {\n const { __continuation, ...effect } = pe as PendingEffect & { __continuation?: Wire.ContinuationToken };\n effects.push(effect as Wire.Effect);\n if (__continuation !== undefined) {\n continuations[(effect as Wire.Effect).effectId] = __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AkB,SAGhC;AACA,QAAM,UAAyB,CAAC;AAChC,QAAM,gBAAsC,CAAC;AAC7C,aAAW,MAAM,SAAS;AACxB,UAAM,EAAE,gBAAgB,GAAG,OAAO,IAAI;AACtC,YAAQ,KAAK,MAAqB;AAClC,QAAI,mBAAmB,QAAW;AAChC,oBAAe,OAAuB,QAAQ,IAAI;AAAA,IACpD;AAAA,EACF;AACA,SAAO,EAAE,SAAS,cAAc;AAClC;","names":[]}
@@ -0,0 +1,176 @@
1
+ import {
2
+ computeReferenceGameSourceFingerprint
3
+ } from "./chunk-UNVCT5Z7.js";
4
+
5
+ // src/reference-games/schema.ts
6
+ import { z } from "zod";
7
+ var REFERENCE_GAME_SOURCE_MANIFEST_SCHEMA_VERSION = 3;
8
+ var REFERENCE_GAME_MANIFEST_SCHEMA_VERSION = 3;
9
+ var referenceGameSha256DigestSchema = z.string().regex(/^sha256:[a-f0-9]{64}$/);
10
+ var referenceGameSourceObjectSchema = z.object({
11
+ path: z.string().min(1),
12
+ sha256: referenceGameSha256DigestSchema,
13
+ byteLength: z.number().int().nonnegative()
14
+ }).strict();
15
+ var referenceGameSourceEntrySchema = z.object({
16
+ id: z.string().regex(/^[a-z0-9][a-z0-9-]*$/),
17
+ root: z.string().regex(/^examples\/reference-games\/[a-z0-9-]+$/),
18
+ sourceSha256: referenceGameSha256DigestSchema,
19
+ packageJsonSha256: referenceGameSha256DigestSchema,
20
+ lockfileSha256: referenceGameSha256DigestSchema,
21
+ sdkSpecifier: z.string().min(1),
22
+ manifest: z.string().min(1),
23
+ reducer: z.string().min(1),
24
+ ui: z.string().min(1),
25
+ behaviorScenarios: z.array(z.string().min(1)).min(1),
26
+ uiScenarios: z.array(z.string().min(1)).min(1),
27
+ mechanics: z.array(z.string().min(1)).min(1),
28
+ readFirst: z.array(z.string().min(1)).min(1)
29
+ }).strict();
30
+ var referenceGameSourceInventoryPolicySchema = z.object({
31
+ schemaVersion: z.literal(1),
32
+ workspaceOwnershipVersion: z.number().int().positive(),
33
+ excludedGameRelativePaths: z.array(z.string().min(1)),
34
+ excludedGameRelativePrefixes: z.array(z.string().min(1))
35
+ }).strict();
36
+ var referenceGameSourceManifestPayloadSchema = z.object({
37
+ inventoryPolicy: referenceGameSourceInventoryPolicySchema,
38
+ games: z.array(referenceGameSourceEntrySchema).min(1),
39
+ objects: z.array(referenceGameSourceObjectSchema).min(1)
40
+ }).strict();
41
+ var referenceGameSourceProvenanceSchema = z.discriminatedUnion(
42
+ "kind",
43
+ [
44
+ z.object({ kind: z.literal("worktree") }).strict(),
45
+ z.object({
46
+ kind: z.literal("git"),
47
+ repository: z.literal("dreamboard-games/dreamboard-sdk"),
48
+ revision: z.string().regex(/^[a-f0-9]{40}$/)
49
+ }).strict()
50
+ ]
51
+ );
52
+ var referenceGameSourceManifestSchema = z.object({
53
+ schemaVersion: z.literal(REFERENCE_GAME_SOURCE_MANIFEST_SCHEMA_VERSION),
54
+ manifestType: z.literal("dreamboard.reference-game-source"),
55
+ sourceFingerprint: referenceGameSha256DigestSchema,
56
+ payload: referenceGameSourceManifestPayloadSchema,
57
+ provenance: referenceGameSourceProvenanceSchema
58
+ }).strict().superRefine((value, context) => {
59
+ const fingerprint = computeReferenceGameSourceFingerprint(value.payload);
60
+ if (value.sourceFingerprint !== fingerprint) {
61
+ context.addIssue({
62
+ code: "custom",
63
+ path: ["sourceFingerprint"],
64
+ message: "sourceFingerprint must match the canonical authored-object inventory"
65
+ });
66
+ }
67
+ });
68
+ var referenceGameIdSchema = z.string().regex(/^[a-z0-9][a-z0-9-]*$/);
69
+ var referenceGameWorkspacePathSchema = z.string().min(1);
70
+ var referenceGameAssetPathSchema = z.string().regex(/^assets\/(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+$/).refine(
71
+ (value) => value.split("/").every((segment) => segment !== "." && segment !== ".."),
72
+ { message: "asset path must stay inside the game assets directory" }
73
+ );
74
+ var referenceGameWorkspaceSchema = z.object({
75
+ manifest: referenceGameWorkspacePathSchema,
76
+ reducer: referenceGameWorkspacePathSchema,
77
+ ui: referenceGameWorkspacePathSchema,
78
+ behaviorScenarios: z.array(referenceGameWorkspacePathSchema).min(1),
79
+ uiScenarios: z.array(referenceGameWorkspacePathSchema).min(1)
80
+ }).strict();
81
+ var referenceGameTeachingSchema = z.object({
82
+ whatThisTeaches: z.array(z.string().min(1)).min(1),
83
+ whenToCopyThisPattern: z.array(z.string().min(1)).min(1),
84
+ readFirst: z.array(referenceGameWorkspacePathSchema).min(1)
85
+ }).strict();
86
+ var referenceGameDemoReleaseSchema = z.object({
87
+ slug: referenceGameIdSchema,
88
+ name: z.string().min(1),
89
+ description: z.string().min(1),
90
+ overview: z.string().min(1),
91
+ creator: z.string().min(1),
92
+ minPlayers: z.number().int().positive(),
93
+ maxPlayers: z.number().int().positive(),
94
+ playTimeMinMinutes: z.number().int().positive(),
95
+ playTimeMaxMinutes: z.number().int().positive(),
96
+ difficulty: z.number().int().min(1).max(5),
97
+ mechanics: z.array(z.string().min(1)).min(1),
98
+ categories: z.array(z.string().min(1)).min(1),
99
+ thumbnailPath: referenceGameAssetPathSchema,
100
+ estimatedMinutes: z.number().int().positive(),
101
+ demoPlayerCount: z.number().int().positive()
102
+ }).strict().superRefine((value, context) => {
103
+ if (value.maxPlayers < value.minPlayers) {
104
+ context.addIssue({
105
+ code: "custom",
106
+ path: ["maxPlayers"],
107
+ message: "maxPlayers must be greater than or equal to minPlayers"
108
+ });
109
+ }
110
+ if (value.playTimeMaxMinutes < value.playTimeMinMinutes) {
111
+ context.addIssue({
112
+ code: "custom",
113
+ path: ["playTimeMaxMinutes"],
114
+ message: "playTimeMaxMinutes must be greater than or equal to playTimeMinMinutes"
115
+ });
116
+ }
117
+ });
118
+ var referenceGameRightsSchema = z.object({
119
+ mechanicsProvenance: z.string().min(1),
120
+ sourceCode: z.string().min(1),
121
+ codeLicense: z.string().min(1),
122
+ ruleText: z.string().min(1),
123
+ artwork: z.string().min(1),
124
+ assetLicenseManifest: z.string().min(1),
125
+ thirdPartyMarks: z.array(z.string()),
126
+ reviewStatus: z.literal("approved"),
127
+ reviewedBy: z.string().min(1),
128
+ reviewedAt: z.string().min(1)
129
+ }).strict();
130
+ var referenceGameSdkPolicySchema = z.object({
131
+ dependency: z.literal("@dreamboard-games/sdk"),
132
+ versionPolicy: z.literal("exact")
133
+ }).strict();
134
+ var referenceGameManifestV3Schema = z.object({
135
+ schemaVersion: z.literal(REFERENCE_GAME_MANIFEST_SCHEMA_VERSION),
136
+ id: referenceGameIdSchema,
137
+ displayName: z.string().min(1),
138
+ workspace: referenceGameWorkspaceSchema,
139
+ teaching: referenceGameTeachingSchema,
140
+ demoRelease: referenceGameDemoReleaseSchema.optional(),
141
+ mechanics: z.array(z.string().min(1)).min(1),
142
+ uiPatterns: z.array(z.string().min(1)).min(1),
143
+ rights: referenceGameRightsSchema,
144
+ sdk: referenceGameSdkPolicySchema
145
+ }).strict();
146
+ function parseReferenceGameSourceManifest(value) {
147
+ return referenceGameSourceManifestSchema.parse(value);
148
+ }
149
+ function parseReferenceGameManifestV3(value) {
150
+ return referenceGameManifestV3Schema.parse(value);
151
+ }
152
+ function isPackageableReferenceGame(game) {
153
+ return game.demoRelease !== void 0;
154
+ }
155
+
156
+ export {
157
+ REFERENCE_GAME_SOURCE_MANIFEST_SCHEMA_VERSION,
158
+ REFERENCE_GAME_MANIFEST_SCHEMA_VERSION,
159
+ referenceGameSha256DigestSchema,
160
+ referenceGameSourceObjectSchema,
161
+ referenceGameSourceEntrySchema,
162
+ referenceGameSourceInventoryPolicySchema,
163
+ referenceGameSourceManifestPayloadSchema,
164
+ referenceGameSourceProvenanceSchema,
165
+ referenceGameSourceManifestSchema,
166
+ referenceGameWorkspaceSchema,
167
+ referenceGameTeachingSchema,
168
+ referenceGameDemoReleaseSchema,
169
+ referenceGameRightsSchema,
170
+ referenceGameSdkPolicySchema,
171
+ referenceGameManifestV3Schema,
172
+ parseReferenceGameSourceManifest,
173
+ parseReferenceGameManifestV3,
174
+ isPackageableReferenceGame
175
+ };
176
+ //# sourceMappingURL=chunk-45P5CEGH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/reference-games/schema.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { computeReferenceGameSourceFingerprint } from \"./canonical.js\";\n\nexport const REFERENCE_GAME_SOURCE_MANIFEST_SCHEMA_VERSION = 3;\nexport const REFERENCE_GAME_MANIFEST_SCHEMA_VERSION = 3;\n\nexport const referenceGameSha256DigestSchema = z\n .string()\n .regex(/^sha256:[a-f0-9]{64}$/);\n\nexport const referenceGameSourceObjectSchema = z\n .object({\n path: z.string().min(1),\n sha256: referenceGameSha256DigestSchema,\n byteLength: z.number().int().nonnegative(),\n })\n .strict();\n\nexport const referenceGameSourceEntrySchema = z\n .object({\n id: z.string().regex(/^[a-z0-9][a-z0-9-]*$/),\n root: z.string().regex(/^examples\\/reference-games\\/[a-z0-9-]+$/),\n sourceSha256: referenceGameSha256DigestSchema,\n packageJsonSha256: referenceGameSha256DigestSchema,\n lockfileSha256: referenceGameSha256DigestSchema,\n sdkSpecifier: z.string().min(1),\n manifest: z.string().min(1),\n reducer: z.string().min(1),\n ui: z.string().min(1),\n behaviorScenarios: z.array(z.string().min(1)).min(1),\n uiScenarios: z.array(z.string().min(1)).min(1),\n mechanics: z.array(z.string().min(1)).min(1),\n readFirst: z.array(z.string().min(1)).min(1),\n })\n .strict();\n\nexport const referenceGameSourceInventoryPolicySchema = z\n .object({\n schemaVersion: z.literal(1),\n workspaceOwnershipVersion: z.number().int().positive(),\n excludedGameRelativePaths: z.array(z.string().min(1)),\n excludedGameRelativePrefixes: z.array(z.string().min(1)),\n })\n .strict();\n\nexport const referenceGameSourceManifestPayloadSchema = z\n .object({\n inventoryPolicy: referenceGameSourceInventoryPolicySchema,\n games: z.array(referenceGameSourceEntrySchema).min(1),\n objects: z.array(referenceGameSourceObjectSchema).min(1),\n })\n .strict();\n\nexport const referenceGameSourceProvenanceSchema = z.discriminatedUnion(\n \"kind\",\n [\n z.object({ kind: z.literal(\"worktree\") }).strict(),\n z\n .object({\n kind: z.literal(\"git\"),\n repository: z.literal(\"dreamboard-games/dreamboard-sdk\"),\n revision: z.string().regex(/^[a-f0-9]{40}$/),\n })\n .strict(),\n ],\n);\n\nexport const referenceGameSourceManifestSchema = z\n .object({\n schemaVersion: z.literal(REFERENCE_GAME_SOURCE_MANIFEST_SCHEMA_VERSION),\n manifestType: z.literal(\"dreamboard.reference-game-source\"),\n sourceFingerprint: referenceGameSha256DigestSchema,\n payload: referenceGameSourceManifestPayloadSchema,\n provenance: referenceGameSourceProvenanceSchema,\n })\n .strict()\n .superRefine((value, context) => {\n const fingerprint = computeReferenceGameSourceFingerprint(value.payload);\n if (value.sourceFingerprint !== fingerprint) {\n context.addIssue({\n code: \"custom\",\n path: [\"sourceFingerprint\"],\n message:\n \"sourceFingerprint must match the canonical authored-object inventory\",\n });\n }\n });\n\nconst referenceGameIdSchema = z.string().regex(/^[a-z0-9][a-z0-9-]*$/);\nconst referenceGameWorkspacePathSchema = z.string().min(1);\nconst referenceGameAssetPathSchema = z\n .string()\n .regex(/^assets\\/(?:[A-Za-z0-9._-]+\\/)*[A-Za-z0-9._-]+$/)\n .refine(\n (value) =>\n value.split(\"/\").every((segment) => segment !== \".\" && segment !== \"..\"),\n { message: \"asset path must stay inside the game assets directory\" },\n );\n\nexport const referenceGameWorkspaceSchema = z\n .object({\n manifest: referenceGameWorkspacePathSchema,\n reducer: referenceGameWorkspacePathSchema,\n ui: referenceGameWorkspacePathSchema,\n behaviorScenarios: z.array(referenceGameWorkspacePathSchema).min(1),\n uiScenarios: z.array(referenceGameWorkspacePathSchema).min(1),\n })\n .strict();\n\nexport const referenceGameTeachingSchema = z\n .object({\n whatThisTeaches: z.array(z.string().min(1)).min(1),\n whenToCopyThisPattern: z.array(z.string().min(1)).min(1),\n readFirst: z.array(referenceGameWorkspacePathSchema).min(1),\n })\n .strict();\n\nexport const referenceGameDemoReleaseSchema = z\n .object({\n slug: referenceGameIdSchema,\n name: z.string().min(1),\n description: z.string().min(1),\n overview: z.string().min(1),\n creator: z.string().min(1),\n minPlayers: z.number().int().positive(),\n maxPlayers: z.number().int().positive(),\n playTimeMinMinutes: z.number().int().positive(),\n playTimeMaxMinutes: z.number().int().positive(),\n difficulty: z.number().int().min(1).max(5),\n mechanics: z.array(z.string().min(1)).min(1),\n categories: z.array(z.string().min(1)).min(1),\n thumbnailPath: referenceGameAssetPathSchema,\n estimatedMinutes: z.number().int().positive(),\n demoPlayerCount: z.number().int().positive(),\n })\n .strict()\n .superRefine((value, context) => {\n if (value.maxPlayers < value.minPlayers) {\n context.addIssue({\n code: \"custom\",\n path: [\"maxPlayers\"],\n message: \"maxPlayers must be greater than or equal to minPlayers\",\n });\n }\n if (value.playTimeMaxMinutes < value.playTimeMinMinutes) {\n context.addIssue({\n code: \"custom\",\n path: [\"playTimeMaxMinutes\"],\n message:\n \"playTimeMaxMinutes must be greater than or equal to playTimeMinMinutes\",\n });\n }\n });\n\nexport const referenceGameRightsSchema = z\n .object({\n mechanicsProvenance: z.string().min(1),\n sourceCode: z.string().min(1),\n codeLicense: z.string().min(1),\n ruleText: z.string().min(1),\n artwork: z.string().min(1),\n assetLicenseManifest: z.string().min(1),\n thirdPartyMarks: z.array(z.string()),\n reviewStatus: z.literal(\"approved\"),\n reviewedBy: z.string().min(1),\n reviewedAt: z.string().min(1),\n })\n .strict();\n\nexport const referenceGameSdkPolicySchema = z\n .object({\n dependency: z.literal(\"@dreamboard-games/sdk\"),\n versionPolicy: z.literal(\"exact\"),\n })\n .strict();\n\nexport const referenceGameManifestV3Schema = z\n .object({\n schemaVersion: z.literal(REFERENCE_GAME_MANIFEST_SCHEMA_VERSION),\n id: referenceGameIdSchema,\n displayName: z.string().min(1),\n workspace: referenceGameWorkspaceSchema,\n teaching: referenceGameTeachingSchema,\n demoRelease: referenceGameDemoReleaseSchema.optional(),\n mechanics: z.array(z.string().min(1)).min(1),\n uiPatterns: z.array(z.string().min(1)).min(1),\n rights: referenceGameRightsSchema,\n sdk: referenceGameSdkPolicySchema,\n })\n .strict();\n\nexport type ReferenceGameSourceObject = z.infer<\n typeof referenceGameSourceObjectSchema\n>;\nexport type ReferenceGameSourceEntry = z.infer<\n typeof referenceGameSourceEntrySchema\n>;\nexport type ReferenceGameSourceManifestPayload = z.infer<\n typeof referenceGameSourceManifestPayloadSchema\n>;\nexport type ReferenceGameSourceInventoryPolicy = z.infer<\n typeof referenceGameSourceInventoryPolicySchema\n>;\nexport type ReferenceGameSourceProvenance = z.infer<\n typeof referenceGameSourceProvenanceSchema\n>;\nexport type ReferenceGameSourceManifest = z.infer<\n typeof referenceGameSourceManifestSchema\n>;\nexport type ReferenceGameWorkspace = z.infer<\n typeof referenceGameWorkspaceSchema\n>;\nexport type ReferenceGameTeaching = z.infer<typeof referenceGameTeachingSchema>;\nexport type ReferenceGameDemoRelease = z.infer<\n typeof referenceGameDemoReleaseSchema\n>;\nexport type ReferenceGameRights = z.infer<typeof referenceGameRightsSchema>;\nexport type ReferenceGameSdkPolicy = z.infer<\n typeof referenceGameSdkPolicySchema\n>;\nexport type ReferenceGameManifestV3 = z.infer<\n typeof referenceGameManifestV3Schema\n>;\n\nexport function parseReferenceGameSourceManifest(\n value: unknown,\n): ReferenceGameSourceManifest {\n return referenceGameSourceManifestSchema.parse(value);\n}\n\nexport function parseReferenceGameManifestV3(\n value: unknown,\n): ReferenceGameManifestV3 {\n return referenceGameManifestV3Schema.parse(value);\n}\n\nexport function isPackageableReferenceGame(\n game: ReferenceGameManifestV3,\n): boolean {\n return game.demoRelease !== undefined;\n}\n"],"mappings":";;;;;AAAA,SAAS,SAAS;AAIX,IAAM,gDAAgD;AACtD,IAAM,yCAAyC;AAE/C,IAAM,kCAAkC,EAC5C,OAAO,EACP,MAAM,uBAAuB;AAEzB,IAAM,kCAAkC,EAC5C,OAAO;AAAA,EACN,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,QAAQ;AAAA,EACR,YAAY,EAA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,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAAA,EAC3C,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAAA,EAC5C,QAAQ;AAAA,EACR,KAAK;AACP,CAAC,EACA,OAAO;AAmCH,SAAS,iCACd,OAC6B;AAC7B,SAAO,kCAAkC,MAAM,KAAK;AACtD;AAEO,SAAS,6BACd,OACyB;AACzB,SAAO,8BAA8B,MAAM,KAAK;AAClD;AAEO,SAAS,2BACd,MACS;AACT,SAAO,KAAK,gBAAgB;AAC9B;","names":[]}
@@ -0,0 +1,32 @@
1
+ import {
2
+ collectReducerDefinitionIndex
3
+ } from "./chunk-YNW3KBDE.js";
4
+
5
+ // src/reducer/client-param-schemas.ts
6
+ import { z } from "zod";
7
+ function schemaForCollectors(collectors) {
8
+ const shape = {};
9
+ for (const [key, collector] of Object.entries(collectors)) {
10
+ if (collector.kind === "rng") continue;
11
+ const schema = collector.schema;
12
+ shape[key] = "defaultValue" in collector ? schema.default(collector.defaultValue) : schema;
13
+ }
14
+ return z.object(shape);
15
+ }
16
+ function createClientParamSchemasByPhase(definition) {
17
+ const index = collectReducerDefinitionIndex(definition);
18
+ const out = {};
19
+ for (const phaseIndex of index.phasesByName.values()) {
20
+ const phaseSchemas = {};
21
+ for (const [id, interaction] of phaseIndex.interactions) {
22
+ phaseSchemas[id] = interaction.paramsSchema ?? schemaForCollectors(interaction.inputs);
23
+ }
24
+ out[String(phaseIndex.phaseName)] = phaseSchemas;
25
+ }
26
+ return out;
27
+ }
28
+
29
+ export {
30
+ createClientParamSchemasByPhase
31
+ };
32
+ //# sourceMappingURL=chunk-5XTAQ4EQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/reducer/client-param-schemas.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { collectReducerDefinitionIndex } from \"./definition-index\";\nimport type {\n InputCollector,\n PhaseMapOf,\n ReducerGameContractLike,\n ReducerGameDefinition,\n ViewMapOf,\n} from \"./model\";\n\nexport type ClientParamSchema = {\n safeParse: (value: unknown) =>\n | { success: true; data: Record<string, unknown> }\n | {\n success: false;\n error: { issues: Array<{ path: PropertyKey[]; message: string }> };\n };\n};\n\nexport type ClientParamSchemasByPhase = Readonly<\n Record<string, Readonly<Record<string, ClientParamSchema>>>\n>;\n\nfunction schemaForCollectors(\n collectors: Record<string, InputCollector>,\n): ClientParamSchema {\n const shape: Record<string, z.ZodTypeAny> = {};\n for (const [key, collector] of Object.entries(collectors)) {\n if (collector.kind === \"rng\") continue;\n const schema = collector.schema as z.ZodTypeAny;\n shape[key] =\n \"defaultValue\" in collector\n ? schema.default(collector.defaultValue)\n : schema;\n }\n return z.object(shape) as unknown as ClientParamSchema;\n}\n\nexport function createClientParamSchemasByPhase<\n Contract extends ReducerGameContractLike,\n Definitions extends PhaseMapOf<Contract>,\n Views extends ViewMapOf<Contract>,\n>(\n definition: ReducerGameDefinition<Contract, Definitions, Views>,\n): ClientParamSchemasByPhase {\n const index = collectReducerDefinitionIndex(definition);\n const out: Record<string, Record<string, ClientParamSchema>> = {};\n for (const phaseIndex of index.phasesByName.values()) {\n const phaseSchemas: Record<string, ClientParamSchema> = {};\n for (const [id, interaction] of phaseIndex.interactions) {\n phaseSchemas[id] =\n interaction.paramsSchema ?? schemaForCollectors(interaction.inputs);\n }\n out[String(phaseIndex.phaseName)] = phaseSchemas;\n }\n return out;\n}\n"],"mappings":";;;;;AAAA,SAAS,SAAS;AAuBlB,SAAS,oBACP,YACmB;AACnB,QAAM,QAAsC,CAAC;AAC7C,aAAW,CAAC,KAAK,SAAS,KAAK,OAAO,QAAQ,UAAU,GAAG;AACzD,QAAI,UAAU,SAAS,MAAO;AAC9B,UAAM,SAAS,UAAU;AACzB,UAAM,GAAG,IACP,kBAAkB,YACd,OAAO,QAAQ,UAAU,YAAY,IACrC;AAAA,EACR;AACA,SAAO,EAAE,OAAO,KAAK;AACvB;AAEO,SAAS,gCAKd,YAC2B;AAC3B,QAAM,QAAQ,8BAA8B,UAAU;AACtD,QAAM,MAAyD,CAAC;AAChE,aAAW,cAAc,MAAM,aAAa,OAAO,GAAG;AACpD,UAAM,eAAkD,CAAC;AACzD,eAAW,CAAC,IAAI,WAAW,KAAK,WAAW,cAAc;AACvD,mBAAa,EAAE,IACb,YAAY,gBAAgB,oBAAoB,YAAY,MAAM;AAAA,IACtE;AACA,QAAI,OAAO,WAAW,SAAS,CAAC,IAAI;AAAA,EACtC;AACA,SAAO;AACT;","names":[]}