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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +186 -45
  2. package/dist/board-target-B0QG6OYx.d.ts +8 -0
  3. package/dist/chunk-3JXUL4VN.js +139 -0
  4. package/dist/chunk-3JXUL4VN.js.map +1 -0
  5. package/dist/{chunk-S2JEDVWH.js → chunk-C77SYIVT.js} +6102 -6505
  6. package/dist/chunk-C77SYIVT.js.map +1 -0
  7. package/dist/chunk-DMFVAZI2.js +16 -0
  8. package/dist/chunk-DMFVAZI2.js.map +1 -0
  9. package/dist/chunk-OOFMBCFF.js +1338 -0
  10. package/dist/chunk-OOFMBCFF.js.map +1 -0
  11. package/dist/chunk-UG2Q4NLG.js +590 -0
  12. package/dist/chunk-UG2Q4NLG.js.map +1 -0
  13. package/dist/chunk-XU6WJW6K.js +847 -0
  14. package/dist/chunk-XU6WJW6K.js.map +1 -0
  15. package/dist/diagnostics-B8d5aLad.d.ts +65 -0
  16. package/dist/extract-gVKcB8Og.d.ts +4736 -0
  17. package/dist/index.d.ts +3782 -1
  18. package/dist/index.js +1096 -6
  19. package/dist/index.js.map +1 -1
  20. package/dist/model-vdpLHrxh.d.ts +432 -0
  21. package/dist/react.d.ts +60 -0
  22. package/dist/react.js +208 -0
  23. package/dist/react.js.map +1 -0
  24. package/dist/reducer.d.ts +1244 -78
  25. package/dist/reducer.js +4204 -121
  26. package/dist/reducer.js.map +1 -1
  27. package/dist/testing.d.ts +520 -564
  28. package/dist/testing.js +2451 -915
  29. package/dist/testing.js.map +1 -1
  30. package/dist/types-Bj5ZLTUV.d.ts +114 -0
  31. package/package.json +40 -142
  32. package/dist/HandView-Bi2lxzQP.d.ts +0 -79
  33. package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
  34. package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
  35. package/dist/attributes-DbvyMbXw.d.ts +0 -68
  36. package/dist/browser-interaction.d.ts +0 -910
  37. package/dist/browser-interaction.js +0 -119
  38. package/dist/browser-interaction.js.map +0 -1
  39. package/dist/chunk-32PFKDV7.js +0 -11705
  40. package/dist/chunk-32PFKDV7.js.map +0 -1
  41. package/dist/chunk-3BAD4VC2.js +0 -263
  42. package/dist/chunk-3BAD4VC2.js.map +0 -1
  43. package/dist/chunk-3SKDNDPG.js +0 -104
  44. package/dist/chunk-3SKDNDPG.js.map +0 -1
  45. package/dist/chunk-5YV2WHJ4.js +0 -25
  46. package/dist/chunk-5YV2WHJ4.js.map +0 -1
  47. package/dist/chunk-ANRB4XKA.js +0 -90
  48. package/dist/chunk-ANRB4XKA.js.map +0 -1
  49. package/dist/chunk-BI4G3PM2.js +0 -1864
  50. package/dist/chunk-BI4G3PM2.js.map +0 -1
  51. package/dist/chunk-EVCLTY4Q.js +0 -935
  52. package/dist/chunk-EVCLTY4Q.js.map +0 -1
  53. package/dist/chunk-GDPKTBUR.js +0 -564
  54. package/dist/chunk-GDPKTBUR.js.map +0 -1
  55. package/dist/chunk-H6VDGFL5.js +0 -2903
  56. package/dist/chunk-H6VDGFL5.js.map +0 -1
  57. package/dist/chunk-LR3ZTWQF.js +0 -5960
  58. package/dist/chunk-LR3ZTWQF.js.map +0 -1
  59. package/dist/chunk-PF7L4BMG.js +0 -117
  60. package/dist/chunk-PF7L4BMG.js.map +0 -1
  61. package/dist/chunk-PN5O6GG2.js +0 -32
  62. package/dist/chunk-PN5O6GG2.js.map +0 -1
  63. package/dist/chunk-PZ5AY32C.js +0 -10
  64. package/dist/chunk-PZ5AY32C.js.map +0 -1
  65. package/dist/chunk-S2JEDVWH.js.map +0 -1
  66. package/dist/chunk-T3ZKNUZ7.js +0 -1
  67. package/dist/chunk-T3ZKNUZ7.js.map +0 -1
  68. package/dist/chunk-UGH54WZ2.js +0 -223
  69. package/dist/chunk-UGH54WZ2.js.map +0 -1
  70. package/dist/chunk-VCDWP5VL.js +0 -746
  71. package/dist/chunk-VCDWP5VL.js.map +0 -1
  72. package/dist/chunk-VDXOF4FW.js +0 -69
  73. package/dist/chunk-VDXOF4FW.js.map +0 -1
  74. package/dist/chunk-WHR5UW3F.js +0 -1988
  75. package/dist/chunk-WHR5UW3F.js.map +0 -1
  76. package/dist/chunk-Y75CFE77.js +0 -17
  77. package/dist/chunk-Y75CFE77.js.map +0 -1
  78. package/dist/chunk-Z7QCREWI.js +0 -3435
  79. package/dist/chunk-Z7QCREWI.js.map +0 -1
  80. package/dist/chunk-ZZGN2ATS.js +0 -1941
  81. package/dist/chunk-ZZGN2ATS.js.map +0 -1
  82. package/dist/components-gAbIz7hK.d.ts +0 -1284
  83. package/dist/definitions-BgmV_GhC.d.ts +0 -300
  84. package/dist/diagnostics-DIi3ina7.d.ts +0 -50
  85. package/dist/digest.d.ts +0 -8
  86. package/dist/game-CsZScpcn.d.ts +0 -763
  87. package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
  88. package/dist/index-CcT9Q7N7.d.ts +0 -193
  89. package/dist/index.d-DjzoK7zn.d.ts +0 -2101
  90. package/dist/package-set.d.ts +0 -13
  91. package/dist/package-set.js +0 -12
  92. package/dist/package-set.js.map +0 -1
  93. package/dist/player-state-Cqpyeql0.d.ts +0 -371
  94. package/dist/plugin-runtime-contract.d.ts +0 -17
  95. package/dist/plugin-runtime-contract.js +0 -92
  96. package/dist/plugin-runtime-contract.js.map +0 -1
  97. package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
  98. package/dist/protocol-dYgafTYY.d.ts +0 -314
  99. package/dist/reducer/advanced.d.ts +0 -82
  100. package/dist/reducer/advanced.js +0 -51
  101. package/dist/reducer/advanced.js.map +0 -1
  102. package/dist/reducer-contract.d.ts +0 -11
  103. package/dist/reducer-contract.js +0 -16
  104. package/dist/reducer-contract.js.map +0 -1
  105. package/dist/reference-games/index.d.ts +0 -31
  106. package/dist/reference-games/index.js +0 -48
  107. package/dist/reference-games/index.js.map +0 -1
  108. package/dist/runtime/primitives.d.ts +0 -250
  109. package/dist/runtime/primitives.js +0 -189
  110. package/dist/runtime/primitives.js.map +0 -1
  111. package/dist/runtime/runtime-api.d.ts +0 -2
  112. package/dist/runtime/runtime-api.js +0 -1
  113. package/dist/runtime/runtime-api.js.map +0 -1
  114. package/dist/runtime/workspace-contract.d.ts +0 -392
  115. package/dist/runtime/workspace-contract.js +0 -28
  116. package/dist/runtime/workspace-contract.js.map +0 -1
  117. package/dist/runtime-RJ5orDJU.d.ts +0 -1699
  118. package/dist/runtime-api-Bz5pwNU_.d.ts +0 -296
  119. package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
  120. package/dist/runtime.d.ts +0 -83
  121. package/dist/runtime.js +0 -242
  122. package/dist/runtime.js.map +0 -1
  123. package/dist/schema.d.ts +0 -379
  124. package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
  125. package/dist/testing-compiler.d.ts +0 -37
  126. package/dist/testing-compiler.js +0 -272
  127. package/dist/testing-compiler.js.map +0 -1
  128. package/dist/testing-runtime.d.ts +0 -119
  129. package/dist/testing-runtime.js +0 -212
  130. package/dist/testing-runtime.js.map +0 -1
  131. package/dist/types-DJj5MJkl.d.ts +0 -256
  132. package/dist/types-DR7DoB1x.d.ts +0 -28
  133. package/dist/types-JWCYHmu7.d.ts +0 -122
  134. package/dist/types.d.ts +0 -1958
  135. package/dist/types.js +0 -14
  136. package/dist/types.js.map +0 -1
  137. package/dist/ui/components.d.ts +0 -17
  138. package/dist/ui/components.js +0 -216
  139. package/dist/ui/components.js.map +0 -1
  140. package/dist/ui/defaults.d.ts +0 -19
  141. package/dist/ui/defaults.js +0 -104
  142. package/dist/ui/defaults.js.map +0 -1
  143. package/dist/ui/player-state.d.ts +0 -2
  144. package/dist/ui/player-state.js +0 -1
  145. package/dist/ui/player-state.js.map +0 -1
  146. package/dist/ui/plugin-styles.css +0 -2
  147. package/dist/ui-contract-GTUPkf8z.d.ts +0 -1168
  148. package/dist/ui.d.ts +0 -317
  149. package/dist/ui.js +0 -277
  150. package/dist/ui.js.map +0 -1
  151. package/dist/views-BpuWcOyN.d.ts +0 -1641
