@dreamboard-games/sdk 0.4.0-alpha.8 → 0.5.0-alpha.0

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 (121) hide show
  1. package/README.md +49 -11
  2. package/dist/authoring/index.d.ts +6 -14
  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 +11 -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 +45 -0
  10. package/dist/authoring-materialize-cli.js.map +1 -0
  11. package/dist/browser-interaction.d.ts +22 -22
  12. package/dist/{chunk-3BLN5POZ.js → chunk-2GQIALJL.js} +51 -15
  13. package/dist/chunk-2GQIALJL.js.map +1 -0
  14. package/dist/chunk-533O7C4L.js +7095 -0
  15. package/dist/chunk-533O7C4L.js.map +1 -0
  16. package/dist/{chunk-44N3T2A5.js → chunk-6LMESVGT.js} +9 -28
  17. package/dist/chunk-6LMESVGT.js.map +1 -0
  18. package/dist/{chunk-ZYONCTZ2.js → chunk-DQS2EG5E.js} +3 -3
  19. package/dist/{chunk-ZYONCTZ2.js.map → chunk-DQS2EG5E.js.map} +1 -1
  20. package/dist/chunk-EOEA3I64.js +1864 -0
  21. package/dist/chunk-EOEA3I64.js.map +1 -0
  22. package/dist/{chunk-B2YBS3SG.js → chunk-FL67RDID.js} +41 -13
  23. package/dist/chunk-FL67RDID.js.map +1 -0
  24. package/dist/{chunk-2TAKLJJD.js → chunk-HIH6Y4FA.js} +222 -1267
  25. package/dist/chunk-HIH6Y4FA.js.map +1 -0
  26. package/dist/chunk-HUK4234C.js +166 -0
  27. package/dist/chunk-HUK4234C.js.map +1 -0
  28. package/dist/chunk-KGV2EUNN.js +532 -0
  29. package/dist/chunk-KGV2EUNN.js.map +1 -0
  30. package/dist/{chunk-VTK4TIXC.js → chunk-KRJPRYEA.js} +49 -4
  31. package/dist/chunk-KRJPRYEA.js.map +1 -0
  32. package/dist/chunk-KWHOFBDM.js +9 -0
  33. package/dist/chunk-KWHOFBDM.js.map +1 -0
  34. package/dist/{chunk-UC2UXAC6.js → chunk-LMHCGCA6.js} +2 -2
  35. package/dist/{chunk-XV27IQHA.js → chunk-N33CGX2F.js} +15 -85
  36. package/dist/chunk-N33CGX2F.js.map +1 -0
  37. package/dist/chunk-TXELBVTG.js +32 -0
  38. package/dist/chunk-TXELBVTG.js.map +1 -0
  39. package/dist/{chunk-2TRZSZGD.js → chunk-VRRR6QZT.js} +9 -12
  40. package/dist/chunk-VRRR6QZT.js.map +1 -0
  41. package/dist/chunk-VWTKGIYF.js +90 -0
  42. package/dist/chunk-VWTKGIYF.js.map +1 -0
  43. package/dist/{chunk-IYX5OO2K.js → chunk-XFMSLL3P.js} +133 -61
  44. package/dist/chunk-XFMSLL3P.js.map +1 -0
  45. package/dist/{chunk-YGQTL63W.js → chunk-ZSTCUJKZ.js} +4 -4
  46. package/dist/chunk-ZSTCUJKZ.js.map +1 -0
  47. package/dist/codegen.js +1 -1
  48. package/dist/{components-BTwSIjXj.d.ts → components-CNAt5J1p.d.ts} +1 -1
  49. package/dist/definitions-bZSBaPjj.d.ts +300 -0
  50. package/dist/{diagnostics-1BWjRo6-.d.ts → diagnostics-DIi3ina7.d.ts} +2 -1
  51. package/dist/digest.d.ts +8 -0
  52. package/dist/{index-CFTjJIXd.d.ts → index-CR69MyWr.d.ts} +2 -2
  53. package/dist/{index.d-C0PKOVbh.d.ts → index.d-Bw8AOcgp.d.ts} +532 -225
  54. package/dist/index.js +2 -2
  55. package/dist/package-set.d.ts +2 -2
  56. package/dist/package-set.js +2 -2
  57. package/dist/plugin-runtime-contract.d.ts +17 -0
  58. package/dist/plugin-runtime-contract.js +94 -0
  59. package/dist/plugin-runtime-contract.js.map +1 -0
  60. package/dist/{protocol-nS2ojsGr.d.ts → protocol-CVaSqPgX.d.ts} +54 -47
  61. package/dist/reducer/advanced.d.ts +5 -4
  62. package/dist/reducer/advanced.js +14 -108
  63. package/dist/reducer/advanced.js.map +1 -1
  64. package/dist/reducer-contract.d.ts +1 -1
  65. package/dist/reducer-contract.js +6 -4
  66. package/dist/reducer.d.ts +20 -98
  67. package/dist/reducer.js +28 -6050
  68. package/dist/reducer.js.map +1 -1
  69. package/dist/reference-games/index.d.ts +6 -198
  70. package/dist/reference-games/index.js +18 -200
  71. package/dist/reference-games/index.js.map +1 -1
  72. package/dist/runtime/primitives.d.ts +3 -3
  73. package/dist/runtime/primitives.js +5 -5
  74. package/dist/runtime/runtime-api.d.ts +1 -1
  75. package/dist/runtime/workspace-contract.d.ts +343 -11
  76. package/dist/runtime/workspace-contract.js +12 -6
  77. package/dist/{runtime-Dkfm1x2r.d.ts → runtime-C7Z2acNU.d.ts} +67 -31
  78. package/dist/{runtime-api-C6aWo9c0.d.ts → runtime-api-CgPuEVeF.d.ts} +4 -13
  79. package/dist/runtime.d.ts +7 -7
  80. package/dist/runtime.js +15 -11
  81. package/dist/runtime.js.map +1 -1
  82. package/dist/schema.d.ts +405 -0
  83. package/dist/{stale-contract-artifact-error-C5AaZPJ8.d.ts → stale-contract-artifact-error-XLaweZtF.d.ts} +1 -1
  84. package/dist/testing-compiler.d.ts +37 -0
  85. package/dist/testing-compiler.js +272 -0
  86. package/dist/testing-compiler.js.map +1 -0
  87. package/dist/testing-runtime.d.ts +98 -21
  88. package/dist/testing-runtime.js +154 -95
  89. package/dist/testing-runtime.js.map +1 -1
  90. package/dist/testing.d.ts +197 -156
  91. package/dist/testing.js +660 -372
  92. package/dist/testing.js.map +1 -1
  93. package/dist/types-DN4O7kH_.d.ts +122 -0
  94. package/dist/{types-CTeN_QAk.d.ts → types-q1Guidm5.d.ts} +4 -5
  95. package/dist/types.d.ts +0 -1
  96. package/dist/ui/components.d.ts +3 -2
  97. package/dist/ui/components.js +1 -1
  98. package/dist/ui/plugin-styles.css +1 -1
  99. package/dist/{ui-contract-Ue6SywvO.d.ts → ui-contract-BC4JpysE.d.ts} +2 -6
  100. package/dist/ui.d.ts +4 -3
  101. package/dist/ui.js +2 -2
  102. package/dist/{views-Qx-EHBP8.d.ts → views-D2Cfzr3h.d.ts} +17 -5
  103. package/package.json +41 -22
  104. package/REFERENCE.md +0 -22884
  105. package/dist/chunk-2TAKLJJD.js.map +0 -1
  106. package/dist/chunk-2TRZSZGD.js.map +0 -1
  107. package/dist/chunk-3BLN5POZ.js.map +0 -1
  108. package/dist/chunk-3OZMHZK3.js +0 -40
  109. package/dist/chunk-3OZMHZK3.js.map +0 -1
  110. package/dist/chunk-44N3T2A5.js.map +0 -1
  111. package/dist/chunk-5CQIJHGF.js +0 -663
  112. package/dist/chunk-5CQIJHGF.js.map +0 -1
  113. package/dist/chunk-B2YBS3SG.js.map +0 -1
  114. package/dist/chunk-IYX5OO2K.js.map +0 -1
  115. package/dist/chunk-VTK4TIXC.js.map +0 -1
  116. package/dist/chunk-VTNEWMWJ.js +0 -12
  117. package/dist/chunk-VTNEWMWJ.js.map +0 -1
  118. package/dist/chunk-XV27IQHA.js.map +0 -1
  119. package/dist/chunk-YGQTL63W.js.map +0 -1
  120. package/dist/types-B_3pObUV.d.ts +0 -192
  121. /package/dist/{chunk-UC2UXAC6.js.map → chunk-LMHCGCA6.js.map} +0 -0
