@dreamboard-games/sdk 0.4.0-alpha.9 → 0.5.0-alpha.1

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 (133) hide show
  1. package/README.md +171 -11
  2. package/dist/authoring/index.d.ts +3 -6
  3. package/dist/authoring/index.js +3 -3
  4. package/dist/authoring-compiler.d.ts +3 -3
  5. package/dist/authoring-compiler.js +4 -5
  6. package/dist/{authoring-materialize-cli.js → authoring-generate-cli.js} +8 -9
  7. package/dist/authoring-generate-cli.js.map +1 -0
  8. package/dist/browser-interaction.d.ts +21 -21
  9. package/dist/{chunk-P6IJ5YVY.js → chunk-2WJSQQT7.js} +21 -9
  10. package/dist/chunk-2WJSQQT7.js.map +1 -0
  11. package/dist/{chunk-2TRZSZGD.js → chunk-32PFKDV7.js} +177 -416
  12. package/dist/chunk-32PFKDV7.js.map +1 -0
  13. package/dist/{chunk-NGYFBNBP.js → chunk-3BAD4VC2.js} +15 -85
  14. package/dist/chunk-3BAD4VC2.js.map +1 -0
  15. package/dist/{chunk-UC2UXAC6.js → chunk-3SKDNDPG.js} +2 -2
  16. package/dist/{chunk-BUOODBVO.js → chunk-4ZKTGZZK.js} +9 -28
  17. package/dist/chunk-4ZKTGZZK.js.map +1 -0
  18. package/dist/{chunk-XDGRC6OR.js → chunk-7M3N5DFJ.js} +613 -487
  19. package/dist/chunk-7M3N5DFJ.js.map +1 -0
  20. package/dist/{chunk-YNW3KBDE.js → chunk-EHPEMPRZ.js} +128 -128
  21. package/dist/chunk-EHPEMPRZ.js.map +1 -0
  22. package/dist/chunk-EY2LL5WD.js +9 -0
  23. package/dist/chunk-EY2LL5WD.js.map +1 -0
  24. package/dist/{chunk-GMOBG7Y7.js → chunk-GDPKTBUR.js} +5 -5
  25. package/dist/{chunk-GMOBG7Y7.js.map → chunk-GDPKTBUR.js.map} +1 -1
  26. package/dist/{chunk-SACZWUA6.js → chunk-JUGQ6F3N.js} +172 -1574
  27. package/dist/{chunk-SACZWUA6.js.map → chunk-JUGQ6F3N.js.map} +1 -1
  28. package/dist/chunk-K2JGSRMD.js +90 -0
  29. package/dist/chunk-K2JGSRMD.js.map +1 -0
  30. package/dist/{chunk-WDR7SKBM.js → chunk-M2S3QC32.js} +4 -4
  31. package/dist/chunk-M2S3QC32.js.map +1 -0
  32. package/dist/{chunk-JRGP6W4V.js → chunk-MIKC4Y67.js} +49 -4
  33. package/dist/chunk-MIKC4Y67.js.map +1 -0
  34. package/dist/chunk-MYKS6MTR.js +1347 -0
  35. package/dist/chunk-MYKS6MTR.js.map +1 -0
  36. package/dist/{chunk-7ADPYKFT.js → chunk-QLSK3DYO.js} +5 -5
  37. package/dist/chunk-QLSK3DYO.js.map +1 -0
  38. package/dist/{chunk-3PFDHTR7.js → chunk-UGH54WZ2.js} +42 -12
  39. package/dist/chunk-UGH54WZ2.js.map +1 -0
  40. package/dist/chunk-VCDWP5VL.js +746 -0
  41. package/dist/chunk-VCDWP5VL.js.map +1 -0
  42. package/dist/{chunk-5XTAQ4EQ.js → chunk-VZ7N6WAQ.js} +2 -2
  43. package/dist/{chunk-L3W2FPRQ.js → chunk-XRS4AZFK.js} +84 -13
  44. package/dist/chunk-XRS4AZFK.js.map +1 -0
  45. package/dist/codegen.d.ts +1 -3
  46. package/dist/codegen.js +1 -5
  47. package/dist/{components-BPzsSRs8.d.ts → components-CuBO6rev.d.ts} +2 -18
  48. package/dist/{definitions-0kjPV9wh.d.ts → definitions-1Hj-pQU8.d.ts} +9 -3
  49. package/dist/digest.d.ts +8 -0
  50. package/dist/game-g9dDFYyU.d.ts +546 -0
  51. package/dist/{index-CWzWpQzM.d.ts → index-Bxbv3c9W.d.ts} +2 -2
  52. package/dist/{index.d-C7Ztirg6.d.ts → index.d-DjzoK7zn.d.ts} +389 -225
  53. package/dist/index.js +2 -2
  54. package/dist/package-set.d.ts +2 -2
  55. package/dist/package-set.js +2 -2
  56. package/dist/plugin-runtime-contract.d.ts +17 -0
  57. package/dist/plugin-runtime-contract.js +92 -0
  58. package/dist/{protocol-B2LWcqB4.d.ts → protocol-dYgafTYY.d.ts} +45 -53
  59. package/dist/reducer/advanced.d.ts +6 -4
  60. package/dist/reducer/advanced.js +14 -85
  61. package/dist/reducer/advanced.js.map +1 -1
  62. package/dist/reducer-contract.d.ts +1 -1
  63. package/dist/reducer-contract.js +6 -4
  64. package/dist/reducer.d.ts +11 -775
  65. package/dist/reducer.js +15 -1293
  66. package/dist/reducer.js.map +1 -1
  67. package/dist/reference-games/index.d.ts +29 -11
  68. package/dist/reference-games/index.js +43 -45
  69. package/dist/reference-games/index.js.map +1 -1
  70. package/dist/runtime/primitives.d.ts +3 -4
  71. package/dist/runtime/primitives.js +5 -5
  72. package/dist/runtime/runtime-api.d.ts +1 -2
  73. package/dist/runtime/workspace-contract.d.ts +347 -11
  74. package/dist/runtime/workspace-contract.js +13 -6
  75. package/dist/{runtime-B_w9AO2n.d.ts → runtime-DksMTWtC.d.ts} +8 -27
  76. package/dist/{plugin-state-BRH3UiUp.d.ts → runtime-api-C9bDgp63.d.ts} +83 -4
  77. package/dist/runtime.d.ts +8 -8
  78. package/dist/runtime.js +19 -14
  79. package/dist/runtime.js.map +1 -1
  80. package/dist/schema.d.ts +379 -0
  81. package/dist/testing-compiler.d.ts +6 -5
  82. package/dist/testing-compiler.js +41 -5
  83. package/dist/testing-compiler.js.map +1 -1
  84. package/dist/testing-runtime.d.ts +7 -6
  85. package/dist/testing-runtime.js +6 -6
  86. package/dist/testing.d.ts +30 -107
  87. package/dist/testing.js +44 -371
  88. package/dist/testing.js.map +1 -1
  89. package/dist/{types-_zfC_7CD.d.ts → types-DR7DoB1x.d.ts} +4 -5
  90. package/dist/{types-Bvptkukh.d.ts → types-Dlh4GsNp.d.ts} +2 -2
  91. package/dist/types.d.ts +0 -1
  92. package/dist/ui/components.d.ts +3 -3
  93. package/dist/ui/components.js +1 -5
  94. package/dist/ui/plugin-styles.css +1 -1
  95. package/dist/{ui-contract-CUC7Lyoc.d.ts → ui-contract-Mgx_k9gm.d.ts} +2 -7
  96. package/dist/ui.d.ts +4 -4
  97. package/dist/ui.js +2 -6
  98. package/dist/{views-DE2eZxPz.d.ts → views-B4lD4fT0.d.ts} +102 -49
  99. package/package.json +28 -29
  100. package/REFERENCE.md +0 -23787
  101. package/dist/authoring-materialize-cli.js.map +0 -1
  102. package/dist/chunk-2TRZSZGD.js.map +0 -1
  103. package/dist/chunk-3PFDHTR7.js.map +0 -1
  104. package/dist/chunk-45P5CEGH.js +0 -176
  105. package/dist/chunk-45P5CEGH.js.map +0 -1
  106. package/dist/chunk-7ADPYKFT.js.map +0 -1
  107. package/dist/chunk-BUOODBVO.js.map +0 -1
  108. package/dist/chunk-JRGP6W4V.js.map +0 -1
  109. package/dist/chunk-L3W2FPRQ.js.map +0 -1
  110. package/dist/chunk-NGYFBNBP.js.map +0 -1
  111. package/dist/chunk-P6IJ5YVY.js.map +0 -1
  112. package/dist/chunk-QQNL4WTX.js +0 -578
  113. package/dist/chunk-QQNL4WTX.js.map +0 -1
  114. package/dist/chunk-SFOAY5H4.js +0 -12
  115. package/dist/chunk-SFOAY5H4.js.map +0 -1
  116. package/dist/chunk-UNVCT5Z7.js +0 -73
  117. package/dist/chunk-UNVCT5Z7.js.map +0 -1
  118. package/dist/chunk-WDR7SKBM.js.map +0 -1
  119. package/dist/chunk-XDGRC6OR.js.map +0 -1
  120. package/dist/chunk-XLHLFTLI.js +0 -399
  121. package/dist/chunk-XLHLFTLI.js.map +0 -1
  122. package/dist/chunk-YNW3KBDE.js.map +0 -1
  123. package/dist/reference-game-compiler.d.ts +0 -45
  124. package/dist/reference-game-compiler.js +0 -25
  125. package/dist/reference-game-source-manifest-cli.d.ts +0 -1
  126. package/dist/reference-game-source-manifest-cli.js +0 -84
  127. package/dist/reference-game-source-manifest-cli.js.map +0 -1
  128. package/dist/runtime-api-xCWLMQRT.d.ts +0 -97
  129. package/dist/schema-9jZzlEWZ.d.ts +0 -220
  130. /package/dist/{authoring-materialize-cli.d.ts → authoring-generate-cli.d.ts} +0 -0
  131. /package/dist/{chunk-UC2UXAC6.js.map → chunk-3SKDNDPG.js.map} +0 -0
  132. /package/dist/{chunk-5XTAQ4EQ.js.map → chunk-VZ7N6WAQ.js.map} +0 -0
  133. /package/dist/{reference-game-compiler.js.map → plugin-runtime-contract.js.map} +0 -0