@@ -1,296 +0,0 @@
1
- import { w } from './protocol-dYgafTYY.js';
2
-
3
- /** Player identity received through the host protocol. */
4
- type PlayerId = w["playerId"];
5
-
6
- /** Choice option surfaced on a prompt-kind interaction's structured context. */
7
- interface InteractionContextOption {
8
- id: string;
9
- label?: string;
10
- }
11
- /** Structured context attached to a prompt-kind InteractionDescriptor. */
12
- interface InteractionContext {
13
- /** Addressed player id. */
14
- to: string;
15
- title?: string;
16
- /** Authored prompt payload. Shape is defined by the game's prompt schema. */
17
- payload?: Record<string, unknown>;
18
- /** Selectable options for choice-kind prompts. */
19
- options?: readonly InteractionContextOption[];
20
- }
21
- type InteractionCommitPolicy = {
22
- mode: "manual";
23
- } | {
24
- mode: "autoWhenReady";
25
- };
26
- type InputSelection = {
27
- mode: "single";
28
- } | {
29
- mode: "many";
30
- min: number;
31
- max?: number;
32
- distinct?: boolean;
33
- };
34
- type InputDomain = CardTargetDomain | BoardTargetDomain | ResourceMapDomain | BoundedNumberDomain | ChoiceDomain | ChoiceListDomain;
35
- type InputDomainResolver = EagerInputDomainDependencies | LazyInputDomainDependencies;
36
- interface EagerInputDomainDependencies {
37
- mode: "eager";
38
- dependentCases: readonly InputDomainDependencyCase[];
39
- }
40
- interface LazyInputDomainDependencies {
41
- mode: "lazy";
42
- dependsOn: readonly string[];
43
- resolver: {
44
- interactionKey?: string;
45
- inputKey: string;
46
- };
47
- }
48
- interface ResolvedCardTargetDomain {
49
- type: "cardTarget";
50
- projection: "resolved";
51
- zoneId?: string;
52
- zoneIds?: readonly string[];
53
- eligibleTargets: readonly string[];
54
- selection?: InputSelection;
55
- dependencies?: InputDomainResolver;
56
- }
57
- interface LazyCardTargetDomain {
58
- type: "cardTarget";
59
- projection: "lazy";
60
- zoneId?: string;
61
- zoneIds?: readonly string[];
62
- selection?: InputSelection;
63
- dependencies: LazyInputDomainDependencies;
64
- }
65
- type CardTargetDomain = ResolvedCardTargetDomain | LazyCardTargetDomain;
66
- interface ResolvedBoardTargetDomain {
67
- type: "boardTarget";
68
- projection: "resolved";
69
- targetKind: string;
70
- boardId?: string;
71
- eligibleTargets: readonly string[];
72
- selection?: InputSelection;
73
- dependencies?: InputDomainResolver;
74
- }
75
- interface LazyBoardTargetDomain {
76
- type: "boardTarget";
77
- projection: "lazy";
78
- targetKind: string;
79
- boardId?: string;
80
- selection?: InputSelection;
81
- dependencies: LazyInputDomainDependencies;
82
- }
83
- type BoardTargetDomain = ResolvedBoardTargetDomain | LazyBoardTargetDomain;
84
- interface ResourceMapDomain {
85
- type: "resourceMap";
86
- resources?: ReadonlyArray<{
87
- resourceId: string;
88
- label?: string;
89
- icon?: string;
90
- min: number;
91
- max: number;
92
- }>;
93
- dependencies?: InputDomainResolver;
94
- }
95
- interface BoundedNumberDomain {
96
- type: "boundedNumber";
97
- min?: number;
98
- max?: number;
99
- step?: number;
100
- dependencies?: InputDomainResolver;
101
- }
102
- interface ChoiceDomain {
103
- type: "choice";
104
- choices?: readonly InteractionChoiceOption[];
105
- selection?: InputSelection;
106
- dependencies?: InputDomainResolver;
107
- }
108
- interface ChoiceListDomain {
109
- type: "choiceList";
110
- choices?: readonly InteractionChoiceOption[];
111
- min?: number;
112
- max?: number;
113
- selection?: InputSelection;
114
- dependencies?: InputDomainResolver;
115
- }
116
- interface InputDomainDependencyCase {
117
- when: Readonly<Record<string, string>>;
118
- domain: InputDomain;
119
- }
120
- interface InteractionChoiceOption {
121
- value: string | null;
122
- label: string;
123
- icon?: string;
124
- badge?: string;
125
- description?: string;
126
- disabled?: boolean;
127
- disabledReason?: string;
128
- }
129
- interface InteractionInputDescriptor {
130
- key: string;
131
- kind: string;
132
- domain: InputDomain;
133
- defaultValue?: unknown;
134
- }
135
- interface InteractionDiagnosticReason {
136
- ruleId: string;
137
- errorCode: string;
138
- }
139
- type InteractionAvailability = {
140
- status: "available";
141
- } | {
142
- status: "notYourTurn";
143
- reason: string;
144
- } | {
145
- status: "insufficientResources";
146
- reason: string;
147
- missingResources: Readonly<Record<string, number>>;
148
- } | {
149
- status: "blocked";
150
- reason: string;
151
- code?: string;
152
- };
153
- interface InteractionDescriptorBase<Key extends string = string> {
154
- phaseName: string;
155
- interactionKey: Key;
156
- interactionId: string;
157
- label: string;
158
- help?: string;
159
- /** Draft commit policy. Always materialized by the trusted reducer bundle. */
160
- commit: InteractionCommitPolicy;
161
- /** Canonical descriptor digest used by browser replay/protocol tooling when projected by the host. */
162
- descriptorDigest?: string;
163
- /** Explicit authoring/runtime actor seat used by browser replay draft digests. */
164
- actorSeat?: number;
165
- /** Canonical draft digest used by browser replay/protocol tooling when projected by the host. */
166
- draftDigest?: string;
167
- /** Source zone id for zone-scoped interactions (e.g., cardInput). */
168
- zoneId?: string;
169
- /** Source zone ids for zone-scoped interactions that span multiple zones. */
170
- zoneIds?: readonly string[];
171
- /** Ordered input descriptors. This is the canonical source for input keys, collector kind, and valid-value domains. */
172
- inputs: readonly InteractionInputDescriptor[];
173
- /** Resolved cost map keyed by resource id (if interaction declares one). */
174
- cost?: Record<string, unknown>;
175
- /** Snapshot of seat's currently available resources keyed by resource id. */
176
- currentResources?: Record<string, unknown>;
177
- /** Authoritative availability state for this descriptor. */
178
- availability: InteractionAvailability;
179
- /** Optional verbose diagnostics for dev tooling; omitted from production projections. */
180
- reasons?: readonly InteractionDiagnosticReason[];
181
- }
182
- type ActionInteractionDescriptor<Key extends string = string> = InteractionDescriptorBase<Key> & {
183
- kind: "action";
184
- };
185
- type PromptInteractionDescriptor<Key extends string = string> = InteractionDescriptorBase<Key> & {
186
- kind: "prompt";
187
- /** Structured prompt context for prompt-kind interactions. */
188
- context: InteractionContext;
189
- };
190
- type InteractionDescriptor<Key extends string = string> = ActionInteractionDescriptor<Key> | PromptInteractionDescriptor<Key>;
191
- /**
192
- * Per-player view of a single zone. Mirrors the ZoneHandles wire shape from
193
- * the trusted bundle's resolveZoneHandles; `cardViewsById` is JSON-serialized
194
- * `ViewCard` and `playableByCardId` lists the interactions that are playable
195
- * on each card (eligibility already filtered by each interaction's validate).
196
- */
197
- interface ZoneHandlesSnapshot<InteractionType extends string = string> {
198
- cardIds: readonly string[];
199
- cardViewsById: Readonly<Record<string, string>>;
200
- playableByCardId: Readonly<Record<string, ReadonlyArray<InteractionDescriptor<InteractionType>>>>;
201
- }
202
- interface GameEventDetail {
203
- label: string;
204
- value: string | number | boolean;
205
- }
206
- interface SystemActionEvent {
207
- kind: "systemAction";
208
- procedureId: string;
209
- title: string;
210
- summary?: string;
211
- details?: readonly GameEventDetail[];
212
- }
213
- type GameEvent = SystemActionEvent;
214
-
215
- /**
216
- * Result of validating a player action
217
- */
218
- interface ValidationResult {
219
- /** Whether the action is valid */
220
- valid: boolean;
221
- /** Machine-readable error code if validation failed */
222
- errorCode?: string;
223
- /** Human-readable error message if validation failed */
224
- message?: string;
225
- }
226
- /**
227
- * Structured authoritative submission failure returned by runtime submit APIs.
228
- */
229
- interface SubmissionError extends Error {
230
- /** Machine-readable error code when available */
231
- errorCode?: string;
232
- }
233
- type RuntimeDiagnosticEvent = {
234
- type: "runtimeLog";
235
- level: "log" | "warn" | "error";
236
- message: string;
237
- details?: readonly unknown[];
238
- } | {
239
- type: "internalError";
240
- code: string;
241
- message: string;
242
- stack?: string;
243
- };
244
- type RuntimeDiagnosticHandler = (event: RuntimeDiagnosticEvent) => void;
245
- /**
246
- * Plugin session state
247
- */
248
- interface PluginSessionState {
249
- /** Session initialization status */
250
- status: "loading" | "ready";
251
- /** Current session ID (null if not initialized) */
252
- sessionId: string | null;
253
- /** The player perspective represented by the current gameplay frame */
254
- controllingPlayerId: PlayerId | null;
255
- }
256
- /**
257
- * RuntimeAPI provides the interface between plugin code and the game runtime.
258
- * This API is exposed to plugin iframes for subscribing to game events and submitting actions.
259
- */
260
- interface RuntimeAPI {
261
- /**
262
- * Submit a player interaction to the game server. `submitInteraction`
263
- * is the single submission verb for every interaction kind — authors
264
- * do not split between "action" and "prompt response" calls.
265
- *
266
- * @param interactionId - Identifier of the interaction
267
- * @param params - Interaction-specific runtime JSON payload; prompt
268
- * collectors may submit scalars while ordinary collectors submit objects.
269
- * @throws SubmissionError if submission is rejected by the authority.
270
- */
271
- submitInteraction: (interactionId: string, params: unknown) => Promise<void>;
272
- emitDiagnostic?: (event: RuntimeDiagnosticEvent) => void;
273
- setDiagnosticHandler?: (handler: RuntimeDiagnosticHandler | undefined) => void;
274
- /**
275
- * Get the current plugin session state.
276
- * Returns initialization status and session/player IDs.
277
- *
278
- * @returns Current plugin session state
279
- *
280
- * @example
281
- * ```typescript
282
- * const { status, sessionId, playerId } = runtime.getSessionState();
283
- * if (status === "ready") {
284
- * console.log('Connected to session:', sessionId);
285
- * }
286
- * ```
287
- */
288
- getSessionState: () => PluginSessionState;
289
- /**
290
- * Disconnect from the runtime and clean up all listeners.
291
- * Should be called when the plugin is unmounting.
292
- */
293
- disconnect: () => void;
294
- }
295
-
296
- export type { GameEvent as G, InputDomain as I, PlayerId as P, RuntimeAPI as R, SubmissionError as S, ValidationResult as V, ZoneHandlesSnapshot as Z, GameEventDetail as a, InteractionDescriptor as b, InteractionInputDescriptor as c, PluginSessionState as d, RuntimeDiagnosticEvent as e, RuntimeDiagnosticHandler as f, SystemActionEvent as g };
@@ -1,5 +0,0 @@
1
- type RuntimeJson = null | boolean | number | string | RuntimeJson[] | {
2
- [key: string]: RuntimeJson;
3
- };
4
-
5
- export type { RuntimeJson as R };
package/dist/runtime.d.ts DELETED
@@ -1,83 +0,0 @@
1
- import { b5 as UIContract$1, G as DreamboardUI$1, b3 as TypedGame$1 } from './ui-contract-GTUPkf8z.js';
2
- export { c as BoardGridInteractionFilter, g as BoardHexGridProps, i as BoardHexViewProps, m as BoardSpaceTargetProps, o as BoardSquareGridInteractionFilter, p as BoardSquareGridProps, M as GameMeState, Q as GamePlayersState, R as GameRenderState, U as GameTurnState, b7 as UIRootProps, bh as ZoneCardRenderItem, bl as ZoneListProps } from './ui-contract-GTUPkf8z.js';
3
- export { a as ClientParamSchemaMap, W as WorkspaceBoardSurface, b as WorkspaceBoardSurfaceDescriptor, c as WorkspaceBoardTargetInputSlot, d as WorkspaceCardCollectionSurface, e as WorkspaceCardCollectionSurfaceDescriptor, f as WorkspaceCardInputSlot, g as WorkspaceFormInputSlot, h as WorkspaceHandSurface, i as WorkspaceHandSurfaceDescriptor, j as WorkspaceInteractionFormDescriptor, k as WorkspaceInteractionFormsDescriptor, l as WorkspaceInteractionSlotComponent, m as WorkspacePileSurface, n as WorkspacePileSurfaceDescriptor, o as WorkspacePilesSurfaceDescriptor, p as WorkspaceSurfaceSpec, q as createWorkspaceUIContract } from './index-CcT9Q7N7.js';
4
- import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import react__default from 'react';
6
- import { f as RuntimeDiagnosticHandler } from './runtime-api-Bz5pwNU_.js';
7
- export { G as GameEvent, a as GameEventDetail, b as InteractionDescriptor, g as SystemActionEvent } from './runtime-api-Bz5pwNU_.js';
8
- import { P as PluginRuntimeClient, a as PluginRuntimeClientOptions, b as PluginTransport } from './types-DR7DoB1x.js';
9
- export { R as RuntimeClock, c as RuntimeIdFactory } from './types-DR7DoB1x.js';
10
- export { b as ResourceCounterComponents } from './ResourceCounter-BFxJknqp.js';
11
- import './hex-board-view-aKkblDp6.js';
12
- import './player-state-Cqpyeql0.js';
13
- import './types.js';
14
- import './ThemeProvider-CElaL2ik.js';
15
- import './primitive-props-BNHDkgd7.js';
16
- import './attributes-DbvyMbXw.js';
17
- import './types-DJj5MJkl.js';
18
- import './protocol-dYgafTYY.js';
19
-
20
- interface PluginRuntimeProps {
21
- /** Child components to render after gameplay frame has started */
22
- children: react__default.ReactNode;
23
- /**
24
- * Timeout in milliseconds to wait for the first gameplay-frame snapshot.
25
- * @default 10000 (10 seconds)
26
- */
27
- timeout?: number;
28
- /** Custom loading component to show while waiting for gameplay frame */
29
- loadingComponent?: react__default.ReactNode;
30
- /** Custom error component to show when initialization fails */
31
- errorComponent?: (error: string) => react__default.ReactNode;
32
- onDiagnostic?: RuntimeDiagnosticHandler;
33
- }
34
- /**
35
- * PluginRuntime provides the RuntimeContext for plugin components.
36
- *
37
- * This component:
38
- * - Creates a transport-backed runtime client
39
- * - Waits for the first projected gameplay frame before rendering children
40
- * - Provides runtime commands plus session/frame state to all child components
41
- *
42
- * @example
43
- * ```tsx
44
- * // In your plugin's index.tsx
45
- * import { PluginRuntime } from "./components/dreamboard";
46
- * import App from './App';
47
- *
48
- * ReactDOM.createRoot(document.getElementById('root')!).render(
49
- * <PluginRuntime>
50
- * <App />
51
- * </PluginRuntime>
52
- * );
53
- * ```
54
- */
55
- declare function PluginRuntime({ children, timeout, loadingComponent, errorComponent, onDiagnostic, }: PluginRuntimeProps): react_jsx_runtime.JSX.Element;
56
-
57
- declare function PluginRuntimeBoundary({ runtime, children, }: {
58
- runtime: PluginRuntimeClient;
59
- children: react__default.ReactNode;
60
- }): react_jsx_runtime.JSX.Element;
61
-
62
- declare function createPluginRuntimeClient(options: PluginRuntimeClientOptions): PluginRuntimeClient;
63
-
64
- interface PostMessagePluginTransportOptions {
65
- readonly targetWindow?: Window;
66
- readonly parentWindow?: Window;
67
- readonly bundledSdkVersion?: string;
68
- readonly onInvalidMessage?: (reason: string, value: unknown) => void;
69
- }
70
- declare function createPostMessagePluginTransport(options?: PostMessagePluginTransportOptions): PluginTransport;
71
-
72
- interface DreamboardUIRegister {
73
- readonly __dreamboardUIRegister?: never;
74
- }
75
- type UIContract = UIContract$1;
76
- type RegisteredUIContract = DreamboardUIRegister extends {
77
- ui: infer Registered extends UIContract;
78
- } ? Registered : UIContract;
79
- type RegisteredUI = RegisteredUIContract;
80
- type DreamboardUI<Contract extends UIContract = RegisteredUI> = DreamboardUI$1<Contract>;
81
- type TypedGame<Contract extends UIContract, View = unknown, Player extends string = string, Phase extends string = string> = TypedGame$1<Contract, View, Player, Phase>;
82
-
83
- export { type DreamboardUI, type DreamboardUIRegister, PluginRuntime, PluginRuntimeBoundary, PluginRuntimeClient, PluginRuntimeClientOptions, type PluginRuntimeProps, PluginTransport, type PostMessagePluginTransportOptions, type RegisteredUI, type TypedGame, type UIContract, createPluginRuntimeClient, createPostMessagePluginTransport };
package/dist/runtime.js DELETED
@@ -1,242 +0,0 @@
1
- import {
2
- PluginRuntimeBoundary,
3
- createPluginRuntimeClient
4
- } from "./chunk-3BAD4VC2.js";
5
- import {
6
- createWorkspaceUIContract
7
- } from "./chunk-EVCLTY4Q.js";
8
- import "./chunk-ANRB4XKA.js";
9
- import "./chunk-PN5O6GG2.js";
10
- import "./chunk-LR3ZTWQF.js";
11
- import "./chunk-T3ZKNUZ7.js";
12
- import "./chunk-GDPKTBUR.js";
13
- import "./chunk-3SKDNDPG.js";
14
- import {
15
- GameSkeleton
16
- } from "./chunk-32PFKDV7.js";
17
- import "./chunk-VDXOF4FW.js";
18
- import "./chunk-WHR5UW3F.js";
19
- import {
20
- DREAMBOARD_SDK_VERSION
21
- } from "./chunk-Y75CFE77.js";
22
- import {
23
- DREAMBOARD_PLUGIN_PROTOCOL,
24
- DREAMBOARD_PLUGIN_PROTOCOL_VERSION,
25
- HostToPluginEnvelopeSchema
26
- } from "./chunk-VCDWP5VL.js";
27
- import "./chunk-ZZGN2ATS.js";
28
- import "./chunk-H6VDGFL5.js";
29
- import "./chunk-5YV2WHJ4.js";
30
- import "./chunk-PF7L4BMG.js";
31
- import "./chunk-Z7QCREWI.js";
32
- import "./chunk-UGH54WZ2.js";
33
- import "./chunk-PZ5AY32C.js";
34
-
35
- // src/runtime/hooks/usePluginRuntime.ts
36
- import { useState, useEffect, useRef } from "react";
37
-
38
- // src/runtime/browser/post-message-transport.ts
39
- function createPostMessagePluginTransport(options = {}) {
40
- const targetWindow = options.targetWindow ?? window;
41
- const parentWindow = options.parentWindow ?? targetWindow.parent;
42
- const bundledSdkVersion = options.bundledSdkVersion?.trim() || "unknown";
43
- let channel = null;
44
- let outboundSequence = 0;
45
- let invalidEnvelopeReported = false;
46
- const reportInvalidEnvelope = (reason, value) => {
47
- options.onInvalidMessage?.(reason, value);
48
- if (!channel || invalidEnvelopeReported) {
49
- return;
50
- }
51
- invalidEnvelopeReported = true;
52
- channel.hostWindow.postMessage(
53
- {
54
- protocol: DREAMBOARD_PLUGIN_PROTOCOL,
55
- version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,
56
- channelId: channel.channelId,
57
- sequence: ++outboundSequence,
58
- payload: {
59
- type: "runtime.error",
60
- code: "host-runtime-protocol-mismatch",
61
- message: `Plugin runtime rejected a host message (${reason}). Bundled @dreamboard-games/sdk version: ${bundledSdkVersion}. The host and plugin bundle may have incompatible SDK/runtime contract versions.`
62
- }
63
- },
64
- channel.hostOrigin
65
- );
66
- };
67
- return {
68
- start(onMessage) {
69
- const handleMessage = (event) => {
70
- if (event.source !== parentWindow) {
71
- return;
72
- }
73
- const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);
74
- if (!parseResult.success) {
75
- reportInvalidEnvelope("invalid-envelope", event.data);
76
- return;
77
- }
78
- const envelope = parseResult.data;
79
- if (!channel) {
80
- if (envelope.payload.type !== "runtime.init") {
81
- return;
82
- }
83
- channel = {
84
- channelId: envelope.channelId,
85
- hostOrigin: event.origin,
86
- hostWindow: event.source
87
- };
88
- }
89
- if (envelope.channelId !== channel.channelId || event.origin !== channel.hostOrigin || event.source !== channel.hostWindow) {
90
- reportInvalidEnvelope("channel-mismatch", event.data);
91
- return;
92
- }
93
- onMessage(envelope);
94
- };
95
- targetWindow.addEventListener("message", handleMessage);
96
- return () => {
97
- targetWindow.removeEventListener("message", handleMessage);
98
- channel = null;
99
- };
100
- },
101
- send(payload) {
102
- if (!channel) {
103
- throw new Error("Plugin transport is not initialized.");
104
- }
105
- channel.hostWindow.postMessage(
106
- {
107
- protocol: DREAMBOARD_PLUGIN_PROTOCOL,
108
- version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,
109
- channelId: channel.channelId,
110
- sequence: ++outboundSequence,
111
- payload
112
- },
113
- channel.hostOrigin
114
- );
115
- }
116
- };
117
- }
118
-
119
- // src/runtime/hooks/usePluginRuntime.ts
120
- var BUNDLED_SDK_VERSION = DREAMBOARD_SDK_VERSION;
121
- function hasProjectedView(runtime) {
122
- const frame = runtime.getFrame();
123
- return frame !== null && frame.view !== null && typeof frame.view !== "undefined";
124
- }
125
- function usePluginRuntime(options = {}) {
126
- const { timeout = 1e4, onDiagnostic } = options;
127
- const [error, setError] = useState(null);
128
- const [runtime] = useState(
129
- () => createPluginRuntimeClient({
130
- transport: createPostMessagePluginTransport({
131
- bundledSdkVersion: BUNDLED_SDK_VERSION,
132
- onInvalidMessage: (reason, value) => {
133
- const message = `Plugin runtime rejected a host message (${reason}). Bundled @dreamboard-games/sdk version: ${BUNDLED_SDK_VERSION}. The host and plugin bundle may have incompatible SDK/runtime contract versions.`;
134
- setError(message);
135
- onDiagnostic?.({
136
- type: "runtimeLog",
137
- level: "warn",
138
- message,
139
- details: [value]
140
- });
141
- }
142
- })
143
- })
144
- );
145
- const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));
146
- const hasBeenReadyRef = useRef(false);
147
- if (isReady) hasBeenReadyRef.current = true;
148
- useEffect(() => {
149
- void onDiagnostic;
150
- }, [onDiagnostic]);
151
- useEffect(() => {
152
- const markReadyFromFrame = () => {
153
- if (!hasProjectedView(runtime)) {
154
- return false;
155
- }
156
- setError(null);
157
- setIsReady(true);
158
- return true;
159
- };
160
- if (markReadyFromFrame()) {
161
- return;
162
- }
163
- const timeoutId = setTimeout(() => {
164
- if (!markReadyFromFrame()) {
165
- setError(
166
- `Timed out waiting for the initial projected view after ${timeout}ms. Ensure the host sends a gameplay frame with a seat view.`
167
- );
168
- }
169
- }, timeout);
170
- const pollId = setInterval(() => {
171
- if (markReadyFromFrame()) {
172
- clearInterval(pollId);
173
- clearTimeout(timeoutId);
174
- }
175
- }, 100);
176
- const unsubscribe = runtime.subscribeFrame(() => {
177
- if (!hasProjectedView(runtime)) {
178
- setIsReady(false);
179
- return;
180
- }
181
- clearInterval(pollId);
182
- clearTimeout(timeoutId);
183
- setError(null);
184
- setIsReady(true);
185
- });
186
- return () => {
187
- clearInterval(pollId);
188
- clearTimeout(timeoutId);
189
- unsubscribe?.();
190
- };
191
- }, [runtime, timeout]);
192
- return {
193
- runtime,
194
- isReady,
195
- waiting: hasBeenReadyRef.current && !isReady,
196
- error
197
- };
198
- }
199
-
200
- // src/runtime/components/PluginRuntime.tsx
201
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
202
- function PluginRuntime({
203
- children,
204
- timeout = 1e4,
205
- loadingComponent,
206
- errorComponent,
207
- onDiagnostic
208
- }) {
209
- const { runtime, isReady, waiting, error } = usePluginRuntime({
210
- timeout,
211
- onDiagnostic
212
- });
213
- if (error) {
214
- if (errorComponent) {
215
- return /* @__PURE__ */ jsx(Fragment, { children: errorComponent(error) });
216
- }
217
- return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center bg-gray-50", children: /* @__PURE__ */ jsxs("div", { className: "text-center p-6", children: [
218
- /* @__PURE__ */ jsx("p", { className: "text-red-600 font-medium mb-2", children: "Failed to load game" }),
219
- /* @__PURE__ */ jsx("p", { className: "text-gray-600 text-sm", children: error })
220
- ] }) });
221
- }
222
- if (!isReady) {
223
- if (loadingComponent) {
224
- return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
225
- }
226
- return /* @__PURE__ */ jsx(
227
- GameSkeleton,
228
- {
229
- message: waiting ? "Waiting for the other players\u2026" : "Waiting for game state..."
230
- }
231
- );
232
- }
233
- return /* @__PURE__ */ jsx(PluginRuntimeBoundary, { runtime, children });
234
- }
235
- export {
236
- PluginRuntime,
237
- PluginRuntimeBoundary,
238
- createPluginRuntimeClient,
239
- createPostMessagePluginTransport,
240
- createWorkspaceUIContract
241
- };
242
- //# sourceMappingURL=runtime.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/runtime/hooks/usePluginRuntime.ts","../src/runtime/browser/post-message-transport.ts","../src/runtime/components/PluginRuntime.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport { DREAMBOARD_SDK_VERSION } from \"../../package-set.js\";\nimport { createPostMessagePluginTransport } from \"../browser/post-message-transport.js\";\nimport { createPluginRuntimeClient } from \"../core/create-plugin-runtime-client.js\";\nimport type { PluginRuntimeClient } from \"../core/types.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\n\nconst BUNDLED_SDK_VERSION = DREAMBOARD_SDK_VERSION;\n\nexport interface UsePluginRuntimeOptions {\n /**\n * Timeout in milliseconds to wait for the first gameplay frame.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\nexport interface UsePluginRuntimeResult {\n /** The transport-agnostic plugin runtime client. */\n runtime: PluginRuntimeClient;\n /** Whether the initial reducer-native snapshot is available and ready */\n isReady: boolean;\n /**\n * True when the plugin was ready before but the current snapshot has no\n * projected view — e.g. you've acted and are waiting on the rest of the\n * table in a simultaneous phase. Lets the loading affordance read as a\n * mid-game wait rather than a cold \"still loading\" stall.\n */\n waiting: boolean;\n /** Error message if initialization failed */\n error: string | null;\n}\n\nfunction hasProjectedView(runtime: PluginRuntimeClient): boolean {\n const frame = runtime.getFrame();\n return (\n frame !== null && frame.view !== null && typeof frame.view !== \"undefined\"\n );\n}\n\n/**\n * Hook that creates and manages a PluginRuntimeClient instance.\n *\n * This hook handles:\n * 1. Creating the runtime client\n * 2. Waiting for the first gameplay frame before setting isReady\n *\n * In the new architecture, the host only renders the plugin when a reducer-native\n * snapshot is available, so isReady should become true quickly after init.\n *\n * @example\n * ```tsx\n * function PluginRuntime({ children }: { children: React.ReactNode }) {\n * const { runtime, isReady, error } = usePluginRuntime();\n *\n * if (error) {\n * return <div>Error: {error}</div>;\n * }\n *\n * if (!isReady) {\n * return <GameSkeleton message=\"Waiting for game state...\" />;\n * }\n *\n * return <RuntimeProvider runtime={runtime}>{children}</RuntimeProvider>;\n * }\n * ```\n */\nexport function usePluginRuntime(\n options: UsePluginRuntimeOptions = {},\n): UsePluginRuntimeResult {\n const { timeout = 10000, onDiagnostic } = options;\n const [error, setError] = useState<string | null>(null);\n\n // Create runtime once and keep stable reference\n const [runtime] = useState<PluginRuntimeClient>(() =>\n createPluginRuntimeClient({\n transport: createPostMessagePluginTransport({\n bundledSdkVersion: BUNDLED_SDK_VERSION,\n onInvalidMessage: (reason, value) => {\n const message =\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${BUNDLED_SDK_VERSION}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\";\n setError(message);\n onDiagnostic?.({\n type: \"runtimeLog\",\n level: \"warn\",\n message,\n details: [value],\n });\n },\n }),\n }),\n );\n const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));\n // Latches once we've shown a view, so a later view-less snapshot reads as a\n // mid-game wait rather than a fresh load. (A ref, so it never re-triggers a\n // render on its own.)\n const hasBeenReadyRef = useRef(false);\n if (isReady) hasBeenReadyRef.current = true;\n\n useEffect(() => {\n void onDiagnostic;\n }, [onDiagnostic]);\n\n // Subscribe to gameplay frames and set isReady when the first projected view arrives.\n useEffect(() => {\n const markReadyFromFrame = () => {\n if (!hasProjectedView(runtime)) {\n return false;\n }\n setError(null);\n setIsReady(true);\n return true;\n };\n\n if (markReadyFromFrame()) {\n return;\n }\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n if (!markReadyFromFrame()) {\n setError(\n `Timed out waiting for the initial projected view after ${timeout}ms. ` +\n \"Ensure the host sends a gameplay frame with a seat view.\",\n );\n }\n }, timeout);\n\n // Fallback poll for dev/HMR flows where the runtime frame may already\n // exist but the first subscribe callback is missed.\n const pollId = setInterval(() => {\n if (markReadyFromFrame()) {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n }\n }, 100);\n\n const unsubscribe = runtime.subscribeFrame(() => {\n if (!hasProjectedView(runtime)) {\n setIsReady(false);\n return;\n }\n clearInterval(pollId);\n clearTimeout(timeoutId);\n setError(null);\n setIsReady(true);\n });\n\n return () => {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n unsubscribe?.();\n };\n }, [runtime, timeout]);\n\n return {\n runtime,\n isReady,\n waiting: hasBeenReadyRef.current && !isReady,\n error,\n };\n}\n","import {\n DREAMBOARD_PLUGIN_PROTOCOL,\n DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n HostToPluginEnvelopeSchema,\n type HostToPluginEnvelope,\n type PluginToHostPayload,\n} from \"@dreamboard-games/plugin-runtime-contract\";\nimport type { PluginTransport } from \"../core/types.js\";\n\nexport interface PostMessagePluginTransportOptions {\n readonly targetWindow?: Window;\n readonly parentWindow?: Window;\n readonly bundledSdkVersion?: string;\n readonly onInvalidMessage?: (reason: string, value: unknown) => void;\n}\n\nexport function createPostMessagePluginTransport(\n options: PostMessagePluginTransportOptions = {},\n): PluginTransport {\n const targetWindow = options.targetWindow ?? window;\n const parentWindow = options.parentWindow ?? targetWindow.parent;\n const bundledSdkVersion = options.bundledSdkVersion?.trim() || \"unknown\";\n let channel: {\n readonly channelId: string;\n readonly hostOrigin: string;\n readonly hostWindow: Window;\n } | null = null;\n let outboundSequence = 0;\n let invalidEnvelopeReported = false;\n\n const reportInvalidEnvelope = (reason: string, value: unknown) => {\n options.onInvalidMessage?.(reason, value);\n\n if (!channel || invalidEnvelopeReported) {\n return;\n }\n\n invalidEnvelopeReported = true;\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload: {\n type: \"runtime.error\",\n code: \"host-runtime-protocol-mismatch\",\n message:\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${bundledSdkVersion}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\",\n },\n },\n channel.hostOrigin,\n );\n };\n\n return {\n start(onMessage) {\n const handleMessage = (event: MessageEvent) => {\n if (event.source !== parentWindow) {\n return;\n }\n const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);\n if (!parseResult.success) {\n reportInvalidEnvelope(\"invalid-envelope\", event.data);\n return;\n }\n const envelope = parseResult.data;\n if (!channel) {\n if (envelope.payload.type !== \"runtime.init\") {\n return;\n }\n channel = {\n channelId: envelope.channelId,\n hostOrigin: event.origin,\n hostWindow: event.source as Window,\n };\n }\n if (\n envelope.channelId !== channel.channelId ||\n event.origin !== channel.hostOrigin ||\n event.source !== channel.hostWindow\n ) {\n reportInvalidEnvelope(\"channel-mismatch\", event.data);\n return;\n }\n onMessage(envelope as HostToPluginEnvelope);\n };\n\n targetWindow.addEventListener(\"message\", handleMessage);\n return () => {\n targetWindow.removeEventListener(\"message\", handleMessage);\n channel = null;\n };\n },\n send(payload: PluginToHostPayload) {\n if (!channel) {\n throw new Error(\"Plugin transport is not initialized.\");\n }\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload,\n },\n channel.hostOrigin,\n );\n },\n };\n}\n","import React from \"react\";\nimport { usePluginRuntime } from \"../hooks/usePluginRuntime.js\";\nimport { GameSkeleton } from \"../../ui.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\nimport { PluginRuntimeBoundary } from \"./PluginRuntimeBoundary.js\";\n\nexport interface PluginRuntimeProps {\n /** Child components to render after gameplay frame has started */\n children: React.ReactNode;\n /**\n * Timeout in milliseconds to wait for the first gameplay-frame snapshot.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n /** Custom loading component to show while waiting for gameplay frame */\n loadingComponent?: React.ReactNode;\n /** Custom error component to show when initialization fails */\n errorComponent?: (error: string) => React.ReactNode;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\n/**\n * PluginRuntime provides the RuntimeContext for plugin components.\n *\n * This component:\n * - Creates a transport-backed runtime client\n * - Waits for the first projected gameplay frame before rendering children\n * - Provides runtime commands plus session/frame state to all child components\n *\n * @example\n * ```tsx\n * // In your plugin's index.tsx\n * import { PluginRuntime } from \"./components/dreamboard\";\n * import App from './App';\n *\n * ReactDOM.createRoot(document.getElementById('root')!).render(\n * <PluginRuntime>\n * <App />\n * </PluginRuntime>\n * );\n * ```\n */\nexport function PluginRuntime({\n children,\n timeout = 10000,\n loadingComponent,\n errorComponent,\n onDiagnostic,\n}: PluginRuntimeProps) {\n const { runtime, isReady, waiting, error } = usePluginRuntime({\n timeout,\n onDiagnostic,\n });\n\n if (error) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n return (\n <div className=\"flex h-full w-full items-center justify-center bg-gray-50\">\n <div className=\"text-center p-6\">\n <p className=\"text-red-600 font-medium mb-2\">Failed to load game</p>\n <p className=\"text-gray-600 text-sm\">{error}</p>\n </div>\n </div>\n );\n }\n\n if (!isReady) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Once the game has rendered, a view-less snapshot is a mid-game wait (you\n // acted and are waiting on the table), not a cold load — say so rather than\n // reading as a stalled \"Waiting for game state\".\n return (\n <GameSkeleton\n message={\n waiting\n ? \"Waiting for the other players…\"\n : \"Waiting for game state...\"\n }\n />\n );\n }\n\n return (\n <PluginRuntimeBoundary runtime={runtime}>{children}</PluginRuntimeBoundary>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,WAAW,cAAc;;;ACgBrC,SAAS,iCACd,UAA6C,CAAC,GAC7B;AACjB,QAAM,eAAe,QAAQ,gBAAgB;AAC7C,QAAM,eAAe,QAAQ,gBAAgB,aAAa;AAC1D,QAAM,oBAAoB,QAAQ,mBAAmB,KAAK,KAAK;AAC/D,MAAI,UAIO;AACX,MAAI,mBAAmB;AACvB,MAAI,0BAA0B;AAE9B,QAAM,wBAAwB,CAAC,QA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