@@ -1,3 +1,5 @@
1
+ import './plugin-state-BRH3UiUp.js';
2
+
1
3
  type PlayerId = string;
2
4
 
3
5
  /**
@@ -46,25 +48,14 @@ interface PluginSessionState {
46
48
  * This API is exposed to plugin iframes for subscribing to game events and submitting actions.
47
49
  */
48
50
  interface RuntimeAPI {
49
- /**
50
- * Validate a player interaction before submitting it. `params` is typed
51
- * as `unknown` because a `promptInput` collector can declare a scalar
52
- * response schema (`z.enum([...])`, `z.string()`, `z.number()`, ...)
53
- * while ordinary collectors pass an object.
54
- *
55
- * @param interactionId - Identifier of the interaction
56
- * @param params - Interaction-specific payload
57
- * @returns Promise that resolves with validation result
58
- */
59
- validateInteraction: (interactionId: string, params: unknown) => Promise<ValidationResult>;
60
51
  /**
61
52
  * Submit a player interaction to the game server. `submitInteraction`
62
53
  * is the single submission verb for every interaction kind — authors
63
54
  * do not split between "action" and "prompt response" calls.
64
55
  *
65
56
  * @param interactionId - Identifier of the interaction
66
- * @param params - Interaction-specific payload (see
67
- * {@link validateInteraction} for the `unknown` typing rationale)
57
+ * @param params - Interaction-specific runtime JSON payload; prompt
58
+ * collectors may submit scalars while ordinary collectors submit objects.
68
59
  * @throws SubmissionError if submission is rejected by the authority.
69
60
  */
70
61
  submitInteraction: (interactionId: string, params: unknown) => Promise<void>;
package/dist/runtime.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { b5 as UIContract$1, G as DreamboardUI$1, b3 as TypedGame$1 } from './ui-contract-Ue6SywvO.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-Ue6SywvO.js';
3
- export { C as ClientParamSchemaMap, W as WorkspaceBoardSurface, a as WorkspaceBoardSurfaceDescriptor, b as WorkspaceBoardTargetInputSlot, c as WorkspaceCardCollectionSurface, d as WorkspaceCardCollectionSurfaceDescriptor, e as WorkspaceCardInputSlot, f as WorkspaceFormInputSlot, g as WorkspaceHandSurface, h as WorkspaceHandSurfaceDescriptor, i as WorkspaceInteractionFormDescriptor, j as WorkspaceInteractionFormsDescriptor, k as WorkspaceInteractionSlotComponent, l as WorkspacePileSurface, m as WorkspacePileSurfaceDescriptor, n as WorkspacePilesSurfaceDescriptor, o as WorkspaceSurfaceSpec, p as createWorkspaceUIContract } from './index-CFTjJIXd.js';
1
+ import { b5 as UIContract$1, G as DreamboardUI$1, b3 as TypedGame$1 } from './ui-contract-BC4JpysE.js';
2
+ export { c as BoardGridInteractionFilter, g as BoardHexGridProps, i as BoardHexViewProps, m as BoardSpaceTargetProps, o as BoardSquareGridInteractionFilter, p as BoardSquareGridProps, M as GameMeState, Q as GamePlayersState, R as GameRenderState, U as GameTurnState, b7 as UIRootProps, bh as ZoneCardRenderItem, bl as ZoneListProps } from './ui-contract-BC4JpysE.js';
3
+ export { a as ClientParamSchemaMap, W as WorkspaceBoardSurface, b as WorkspaceBoardSurfaceDescriptor, c as WorkspaceBoardTargetInputSlot, d as WorkspaceCardCollectionSurface, e as WorkspaceCardCollectionSurfaceDescriptor, f as WorkspaceCardInputSlot, g as WorkspaceFormInputSlot, h as WorkspaceHandSurface, i as WorkspaceHandSurfaceDescriptor, j as WorkspaceInteractionFormDescriptor, k as WorkspaceInteractionFormsDescriptor, l as WorkspaceInteractionSlotComponent, m as WorkspacePileSurface, n as WorkspacePileSurfaceDescriptor, o as WorkspacePilesSurfaceDescriptor, p as WorkspaceSurfaceSpec, q as createWorkspaceUIContract } from './index-CR69MyWr.js';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import react__default from 'react';
6
- import { c as RuntimeDiagnosticHandler } from './runtime-api-C6aWo9c0.js';
7
- import { P as PluginRuntimeClient, a as PluginRuntimeClientOptions, b as PluginTransport } from './types-CTeN_QAk.js';
8
- export { R as RuntimeClock, c as RuntimeIdFactory } from './types-CTeN_QAk.js';
6
+ import { c as RuntimeDiagnosticHandler } from './runtime-api-CgPuEVeF.js';
7
+ import { P as PluginRuntimeClient, a as PluginRuntimeClientOptions, b as PluginTransport } from './types-q1Guidm5.js';
8
+ export { R as RuntimeClock, c as RuntimeIdFactory } from './types-q1Guidm5.js';
9
9
  export { G as GameEvent, a as GameEventDetail, b as InteractionDescriptor, P as ProjectedGameEvent, S as SystemActionEvent } from './plugin-state-BRH3UiUp.js';
10
10
  export { b as ResourceCounterComponents } from './ResourceCounter-BFxJknqp.js';
11
11
  import './hex-board-view-aKkblDp6.js';
@@ -15,7 +15,7 @@ import './ThemeProvider-CElaL2ik.js';
15
15
  import './primitive-props-BNHDkgd7.js';
16
16
  import './attributes-DbvyMbXw.js';
17
17
  import './types-DJj5MJkl.js';
18
- import './protocol-nS2ojsGr.js';
18
+ import './protocol-CVaSqPgX.js';
19
19
 
20
20
  interface PluginRuntimeProps {
21
21
  /** Child components to render after gameplay frame has started */
package/dist/runtime.js CHANGED
@@ -1,29 +1,33 @@
1
1
  import {
2
2
  createWorkspaceUIContract
3
- } from "./chunk-VTK4TIXC.js";
3
+ } from "./chunk-KRJPRYEA.js";
4
+ import "./chunk-VWTKGIYF.js";
5
+ import "./chunk-6LMESVGT.js";
6
+ import "./chunk-T3ZKNUZ7.js";
4
7
  import {
5
8
  PluginRuntimeBoundary,
6
9
  createPluginRuntimeClient
7
- } from "./chunk-XV27IQHA.js";
8
- import "./chunk-44N3T2A5.js";
9
- import "./chunk-T3ZKNUZ7.js";
10
- import "./chunk-ZYONCTZ2.js";
11
- import "./chunk-UC2UXAC6.js";
10
+ } from "./chunk-N33CGX2F.js";
11
+ import "./chunk-DQS2EG5E.js";
12
+ import "./chunk-TXELBVTG.js";
13
+ import "./chunk-FL67RDID.js";
14
+ import "./chunk-LMHCGCA6.js";
12
15
  import {
13
16
  GameSkeleton
14
- } from "./chunk-2TRZSZGD.js";
17
+ } from "./chunk-VRRR6QZT.js";
15
18
  import "./chunk-VDXOF4FW.js";