package/README.md CHANGED
@@ -1,19 +1,179 @@
1
1
  # @dreamboard-games/sdk
2
2
 
3
- The public Dreamboard SDK package. This repository publishes one consumer
4
- package, `@dreamboard-games/sdk`; public capabilities are exposed through the
5
- package export map rather than separate installable workspace packages.
3
+ The public TypeScript SDK for authoring, testing, and rendering Dreamboard
4
+ games. Install this package rather than any of the repository's unpublished
5
+ workspace inputs.
6
6
 
7
- Internal workspaces such as `sdk-types`, `workspace-codegen`, and
8
- `reducer-contract` are implementation inputs. Consumers should not install or
9
- import those package names directly.
7
+ ```sh
8
+ pnpm add @dreamboard-games/sdk
9
+ ```
10
10
 
11
- Typical imports:
11
+ The package's declarations and export map are the API authority. Supported
12
+ imports include the root module and explicit subpaths for authoring, runtime,
13
+ reducer contracts, testing, browser interaction, UI, and reference-game
14
+ metadata. Import only subpaths present in the installed package's `exports`
15
+ field.
12
16
 
13
17
  ```ts
14
- import {
15
- DREAMBOARD_SDK_PACKAGE_SET,
16
- DREAMBOARD_SDK_VERSION,
17
- } from "@dreamboard-games/sdk";
18
+ import { DREAMBOARD_SDK_VERSION } from "@dreamboard-games/sdk";
18
19
  import type { ReducerWire } from "@dreamboard-games/sdk/reducer-contract";
20
+ import {
21
+ REFERENCE_GAME_MANIFEST_SCHEMA_VERSION,
22
+ parseReferenceGameManifest,
23
+ type ReferenceGameManifest,
24
+ } from "@dreamboard-games/sdk/reference-games";
25
+
26
+ const manifest: ReferenceGameManifest = parseReferenceGameManifest(input);
27
+ console.log(REFERENCE_GAME_MANIFEST_SCHEMA_VERSION, manifest.id);
28
+ ```
29
+
30
+ Reference-game manifests use schema V5. They describe the game workspace,
31
+ teaching purpose, mechanics, UI patterns, and substantive rights metadata.
32
+
33
+ Include the packaged stylesheet when using SDK UI components:
34
+
35
+ ```ts
36
+ import "@dreamboard-games/sdk/ui/plugin-styles.css";
37
+ ```
38
+
39
+ ## Game authoring
40
+
41
+ `createGame(model)` is the single authoring entry point. The **model** is a
42
+ plain object: manifest ids, state schemas, one Zod schema per phase, and error
43
+ codes. The returned value is three things at once:
44
+
45
+ - the **type leaf**: `typeof game.types.State`, `.ErrorCode`, `.PlayerId`,
46
+ `.Queries`, `.Tx` (phantom carriers; reading them at runtime throws),
47
+ - the **factory namespace**: `game.phase(name)`, `phase.define`,
48
+ `phase.interaction`, `phase.inputs.*`, `game.views.*`,
49
+ - the **assembler**: `game.assemble({ initial, initialPhase, phases, views })`.
50
+
51
+ Mutation callbacks (`enter`, `reduce`, `resolve`) receive an open transaction
52
+ `tx`. Mutate through it and finish with a bare `return` (accept), or with
53
+ `tx.transition(name)`, `tx.endGame(outcome)`, or `tx.reject(code)`. Events go
54
+ through `tx.emit(...)`. `state` is the read-only snapshot the callback started
55
+ from; `tx.state` is the current draft.
56
+
57
+ ```ts
58
+ // app/game-model.ts — the model, bound once
59
+ import { z } from "zod";
60
+ import { createGame } from "@dreamboard-games/sdk/reducer";
61
+ import { ids, manifestContract } from "../shared/manifest-contract";
62
+
63
+ export const game = createGame({
64
+ manifest: manifestContract,
65
+ state: {
66
+ public: z.object({ currentPlayerId: ids.playerId.nullable() }),
67
+ private: z.object({}),
68
+ hidden: z.object({}),
69
+ },
70
+ phases: {
71
+ setup: z.object({}),
72
+ play: z.object({ leadCardId: ids.cardId.nullable() }),
73
+ },
74
+ errors: { NOT_YOUR_CARD: "Play a card from your own hand." },
75
+ });
76
+
77
+ export type GameState = typeof game.types.State;
19
78
  ```
79
+
80
+ ```ts
81
+ // app/phases/play.ts — one phase, one file
82
+ import { game } from "../game-model";
83
+
84
+ const play = game.phase("play");
85
+
86
+ // Inputs name their candidate domain and eligibility predicates directly.
87
+ // `where.errorCode` is checked against `model.errors`.
88
+ const ownCard = play.inputs.card({
89
+ from: ["hand"],
90
+ where: {
91
+ id: "own-card",
92
+ errorCode: "NOT_YOUR_CARD",
93
+ test: ({ q, playerId, targetId }) =>
94
+ q.zone.playerCards(playerId, "hand").includes(targetId),
95
+ },
96
+ });
97
+
98
+ export default play.define({
99
+ kind: "player",
100
+ initialState: () => ({ leadCardId: null }),
101
+ actor: ({ state }) => state.publicState.currentPlayerId,
102
+ interactions: {
103
+ playCard: play.interaction({
104
+ inputs: { cardId: ownCard },
105
+ reduce({ tx, input, q }) {
106
+ // tx.state.phase.leadCardId and input.params.cardId are inferred.
107
+ tx.moveCardFromPlayerZoneToSharedZone({
108
+ playerId: input.playerId,
109
+ fromZoneId: "hand",
110
+ toZoneId: "trick",
111
+ cardId: input.params.cardId,
112
+ });
113
+ tx.patchPhaseState({ leadCardId: input.params.cardId });
114
+ const next = q.player.nextInOrder(input.playerId);
115
+ if (next) tx.setActivePlayers([next]);
116
+ if (q.zone.playerCards(input.playerId, "hand").length === 0) {
117
+ return tx.transition("setup");
118
+ }
119
+ },
120
+ }),
121
+ },
122
+ });
123
+ ```
124
+
125
+ ```ts
126
+ // app/game.ts — assembly
127
+ import { game } from "./game-model";
128
+ import play from "./phases/play";
129
+ import setup from "./phases/setup";
130
+
131
+ export default game.assemble({
132
+ initial: {
133
+ public: ({ playerIds }) => ({ currentPlayerId: playerIds[0] ?? null }),
134
+ private: () => ({}),
135
+ hidden: () => ({}),
136
+ },
137
+ initialPhase: "setup",
138
+ phases: { setup, play },
139
+ views: {
140
+ shared: game.views.empty(),
141
+ player: game.views.player({
142
+ project: ({ state, playerId, q }) => ({
143
+ me: playerId,
144
+ hand: q.zone.playerCards(playerId, "hand"),
145
+ current: state.publicState.currentPlayerId,
146
+ }),
147
+ }),
148
+ },
149
+ });
150
+ ```
151
+
152
+ A missing, extra, or misspelled phase key fails to typecheck at `assemble`
153
+ or at `game.phase(name)`. Rules, views, and tests import `GameState` and
154
+ `typeof game.types.Tx` from the model module; nothing but the test harness
155
+ imports the assembled game, so there is no import cycle.
156
+
157
+ New workspaces keep authored starter code in `app/game.ts` and `ui/App.tsx`.
158
+ Run the package-local `pnpm generate` command to refresh framework-owned
159
+ manifest and UI contracts; generated files are not authoring surfaces.
160
+
161
+ ## Reducer runner contract
162
+
163
+ `createReducerBundle(game)` returns exactly the contract version and four
164
+ operations: `boardStatic()`, `initialize(input)`, `dispatch({ state, input })`,
165
+ and `project({ state, playerIds })`. The runner contract is `0.5.0`; hosts must
166
+ require that exact version. Dispatch includes validation and effect execution. Initialization returns
167
+ `{ state, terminal?, events? }`, preserving outcomes and events from initial
168
+ phase entry and automatic continuations.
169
+
170
+ The authoritative state is explicit on every dispatch and projection. A host
171
+ may retain a warm worker and SDK caches, but replaying the same state and input
172
+ must produce the same gameplay result as a fresh worker. Projection timing is
173
+ diagnostic and is excluded from this equivalence.
174
+
175
+ Seat projections are independent of session versions. The gameplay service
176
+ owns the monotonically increasing version, perspective, and action-set identity.
177
+ The plugin frame basis contains `version`, `actionSetVersion`, and
178
+ `perspectivePlayerId`; it has no generation counter. Hosts merge the separately
179
+ cached board static projection when materializing plugin gameplay frames.
@@ -1,10 +1,7 @@
1
1
  import { JsonValue } from '../types.js';