16
19
  import "./chunk-WHR5UW3F.js";
20
+ import "./chunk-PF7L4BMG.js";
17
21
  import {
18
22
  DREAMBOARD_SDK_VERSION
19
- } from "./chunk-YGQTL63W.js";
20
- import "./chunk-VTNEWMWJ.js";
21
- import "./chunk-PF7L4BMG.js";
23
+ } from "./chunk-ZSTCUJKZ.js";
24
+ import "./chunk-KWHOFBDM.js";
22
25
  import {
23
26
  DREAMBOARD_PLUGIN_PROTOCOL,
24
27
  DREAMBOARD_PLUGIN_PROTOCOL_VERSION,
25
28
  HostToPluginEnvelopeSchema
26
- } from "./chunk-IYX5OO2K.js";
29
+ } from "./chunk-XFMSLL3P.js";
30
+ import "./chunk-2GQIALJL.js";
27
31
  import "./chunk-PZ5AY32C.js";
28
32
 
29
33
  // src/runtime/hooks/usePluginRuntime.ts
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/runtime/hooks/usePluginRuntime.ts","../src/runtime/browser/post-message-transport.ts","../src/runtime/components/PluginRuntime.tsx"],"sourcesContent":["import { useState, useEffect, useRef } from \"react\";\nimport { DREAMBOARD_SDK_VERSION } from \"../../package-set.js\";\nimport { createPostMessagePluginTransport } from \"../browser/post-message-transport.js\";\nimport { createPluginRuntimeClient } from \"../core/create-plugin-runtime-client.js\";\nimport type { PluginRuntimeClient } from \"../core/types.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\n\nconst BUNDLED_SDK_VERSION = DREAMBOARD_SDK_VERSION;\n\nexport interface UsePluginRuntimeOptions {\n /**\n * Timeout in milliseconds to wait for the first gameplay frame.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\nexport interface UsePluginRuntimeResult {\n /** The transport-agnostic plugin runtime client. */\n runtime: PluginRuntimeClient;\n /** Whether the initial reducer-native snapshot is available and ready */\n isReady: boolean;\n /**\n * True when the plugin was ready before but the current snapshot has no\n * projected view — e.g. you've acted and are waiting on the rest of the\n * table in a simultaneous phase. Lets the loading affordance read as a\n * mid-game wait rather than a cold \"still loading\" stall.\n */\n waiting: boolean;\n /** Error message if initialization failed */\n error: string | null;\n}\n\nfunction hasProjectedView(runtime: PluginRuntimeClient): boolean {\n const frame = runtime.getFrame();\n return (\n frame !== null && frame.view !== null && typeof frame.view !== \"undefined\"\n );\n}\n\n/**\n * Hook that creates and manages a PluginRuntimeClient instance.\n *\n * This hook handles:\n * 1. Creating the runtime client\n * 2. Waiting for the first gameplay frame before setting isReady\n *\n * In the new architecture, the host only renders the plugin when a reducer-native\n * snapshot is available, so isReady should become true quickly after init.\n *\n * @example\n * ```tsx\n * function PluginRuntime({ children }: { children: React.ReactNode }) {\n * const { runtime, isReady, error } = usePluginRuntime();\n *\n * if (error) {\n * return <div>Error: {error}</div>;\n * }\n *\n * if (!isReady) {\n * return <GameSkeleton message=\"Waiting for game state...\" />;\n * }\n *\n * return <RuntimeProvider runtime={runtime}>{children}</RuntimeProvider>;\n * }\n * ```\n */\nexport function usePluginRuntime(\n options: UsePluginRuntimeOptions = {},\n): UsePluginRuntimeResult {\n const { timeout = 10000, onDiagnostic } = options;\n const [error, setError] = useState<string | null>(null);\n\n // Create runtime once and keep stable reference\n const [runtime] = useState<PluginRuntimeClient>(() =>\n createPluginRuntimeClient({\n transport: createPostMessagePluginTransport({\n bundledSdkVersion: BUNDLED_SDK_VERSION,\n onInvalidMessage: (reason, value) => {\n const message =\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${BUNDLED_SDK_VERSION}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\";\n setError(message);\n onDiagnostic?.({\n type: \"runtimeLog\",\n level: \"warn\",\n message,\n details: [value],\n });\n },\n }),\n }),\n );\n const [isReady, setIsReady] = useState(() => hasProjectedView(runtime));\n // Latches once we've shown a view, so a later view-less snapshot reads as a\n // mid-game wait rather than a fresh load. (A ref, so it never re-triggers a\n // render on its own.)\n const hasBeenReadyRef = useRef(false);\n if (isReady) hasBeenReadyRef.current = true;\n\n useEffect(() => {\n void onDiagnostic;\n }, [onDiagnostic]);\n\n // Subscribe to gameplay frames and set isReady when the first projected view arrives.\n useEffect(() => {\n const markReadyFromFrame = () => {\n if (!hasProjectedView(runtime)) {\n return false;\n }\n setError(null);\n setIsReady(true);\n return true;\n };\n\n if (markReadyFromFrame()) {\n return;\n }\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n if (!markReadyFromFrame()) {\n setError(\n `Timed out waiting for the initial projected view after ${timeout}ms. ` +\n \"Ensure the host sends a gameplay frame with a seat view.\",\n );\n }\n }, timeout);\n\n // Fallback poll for dev/HMR flows where the runtime frame may already\n // exist but the first subscribe callback is missed.\n const pollId = setInterval(() => {\n if (markReadyFromFrame()) {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n }\n }, 100);\n\n const unsubscribe = runtime.subscribeFrame(() => {\n if (!hasProjectedView(runtime)) {\n setIsReady(false);\n return;\n }\n clearInterval(pollId);\n clearTimeout(timeoutId);\n setError(null);\n setIsReady(true);\n });\n\n return () => {\n clearInterval(pollId);\n clearTimeout(timeoutId);\n unsubscribe?.();\n };\n }, [runtime, timeout]);\n\n return {\n runtime,\n isReady,\n waiting: hasBeenReadyRef.current && !isReady,\n error,\n };\n}\n","import {\n DREAMBOARD_PLUGIN_PROTOCOL,\n DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n HostToPluginEnvelopeSchema,\n type HostToPluginEnvelope,\n type PluginToHostPayload,\n} from \"@dreamboard-games/plugin-runtime-contract\";\nimport type { PluginTransport } from \"../core/types.js\";\n\nexport interface PostMessagePluginTransportOptions {\n readonly targetWindow?: Window;\n readonly parentWindow?: Window;\n readonly bundledSdkVersion?: string;\n readonly onInvalidMessage?: (reason: string, value: unknown) => void;\n}\n\nexport function createPostMessagePluginTransport(\n options: PostMessagePluginTransportOptions = {},\n): PluginTransport {\n const targetWindow = options.targetWindow ?? window;\n const parentWindow = options.parentWindow ?? targetWindow.parent;\n const bundledSdkVersion = options.bundledSdkVersion?.trim() || \"unknown\";\n let channel: {\n readonly channelId: string;\n readonly hostOrigin: string;\n readonly hostWindow: Window;\n } | null = null;\n let outboundSequence = 0;\n let invalidEnvelopeReported = false;\n\n const reportInvalidEnvelope = (reason: string, value: unknown) => {\n options.onInvalidMessage?.(reason, value);\n\n if (!channel || invalidEnvelopeReported) {\n return;\n }\n\n invalidEnvelopeReported = true;\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload: {\n type: \"runtime.error\",\n code: \"host-runtime-protocol-mismatch\",\n message:\n `Plugin runtime rejected a host message (${reason}). ` +\n `Bundled @dreamboard-games/sdk version: ${bundledSdkVersion}. ` +\n \"The host and plugin bundle may have incompatible SDK/runtime contract versions.\",\n },\n },\n channel.hostOrigin,\n );\n };\n\n return {\n start(onMessage) {\n const handleMessage = (event: MessageEvent) => {\n if (event.source !== parentWindow) {\n return;\n }\n const parseResult = HostToPluginEnvelopeSchema.safeParse(event.data);\n if (!parseResult.success) {\n reportInvalidEnvelope(\"invalid-envelope\", event.data);\n return;\n }\n const envelope = parseResult.data;\n if (!channel) {\n if (envelope.payload.type !== \"runtime.init\") {\n return;\n }\n channel = {\n channelId: envelope.channelId,\n hostOrigin: event.origin,\n hostWindow: event.source as Window,\n };\n }\n if (\n envelope.channelId !== channel.channelId ||\n event.origin !== channel.hostOrigin ||\n event.source !== channel.hostWindow\n ) {\n reportInvalidEnvelope(\"channel-mismatch\", event.data);\n return;\n }\n onMessage(envelope as HostToPluginEnvelope);\n };\n\n targetWindow.addEventListener(\"message\", handleMessage);\n return () => {\n targetWindow.removeEventListener(\"message\", handleMessage);\n channel = null;\n };\n },\n send(payload: PluginToHostPayload) {\n if (!channel) {\n throw new Error(\"Plugin transport is not initialized.\");\n }\n channel.hostWindow.postMessage(\n {\n protocol: DREAMBOARD_PLUGIN_PROTOCOL,\n version: DREAMBOARD_PLUGIN_PROTOCOL_VERSION,\n channelId: channel.channelId,\n sequence: ++outboundSequence,\n payload,\n },\n channel.hostOrigin,\n );\n },\n };\n}\n","import React from \"react\";\nimport { usePluginRuntime } from \"../hooks/usePluginRuntime.js\";\nimport { GameSkeleton } from \"../../ui.js\";\nimport type { RuntimeDiagnosticHandler } from \"../types/runtime-api.js\";\nimport { PluginRuntimeBoundary } from \"./PluginRuntimeBoundary.js\";\n\nexport interface PluginRuntimeProps {\n /** Child components to render after gameplay frame has started */\n children: React.ReactNode;\n /**\n * Timeout in milliseconds to wait for the first gameplay-frame snapshot.\n * @default 10000 (10 seconds)\n */\n timeout?: number;\n /** Custom loading component to show while waiting for gameplay frame */\n loadingComponent?: React.ReactNode;\n /** Custom error component to show when initialization fails */\n errorComponent?: (error: string) => React.ReactNode;\n onDiagnostic?: RuntimeDiagnosticHandler;\n}\n\n/**\n * PluginRuntime provides the RuntimeContext for plugin components.\n *\n * This component:\n * - Creates a transport-backed runtime client\n * - Waits for the first projected gameplay frame before rendering children\n * - Provides runtime commands plus session/frame state to all child components\n *\n * @example\n * ```tsx\n * // In your plugin's index.tsx\n * import { PluginRuntime } from \"./components/dreamboard\";\n * import App from './App';\n *\n * ReactDOM.createRoot(document.getElementById('root')!).render(\n * <PluginRuntime>\n * <App />\n * </PluginRuntime>\n * );\n * ```\n */\nexport function PluginRuntime({\n children,\n timeout = 10000,\n loadingComponent,\n errorComponent,\n onDiagnostic,\n}: PluginRuntimeProps) {\n const { runtime, isReady, waiting, error } = usePluginRuntime({\n timeout,\n onDiagnostic,\n });\n\n if (error) {\n if (errorComponent) {\n return <>{errorComponent(error)}</>;\n }\n return (\n <div className=\"flex h-full w-full items-center justify-center bg-gray-50\">\n <div className=\"text-center p-6\">\n <p className=\"text-red-600 font-medium mb-2\">Failed to load game</p>\n <p className=\"text-gray-600 text-sm\">{error}</p>\n </div>\n </div>\n );\n }\n\n if (!isReady) {\n if (loadingComponent) {\n return <>{loadingComponent}</>;\n }\n // Once the game has rendered, a view-less snapshot is a mid-game wait (you\n // acted and are waiting on the table), not a cold load — say so rather than\n // reading as a stalled \"Waiting for game state\".\n return (\n <GameSkeleton\n message={\n waiting\n ? \"Waiting for the other players…\"\n : \"Waiting for game state...\"\n }\n />\n );\n }\n\n return (\n <PluginRuntimeBoundary runtime={runtime}>{children}</PluginRuntimeBoundary>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,WAAW,cAAc;;;ACgBrC,SAAS,iCACd,UAA6C,CAAC,GAC7B;AACjB,QAA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AC,SAAI,WAAU,6DACb,+BAAC,SAAI,WAAU,mBACb;AAAA,0BAAC,OAAE,WAAU,iCAAgC,iCAAmB;AAAA,MAChE,oBAAC,OAAE,WAAU,yBAAyB,iBAAM;AAAA,OAC9C,GACF;AAAA,EAEJ;AAEA,MAAI,CAAC,SAAS;AACZ,QAAI,kBAAkB;AACpB,aAAO,gCAAG,4BAAiB;AAAA,IAC7B;AAIA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SACE,UACI,wCACA;AAAA;AAAA,IAER;AAAA,EAEJ;AAEA,SACE,oBAAC,yBAAsB,SAAmB,UAAS;AAEvD;","names":[]}
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,QAAgB,UAAmB;AAChE,YAAQ,mBAAmB,QAAQ,KAAK;AAExC,QAAI,CAAC,WAAW,yBAAyB;AACvC;AAAA,IACF;AAEA,8BAA0B;AAC1B,YAAQ,WAAW;AAAA,MACjB;AAAA,QACE,UAAU;AAAA,QACV,SAAS;AAAA,QACT,WAAW,QAAQ;AAAA,QACnB,UAAU,EAAE;AAAA,QACZ,SAAS;AAAA,UACP,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SACE,2CAA2C,MAAM,6CACP,iBAAiB;AAAA,QAE/D;AAAA,MACF;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM,WAAW;AACf,YAAM,gBAAgB,CAAC,UAAwB;AAC7C,YAAI,MAAM,WAAW,cAAc;AACjC;AAAA,QACF;AACA,cAAM,cAAc,2BAA2B,UAAU,MAAM,IAAI;AACnE,YAAI,CAAC,YAAY,SAAS;AACxB,gCAAsB,oBAAoB,MAAM,IAAI;AACpD;AAAA,QACF;AACA,cAAM,WAAW,YAAY;AAC7B,YAAI,CAAC,SAAS;AACZ,cAAI,SAAS,QAAQ,SAAS,gBAAgB;AAC5C;AAAA,UACF;AACA,oBAAU;AAAA,YACR,WAAW,SAAS;AA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;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AACF,GAAuB;AACrB,QAAM,EAAE,SAAS,SAAS,SAAS,MAAM,IAAI,iBAAiB;AAAA,IAC5D;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,OAAO;AACT,QAAI,gBAAgB;AAClB,aAAO,gCAAG,yBAAe,KAAK,GAAE;AAAA,IAClC;AACA,WACE,oBAAC,SAAI,WAAU,6DACb,+BAAC,SAAI,WAAU,mBACb;AAAA,0BAAC,OAAE,WAAU,iCAAgC,iCAAmB;AAAA,MAChE,oBAAC,OAAE,WAAU,yBAAyB,iBAAM;AAAA,OAC9C,GACF;AAAA,EAEJ;AAEA,MAAI,CAAC,SAAS;AACZ,QAAI,kBAAkB;AACpB,aAAO,gCAAG,4BAAiB;AAAA,IAC7B;AAIA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SACE,UACI,wCACA;AAAA;AAAA,IAER;AAAA,EAEJ;AAEA,SACE,oBAAC,yBAAsB,SAAmB,UAAS;AAEvD;","names":[]}
@@ -0,0 +1,405 @@
1
+ import { z } from 'zod';
2
+ import { N as RuntimeJson, x as PluginProtocolEnvelope, f as HostToPluginPayload, o as InteractionDescriptor, v as PluginGameplayFrame, B as PluginProtocolTape, Z as ZoneHandlesSnapshot, E as PluginSessionDescriptor, J as PluginToHostPayload } from './protocol-CVaSqPgX.js';
3
+
4
+ declare const RuntimeJsonSchema: z.ZodType<RuntimeJson>;
5
+ declare const BoardStaticProjectionSchema: z.ZodObject<{
6
+ view: z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>;
7
+ hash: z.ZodOptional<z.ZodString>;
8
+ manifestVersion: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strict>;
10
+ declare const SetupGuidanceStepSchema: z.ZodObject<{
11
+ id: z.ZodString;
12
+ label: z.ZodString;
13
+ description: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strict>;
15
+ declare const GameGuidanceProjectionSchema: z.ZodObject<{
16
+ phase: z.ZodObject<{
17
+ id: z.ZodString;
18
+ label: z.ZodString;
19
+ summary: z.ZodOptional<z.ZodString>;
20
+ objective: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strict>;
22
+ setup: z.ZodOptional<z.ZodObject<{
23
+ profileId: z.ZodString;
24
+ name: z.ZodString;
25
+ summary: z.ZodOptional<z.ZodString>;
26
+ steps: z.ZodArray<z.ZodObject<{
27
+ id: z.ZodString;
28
+ label: z.ZodString;
29
+ description: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strict>>;
31
+ }, z.core.$strict>>;
32
+ }, z.core.$strict>;
33
+ declare const GameEventDetailSchema: z.ZodObject<{
34
+ label: z.ZodString;
35
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
36
+ }, z.core.$strict>;
37
+ declare const SystemActionEventSchema: z.ZodObject<{
38
+ kind: z.ZodLiteral<"systemAction">;
39
+ procedureId: z.ZodString;
40
+ title: z.ZodString;
41
+ summary: z.ZodOptional<z.ZodString>;
42
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
43
+ label: z.ZodString;
44
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
45
+ }, z.core.$strict>>>;
46
+ }, z.core.$strict>;
47
+ declare const GameEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
48
+ kind: z.ZodLiteral<"systemAction">;
49
+ procedureId: z.ZodString;
50
+ title: z.ZodString;
51
+ summary: z.ZodOptional<z.ZodString>;
52
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
53
+ label: z.ZodString;
54
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
55
+ }, z.core.$strict>>>;
56
+ }, z.core.$strict>], "kind">;
57
+ declare const ProjectedGameEventSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
58
+ kind: z.ZodLiteral<"systemAction">;
59
+ procedureId: z.ZodString;
60
+ title: z.ZodString;
61
+ summary: z.ZodOptional<z.ZodString>;
62
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
63
+ label: z.ZodString;
64
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
65
+ }, z.core.$strict>>>;
66
+ }, z.core.$strict>], "kind">, z.ZodObject<{
67
+ version: z.ZodNumber;
68
+ index: z.ZodNumber;
69
+ }, z.core.$strict>>;
70
+ declare const SeatProjectionBundleSchema: z.ZodObject<{
71
+ currentStage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ stageSeats: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
+ simultaneousPhase: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
74
+ schedulerFlow: z.ZodOptional<z.ZodObject<{
75
+ version: z.ZodLiteral<1>;
76
+ activePlayerIds: z.ZodArray<z.ZodString>;
77
+ pendingPlayerIds: z.ZodArray<z.ZodString>;
78
+ continuationDependencies: z.ZodArray<z.ZodObject<{
79
+ waiterPlayerId: z.ZodString;
80
+ blockerPlayerIds: z.ZodArray<z.ZodString>;
81
+ }, z.core.$strict>>;
82
+ }, z.core.$strict>>;
83
+ guidance: z.ZodOptional<z.ZodNullable<z.ZodObject<{
84
+ phase: z.ZodObject<{
85
+ id: z.ZodString;
86
+ label: z.ZodString;
87
+ summary: z.ZodOptional<z.ZodString>;
88
+ objective: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strict>;
90
+ setup: z.ZodOptional<z.ZodObject<{
91
+ profileId: z.ZodString;
92
+ name: z.ZodString;
93
+ summary: z.ZodOptional<z.ZodString>;
94
+ steps: z.ZodArray<z.ZodObject<{
95
+ id: z.ZodString;
96
+ label: z.ZodString;
97
+ description: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>>;
99
+ }, z.core.$strict>>;
100
+ }, z.core.$strict>>>;
101
+ recentEvents: z.ZodOptional<z.ZodArray<z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
102
+ kind: z.ZodLiteral<"systemAction">;
103
+ procedureId: z.ZodString;
104
+ title: z.ZodString;
105
+ summary: z.ZodOptional<z.ZodString>;
106
+ details: z.ZodOptional<z.ZodArray<z.ZodObject<{
107
+ label: z.ZodString;
108
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
109
+ }, z.core.$strict>>>;
110
+ }, z.core.$strict>], "kind">, z.ZodObject<{
111
+ version: z.ZodNumber;
112
+ index: z.ZodNumber;
113
+ }, z.core.$strict>>>>;
114
+ sharedView: z.ZodOptional<z.ZodUnknown>;
115
+ interactionsByRef: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
116
+ seats: z.ZodRecord<z.ZodString, z.ZodObject<{
117
+ view: z.ZodOptional<z.ZodUnknown>;
118
+ availableInteractionRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
+ zones: z.ZodOptional<z.ZodUnknown>;
120
+ }, z.core.$strict>>;
121
+ }, z.core.$strict>;
122
+ declare const PlayerIdSchema: z.ZodString;
123
+ declare const PluginPlayerSummarySchema: z.ZodObject<{
124
+ playerId: z.ZodString;
125
+ displayName: z.ZodString;
126
+ color: z.ZodOptional<z.ZodString>;
127
+ }, z.core.$strict>;
128
+ declare const PluginSessionDescriptorSchema: z.ZodObject<{
129
+ sessionId: z.ZodString;
130
+ players: z.ZodArray<z.ZodObject<{
131
+ playerId: z.ZodString;
132
+ displayName: z.ZodString;
133
+ color: z.ZodOptional<z.ZodString>;
134
+ }, z.core.$strict>>;
135
+ }, z.core.$strict>;
136
+ declare const InteractionCommitPolicySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
137
+ mode: z.ZodLiteral<"manual">;
138
+ }, z.core.$strict>, z.ZodObject<{
139
+ mode: z.ZodLiteral<"autoWhenReady">;
140
+ }, z.core.$strict>], "mode">;
141
+ declare const InputSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
142
+ mode: z.ZodLiteral<"single">;
143
+ }, z.core.$strict>, z.ZodObject<{
144
+ mode: z.ZodLiteral<"many">;
145
+ min: z.ZodNumber;
146
+ max: z.ZodOptional<z.ZodNumber>;
147
+ distinct: z.ZodOptional<z.ZodBoolean>;
148
+ }, z.core.$strict>], "mode">;
149
+ declare const InputDomainDependenciesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
150
+ mode: z.ZodLiteral<"eager">;
151
+ dependentCases: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
152
+ }, z.core.$strict>, z.ZodObject<{
153
+ mode: z.ZodLiteral<"lazy">;
154
+ dependsOn: z.ZodArray<z.ZodString>;
155
+ resolver: z.ZodObject<{
156
+ interactionKey: z.ZodOptional<z.ZodString>;
157
+ inputKey: z.ZodString;
158
+ }, z.core.$strict>;
159
+ }, z.core.$strict>], "mode">;
160
+ declare const InputDomainSchema: z.ZodObject<{
161
+ type: z.ZodString;
162
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
163
+ mode: z.ZodLiteral<"single">;
164
+ }, z.core.$strict>, z.ZodObject<{
165
+ mode: z.ZodLiteral<"many">;
166
+ min: z.ZodNumber;
167
+ max: z.ZodOptional<z.ZodNumber>;
168
+ distinct: z.ZodOptional<z.ZodBoolean>;
169
+ }, z.core.$strict>], "mode">>;
170
+ dependencies: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
171
+ mode: z.ZodLiteral<"eager">;
172
+ dependentCases: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
173
+ }, z.core.$strict>, z.ZodObject<{
174
+ mode: z.ZodLiteral<"lazy">;
175
+ dependsOn: z.ZodArray<z.ZodString>;
176
+ resolver: z.ZodObject<{
177
+ interactionKey: z.ZodOptional<z.ZodString>;
178
+ inputKey: z.ZodString;
179
+ }, z.core.$strict>;
180
+ }, z.core.$strict>], "mode">>;
181
+ }, z.core.$catchall<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>;
182
+ declare const InteractionChoiceOptionSchema: z.ZodObject<{
183
+ value: z.ZodNullable<z.ZodString>;
184
+ label: z.ZodString;
185
+ icon: z.ZodOptional<z.ZodString>;
186
+ badge: z.ZodOptional<z.ZodString>;
187
+ description: z.ZodOptional<z.ZodString>;
188
+ disabled: z.ZodOptional<z.ZodBoolean>;
189
+ disabledReason: z.ZodOptional<z.ZodString>;
190
+ }, z.core.$strict>;
191
+ declare const InteractionInputDescriptorSchema: z.ZodObject<{
192
+ key: z.ZodString;
193
+ kind: z.ZodString;
194
+ domain: z.ZodObject<{
195
+ type: z.ZodString;
196
+ selection: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
197
+ mode: z.ZodLiteral<"single">;
198
+ }, z.core.$strict>, z.ZodObject<{
199
+ mode: z.ZodLiteral<"many">;
200
+ min: z.ZodNumber;
201
+ max: z.ZodOptional<z.ZodNumber>;
202
+ distinct: z.ZodOptional<z.ZodBoolean>;
203
+ }, z.core.$strict>], "mode">>;
204
+ dependencies: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
205
+ mode: z.ZodLiteral<"eager">;
206
+ dependentCases: z.ZodArray<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
207
+ }, z.core.$strict>, z.ZodObject<{
208
+ mode: z.ZodLiteral<"lazy">;
209
+ dependsOn: z.ZodArray<z.ZodString>;
210
+ resolver: z.ZodObject<{
211
+ interactionKey: z.ZodOptional<z.ZodString>;
212
+ inputKey: z.ZodString;
213
+ }, z.core.$strict>;
214
+ }, z.core.$strict>], "mode">>;
215
+ }, z.core.$catchall<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>;
216
+ defaultValue: z.ZodOptional<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>;
217
+ }, z.core.$strict>;
218
+ declare const InteractionAvailabilitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
219
+ status: z.ZodLiteral<"available">;
220
+ }, z.core.$strict>, z.ZodObject<{
221
+ status: z.ZodLiteral<"notYourTurn">;
222
+ reason: z.ZodString;
223
+ }, z.core.$strict>, z.ZodObject<{
224
+ status: z.ZodLiteral<"insufficientResources">;
225
+ reason: z.ZodString;
226
+ missingResources: z.ZodRecord<z.ZodString, z.ZodNumber>;
227
+ }, z.core.$strict>, z.ZodObject<{
228
+ status: z.ZodLiteral<"blocked">;
229
+ reason: z.ZodString;
230
+ code: z.ZodOptional<z.ZodString>;
231
+ }, z.core.$strict>], "status">;
232
+ declare const InteractionContextSchema: z.ZodObject<{
233
+ to: z.ZodString;
234
+ title: z.ZodOptional<z.ZodString>;
235
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>;
236
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
237
+ id: z.ZodString;
238
+ label: z.ZodOptional<z.ZodString>;
239
+ }, z.core.$strict>>>;
240
+ }, z.core.$strict>;
241
+ declare const InteractionDescriptorSchema: z.ZodType<InteractionDescriptor>;
242
+ declare const ZoneHandlesSnapshotSchema: z.ZodType<ZoneHandlesSnapshot>;
243
+ declare const SimultaneousPhaseSnapshotSchema: z.ZodObject<{
244
+ phaseName: z.ZodString;
245
+ interactionId: z.ZodString;
246
+ actorIds: z.ZodArray<z.ZodString>;
247
+ sealedPlayerIds: z.ZodArray<z.ZodString>;
248
+ pendingPlayerIds: z.ZodArray<z.ZodString>;
249
+ }, z.core.$strict>;
250
+ declare const GameplayBasisSchema: z.ZodObject<{
251
+ version: z.ZodNumber;
252
+ actionSetVersion: z.ZodString;
253
+ perspectivePlayerId: z.ZodString;
254
+ }, z.core.$strict>;
255
+ declare const GameOutcomeSchema: z.ZodObject<{
256
+ reason: z.ZodObject<{
257
+ code: z.ZodString;
258
+ message: z.ZodOptional<z.ZodString>;
259
+ }, z.core.$strict>;
260
+ standings: z.ZodArray<z.ZodObject<{
261
+ playerId: z.ZodString;
262
+ rank: z.ZodNumber;
263
+ result: z.ZodEnum<{
264
+ win: "win";
265
+ draw: "draw";
266
+ loss: "loss";
267
+ eliminated: "eliminated";
268
+ }>;
269
+ score: z.ZodOptional<z.ZodNumber>;
270
+ scoreBreakdown: z.ZodOptional<z.ZodArray<z.ZodObject<{
271
+ id: z.ZodString;
272
+ label: z.ZodString;
273
+ value: z.ZodNumber;
274
+ }, z.core.$strict>>>;
275
+ tieBreaks: z.ZodOptional<z.ZodArray<z.ZodObject<{
276
+ id: z.ZodString;
277
+ label: z.ZodString;
278
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
279
+ }, z.core.$strict>>>;
280
+ }, z.core.$strict>>;
281
+ }, z.core.$strict>;
282
+ declare const PluginGameplayFrameSchema: z.ZodType<PluginGameplayFrame>;
283
+ declare const InteractionResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
284
+ type: z.ZodLiteral<"interaction.result">;
285
+ clientActionId: z.ZodString;
286
+ accepted: z.ZodLiteral<true>;
287
+ }, z.core.$strict>, z.ZodObject<{
288
+ type: z.ZodLiteral<"interaction.result">;
289
+ clientActionId: z.ZodString;
290
+ accepted: z.ZodLiteral<false>;
291
+ errorCode: z.ZodString;
292
+ message: z.ZodOptional<z.ZodString>;
293
+ }, z.core.$strict>], "accepted">;
294
+ declare const SubmitInteractionCommandSchema: z.ZodObject<{
295
+ type: z.ZodLiteral<"interaction.submit">;
296
+ clientActionId: z.ZodString;
297
+ basis: z.ZodObject<{
298
+ version: z.ZodNumber;
299
+ actionSetVersion: z.ZodString;
300
+ perspectivePlayerId: z.ZodString;
301
+ }, z.core.$strict>;
302
+ interactionId: z.ZodString;
303
+ params: z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>;
304
+ }, z.core.$strict>;
305
+ declare const HostToPluginPayloadSchema: z.ZodType<HostToPluginPayload>;
306
+ declare const PluginToHostPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
307
+ type: z.ZodLiteral<"runtime.ready">;
308
+ }, z.core.$strict>, z.ZodObject<{
309
+ type: z.ZodLiteral<"runtime.ack">;
310
+ sequence: z.ZodNumber;
311
+ clientReceivedAtMs: z.ZodOptional<z.ZodNumber>;
312
+ clientRenderedAtMs: z.ZodOptional<z.ZodNumber>;
313
+ }, z.core.$strict>, z.ZodObject<{
314
+ type: z.ZodLiteral<"interaction.submit">;
315
+ clientActionId: z.ZodString;
316
+ basis: z.ZodObject<{
317
+ version: z.ZodNumber;
318
+ actionSetVersion: z.ZodString;
319
+ perspectivePlayerId: z.ZodString;
320
+ }, z.core.$strict>;
321
+ interactionId: z.ZodString;
322
+ params: z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>;
323
+ }, z.core.$strict>, z.ZodObject<{
324
+ type: z.ZodLiteral<"runtime.error">;
325
+ message: z.ZodString;
326
+ code: z.ZodOptional<z.ZodString>;
327
+ }, z.core.$strict>], "type">;
328
+ declare function createPluginProtocolEnvelopeSchema<Payload>(payloadSchema: z.ZodType<Payload>): z.ZodType<PluginProtocolEnvelope<Payload>>;
329
+ declare const HostToPluginEnvelopeSchema: z.ZodType<PluginProtocolEnvelope<HostToPluginPayload>, unknown, z.core.$ZodTypeInternals<PluginProtocolEnvelope<HostToPluginPayload>, unknown>>;
330
+ declare const PluginToHostEnvelopeSchema: z.ZodType<PluginProtocolEnvelope<{
331
+ type: "runtime.ready";
332
+ } | {
333
+ type: "runtime.ack";
334
+ sequence: number;
335
+ clientReceivedAtMs?: number | undefined;
336
+ clientRenderedAtMs?: number | undefined;
337
+ } | {
338
+ type: "interaction.submit";
339
+ clientActionId: string;
340
+ basis: {
341
+ version: number;
342
+ actionSetVersion: string;
343
+ perspectivePlayerId: string;
344
+ };
345
+ interactionId: string;
346
+ params: RuntimeJson;
347
+ } | {
348
+ type: "runtime.error";
349
+ message: string;
350
+ code?: string | undefined;
351
+ }>, unknown, z.core.$ZodTypeInternals<PluginProtocolEnvelope<{
352
+ type: "runtime.ready";
353
+ } | {
354
+ type: "runtime.ack";
355
+ sequence: number;
356
+ clientReceivedAtMs?: number | undefined;
357
+ clientRenderedAtMs?: number | undefined;
358
+ } | {
359
+ type: "interaction.submit";
360
+ clientActionId: string;
361
+ basis: {
362
+ version: number;
363
+ actionSetVersion: string;
364
+ perspectivePlayerId: string;
365
+ };
366
+ interactionId: string;
367
+ params: RuntimeJson;
368
+ } | {
369
+ type: "runtime.error";
370
+ message: string;
371
+ code?: string | undefined;
372
+ }>, unknown>>;
373
+ declare const PluginProtocolFrameSchema: z.ZodObject<{
374
+ id: z.ZodString;
375
+ frame: z.ZodType<PluginGameplayFrame<unknown, string, string, string>, unknown, z.core.$ZodTypeInternals<PluginGameplayFrame<unknown, string, string, string>, unknown>>;
376
+ projectionDigest: z.ZodString;
377
+ }, z.core.$strict>;
378
+ declare const PluginProtocolStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
379
+ id: z.ZodString;
380
+ kind: z.ZodLiteral<"host.frame">;
381
+ frameId: z.ZodString;
382
+ }, z.core.$strict>, z.ZodObject<{
383
+ id: z.ZodString;
384
+ kind: z.ZodLiteral<"client.submit">;
385
+ fromFrameId: z.ZodString;
386
+ requestDigest: z.ZodString;
387
+ response: z.ZodDiscriminatedUnion<[z.ZodObject<{
388
+ type: z.ZodLiteral<"interaction.result">;
389
+ clientActionId: z.ZodString;
390
+ accepted: z.ZodLiteral<true>;
391
+ }, z.core.$strict>, z.ZodObject<{
392
+ type: z.ZodLiteral<"interaction.result">;
393
+ clientActionId: z.ZodString;
394
+ accepted: z.ZodLiteral<false>;
395
+ errorCode: z.ZodString;
396
+ message: z.ZodOptional<z.ZodString>;
397
+ }, z.core.$strict>], "accepted">;
398
+ }, z.core.$strict>], "kind">;
399
+ declare const PluginProtocolTapeSchema: z.ZodType<PluginProtocolTape>;
400
+ declare function parsePluginSessionDescriptor(value: unknown): PluginSessionDescriptor;
401
+ declare function parsePluginGameplayFrame(value: unknown): PluginGameplayFrame;
402
+ declare function parseHostToPluginEnvelope(value: unknown): PluginProtocolEnvelope<HostToPluginPayload>;
403
+ declare function parsePluginToHostEnvelope(value: unknown): PluginProtocolEnvelope<PluginToHostPayload>;
404
+
405
+ export { BoardStaticProjectionSchema, GameEventDetailSchema, GameEventSchema, GameGuidanceProjectionSchema, GameOutcomeSchema, GameplayBasisSchema, HostToPluginEnvelopeSchema, HostToPluginPayloadSchema, InputDomainDependenciesSchema, InputDomainSchema, InputSelectionSchema, InteractionAvailabilitySchema, InteractionChoiceOptionSchema, InteractionCommitPolicySchema, InteractionContextSchema, InteractionDescriptorSchema, InteractionInputDescriptorSchema, InteractionResultSchema, PlayerIdSchema, PluginGameplayFrameSchema, PluginPlayerSummarySchema, PluginProtocolFrameSchema, PluginProtocolStepSchema, PluginProtocolTapeSchema, PluginSessionDescriptorSchema, PluginToHostEnvelopeSchema, PluginToHostPayloadSchema, ProjectedGameEventSchema, RuntimeJsonSchema, SeatProjectionBundleSchema, SetupGuidanceStepSchema, SimultaneousPhaseSnapshotSchema, SubmitInteractionCommandSchema, SystemActionEventSchema, ZoneHandlesSnapshotSchema, createPluginProtocolEnvelopeSchema, parseHostToPluginEnvelope, parsePluginGameplayFrame, parsePluginSessionDescriptor, parsePluginToHostEnvelope };
@@ -1,4 +1,4 @@
1
- type StaleContractArtifactKind = "base-states" | "session-state";
1
+ type StaleContractArtifactKind = "session-state";
2
2
  type StaleContractArtifactErrorOptions = {
3
3
  artifact: StaleContractArtifactKind;
4
4
  expected: string;
@@ -0,0 +1,37 @@
1
+ import { j as ScenarioCheckpointSelector, o as ScenarioDefinitionGameLike, x as ScenarioReplayDefinition, h as ScenarioCheckpoint } from './definitions-bZSBaPjj.js';
2
+ import 'zod';
3
+ import './views-D2Cfzr3h.js';
4
+ import './runtime-C7Z2acNU.js';
5
+ import './types.js';
6
+ import './protocol-CVaSqPgX.js';
7
+ import './diagnostics-DIi3ina7.js';
8
+
9
+ type CompiledScenarioReplay<Game extends ScenarioDefinitionGameLike = ScenarioDefinitionGameLike> = {
10
+ readonly schemaVersion: 1;
11
+ readonly scenario: {
12
+ readonly path: string;
13
+ /** Covers the local game/scenario module graph, including assertions. */
14
+ readonly sourceDigest: `sha256:${string}`;
15
+ };
16
+ /** Canonical serializable scenario projection; never contains `then`. */
17
+ readonly definition: ScenarioReplayDefinition<Game>;
18
+ readonly checkpoint: ScenarioCheckpoint;
19
+ readonly expected: {
20
+ readonly checkpointDigest: `sha256:${string}`;
21
+ readonly publicProjectionDigest: `sha256:${string}`;
22
+ };
23
+ };
24
+ type CompileScenarioReplayOptions = {
25
+ readonly scenarioPath: string;
26
+ readonly at?: ScenarioCheckpointSelector;
27
+ };
28
+ /**
29
+ * Compile one authored scenario into the trusted, serializable replay DTO used
30
+ * by dev-host, Workbench, demo, and performance adapters.
31
+ *
32
+ * The DTO may contain sealed/private command parameters. It must never cross a
33
+ * player, spectator, browser, or ordinary-log boundary.
34
+ */
35
+ declare function compileScenarioReplay(options: CompileScenarioReplayOptions): Promise<CompiledScenarioReplay>;
36
+
37
+ export { type CompileScenarioReplayOptions, type CompiledScenarioReplay, compileScenarioReplay };