2
2
 
3
- type GeneratedAuthoringMetadataV1 = {
3
+ type AuthoringMetadataV1 = {
4
4
  sdkVersion: string;
5
- codegenVersion: string;
6
- manifestSchemaVersion: number;
7
- generatedArtifactSchemaVersion: number;
8
5
  };
9
6
  type AuthoringValidationResultV1 = {
10
7
  valid: boolean;
@@ -36,7 +33,7 @@ type AuthoringManifestConformanceCaseV1 = {
36
33
  };
37
34
  type ProjectAuthoringAdapterV1 = {
38
35
  protocolVersion: 1;
39
- metadata: GeneratedAuthoringMetadataV1;
36
+ metadata: AuthoringMetadataV1;
40
37
  generatedPaths: readonly string[];
41
38
  generatedPathPatterns: readonly GeneratedPathPatternV1[];
42
39
  manifestConformanceCases: readonly AuthoringManifestConformanceCaseV1[];
@@ -59,4 +56,4 @@ declare const GENERATED_WORKSPACE_PATH_PATTERNS: readonly GeneratedWorkspacePath
59
56
  declare const MANIFEST_CONFORMANCE_CASES: readonly AuthoringManifestConformanceCaseV1[];
60
57
  declare const projectAuthoringAdapter: ProjectAuthoringAdapterV1;
61
58
 
62
- export { type AuthoringManifestConformanceCaseV1, type AuthoringValidationResultV1, GENERATED_WORKSPACE_PATHS, GENERATED_WORKSPACE_PATH_PATTERNS, type GeneratedArtifactV1, type GeneratedAuthoringMetadataV1, type GeneratedPathPatternV1, MANIFEST_CONFORMANCE_CASES, type ProjectAuthoringAdapterV1, diagnosticCodesForValidationErrors, generateWorkspaceArtifacts, materializeManifest, projectAuthoringAdapter, validateManifest };
59
+ export { type AuthoringManifestConformanceCaseV1, type AuthoringMetadataV1, type AuthoringValidationResultV1, GENERATED_WORKSPACE_PATHS, GENERATED_WORKSPACE_PATH_PATTERNS, type GeneratedArtifactV1, type GeneratedPathPatternV1, MANIFEST_CONFORMANCE_CASES, type ProjectAuthoringAdapterV1, diagnosticCodesForValidationErrors, generateWorkspaceArtifacts, materializeManifest, projectAuthoringAdapter, validateManifest };
@@ -7,9 +7,9 @@ import {
7
7
  materializeManifest,
8
8
  projectAuthoringAdapter,
9
9
  validateManifest
10
- } from "../chunk-7ADPYKFT.js";
11
- import "../chunk-SFOAY5H4.js";
12
- import "../chunk-SACZWUA6.js";
10
+ } from "../chunk-QLSK3DYO.js";
11
+ import "../chunk-EY2LL5WD.js";
12
+ import "../chunk-JUGQ6F3N.js";
13
13
  import "../chunk-PZ5AY32C.js";
14
14
  export {
15
15
  GENERATED_WORKSPACE_PATHS,
@@ -4,7 +4,7 @@ type MaterializeWorkspaceOptions = {
4
4
  /** Scaffolding-only. Existing build/test paths leave seed files untouched. */
5
5
  readonly writeMissingSeeds?: boolean;
6
6
  };
7
- type MaterializedWorkspaceReceipt = {
7
+ type MaterializedWorkspaceResult = {
8
8
  readonly schemaVersion: 1;
9
9
  readonly projectRoot: string;
10
10
  readonly authoritativeFiles: number;
@@ -22,6 +22,6 @@ type MaterializedWorkspaceReceipt = {
22
22
  * scaffolding caller explicitly opts in. No test state or projection artifact
23
23
  * is emitted.
24
24
  */
25
- declare function materializeWorkspace(options: MaterializeWorkspaceOptions): Promise<MaterializedWorkspaceReceipt>;
25
+ declare function materializeWorkspace(options: MaterializeWorkspaceOptions): Promise<MaterializedWorkspaceResult>;
26
26
 
27
- export { type MaterializeWorkspaceOptions, type MaterializedWorkspaceReceipt, materializeWorkspace };
27
+ export { type MaterializeWorkspaceOptions, type MaterializedWorkspaceResult, materializeWorkspace };
@@ -1,10 +1,9 @@
1
1
  import {
2
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";
3
+ } from "./chunk-2WJSQQT7.js";
4
+ import "./chunk-QLSK3DYO.js";
5
+ import "./chunk-EY2LL5WD.js";
6
+ import "./chunk-JUGQ6F3N.js";
8
7
  import "./chunk-PZ5AY32C.js";
9
8
  export {
10
9
  materializeWorkspace
@@ -1,17 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
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";
4
+ } from "./chunk-2WJSQQT7.js";
5
+ import "./chunk-QLSK3DYO.js";
6
+ import "./chunk-EY2LL5WD.js";
7
+ import "./chunk-JUGQ6F3N.js";
9
8
  import "./chunk-PZ5AY32C.js";
10
9
 
11
- // src/authoring-materialize-cli.ts
10
+ // src/authoring-generate-cli.ts
12
11
  var options = parseArgs(process.argv.slice(2));
13
- var receipt = await materializeWorkspace(options);
14
- console.log(JSON.stringify(receipt, null, 2));
12
+ var result = await materializeWorkspace(options);
13
+ console.log(JSON.stringify(result, null, 2));
15
14
  function parseArgs(argv) {
16
15
  let manifestPath;
17
16
  let projectRoot;
@@ -43,4 +42,4 @@ function parseArgs(argv) {
43
42
  ...writeMissingSeeds ? { writeMissingSeeds: true } : {}
44
43
  };
45
44
  }
46
- //# sourceMappingURL=authoring-materialize-cli.js.map
45
+ //# sourceMappingURL=authoring-generate-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/authoring-generate-cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { materializeWorkspace } from \"./authoring/materialize-workspace.js\";\n\nconst options = parseArgs(process.argv.slice(2));\nconst result = await materializeWorkspace(options);\nconsole.log(JSON.stringify(result, 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,SAAS,MAAM,qBAAqB,OAAO;AACjD,QAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAE3C,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":[]}
@@ -111,8 +111,8 @@ declare const gameplaySemanticEffectSchema: z.ZodUnion<readonly [z.ZodObject<{
111
111
  declare const browserInteractionDiagnosticSchema: z.ZodObject<{
112
112
  code: z.ZodString;
113
113
  severity: z.ZodEnum<{
114
- error: "error";
115
114
  warning: "warning";
115
+ error: "error";
116
116
  }>;
117
117
  message: z.ZodString;
118
118
  surface: z.ZodOptional<z.ZodString>;
@@ -190,8 +190,8 @@ declare const browserInteractionActuatorSchema: z.ZodObject<{
190
190
  diagnostics: z.ZodArray<z.ZodObject<{
191
191
  code: z.ZodString;
192
192
  severity: z.ZodEnum<{
193
- error: "error";
194
193
  warning: "warning";
194
+ error: "error";
195
195
  }>;
196
196
  message: z.ZodString;
197
197
  surface: z.ZodOptional<z.ZodString>;
@@ -225,8 +225,8 @@ declare const browserInteractionPointerTargetSchema: z.ZodObject<{
225
225
  diagnostics: z.ZodArray<z.ZodObject<{
226
226
  code: z.ZodString;
227
227
  severity: z.ZodEnum<{
228
- error: "error";
229
228
  warning: "warning";
229
+ error: "error";
230
230
  }>;
231
231
  message: z.ZodString;
232
232
  surface: z.ZodOptional<z.ZodString>;
@@ -315,8 +315,8 @@ declare const browserGameplayInteractionSchema: z.ZodObject<{
315
315
  diagnostics: z.ZodArray<z.ZodObject<{
316
316
  code: z.ZodString;
317
317
  severity: z.ZodEnum<{
318
- error: "error";
319
318
  warning: "warning";
319
+ error: "error";
320
320
  }>;
321
321
  message: z.ZodString;
322
322
  surface: z.ZodOptional<z.ZodString>;
@@ -350,8 +350,8 @@ declare const browserGameplayInteractionSchema: z.ZodObject<{
350
350
  diagnostics: z.ZodArray<z.ZodObject<{
351
351
  code: z.ZodString;
352
352
  severity: z.ZodEnum<{
353
- error: "error";
354
353
  warning: "warning";
354
+ error: "error";
355
355
  }>;
356
356
  message: z.ZodString;
357
357
  surface: z.ZodOptional<z.ZodString>;
@@ -365,8 +365,8 @@ declare const browserGameplayInteractionSchema: z.ZodObject<{
365
365
  diagnostics: z.ZodArray<z.ZodObject<{
366
366
  code: z.ZodString;
367
367
  severity: z.ZodEnum<{
368
- error: "error";
369
368
  warning: "warning";
369
+ error: "error";
370
370
  }>;
371
371
  message: z.ZodString;
372
372
  surface: z.ZodOptional<z.ZodString>;
@@ -458,8 +458,8 @@ declare const browserGameplaySurfaceSnapshotSchema: z.ZodObject<{
458
458
  diagnostics: z.ZodArray<z.ZodObject<{
459
459
  code: z.ZodString;
460
460
  severity: z.ZodEnum<{
461
- error: "error";
462
461
  warning: "warning";
462
+ error: "error";
463
463
  }>;
464
464
  message: z.ZodString;
465
465
  surface: z.ZodOptional<z.ZodString>;
@@ -493,8 +493,8 @@ declare const browserGameplaySurfaceSnapshotSchema: z.ZodObject<{
493
493
  diagnostics: z.ZodArray<z.ZodObject<{
494
494
  code: z.ZodString;
495
495
  severity: z.ZodEnum<{
496
- error: "error";
497
496
  warning: "warning";
497
+ error: "error";
498
498
  }>;
499
499
  message: z.ZodString;
500
500
  surface: z.ZodOptional<z.ZodString>;
@@ -508,8 +508,8 @@ declare const browserGameplaySurfaceSnapshotSchema: z.ZodObject<{
508
508
  diagnostics: z.ZodArray<z.ZodObject<{
509
509
  code: z.ZodString;
510
510
  severity: z.ZodEnum<{
511
- error: "error";
512
511
  warning: "warning";
512
+ error: "error";
513
513
  }>;
514
514
  message: z.ZodString;
515
515
  surface: z.ZodOptional<z.ZodString>;
@@ -523,8 +523,8 @@ declare const browserGameplaySurfaceSnapshotSchema: z.ZodObject<{
523
523
  diagnostics: z.ZodArray<z.ZodObject<{
524
524
  code: z.ZodString;
525
525
  severity: z.ZodEnum<{
526
- error: "error";
527
526
  warning: "warning";
527
+ error: "error";
528
528
  }>;
529
529
  message: z.ZodString;
530
530
  surface: z.ZodOptional<z.ZodString>;
@@ -616,8 +616,8 @@ declare const browserSemanticSurfaceSnapshotSchema: z.ZodObject<{
616
616
  diagnostics: z.ZodArray<z.ZodObject<{
617
617
  code: z.ZodString;
618
618
  severity: z.ZodEnum<{
619
- error: "error";
620
619
  warning: "warning";
620
+ error: "error";
621
621
  }>;
622
622
  message: z.ZodString;
623
623
  surface: z.ZodOptional<z.ZodString>;
@@ -651,8 +651,8 @@ declare const browserSemanticSurfaceSnapshotSchema: z.ZodObject<{
651
651
  diagnostics: z.ZodArray<z.ZodObject<{
652
652
  code: z.ZodString;
653
653
  severity: z.ZodEnum<{
654
- error: "error";
655
654
  warning: "warning";
655
+ error: "error";
656
656
  }>;
657
657
  message: z.ZodString;
658
658
  surface: z.ZodOptional<z.ZodString>;
@@ -666,8 +666,8 @@ declare const browserSemanticSurfaceSnapshotSchema: z.ZodObject<{
666
666
  diagnostics: z.ZodArray<z.ZodObject<{
667
667
  code: z.ZodString;
668
668
  severity: z.ZodEnum<{
669
- error: "error";
670
669
  warning: "warning";
670
+ error: "error";
671
671
  }>;
672
672
  message: z.ZodString;
673
673
  surface: z.ZodOptional<z.ZodString>;
@@ -681,8 +681,8 @@ declare const browserSemanticSurfaceSnapshotSchema: z.ZodObject<{
681
681
  diagnostics: z.ZodArray<z.ZodObject<{
682
682
  code: z.ZodString;
683
683
  severity: z.ZodEnum<{
684
- error: "error";
685
684
  warning: "warning";
685
+ error: "error";
686
686
  }>;
687
687
  message: z.ZodString;
688
688
  surface: z.ZodOptional<z.ZodString>;
@@ -699,8 +699,8 @@ declare const browserUnknownSurfaceSnapshotSchema: z.ZodObject<{
699
699
  diagnostics: z.ZodArray<z.ZodObject<{
700
700
  code: z.ZodString;
701
701
  severity: z.ZodEnum<{
702
- error: "error";
703
702
  warning: "warning";
703
+ error: "error";
704
704
  }>;
705
705
  message: z.ZodString;
706
706
  surface: z.ZodOptional<z.ZodString>;
@@ -797,8 +797,8 @@ declare const browserInteractionSnapshotSchema: z.ZodObject<{
797
797
  diagnostics: z.ZodArray<z.ZodObject<{
798
798
  code: z.ZodString;
799
799
  severity: z.ZodEnum<{
800
- error: "error";
801
800
  warning: "warning";
801
+ error: "error";
802
802
  }>;
803
803
  message: z.ZodString;
804
804
  surface: z.ZodOptional<z.ZodString>;
@@ -832,8 +832,8 @@ declare const browserInteractionSnapshotSchema: z.ZodObject<{
832
832
  diagnostics: z.ZodArray<z.ZodObject<{
833
833
  code: z.ZodString;
834
834
  severity: z.ZodEnum<{
835
- error: "error";
836
835
  warning: "warning";
836
+ error: "error";
837
837
  }>;
838
838
  message: z.ZodString;
839
839
  surface: z.ZodOptional<z.ZodString>;
@@ -847,8 +847,8 @@ declare const browserInteractionSnapshotSchema: z.ZodObject<{
847
847
  diagnostics: z.ZodArray<z.ZodObject<{
848
848
  code: z.ZodString;
849
849
  severity: z.ZodEnum<{
850
- error: "error";
851
850
  warning: "warning";
851
+ error: "error";
852
852
  }>;
853
853
  message: z.ZodString;
854
854
  surface: z.ZodOptional<z.ZodString>;
@@ -862,8 +862,8 @@ declare const browserInteractionSnapshotSchema: z.ZodObject<{
862
862
  diagnostics: z.ZodArray<z.ZodObject<{
863
863
  code: z.ZodString;
864
864
  severity: z.ZodEnum<{
865
- error: "error";
866
865
  warning: "warning";
866
+ error: "error";
867
867
  }>;
868
868
  message: z.ZodString;
869
869
  surface: z.ZodOptional<z.ZodString>;
@@ -879,8 +879,8 @@ declare const browserInteractionSnapshotSchema: z.ZodObject<{
879
879
  diagnostics: z.ZodArray<z.ZodObject<{
880
880
  code: z.ZodString;
881
881
  severity: z.ZodEnum<{
882
- error: "error";
883
882
  warning: "warning";
883
+ error: "error";
884
884
  }>;
885
885
  message: z.ZodString;
886
886
  surface: z.ZodOptional<z.ZodString>;
@@ -894,8 +894,8 @@ declare const browserInteractionSnapshotSchema: z.ZodObject<{
894
894
  diagnostics: z.ZodArray<z.ZodObject<{
895
895
  code: z.ZodString;
896
896
  severity: z.ZodEnum<{
897
- error: "error";
898
897
  warning: "warning";
898
+ error: "error";
899
899
  }>;
900
900
  message: z.ZodString;
901
901
  surface: z.ZodOptional<z.ZodString>;
@@ -1,12 +1,9 @@
1
1
  import {
2
2
  generateWorkspaceArtifacts
3
- } from "./chunk-7ADPYKFT.js";
4
- import {
5
- compareReferenceGameCanonicalStrings
6
- } from "./chunk-UNVCT5Z7.js";
3
+ } from "./chunk-QLSK3DYO.js";
7
4
  import {
8
5
  WORKSPACE_CODEGEN_OWNERSHIP
9
- } from "./chunk-SACZWUA6.js";
6
+ } from "./chunk-JUGQ6F3N.js";
10
7
 
11
8
  // src/authoring/materialize-workspace.ts
12
9
  import { createHash, randomUUID } from "crypto";
@@ -52,7 +49,7 @@ async function materializeWorkspace(options) {
52
49
  const actual = createHash("sha256").update(bytes).digest("hex");
53
50
  if (actual !== artifact.contentSha256) {
54
51
  throw new Error(
55
- `Generated ${artifact.path} digest does not match its SDK receipt.`
52
+ `Generated ${artifact.path} digest does not match its declared digest.`
56
53
  );
57
54
  }
58
55
  records.push({
@@ -62,7 +59,7 @@ async function materializeWorkspace(options) {
62
59
  });
63
60
  }
64
61
  records.sort(
65
- (left, right) => compareReferenceGameCanonicalStrings(left.path, right.path)
62
+ (left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0
66
63
  );
67
64
  return {
68
65
  schemaVersion: 1,
@@ -74,6 +71,7 @@ async function materializeWorkspace(options) {
74
71
  };
75
72
  }
76
73
  async function loadManifest(options) {
74
+ const typesEntry = await resolveCurrentSdkTypesFacade();
77
75
  const entryPath = path.join(
78
76
  options.projectRoot,
79
77
  "node_modules/.cache/dreamboard-workspace-compiler",
@@ -89,7 +87,9 @@ async function loadManifest(options) {
89
87
  format: "esm",
90
88
  platform: "node",
91
89
  target: "node24",
92
- packages: "external",
90
+ alias: {
91
+ "@dreamboard-games/sdk/types": typesEntry
92
+ },
93
93
  sourcemap: "inline",
94
94
  logLevel: "silent"
95
95
  });
@@ -104,6 +104,18 @@ async function loadManifest(options) {
104
104
  await rm(entryPath, { force: true });
105
105
  }
106
106
  }
107
+ async function resolveCurrentSdkTypesFacade() {
108
+ const candidates = [
109
+ path.resolve(import.meta.dirname, "../types.ts"),
110
+ path.resolve(import.meta.dirname, "types.js")
111
+ ];
112
+ for (const candidate of candidates) {
113
+ if (await isFile(candidate)) return candidate;
114
+ }
115
+ throw new Error(
116
+ `Could not resolve the current @dreamboard-games/sdk/types facade from ${import.meta.dirname}.`
117
+ );
118
+ }
107
119
  async function writeAuthoritativeFile(destination, content) {
108
120
  const temporaryPath = path.join(
109
121
  path.dirname(destination),
@@ -151,4 +163,4 @@ async function isFile(filePath) {
151
163
  export {
152
164
  materializeWorkspace
153
165
  };
154
- //# sourceMappingURL=chunk-P6IJ5YVY.js.map
166
+ //# sourceMappingURL=chunk-2WJSQQT7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/authoring/materialize-workspace.ts"],"sourcesContent":["import { createHash, randomUUID } from \"node:crypto\";\nimport { mkdir, readFile, rename, rm, stat, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { WORKSPACE_CODEGEN_OWNERSHIP } from \"@dreamboard-games/workspace-codegen\";\nimport { build } from \"esbuild\";\nimport { generateWorkspaceArtifacts } from \"./adapter.js\";\n\nexport type MaterializeWorkspaceOptions = {\n readonly manifestPath: string;\n readonly projectRoot?: string;\n /** Scaffolding-only. Existing build/test paths leave seed files untouched. */\n readonly writeMissingSeeds?: boolean;\n};\n\nexport type MaterializedWorkspaceResult = {\n readonly schemaVersion: 1;\n readonly projectRoot: string;\n readonly authoritativeFiles: number;\n readonly seededFiles: number;\n readonly artifacts: readonly {\n readonly path: string;\n readonly ownership: \"authoritative\";\n readonly sha256: `sha256:${string}`;\n }[];\n readonly digest: `sha256:${string}`;\n};\n\ntype ManifestModule = {\n readonly default?: unknown;\n readonly manifest?: unknown;\n};\n\nconst authoritativePaths = new Set(\n WORKSPACE_CODEGEN_OWNERSHIP.dynamic.generatedFiles,\n);\n\n/**\n * Materialize SDK-owned workspace contracts from authored manifest source.\n * Authoritative files are always replaced. Seed files are untouched unless a\n * scaffolding caller explicitly opts in. No test state or projection artifact\n * is emitted.\n */\nexport async function materializeWorkspace(\n options: MaterializeWorkspaceOptions,\n): Promise<MaterializedWorkspaceResult> {\n const projectRoot = path.resolve(options.projectRoot ?? process.cwd());\n const manifestPath = resolveProjectPath(projectRoot, options.manifestPath);\n if (!(await isFile(manifestPath))) {\n throw new Error(`Manifest source does not exist: ${manifestPath}.`);\n }\n const manifest = await loadManifest({ manifestPath, projectRoot });\n const artifacts = generateWorkspaceArtifacts(manifest);\n const emittedAuthoritative = new Set(\n artifacts\n .filter(({ ownership }) => ownership === \"authoritative\")\n .map(({ path: artifactPath }) => artifactPath),\n );\n assertExactAuthoritativeInventory(emittedAuthoritative);\n\n let seededFiles = 0;\n const records: Array<{\n readonly path: string;\n readonly ownership: \"authoritative\";\n readonly sha256: `sha256:${string}`;\n }> = [];\n for (const artifact of artifacts) {\n const destination = resolveProjectPath(projectRoot, artifact.path);\n if (artifact.ownership === \"seed\") {\n if (!options.writeMissingSeeds || (await isFile(destination))) {\n continue;\n }\n }\n await mkdir(path.dirname(destination), { recursive: true });\n if (artifact.ownership === \"authoritative\") {\n await writeAuthoritativeFile(destination, artifact.content);\n } else {\n await writeFile(destination, artifact.content);\n }\n if (artifact.ownership === \"seed\") {\n seededFiles += 1;\n continue;\n }\n const bytes = await readFile(destination);\n const actual = createHash(\"sha256\").update(bytes).digest(\"hex\");\n if (actual !== artifact.contentSha256) {\n throw new Error(\n `Generated ${artifact.path} digest does not match its declared digest.`,\n );\n }\n records.push({\n path: artifact.path,\n ownership: \"authoritative\",\n sha256: `sha256:${actual}`,\n });\n }\n records.sort((left, right) =>\n left.path < right.path ? -1 : left.path > right.path ? 1 : 0,\n );\n return {\n schemaVersion: 1,\n projectRoot,\n authoritativeFiles: records.length,\n seededFiles,\n artifacts: records,\n digest: `sha256:${createHash(\"sha256\")\n .update(JSON.stringify(records))\n .digest(\"hex\")}`,\n };\n}\n\nasync function loadManifest(options: {\n readonly manifestPath: string;\n readonly projectRoot: string;\n}): Promise<unknown> {\n const typesEntry = await resolveCurrentSdkTypesFacade();\n const entryPath = path.join(\n options.projectRoot,\n \"node_modules/.cache/dreamboard-workspace-compiler\",\n `manifest-${process.pid}-${randomUUID()}.mjs`,\n );\n await mkdir(path.dirname(entryPath), { recursive: true });\n try {\n const result = await build({\n entryPoints: [options.manifestPath],\n outfile: entryPath,\n absWorkingDir: options.projectRoot,\n bundle: true,\n format: \"esm\",\n platform: \"node\",\n target: \"node24\",\n alias: {\n \"@dreamboard-games/sdk/types\": typesEntry,\n },\n sourcemap: \"inline\",\n logLevel: \"silent\",\n });\n void result;\n const loaded = (await import(\n pathToFileURL(entryPath).href\n )) as ManifestModule;\n const manifest = loaded.manifest ?? loaded.default;\n if (!manifest || typeof manifest !== \"object\") {\n throw new Error(\"Manifest source must export a manifest object.\");\n }\n return manifest;\n } finally {\n await rm(entryPath, { force: true });\n }\n}\n\nasync function resolveCurrentSdkTypesFacade(): Promise<string> {\n const candidates = [\n path.resolve(import.meta.dirname, \"../types.ts\"),\n path.resolve(import.meta.dirname, \"types.js\"),\n ];\n for (const candidate of candidates) {\n if (await isFile(candidate)) return candidate;\n }\n throw new Error(\n `Could not resolve the current @dreamboard-games/sdk/types facade from ${import.meta.dirname}.`,\n );\n}\n\nasync function writeAuthoritativeFile(\n destination: string,\n content: string,\n): Promise<void> {\n const temporaryPath = path.join(\n path.dirname(destination),\n `.${path.basename(destination)}.${process.pid}.${randomUUID()}.tmp`,\n );\n try {\n await writeFile(temporaryPath, content);\n await rename(temporaryPath, destination);\n } finally {\n await rm(temporaryPath, { force: true });\n }\n}\n\nfunction assertExactAuthoritativeInventory(emitted: ReadonlySet<string>): void {\n const missing = [...authoritativePaths].filter(\n (value) => !emitted.has(value),\n );\n const unexpected = [...emitted].filter(\n (value) => !authoritativePaths.has(value),\n );\n if (missing.length > 0 || unexpected.length > 0) {\n throw new Error(\n `SDK workspace ownership mismatch (missing: ${missing.join(\", \") || \"none\"}; unexpected: ${unexpected.join(\", \") || \"none\"}).`,\n );\n }\n}\n\nfunction resolveProjectPath(projectRoot: string, value: string): string {\n if (\n typeof value !== \"string\" ||\n value.length === 0 ||\n path.isAbsolute(value) ||\n value.split(/[\\\\/]+/).some((segment) => segment === \"..\")\n ) {\n throw new Error(`Workspace path must be project-relative: ${value}.`);\n }\n const resolved = path.resolve(projectRoot, value);\n if (!resolved.startsWith(`${projectRoot}${path.sep}`)) {\n throw new Error(`Workspace path escapes the project root: ${value}.`);\n }\n return resolved;\n}\n\nasync function isFile(filePath: string): Promise<boolean> {\n return stat(filePath)\n .then((value) => value.isFile())\n .catch((error: unknown) => {\n if (\n typeof error === \"object\" &&\n error !== null &&\n \"code\" in error &&\n error.code === \"ENOENT\"\n ) {\n return false;\n }\n throw error;\n });\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,YAAY,kBAAkB;AACvC,SAAS,OAAO,UAAU,QAAQ,IAAI,MAAM,iBAAiB;AAC7D,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAE9B,SAAS,aAAa;AA4BtB,IAAM,qBAAqB,IAAI;AAAA,EAC7B,4BAA4B,QAAQ;AACtC;AAQA,eAAsB,qB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