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

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 (150) hide show
  1. package/README.md +462 -53
  2. package/dist/board-element-CqtxU5VZ.d.ts +13 -0
  3. package/dist/chunk-CZRPUWCT.js +1602 -0
  4. package/dist/chunk-CZRPUWCT.js.map +1 -0
  5. package/dist/chunk-DMSXVMYY.js +7199 -0
  6. package/dist/chunk-DMSXVMYY.js.map +1 -0
  7. package/dist/chunk-HVNA4RAM.js +1792 -0
  8. package/dist/chunk-HVNA4RAM.js.map +1 -0
  9. package/dist/chunk-U6R7FAH4.js +630 -0
  10. package/dist/chunk-U6R7FAH4.js.map +1 -0
  11. package/dist/chunk-YT3RPO5J.js +635 -0
  12. package/dist/chunk-YT3RPO5J.js.map +1 -0
  13. package/dist/diagnostics-ZAPEBlJP.d.ts +64 -0
  14. package/dist/extract-CwJWDrSD.d.ts +6850 -0
  15. package/dist/index.d.ts +5177 -1
  16. package/dist/index.js +1990 -6
  17. package/dist/index.js.map +1 -1
  18. package/dist/react.d.ts +158 -0
  19. package/dist/react.js +1119 -0
  20. package/dist/react.js.map +1 -0
  21. package/dist/reducer.d.ts +1028 -97
  22. package/dist/reducer.js +4892 -125
  23. package/dist/reducer.js.map +1 -1
  24. package/dist/shortcuts-B_RrufOM.d.ts +822 -0
  25. package/dist/testing.d.ts +529 -569
  26. package/dist/testing.js +2588 -934
  27. package/dist/testing.js.map +1 -1
  28. package/dist/types-BxXRINRF.d.ts +118 -0
  29. package/package.json +39 -144
  30. package/dist/HandView-Bi2lxzQP.d.ts +0 -79
  31. package/dist/ResourceCounter-BFxJknqp.d.ts +0 -98
  32. package/dist/ThemeProvider-CElaL2ik.d.ts +0 -99
  33. package/dist/attributes-DbvyMbXw.d.ts +0 -68
  34. package/dist/browser-interaction.d.ts +0 -910
  35. package/dist/browser-interaction.js +0 -119
  36. package/dist/browser-interaction.js.map +0 -1
  37. package/dist/chunk-32PFKDV7.js +0 -11705
  38. package/dist/chunk-32PFKDV7.js.map +0 -1
  39. package/dist/chunk-3BAD4VC2.js +0 -263
  40. package/dist/chunk-3BAD4VC2.js.map +0 -1
  41. package/dist/chunk-3SKDNDPG.js +0 -104
  42. package/dist/chunk-3SKDNDPG.js.map +0 -1
  43. package/dist/chunk-5YV2WHJ4.js +0 -25
  44. package/dist/chunk-5YV2WHJ4.js.map +0 -1
  45. package/dist/chunk-ANRB4XKA.js +0 -90
  46. package/dist/chunk-ANRB4XKA.js.map +0 -1
  47. package/dist/chunk-BI4G3PM2.js +0 -1864
  48. package/dist/chunk-BI4G3PM2.js.map +0 -1
  49. package/dist/chunk-EVCLTY4Q.js +0 -935
  50. package/dist/chunk-EVCLTY4Q.js.map +0 -1
  51. package/dist/chunk-GDPKTBUR.js +0 -564
  52. package/dist/chunk-GDPKTBUR.js.map +0 -1
  53. package/dist/chunk-H6VDGFL5.js +0 -2903
  54. package/dist/chunk-H6VDGFL5.js.map +0 -1
  55. package/dist/chunk-LR3ZTWQF.js +0 -5960
  56. package/dist/chunk-LR3ZTWQF.js.map +0 -1
  57. package/dist/chunk-PF7L4BMG.js +0 -117
  58. package/dist/chunk-PF7L4BMG.js.map +0 -1
  59. package/dist/chunk-PN5O6GG2.js +0 -32
  60. package/dist/chunk-PN5O6GG2.js.map +0 -1
  61. package/dist/chunk-PZ5AY32C.js +0 -10
  62. package/dist/chunk-PZ5AY32C.js.map +0 -1
  63. package/dist/chunk-S2JEDVWH.js +0 -7165
  64. package/dist/chunk-S2JEDVWH.js.map +0 -1
  65. package/dist/chunk-T3ZKNUZ7.js +0 -1
  66. package/dist/chunk-T3ZKNUZ7.js.map +0 -1
  67. package/dist/chunk-UGH54WZ2.js +0 -223
  68. package/dist/chunk-UGH54WZ2.js.map +0 -1
  69. package/dist/chunk-VCDWP5VL.js +0 -746
  70. package/dist/chunk-VCDWP5VL.js.map +0 -1
  71. package/dist/chunk-VDXOF4FW.js +0 -69
  72. package/dist/chunk-VDXOF4FW.js.map +0 -1
  73. package/dist/chunk-WHR5UW3F.js +0 -1988
  74. package/dist/chunk-WHR5UW3F.js.map +0 -1
  75. package/dist/chunk-Y75CFE77.js +0 -17
  76. package/dist/chunk-Y75CFE77.js.map +0 -1
  77. package/dist/chunk-Z7QCREWI.js +0 -3435
  78. package/dist/chunk-Z7QCREWI.js.map +0 -1
  79. package/dist/chunk-ZZGN2ATS.js +0 -1941
  80. package/dist/chunk-ZZGN2ATS.js.map +0 -1
  81. package/dist/components-gAbIz7hK.d.ts +0 -1284
  82. package/dist/definitions-BgmV_GhC.d.ts +0 -300
  83. package/dist/diagnostics-DIi3ina7.d.ts +0 -50
  84. package/dist/digest.d.ts +0 -8
  85. package/dist/game-CsZScpcn.d.ts +0 -763
  86. package/dist/hex-board-view-aKkblDp6.d.ts +0 -1228
  87. package/dist/index-CcT9Q7N7.d.ts +0 -193
  88. package/dist/index.d-DjzoK7zn.d.ts +0 -2101
  89. package/dist/package-set.d.ts +0 -13
  90. package/dist/package-set.js +0 -12
  91. package/dist/package-set.js.map +0 -1
  92. package/dist/player-state-Cqpyeql0.d.ts +0 -371
  93. package/dist/plugin-runtime-contract.d.ts +0 -17
  94. package/dist/plugin-runtime-contract.js +0 -92
  95. package/dist/plugin-runtime-contract.js.map +0 -1
  96. package/dist/primitive-props-BNHDkgd7.d.ts +0 -16
  97. package/dist/protocol-dYgafTYY.d.ts +0 -314
  98. package/dist/reducer/advanced.d.ts +0 -82
  99. package/dist/reducer/advanced.js +0 -51
  100. package/dist/reducer/advanced.js.map +0 -1
  101. package/dist/reducer-contract.d.ts +0 -11
  102. package/dist/reducer-contract.js +0 -16
  103. package/dist/reducer-contract.js.map +0 -1
  104. package/dist/reference-games/index.d.ts +0 -31
  105. package/dist/reference-games/index.js +0 -48
  106. package/dist/reference-games/index.js.map +0 -1
  107. package/dist/runtime/primitives.d.ts +0 -250
  108. package/dist/runtime/primitives.js +0 -189
  109. package/dist/runtime/primitives.js.map +0 -1
  110. package/dist/runtime/runtime-api.d.ts +0 -2
  111. package/dist/runtime/runtime-api.js +0 -1
  112. package/dist/runtime/runtime-api.js.map +0 -1
  113. package/dist/runtime/workspace-contract.d.ts +0 -392
  114. package/dist/runtime/workspace-contract.js +0 -28
  115. package/dist/runtime/workspace-contract.js.map +0 -1
  116. package/dist/runtime-RJ5orDJU.d.ts +0 -1699
  117. package/dist/runtime-api-Bz5pwNU_.d.ts +0 -296
  118. package/dist/runtime-json-CQ9QbLZ5.d.ts +0 -5
  119. package/dist/runtime.d.ts +0 -83
  120. package/dist/runtime.js +0 -242
  121. package/dist/runtime.js.map +0 -1
  122. package/dist/schema.d.ts +0 -379
  123. package/dist/stale-contract-artifact-error-XLaweZtF.d.ts +0 -18
  124. package/dist/testing-compiler.d.ts +0 -37
  125. package/dist/testing-compiler.js +0 -272
  126. package/dist/testing-compiler.js.map +0 -1
  127. package/dist/testing-runtime.d.ts +0 -119
  128. package/dist/testing-runtime.js +0 -212
  129. package/dist/testing-runtime.js.map +0 -1
  130. package/dist/types-DJj5MJkl.d.ts +0 -256
  131. package/dist/types-DR7DoB1x.d.ts +0 -28
  132. package/dist/types-JWCYHmu7.d.ts +0 -122
  133. package/dist/types.d.ts +0 -1958
  134. package/dist/types.js +0 -14
  135. package/dist/types.js.map +0 -1
  136. package/dist/ui/components.d.ts +0 -17
  137. package/dist/ui/components.js +0 -216
  138. package/dist/ui/components.js.map +0 -1
  139. package/dist/ui/defaults.d.ts +0 -19
  140. package/dist/ui/defaults.js +0 -104
  141. package/dist/ui/defaults.js.map +0 -1
  142. package/dist/ui/player-state.d.ts +0 -2
  143. package/dist/ui/player-state.js +0 -1
  144. package/dist/ui/player-state.js.map +0 -1
  145. package/dist/ui/plugin-styles.css +0 -2
  146. package/dist/ui-contract-GTUPkf8z.d.ts +0 -1168
  147. package/dist/ui.d.ts +0 -317
  148. package/dist/ui.js +0 -277
  149. package/dist/ui.js.map +0 -1
  150. package/dist/views-BpuWcOyN.d.ts +0 -1641
package/dist/testing.d.ts CHANGED
@@ -1,20 +1,281 @@
1
- import { G as SnapshotMatcherHandler, E as ExpectFn, o as ScenarioDefinitionGameLike, x as ScenarioReplayDefinition, h as ScenarioCheckpoint, k as ScenarioCommand } from './definitions-BgmV_GhC.js';
2
- export { A as AssertScenarioOptions, a as ExpectMatchers, I as InteractionAvailabilityLike, b as InteractionDescriptorLike, c as InteractionExplanationLike, R as RejectionExpectation, d as ReplayScenarioOptions, e as RuntimeParamsOfScenarioCommand, S as ScenarioActor, f as ScenarioAssertionContext, g as ScenarioAuthoring, i as ScenarioCheckpointId, j as ScenarioCheckpointSelector, l as ScenarioCommandOf, m as ScenarioCommandTraceEntry, n as ScenarioDefinition, p as ScenarioDefinitionValidationCode, q as ScenarioDefinitionValidationError, r as ScenarioDiagnostics, s as ScenarioFlowDiagnostics, t as ScenarioProbeAccepted, u as ScenarioProbeRejected, v as ScenarioProbeResult, w as ScenarioReplay, y as ScenarioReplayError, z as ScenarioReplayErrorOptions, B as ScenarioReplaySegment, C as ScenarioSchemaOutput, D as ScenarioSeatRef, F as ScenarioSetup, H as createScenarioAuthoring, J as resolveScenarioCheckpoint, K as toScenarioReplayDefinition } from './definitions-BgmV_GhC.js';
3
- import { R as ReducerDiagnosticEvent } from './diagnostics-DIi3ina7.js';
4
- import { g as ScenarioIdentity, f as PerspectiveSelector, e as InspectScenarioResult, P as PerspectiveRef, d as InspectNode, i as Sha256Digest, F as FlowDiagnostic, A as ActorRef, a as InspectEntropy, S as ScenarioDispatchTraceEntry } from './types-JWCYHmu7.js';
5
- export { I as InspectAction, b as InspectInteraction, c as InspectInteractionInput, j as assertScenario, p as probeScenarioCommand, r as replayScenario } from './types-JWCYHmu7.js';
6
- import { w as wire, a as ReducerBundleContract } from './index.d-DjzoK7zn.js';
7
- import { R as RuntimeJson } from './runtime-json-CQ9QbLZ5.js';
8
- import { B, y, z as z$1, v, E } from './protocol-dYgafTYY.js';
1
+ import { aq as PhaseNamesOfDefinition, a4 as InteractionIdOfDefinitionPhase, ae as ManifestIdSchema, u as CollectorValueOf, aa as InteractionSpecByNameOfDefinitionPhase, N as GameStateOf, bq as ViewOfDefinition, aP as RuntimeJson, s as ClientParamsOfInteractionOfDefinition, aD as ReducerGameContractLike, A as AnyReducerGameDefinition, aI as ReducerSessionState, M as GameOutcome, K as GameInput, aL as ReducerValidationResult, aY as SeatProjectionBundle, ah as OptionsOfContract } from './extract-CwJWDrSD.js';
9
2
  import { z } from 'zod';
10
- import { r as BrowserInteractionIntentRequest, l as BrowserInteractionEffectRequest } from './types-DJj5MJkl.js';
11
- import { b as PluginTransport, P as PluginRuntimeClient } from './types-DR7DoB1x.js';
12
- import * as react_jsx_runtime from 'react/jsx-runtime';
13
- import react__default from 'react';
14
- export { S as StaleContractArtifactError, a as StaleContractArtifactErrorOptions, b as StaleContractArtifactKind, i as isStaleContractArtifactError } from './stale-contract-artifact-error-XLaweZtF.js';
15
- import './views-BpuWcOyN.js';
16
- import './runtime-RJ5orDJU.js';
17
- import './types.js';
3
+ import { D as DispatchTraceSummaryEntry, b as ReducerDiagnosticEvent, a as ReducerBundleContract } from './diagnostics-ZAPEBlJP.js';
4
+ import { i as SubmitResult, C as CommandSource, g as SourceSnapshot, a as ApplySource } from './types-BxXRINRF.js';
5
+ import 'honeycomb-grid';
6
+ import '@tanstack/store';
7
+
8
+ type ScenarioDefinitionValidationCode = "INVALID_TYPE" | "UNKNOWN_FIELD" | "INVALID_VALUE" | "UNSAFE_INTEGER" | "OUT_OF_RANGE" | "UNKNOWN_INTERACTION" | "INVALID_COMMAND_PARAMS" | "NON_SERIALIZABLE";
9
+ declare class ScenarioDefinitionValidationError extends Error {
10
+ readonly code: ScenarioDefinitionValidationCode;
11
+ readonly path: string;
12
+ constructor(options: {
13
+ readonly code: ScenarioDefinitionValidationCode;
14
+ readonly path: string;
15
+ readonly reason: string;
16
+ });
17
+ }
18
+
19
+ type InteractionDescriptorLike = {
20
+ interactionId?: string;
21
+ surface?: string;
22
+ kind?: string;
23
+ availability?: InteractionAvailabilityLike;
24
+ } & Record<string, unknown>;
25
+ type InteractionAvailabilityLike = {
26
+ status: "available";
27
+ } | {
28
+ status: "notYourTurn";
29
+ reason: string;
30
+ } | {
31
+ status: "blocked";
32
+ reason: string;
33
+ code?: string;
34
+ };
35
+ type InteractionExplanationLike = {
36
+ interactionId: string;
37
+ phase: string;
38
+ step: string | null;
39
+ availability: "available" | "notYourTurn" | "wrongPhase" | "wrongStep" | "blocked";
40
+ rules: ReadonlyArray<{
41
+ ruleId: string;
42
+ outcome: "passed" | "failed" | "notEvaluated";
43
+ errorCode?: string;
44
+ message?: string;
45
+ }>;
46
+ actor: {
47
+ required: readonly string[];
48
+ playerIsActor: boolean;
49
+ };
50
+ inputs: ReadonlyArray<{
51
+ key: string;
52
+ kind: string;
53
+ eligibleCount: number | "unknown";
54
+ }>;
55
+ };
56
+ type SnapshotMatcherHandler = (name: string | undefined, actual: unknown) => void;
57
+ type RejectionExpectation = {
58
+ errorCode?: string;
59
+ message?: string | RegExp;
60
+ };
61
+ type ExpectMatchers = {
62
+ toBe: (expected: unknown) => void;
63
+ toEqual: (expected: unknown) => void;
64
+ toMatchObject: (expected: Record<string, unknown>) => void;
65
+ toBeDefined: () => void;
66
+ toBeUndefined: () => void;
67
+ toBeNull: () => void;
68
+ toContain: (expected: unknown) => void;
69
+ toContainEqual: (expected: unknown) => void;
70
+ toHaveLength: (expected: number) => void;
71
+ toBeGreaterThan: (expected: number) => void;
72
+ toBeGreaterThanOrEqual: (expected: number) => void;
73
+ toThrow: (predicate?: string | RegExp | ((error: Error) => boolean)) => void;
74
+ toMatchSnapshot: (filename?: string) => void;
75
+ toRejectWith: (expected: RejectionExpectation) => Promise<void>;
76
+ toHaveInteraction: (interactionId: string, opts?: Partial<InteractionDescriptorLike>) => void;
77
+ toBeGatedBy: (reason: string, opts?: {
78
+ interactionId?: string;
79
+ }) => void;
80
+ toBeAvailable: (explanation?: InteractionExplanationLike) => void;
81
+ not: {
82
+ toHaveInteraction: (interactionId: string) => void;
83
+ };
84
+ };
85
+ type ExpectFn = (actual: unknown) => ExpectMatchers;
86
+ type ScenarioSeatRef = {
87
+ readonly seat: number;
88
+ };
89
+ type ScenarioActor = ScenarioSeatRef;
90
+ type ScenarioSetup = {
91
+ readonly players: number;
92
+ readonly seed: number;
93
+ readonly options?: Readonly<Record<string, RuntimeJson>>;
94
+ };
95
+ type ScenarioTupleOutput<Items extends readonly z.core.SomeType[], Rest extends z.core.SomeType | null, Value> = Rest extends z.core.SomeType ? readonly [
96
+ ...{
97
+ [Index in keyof Items]: ScenarioSchemaOutput<Items[Index], Index extends keyof Value ? Value[Index] : z.output<Items[Index]>>;
98
+ },
99
+ ...ScenarioSchemaOutput<Rest>[]
100
+ ] : readonly [
101
+ ...{
102
+ [Index in keyof Items]: ScenarioSchemaOutput<Items[Index], Index extends keyof Value ? Value[Index] : z.output<Items[Index]>>;
103
+ }
104
+ ];
105
+ type OptionalScenarioObjectKeys<Shape extends z.core.$ZodShape> = {
106
+ [Key in keyof Shape]: undefined extends z.output<Shape[Key]> ? Key : never;
107
+ }[keyof Shape];
108
+ type ScenarioObjectOutput<Shape extends z.core.$ZodShape, Value> = {
109
+ readonly [Key in Exclude<keyof Shape, OptionalScenarioObjectKeys<Shape>>]: ScenarioSchemaOutput<Shape[Key], Key extends keyof Value ? Value[Key] : z.output<Shape[Key]>>;
110
+ } & {
111
+ readonly [Key in OptionalScenarioObjectKeys<Shape>]?: ScenarioSchemaOutput<Shape[Key], Key extends keyof Value ? Value[Key] : z.output<Shape[Key]>>;
112
+ };
113
+ /**
114
+ * Authoring projection of an input schema. Only semantic player-id leaves are
115
+ * replaced; ordinary strings retain their original type.
116
+ */
117
+ type ScenarioSchemaOutput<Schema extends z.core.SomeType, Value = z.output<Schema>> = Schema extends ManifestIdSchema<unknown, "playerId"> ? ScenarioSeatRef : Schema extends z.ZodOptional<infer Inner> ? ScenarioSchemaOutput<Inner, Value> | undefined : Schema extends z.ZodExactOptional<infer Inner> ? ScenarioSchemaOutput<Inner, Value> | undefined : Schema extends z.ZodNullable<infer Inner> ? ScenarioSchemaOutput<Inner, Value> | null : Schema extends z.ZodDefault<infer Inner> ? ScenarioSchemaOutput<Inner, Value> : Schema extends z.ZodPrefault<infer Inner> ? ScenarioSchemaOutput<Inner, Value> : Schema extends z.ZodCatch<infer Inner> ? ScenarioSchemaOutput<Inner, Value> : Schema extends z.ZodReadonly<infer Inner> ? Readonly<ScenarioSchemaOutput<Inner, Value>> : Schema extends z.ZodNonOptional<infer Inner> ? Exclude<ScenarioSchemaOutput<Inner, Value>, undefined> : Schema extends z.ZodArray<infer Element> ? Value extends readonly (infer Item)[] ? readonly ScenarioSchemaOutput<Element, Item>[] : never : Schema extends z.ZodTuple<infer Items, infer Rest> ? ScenarioTupleOutput<Items, Rest, Value> : Schema extends z.ZodObject<infer Shape> ? ScenarioObjectOutput<Shape, Value & z.output<Schema>> : Schema extends z.ZodRecord<infer Key, infer Element> ? Key extends ManifestIdSchema<unknown, "playerId"> ? never : Readonly<Record<Extract<z.output<Key>, string | number | symbol>, ScenarioSchemaOutput<Element, Value extends Readonly<Record<string, infer Item>> ? Item : z.output<Element>>>> : Schema extends z.ZodIntersection<infer Left, infer Right> ? ScenarioSchemaOutput<Left, Value> & ScenarioSchemaOutput<Right, Value> : Schema extends z.ZodPipe<infer Input, z.ZodType> ? ScenarioSchemaOutput<Input> : Schema extends z.ZodLazy<infer Inner> ? ScenarioSchemaOutput<Inner, Value> : Schema extends z.ZodUnion<infer Options> ? ScenarioSchemaOutput<Options[number], Value> : Value & z.output<Schema>;
118
+ type InputCollectorsOfInteraction<Interaction> = Interaction extends {
119
+ readonly steps: {
120
+ readonly collectors: infer Collectors extends Readonly<Record<string, unknown>>;
121
+ };
122
+ } ? Collectors : Interaction extends {
123
+ readonly inputs?: infer Collectors;
124
+ } ? NonNullable<Collectors> extends Readonly<Record<string, unknown>> ? NonNullable<Collectors> : Record<string, never> : Record<string, never>;
125
+ type ScenarioParamsOfCollectors<Collectors extends Readonly<Record<string, unknown>>> = {
126
+ readonly [Key in keyof Collectors as Collectors[Key] extends {
127
+ readonly kind: "rng";
128
+ } ? never : Key]: Collectors[Key] extends {
129
+ readonly schema: infer Schema extends z.core.SomeType;
130
+ } ? ScenarioSchemaOutput<Schema, CollectorValueOf<Collectors[Key]>> : never;
131
+ };
132
+ type ScenarioStepParams<Params> = {
133
+ [Key in keyof Params]: Pick<Params, Key> & Partial<Record<Exclude<keyof Params, Key>, never>>;
134
+ }[keyof Params];
135
+ type ScenarioParamsOfInteraction<Interaction> = Interaction extends {
136
+ readonly steps: unknown;
137
+ } ? ScenarioStepParams<ScenarioParamsOfCollectors<InputCollectorsOfInteraction<Interaction>>> : ScenarioParamsOfCollectors<InputCollectorsOfInteraction<Interaction>>;
138
+ type ScenarioCommand<InteractionId extends string = string, Params = Record<string, unknown>> = {
139
+ readonly actor: ScenarioActor;
140
+ readonly interactionId: InteractionId;
141
+ readonly params: Params;
142
+ };
143
+ type ScenarioCommandForPhase<Game, Phase extends PhaseNamesOfDefinition<Game>> = {
144
+ [InteractionId in InteractionIdOfDefinitionPhase<Game, Phase>]: ScenarioCommand<InteractionId, ScenarioParamsOfInteraction<InteractionSpecByNameOfDefinitionPhase<Game, Phase, InteractionId>>>;
145
+ }[InteractionIdOfDefinitionPhase<Game, Phase>];
146
+ type ScenarioCommandOf<Game> = {
147
+ [Phase in PhaseNamesOfDefinition<Game>]: ScenarioCommandForPhase<Game, Phase>;
148
+ }[PhaseNamesOfDefinition<Game>];
149
+ /** Production params remain available for runtime implementors and diagnostics. */
150
+ type RuntimeParamsOfScenarioCommand<Game, Phase extends PhaseNamesOfDefinition<Game>, InteractionId extends InteractionIdOfDefinitionPhase<Game, Phase>> = ClientParamsOfInteractionOfDefinition<Game, Phase, InteractionId>;
151
+ type ScenarioReplayDefinition<Game> = {
152
+ readonly id: string;
153
+ readonly description?: string;
154
+ readonly setup: ScenarioSetup;
155
+ readonly given: readonly ScenarioCommandOf<Game>[];
156
+ readonly when: readonly ScenarioCommandOf<Game>[];
157
+ };
158
+ type DeepReadonly<Value> = Value extends string | number | boolean | bigint | symbol ? Value : Value extends (...args: never[]) => unknown ? Value : Value extends readonly (infer Item)[] ? readonly DeepReadonly<Item>[] : Value extends object ? {
159
+ readonly [Key in keyof Value]: DeepReadonly<Value[Key]>;
160
+ } : Value;
161
+ type ScenarioPlayerView<Game> = ViewOfDefinition<Game>;
162
+ type ScenarioFlowDiagnostics = {
163
+ readonly currentPhase: string | null;
164
+ readonly activeSeats: readonly ScenarioSeatRef[];
165
+ };
166
+ type ScenarioDiagnostics = {
167
+ readonly events: readonly ReducerDiagnosticEvent[];
168
+ readonly lastDispatch: {
169
+ readonly submissionId: string;
170
+ readonly trace: readonly DispatchTraceSummaryEntry[];
171
+ } | null;
172
+ readonly flow: ScenarioFlowDiagnostics;
173
+ };
174
+ type ScenarioProbeAccepted<Game> = {
175
+ readonly kind: "accepted";
176
+ readonly command: ScenarioCommandOf<Game>;
177
+ readonly checkpointDigest: string;
178
+ readonly trace: readonly DispatchTraceSummaryEntry[];
179
+ toBeAccepted(): void;
180
+ toRejectWith(expected: RejectionExpectation): never;
181
+ };
182
+ type ScenarioProbeRejected<Game> = {
183
+ readonly kind: "rejected";
184
+ readonly command: ScenarioCommandOf<Game>;
185
+ readonly errorCode: string;
186
+ readonly message?: string;
187
+ readonly trace: readonly DispatchTraceSummaryEntry[];
188
+ toBeAccepted(): never;
189
+ toRejectWith(expected: RejectionExpectation): void;
190
+ };
191
+ type ScenarioProbeResult<Game> = ScenarioProbeAccepted<Game> | ScenarioProbeRejected<Game>;
192
+ type ScenarioAssertionContext<Game> = {
193
+ readonly expect: ExpectFn;
194
+ state(): DeepReadonly<GameStateOf<Game>>;
195
+ view(seat: ScenarioSeatRef): DeepReadonly<ScenarioPlayerView<Game>>;
196
+ interactions(seat: ScenarioSeatRef): readonly InteractionDescriptorLike[];
197
+ explain(seat: ScenarioSeatRef, interactionId: string): InteractionExplanationLike;
198
+ readonly diagnostics: ScenarioDiagnostics;
199
+ probe(command: ScenarioCommandOf<Game>): Promise<ScenarioProbeResult<Game>>;
200
+ };
201
+ type ScenarioDefinition<Game> = ScenarioReplayDefinition<Game> & {
202
+ /** Named authored states for CLI, Workbench, demo, and test adapters. */
203
+ readonly checkpoints?: Readonly<Record<ScenarioCheckpointId, ScenarioCheckpoint>>;
204
+ readonly then: (context: ScenarioAssertionContext<Game>) => void | Promise<void>;
205
+ };
206
+ type ScenarioCheckpoint = {
207
+ readonly segment: "setup";
208
+ readonly completed: 0;
209
+ } | {
210
+ readonly segment: "given";
211
+ readonly completed: number;
212
+ } | {
213
+ readonly segment: "when";
214
+ readonly completed: number;
215
+ };
216
+ type ScenarioCheckpointId = string;
217
+ type ScenarioCheckpointSelector = ScenarioCheckpoint | ScenarioCheckpointId;
218
+ /** Resolve authored names while keeping replay DTOs structurally checkpointed. */
219
+ declare function resolveScenarioCheckpoint<Game>(definition: Pick<ScenarioDefinition<Game>, "checkpoints" | "given" | "id" | "when">, selector: ScenarioCheckpointSelector): ScenarioCheckpoint;
220
+ type ScenarioReplaySegment = "given" | "when";
221
+ type ScenarioCommandTraceEntry<Game> = {
222
+ readonly segment: ScenarioReplaySegment;
223
+ readonly index: number;
224
+ readonly command: ScenarioCommandOf<Game>;
225
+ readonly trace: readonly DispatchTraceSummaryEntry[];
226
+ };
227
+ type ScenarioReplay<Game> = {
228
+ readonly scenarioId: string;
229
+ readonly checkpoint: ScenarioCheckpoint;
230
+ readonly checkpointDigest: string;
231
+ readonly complete: boolean;
232
+ readonly trace: readonly ScenarioCommandTraceEntry<Game>[];
233
+ state(): DeepReadonly<GameStateOf<Game>>;
234
+ view(seat: ScenarioSeatRef): DeepReadonly<ScenarioPlayerView<Game>>;
235
+ interactions(seat: ScenarioSeatRef): readonly InteractionDescriptorLike[];
236
+ explain(seat: ScenarioSeatRef, interactionId: string): InteractionExplanationLike;
237
+ readonly diagnostics: ScenarioDiagnostics;
238
+ clone(): ScenarioReplay<Game>;
239
+ };
240
+ type ReplayScenarioOptions<Game> = {
241
+ /** Exact production artifact to execute; omitted for ordinary authored replay. */
242
+ readonly bundle?: ReducerBundleContract;
243
+ readonly game: Game;
244
+ readonly scenario: ScenarioReplayDefinition<Game>;
245
+ readonly at?: ScenarioCheckpoint;
246
+ };
247
+ type AssertScenarioOptions<Game> = {
248
+ readonly replay: ScenarioReplay<Game>;
249
+ readonly assertion: ScenarioDefinition<Game>["then"];
250
+ };
251
+ type ScenarioReplayErrorOptions = {
252
+ readonly scenarioId: string;
253
+ readonly segment: ScenarioReplaySegment;
254
+ readonly index: number;
255
+ readonly interactionId: string;
256
+ readonly errorCode: string;
257
+ readonly reducerMessage?: string;
258
+ readonly trace?: readonly DispatchTraceSummaryEntry[];
259
+ };
260
+ declare class ScenarioReplayError extends Error {
261
+ readonly scenarioId: string;
262
+ readonly segment: ScenarioReplaySegment;
263
+ readonly index: number;
264
+ readonly interactionId: string;
265
+ readonly errorCode: string;
266
+ readonly reducerMessage?: string;
267
+ readonly trace: readonly DispatchTraceSummaryEntry[];
268
+ constructor(options: ScenarioReplayErrorOptions);
269
+ }
270
+ type NoExtraScenarioFields<Actual, Expected> = Record<Exclude<keyof Actual, keyof Expected>, never>;
271
+ type ScenarioAuthoring<Game> = {
272
+ defineScenario<const Definition extends ScenarioDefinition<Game>>(definition: Definition & NoExtraScenarioFields<Definition, ScenarioDefinition<Game>>): Definition;
273
+ };
274
+ declare function createScenarioAuthoring<Contract extends ReducerGameContractLike, const Game extends AnyReducerGameDefinition<Contract>>(game: Game & {
275
+ readonly contract: Contract;
276
+ }): ScenarioAuthoring<Game>;
277
+ /** Select and clone the only serializable portion of a loaded scenario. */
278
+ declare function toScenarioReplayDefinition<Game>(definition: ScenarioDefinition<Game>): ScenarioReplayDefinition<Game>;
18
279
 
19
280
  type CreateExpectApiOptions = {
20
281
  matchSnapshot?: SnapshotMatcherHandler;
@@ -30,7 +291,135 @@ declare class ScenarioAssertionError extends Error {
30
291
  constructor(message: string);
31
292
  }
32
293
 
33
- type InspectScenarioOptions<Game extends ScenarioDefinitionGameLike> = {
294
+ declare function replayScenario<Contract extends ReducerGameContractLike, const Game extends AnyReducerGameDefinition<Contract>>(options: ReplayScenarioOptions<Game> & {
295
+ readonly game: {
296
+ readonly contract: Contract;
297
+ };
298
+ }): Promise<ScenarioReplay<Game>>;
299
+ type ScenarioRuntimeCheckpointMaterialization = {
300
+ readonly checkpoint: ScenarioCheckpoint;
301
+ readonly checkpointDigest: string;
302
+ readonly playerIds: readonly string[];
303
+ readonly state: ReducerSessionState;
304
+ readonly terminal: GameOutcome | null;
305
+ };
306
+ /**
307
+ * Trusted tool-side materialization for CLI, Workbench, and backend adapters.
308
+ * The returned reducer snapshot must never cross a player/browser boundary.
309
+ */
310
+ declare function materializeScenarioRuntimeCheckpoint<Contract extends ReducerGameContractLike, const Game extends AnyReducerGameDefinition<Contract>>(options: ReplayScenarioOptions<Game> & {
311
+ readonly game: {
312
+ readonly contract: Contract;
313
+ };
314
+ }): Promise<ScenarioRuntimeCheckpointMaterialization>;
315
+ declare function assertScenario<Game>(options: AssertScenarioOptions<Game>): Promise<void>;
316
+ declare function probeScenarioCommand<Game>(options: {
317
+ readonly replay: ScenarioReplay<Game>;
318
+ readonly command: ScenarioCommandOf<Game>;
319
+ }): Promise<ScenarioProbeResult<Game>>;
320
+
321
+ type Sha256Digest = `sha256:${string}`;
322
+ type ScenarioIdentity = {
323
+ readonly id: string;
324
+ readonly path: string;
325
+ readonly sourceDigest: Sha256Digest;
326
+ };
327
+ type ActorRef = {
328
+ readonly seat: number;
329
+ readonly playerId: string;
330
+ };
331
+ type PerspectiveRef = {
332
+ readonly kind: "player";
333
+ readonly actor: ActorRef;
334
+ } | {
335
+ readonly kind: "spectator";
336
+ };
337
+ type PerspectiveSelector = {
338
+ readonly kind: "player";
339
+ readonly seat: number;
340
+ } | {
341
+ readonly kind: "spectator";
342
+ };
343
+ type FlowDiagnostic = {
344
+ readonly phase: string;
345
+ readonly step: string | null;
346
+ readonly activeActors: readonly ActorRef[];
347
+ readonly pendingActors: readonly ActorRef[];
348
+ readonly continuationWaiters: readonly ActorRef[];
349
+ readonly blockedBy: readonly {
350
+ readonly actor: ActorRef;
351
+ readonly blockers: readonly ActorRef[];
352
+ readonly source: "scheduler";
353
+ }[];
354
+ };
355
+ type InspectInteractionInput = {
356
+ readonly key: string;
357
+ readonly kind: string;
358
+ readonly eligibleCount: number | "unknown";
359
+ };
360
+ type InspectInteraction = {
361
+ readonly actor: ActorRef;
362
+ readonly interactionId: string;
363
+ readonly availability: {
364
+ readonly status: "available" | "notYourTurn" | "blocked";
365
+ readonly code?: string;
366
+ readonly reason?: string;
367
+ };
368
+ readonly inputs: readonly InspectInteractionInput[];
369
+ readonly explanation: InteractionExplanationLike;
370
+ };
371
+ type InspectAction = {
372
+ readonly actor: ActorRef;
373
+ readonly interactionId: string;
374
+ readonly inputs: readonly InspectInteractionInput[];
375
+ readonly explanation: InteractionExplanationLike;
376
+ readonly hasConcreteCommand: true;
377
+ };
378
+ type ScenarioDispatchTraceEntry = {
379
+ readonly kind: "acceptedCommand";
380
+ readonly actor: ActorRef;
381
+ readonly interactionId: string;
382
+ } | {
383
+ readonly kind: "phaseEntered";
384
+ readonly from: string;
385
+ readonly to: string;
386
+ } | {
387
+ readonly kind: "entropyDraw";
388
+ readonly drawIndex: number;
389
+ };
390
+ type InspectEntropy = {
391
+ readonly seed: number;
392
+ readonly draws: readonly {
393
+ readonly index: number;
394
+ readonly cursorBefore: number;
395
+ readonly cursorAfter: number;
396
+ readonly operation: {
397
+ readonly kind: string;
398
+ readonly parameters: Readonly<Record<string, string | number | boolean>>;
399
+ };
400
+ }[];
401
+ };
402
+ type InspectNode = {
403
+ readonly checkpoint: ScenarioCheckpoint;
404
+ readonly checkpointDigest: Sha256Digest;
405
+ readonly setup: ScenarioSetup;
406
+ readonly flow: FlowDiagnostic;
407
+ readonly perspective: PerspectiveRef;
408
+ readonly publicState: unknown;
409
+ readonly view: unknown;
410
+ readonly interactions: readonly InspectInteraction[];
411
+ readonly actions: readonly InspectAction[];
412
+ readonly entropy: InspectEntropy;
413
+ readonly dispatchTrace: readonly ScenarioDispatchTraceEntry[];
414
+ };
415
+ type InspectScenarioResult = {
416
+ readonly schemaVersion: 1;
417
+ readonly scenario: ScenarioIdentity;
418
+ readonly node: InspectNode;
419
+ readonly seedSource: "scenario" | "override";
420
+ };
421
+
422
+ type InspectScenarioOptions<Game> = {
34
423
  readonly game: Game;
35
424
  readonly scenario: ScenarioReplayDefinition<Game>;
36
425
  readonly identity: ScenarioIdentity;
@@ -38,7 +427,11 @@ type InspectScenarioOptions<Game extends ScenarioDefinitionGameLike> = {
38
427
  readonly at?: ScenarioCheckpoint;
39
428
  readonly seed?: number;
40
429
  };
41
- declare function inspectScenario<const Game extends ScenarioDefinitionGameLike>(options: InspectScenarioOptions<Game>): Promise<InspectScenarioResult>;
430
+ declare function inspectScenario<Contract extends ReducerGameContractLike, const Game extends AnyReducerGameDefinition<Contract>>(options: InspectScenarioOptions<Game> & {
431
+ readonly game: {
432
+ readonly contract: Contract;
433
+ };
434
+ }): Promise<InspectScenarioResult>;
42
435
 
43
436
  type ExploreTransitionResult = {
44
437
  readonly schemaVersion: 1;
@@ -96,7 +489,7 @@ type ExploreSeedResult = {
96
489
  readonly actions: readonly {
97
490
  readonly seat: number;
98
491
  readonly interactionId: string;
99
- readonly concreteOptionCount: number | "lazy";
492
+ readonly concreteOptionCount: number | "unknown";
100
493
  }[];
101
494
  };
102
495
  readonly rejection?: {
@@ -113,25 +506,28 @@ type SeedRange = {
113
506
  readonly start: number;
114
507
  readonly end: number;
115
508
  };
116
- type ExploreScenarioOptions<Game extends ScenarioDefinitionGameLike> = Omit<InspectScenarioOptions<Game>, "seed"> & {
509
+ type ExploreScenarioOptions<Game> = Omit<InspectScenarioOptions<Game>, "seed"> & {
117
510
  readonly seed?: number;
118
511
  readonly seedRange?: SeedRange;
119
512
  readonly limit?: number;
120
513
  readonly maxEvaluations?: number;
121
514
  readonly cursor?: string;
122
515
  };
123
- declare function exploreScenario<const Game extends ScenarioDefinitionGameLike>(options: ExploreScenarioOptions<Game>): Promise<ExploreScenarioResult>;
516
+ declare function exploreScenario<Contract extends ReducerGameContractLike, const Game extends AnyReducerGameDefinition<Contract>>(options: ExploreScenarioOptions<Game> & {
517
+ readonly game: {
518
+ readonly contract: Contract;
519
+ };
520
+ }): Promise<ExploreScenarioResult>;
124
521
 
125
- type ReducerScenarioBundle = Pick<ReducerBundleContract, "project" | "dispatch" | "boardStatic">;
522
+ type ReducerScenarioBundle = Pick<ReducerBundleContract, "project" | "dispatch">;
126
523
  interface ReducerScenarioViewer {
127
524
  readonly seatId: string;
128
525
  readonly playerId: string;
129
526
  }
130
527
  interface ReducerScenarioFrame {
131
528
  readonly id: string;
132
- readonly reducerState: wire.ReducerSessionState;
133
- readonly dynamicProjection: wire.SeatProjectionBundle;
134
- readonly staticProjection?: wire.BoardStaticProjection | null;
529
+ readonly reducerState: ReducerSessionState;
530
+ readonly dynamicProjection: SeatProjectionBundle;
135
531
  readonly gameVersion: number;
136
532
  readonly actionSetVersion: string;
137
533
  readonly projectionDigest: string;
@@ -147,13 +543,13 @@ type ReducerScenarioExchange = {
147
543
  readonly id: string;
148
544
  readonly operation: "validate";
149
545
  readonly fromFrameId: string;
150
- readonly input: wire.GameInput;
151
- readonly result: wire.ReducerInputValidationResult;
546
+ readonly input: GameInput;
547
+ readonly result: ReducerValidationResult;
152
548
  } | {
153
549
  readonly id: string;
154
550
  readonly operation: "submit";
155
551
  readonly fromFrameId: string;
156
- readonly input: wire.GameInput;
552
+ readonly input: GameInput;
157
553
  readonly result: {
158
554
  readonly kind: "accepted";
159
555
  readonly toFrameId: string;
@@ -169,16 +565,16 @@ interface ReducerScenarioDiagnostic {
169
565
  type ReducerScenarioOperation = {
170
566
  readonly id: string;
171
567
  readonly operation: "validate";
172
- readonly input: wire.GameInput;
568
+ readonly input: GameInput;
173
569
  } | {
174
570
  readonly id: string;
175
571
  readonly operation: "submit";
176
- readonly input: wire.GameInput;
572
+ readonly input: GameInput;
177
573
  };
178
574
  interface CreateReducerScenarioRunnerOptions {
179
575
  readonly scenarioId: string;
180
576
  readonly gameId: string;
181
- readonly initialState: wire.ReducerSessionState;
577
+ readonly initialState: ReducerSessionState;
182
578
  readonly bundle: ReducerScenarioBundle;
183
579
  readonly viewer: ReducerScenarioViewer;
184
580
  readonly playerIds: readonly string[];
@@ -190,553 +586,117 @@ interface ReducerScenarioRunner {
190
586
 
191
587
  declare function createReducerScenarioRunner(options: CreateReducerScenarioRunnerOptions): ReducerScenarioRunner;
192
588
 
193
- declare const UI_SCENARIO_FIXTURE_SCHEMA_VERSION = 2;
194
- declare const UI_SCENARIO_FIXTURE_BUNDLE_SCHEMA_VERSION = 2;
195
- declare const UI_SCENARIO_FIXTURE_SUPPORTED_BROWSER_PROTOCOL_MAJOR = 3;
196
- declare const UI_SCENARIO_FIXTURE_PLUGIN_RUNTIME_PROTOCOL: 4;
197
- declare const uiFixtureFrameSchema: z.ZodObject<{
198
- id: z.ZodString;
199
- frame: z.ZodType<v<unknown, string, string, string>, unknown, z.core.$ZodTypeInternals<v<unknown, string, string, string>, unknown>>;
200
- projectionDigest: z.ZodString;
201
- }, z.core.$strict>;
202
- declare const uiFixtureProtocolStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
203
- id: z.ZodString;
204
- kind: z.ZodLiteral<"host.frame">;
205
- frameId: z.ZodString;
206
- }, z.core.$strict>, z.ZodObject<{
207
- id: z.ZodString;
208
- kind: z.ZodLiteral<"client.submit">;
209
- fromFrameId: z.ZodString;
210
- requestDigest: z.ZodString;
211
- response: z.ZodDiscriminatedUnion<[z.ZodObject<{
212
- type: z.ZodLiteral<"interaction.result">;
213
- clientActionId: z.ZodString;
214
- accepted: z.ZodLiteral<true>;
215
- }, z.core.$strict>, z.ZodObject<{
216
- type: z.ZodLiteral<"interaction.result">;
217
- clientActionId: z.ZodString;
218
- accepted: z.ZodLiteral<false>;
219
- errorCode: z.ZodString;
220
- message: z.ZodOptional<z.ZodString>;
221
- }, z.core.$strict>], "accepted">;
222
- }, z.core.$strict>], "kind">;
223
- declare const pluginProtocolTapeSchema: z.ZodType<B, unknown, z.core.$ZodTypeInternals<B, unknown>>;
224
- declare const uiReplayRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
225
- surface: z.ZodString;
226
- scopeId: z.ZodOptional<z.ZodString>;
227
- interactionKey: z.ZodOptional<z.ZodString>;
228
- interactionId: z.ZodOptional<z.ZodString>;
229
- intent: z.ZodString;
230
- inputKey: z.ZodOptional<z.ZodString>;
231
- candidateValue: z.ZodOptional<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>;
232
- candidateValueKey: z.ZodOptional<z.ZodString>;
233
- actuatorKind: z.ZodOptional<z.ZodEnum<{
234
- fill: "fill";
235
- pointer: "pointer";
236
- keyboard: "keyboard";
237
- click: "click";
238
- }>>;
239
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
240
- }, z.core.$strict>, z.ZodObject<{
241
- surface: z.ZodString;
242
- scopeId: z.ZodOptional<z.ZodString>;
243
- interactionKey: z.ZodOptional<z.ZodString>;
244
- interactionId: z.ZodOptional<z.ZodString>;
245
- effect: z.ZodObject<{
246
- kind: z.ZodString;
247
- }, z.core.$catchall<z.ZodPreprocess<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>>;
248
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
249
- }, z.core.$strict>]>;
250
- declare const uiReplayExecutionSchema: z.ZodUnion<readonly [z.ZodObject<{
251
- kind: z.ZodLiteral<"activate">;
252
- }, z.core.$strict>, z.ZodObject<{
253
- kind: z.ZodLiteral<"fill">;
254
- value: z.ZodString;
255
- }, z.core.$strict>, z.ZodObject<{
256
- kind: z.ZodLiteral<"drag">;
257
- target: z.ZodObject<{
258
- surface: z.ZodString;
259
- scopeId: z.ZodOptional<z.ZodString>;
260
- interactionKey: z.ZodOptional<z.ZodString>;
261
- interactionId: z.ZodOptional<z.ZodString>;
262
- effect: z.ZodObject<{
263
- kind: z.ZodString;
264
- }, z.core.$catchall<z.ZodPreprocess<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>>;
265
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
266
- }, z.core.$strict>;
267
- }, z.core.$strict>]>;
268
- declare const uiStepExpectationSchema: z.ZodObject<{
269
- frameId: z.ZodOptional<z.ZodString>;
270
- projectionDigest: z.ZodOptional<z.ZodString>;
271
- semanticDigest: z.ZodOptional<z.ZodString>;
272
- draftDigest: z.ZodOptional<z.ZodString>;
273
- submissionDigest: z.ZodOptional<z.ZodString>;
274
- focusedInteractionKey: z.ZodOptional<z.ZodString>;
275
- visibleInteractionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
276
- }, z.core.$strict>;
277
- declare const uiResolvedReplayIdentitySchema: z.ZodObject<{
278
- stepId: z.ZodString;
279
- surface: z.ZodString;
280
- scopeId: z.ZodString;
281
- interactionKey: z.ZodString;
282
- interactionId: z.ZodString;
283
- actuatorId: z.ZodString;
284
- descriptorDigest: z.ZodOptional<z.ZodString>;
285
- draftDigest: z.ZodOptional<z.ZodString>;
286
- }, z.core.$strict>;
287
- declare const portableSemanticReplayStepSchema: z.ZodObject<{
288
- stepId: z.ZodString;
289
- requestDigest: z.ZodString;
290
- resolve: z.ZodUnion<readonly [z.ZodObject<{
291
- surface: z.ZodString;
292
- scopeId: z.ZodOptional<z.ZodString>;
293
- interactionKey: z.ZodOptional<z.ZodString>;
294
- interactionId: z.ZodOptional<z.ZodString>;
295
- intent: z.ZodString;
296
- inputKey: z.ZodOptional<z.ZodString>;
297
- candidateValue: z.ZodOptional<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>;
298
- candidateValueKey: z.ZodOptional<z.ZodString>;
299
- actuatorKind: z.ZodOptional<z.ZodEnum<{
300
- fill: "fill";
301
- pointer: "pointer";
302
- keyboard: "keyboard";
303
- click: "click";
304
- }>>;
305
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
306
- }, z.core.$strict>, z.ZodObject<{
307
- surface: z.ZodString;
308
- scopeId: z.ZodOptional<z.ZodString>;
309
- interactionKey: z.ZodOptional<z.ZodString>;
310
- interactionId: z.ZodOptional<z.ZodString>;
311
- effect: z.ZodObject<{
312
- kind: z.ZodString;
313
- }, z.core.$catchall<z.ZodPreprocess<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>>;
314
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
315
- }, z.core.$strict>]>;
316
- execute: z.ZodUnion<readonly [z.ZodObject<{
317
- kind: z.ZodLiteral<"activate">;
318
- }, z.core.$strict>, z.ZodObject<{
319
- kind: z.ZodLiteral<"fill">;
320
- value: z.ZodString;
321
- }, z.core.$strict>, z.ZodObject<{
322
- kind: z.ZodLiteral<"drag">;
323
- target: z.ZodObject<{
324
- surface: z.ZodString;
325
- scopeId: z.ZodOptional<z.ZodString>;
326
- interactionKey: z.ZodOptional<z.ZodString>;
327
- interactionId: z.ZodOptional<z.ZodString>;
328
- effect: z.ZodObject<{
329
- kind: z.ZodString;
330
- }, z.core.$catchall<z.ZodPreprocess<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>>;
331
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
332
- }, z.core.$strict>;
333
- }, z.core.$strict>]>;
334
- expectedIdentity: z.ZodOptional<z.ZodObject<{
335
- stepId: z.ZodString;
336
- surface: z.ZodString;
337
- scopeId: z.ZodString;
338
- interactionKey: z.ZodString;
339
- interactionId: z.ZodString;
340
- actuatorId: z.ZodString;
341
- descriptorDigest: z.ZodOptional<z.ZodString>;
342
- draftDigest: z.ZodOptional<z.ZodString>;
343
- }, z.core.$strict>>;
344
- expect: z.ZodObject<{
345
- frameId: z.ZodOptional<z.ZodString>;
346
- projectionDigest: z.ZodOptional<z.ZodString>;
347
- semanticDigest: z.ZodOptional<z.ZodString>;
348
- draftDigest: z.ZodOptional<z.ZodString>;
349
- submissionDigest: z.ZodOptional<z.ZodString>;
350
- focusedInteractionKey: z.ZodOptional<z.ZodString>;
351
- visibleInteractionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
352
- }, z.core.$strict>;
353
- }, z.core.$strict>;
354
- declare const uiScenarioReplayStepSchema: z.ZodUnion<readonly [z.ZodObject<{
355
- stepId: z.ZodString;
356
- requestDigest: z.ZodString;
357
- resolve: z.ZodUnion<readonly [z.ZodObject<{
358
- surface: z.ZodString;
359
- scopeId: z.ZodOptional<z.ZodString>;
360
- interactionKey: z.ZodOptional<z.ZodString>;
361
- interactionId: z.ZodOptional<z.ZodString>;
362
- intent: z.ZodString;
363
- inputKey: z.ZodOptional<z.ZodString>;
364
- candidateValue: z.ZodOptional<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>;
365
- candidateValueKey: z.ZodOptional<z.ZodString>;
366
- actuatorKind: z.ZodOptional<z.ZodEnum<{
367
- fill: "fill";
368
- pointer: "pointer";
369
- keyboard: "keyboard";
370
- click: "click";
371
- }>>;
372
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
373
- }, z.core.$strict>, z.ZodObject<{
374
- surface: z.ZodString;
375
- scopeId: z.ZodOptional<z.ZodString>;
376
- interactionKey: z.ZodOptional<z.ZodString>;
377
- interactionId: z.ZodOptional<z.ZodString>;
378
- effect: z.ZodObject<{
379
- kind: z.ZodString;
380
- }, z.core.$catchall<z.ZodPreprocess<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>>;
381
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
382
- }, z.core.$strict>]>;
383
- execute: z.ZodUnion<readonly [z.ZodObject<{
384
- kind: z.ZodLiteral<"activate">;
385
- }, z.core.$strict>, z.ZodObject<{
386
- kind: z.ZodLiteral<"fill">;
387
- value: z.ZodString;
388
- }, z.core.$strict>, z.ZodObject<{
389
- kind: z.ZodLiteral<"drag">;
390
- target: z.ZodObject<{
391
- surface: z.ZodString;
392
- scopeId: z.ZodOptional<z.ZodString>;
393
- interactionKey: z.ZodOptional<z.ZodString>;
394
- interactionId: z.ZodOptional<z.ZodString>;
395
- effect: z.ZodObject<{
396
- kind: z.ZodString;
397
- }, z.core.$catchall<z.ZodPreprocess<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>>;
398
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
399
- }, z.core.$strict>;
400
- }, z.core.$strict>]>;
401
- expectedIdentity: z.ZodOptional<z.ZodObject<{
402
- stepId: z.ZodString;
403
- surface: z.ZodString;
404
- scopeId: z.ZodString;
405
- interactionKey: z.ZodString;
406
- interactionId: z.ZodString;
407
- actuatorId: z.ZodString;
408
- descriptorDigest: z.ZodOptional<z.ZodString>;
409
- draftDigest: z.ZodOptional<z.ZodString>;
410
- }, z.core.$strict>>;
411
- expect: z.ZodObject<{
412
- frameId: z.ZodOptional<z.ZodString>;
413
- projectionDigest: z.ZodOptional<z.ZodString>;
414
- semanticDigest: z.ZodOptional<z.ZodString>;
415
- draftDigest: z.ZodOptional<z.ZodString>;
416
- submissionDigest: z.ZodOptional<z.ZodString>;
417
- focusedInteractionKey: z.ZodOptional<z.ZodString>;
418
- visibleInteractionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
419
- }, z.core.$strict>;
420
- }, z.core.$strict>, z.ZodObject<{
421
- stepId: z.ZodString;
422
- kind: z.ZodLiteral<"assert">;
423
- expect: z.ZodObject<{
424
- frameId: z.ZodOptional<z.ZodString>;
425
- projectionDigest: z.ZodOptional<z.ZodString>;
426
- semanticDigest: z.ZodOptional<z.ZodString>;
427
- draftDigest: z.ZodOptional<z.ZodString>;
428
- submissionDigest: z.ZodOptional<z.ZodString>;
429
- focusedInteractionKey: z.ZodOptional<z.ZodString>;
430
- visibleInteractionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
431
- }, z.core.$strict>;
432
- }, z.core.$strict>]>;
433
- declare const uiScenarioFixtureSchema: z.ZodObject<{
434
- schemaVersion: z.ZodLiteral<2>;
435
- browserInteractionProtocol: z.ZodLiteral<"3.0.0">;
436
- pluginRuntimeProtocol: z.ZodLiteral<4>;
437
- id: z.ZodString;
438
- title: z.ZodString;
439
- gameId: z.ZodString;
440
- tags: z.ZodArray<z.ZodString>;
441
- source: z.ZodObject<{
442
- scenarioId: z.ZodString;
443
- reducerFingerprint: z.ZodString;
444
- uiContractFingerprint: z.ZodString;
445
- renderModule: z.ZodString;
446
- renderModuleDigest: z.ZodString;
447
- sourceDigest: z.ZodString;
448
- sourceFiles: z.ZodOptional<z.ZodArray<z.ZodString>>;
449
- }, z.core.$strict>;
450
- viewer: z.ZodObject<{
451
- seatId: z.ZodString;
452
- playerId: z.ZodOptional<z.ZodString>;
453
- }, z.core.$strict>;
454
- environment: z.ZodObject<{
455
- clockIso: z.ZodString;
456
- randomSeed: z.ZodString;
457
- locale: z.ZodLiteral<"en-US">;
458
- timezone: z.ZodLiteral<"UTC">;
459
- viewportTags: z.ZodArray<z.ZodEnum<{
460
- touch: "touch";
461
- desktop: "desktop";
462
- tablet: "tablet";
463
- phone: "phone";
464
- }>>;
465
- }, z.core.$strict>;
466
- protocol: z.ZodType<B, unknown, z.core.$ZodTypeInternals<B, unknown>>;
467
- replay: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
468
- stepId: z.ZodString;
469
- requestDigest: z.ZodString;
470
- resolve: z.ZodUnion<readonly [z.ZodObject<{
471
- surface: z.ZodString;
472
- scopeId: z.ZodOptional<z.ZodString>;
473
- interactionKey: z.ZodOptional<z.ZodString>;
474
- interactionId: z.ZodOptional<z.ZodString>;
475
- intent: z.ZodString;
476
- inputKey: z.ZodOptional<z.ZodString>;
477
- candidateValue: z.ZodOptional<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>;
478
- candidateValueKey: z.ZodOptional<z.ZodString>;
479
- actuatorKind: z.ZodOptional<z.ZodEnum<{
480
- fill: "fill";
481
- pointer: "pointer";
482
- keyboard: "keyboard";
483
- click: "click";
484
- }>>;
485
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
486
- }, z.core.$strict>, z.ZodObject<{
487
- surface: z.ZodString;
488
- scopeId: z.ZodOptional<z.ZodString>;
489
- interactionKey: z.ZodOptional<z.ZodString>;
490
- interactionId: z.ZodOptional<z.ZodString>;
491
- effect: z.ZodObject<{
492
- kind: z.ZodString;
493
- }, z.core.$catchall<z.ZodPreprocess<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>>;
494
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
495
- }, z.core.$strict>]>;
496
- execute: z.ZodUnion<readonly [z.ZodObject<{
497
- kind: z.ZodLiteral<"activate">;
498
- }, z.core.$strict>, z.ZodObject<{
499
- kind: z.ZodLiteral<"fill">;
500
- value: z.ZodString;
501
- }, z.core.$strict>, z.ZodObject<{
502
- kind: z.ZodLiteral<"drag">;
503
- target: z.ZodObject<{
504
- surface: z.ZodString;
505
- scopeId: z.ZodOptional<z.ZodString>;
506
- interactionKey: z.ZodOptional<z.ZodString>;
507
- interactionId: z.ZodOptional<z.ZodString>;
508
- effect: z.ZodObject<{
509
- kind: z.ZodString;
510
- }, z.core.$catchall<z.ZodPreprocess<z.ZodType<RuntimeJson, unknown, z.core.$ZodTypeInternals<RuntimeJson, unknown>>>>>;
511
- allowDisabled: z.ZodOptional<z.ZodBoolean>;
512
- }, z.core.$strict>;
513
- }, z.core.$strict>]>;
514
- expectedIdentity: z.ZodOptional<z.ZodObject<{
515
- stepId: z.ZodString;
516
- surface: z.ZodString;
517
- scopeId: z.ZodString;
518
- interactionKey: z.ZodString;
519
- interactionId: z.ZodString;
520
- actuatorId: z.ZodString;
521
- descriptorDigest: z.ZodOptional<z.ZodString>;
522
- draftDigest: z.ZodOptional<z.ZodString>;
523
- }, z.core.$strict>>;
524
- expect: z.ZodObject<{
525
- frameId: z.ZodOptional<z.ZodString>;
526
- projectionDigest: z.ZodOptional<z.ZodString>;
527
- semanticDigest: z.ZodOptional<z.ZodString>;
528
- draftDigest: z.ZodOptional<z.ZodString>;
529
- submissionDigest: z.ZodOptional<z.ZodString>;
530
- focusedInteractionKey: z.ZodOptional<z.ZodString>;
531
- visibleInteractionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
532
- }, z.core.$strict>;
533
- }, z.core.$strict>, z.ZodObject<{
534
- stepId: z.ZodString;
535
- kind: z.ZodLiteral<"assert">;
536
- expect: z.ZodObject<{
537
- frameId: z.ZodOptional<z.ZodString>;
538
- projectionDigest: z.ZodOptional<z.ZodString>;
539
- semanticDigest: z.ZodOptional<z.ZodString>;
540
- draftDigest: z.ZodOptional<z.ZodString>;
541
- submissionDigest: z.ZodOptional<z.ZodString>;
542
- focusedInteractionKey: z.ZodOptional<z.ZodString>;
543
- visibleInteractionKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
544
- }, z.core.$strict>;
545
- }, z.core.$strict>]>>;
546
- expected: z.ZodObject<{
547
- initialProjectionDigest: z.ZodString;
548
- finalProjectionDigest: z.ZodString;
549
- finalSemanticDigest: z.ZodString;
550
- submissionDigest: z.ZodString;
551
- }, z.core.$strict>;
552
- }, z.core.$strict>;
553
- declare const uiScenarioFixtureBundleIndexSchema: z.ZodObject<{
554
- schemaVersion: z.ZodLiteral<2>;
555
- bundleId: z.ZodString;
556
- sdkCommit: z.ZodString;
557
- pluginRuntimeProtocol: z.ZodLiteral<4>;
558
- browserInteractionProtocol: z.ZodLiteral<"3.0.0">;
559
- fixtures: z.ZodArray<z.ZodObject<{
560
- id: z.ZodString;
561
- file: z.ZodString;
562
- sha256: z.ZodString;
563
- renderModule: z.ZodString;
564
- renderModuleSha256: z.ZodString;
565
- components: z.ZodArray<z.ZodString>;
566
- capabilities: z.ZodArray<z.ZodString>;
567
- }, z.core.$strict>>;
568
- }, z.core.$strict>;
569
- type UIReplayRequest = BrowserInteractionIntentRequest | BrowserInteractionEffectRequest;
570
- type UIReplayExecution = z.infer<typeof uiReplayExecutionSchema>;
571
- type UIStepExpectation = z.infer<typeof uiStepExpectationSchema>;
572
- type UIResolvedReplayIdentity = z.infer<typeof uiResolvedReplayIdentitySchema>;
573
- type PortableSemanticReplayStep = z.infer<typeof portableSemanticReplayStepSchema>;
574
- type UIScenarioReplayStep = z.infer<typeof uiScenarioReplayStepSchema>;
575
- type UIFixtureFrame = y;
576
- type UIFixtureProtocolStep = z$1;
577
- type PluginProtocolTape = B;
578
- type UIScenarioFixture = Omit<z.infer<typeof uiScenarioFixtureSchema>, "protocol" | "replay"> & {
579
- readonly protocol: PluginProtocolTape;
580
- readonly replay: readonly UIScenarioReplayStep[];
581
- };
582
- type UIScenarioFixtureBundleIndex = z.infer<typeof uiScenarioFixtureBundleIndexSchema>;
583
- declare function parseUIScenarioFixture(value: unknown): UIScenarioFixture;
584
- declare function parseUIScenarioFixtureBundleIndex(value: unknown): UIScenarioFixtureBundleIndex;
585
- declare function assertSupportedBrowserInteractionProtocol(version: string): void;
586
-
587
- type UIScenarioAuthorityKind = "protocol" | "reducer";
588
- interface UIScenarioEnvironmentDefinition {
589
- readonly viewport?: "desktop" | "tablet" | "phone";
590
- readonly browsers?: readonly ("chromium" | "webkit")[];
591
- readonly input?: readonly ("mouse" | "touch" | "keyboard")[];
592
- }
593
- interface ProtocolUIScenarioAuthority {
594
- readonly kind: "protocol";
595
- readonly tape: PluginProtocolTape;
589
+ interface CapturedSubmission {
590
+ readonly operation: "submit" | "cancel";
591
+ readonly interactionId: string;
592
+ readonly params?: RuntimeJson;
593
+ resolve(result: SubmitResult): void;
596
594
  }
597
- interface ReducerUIScenarioAuthority {
598
- readonly kind: "reducer";
599
- readonly referenceGame: unknown;
600
- readonly coverage: unknown;
601
- readonly bundle: unknown;
602
- readonly initialState: unknown;
603
- readonly viewer: unknown;
604
- readonly playerIds?: readonly string[];
605
- readonly operations: readonly unknown[];
606
- }
607
- type UIScenarioAuthority = ProtocolUIScenarioAuthority | ReducerUIScenarioAuthority;
608
- interface UIScenarioDefinition {
609
- readonly id: string;
610
- readonly title?: string;
611
- readonly contracts: readonly string[];
612
- readonly capabilities: readonly string[];
613
- readonly sourceFiles: readonly string[];
614
- readonly environment?: UIScenarioEnvironmentDefinition;
615
- readonly authority: UIScenarioAuthority;
616
- readonly replay: readonly UIScenarioReplayStep[];
595
+ interface TestSource extends CommandSource {
596
+ readonly submissions: readonly CapturedSubmission[];
597
+ emit(snapshot: SourceSnapshot): void;
598
+ recovering(): void;
599
+ fail(error: Error): void;
617
600
  }
601
+ /** Test-owned transport control; all request/barrier behavior remains production code. */
602
+ declare function createTestSource(initial: SourceSnapshot): TestSource;
618
603
 
619
- declare function defineUIScenario<const TScenario extends UIScenarioDefinition>(scenario: TScenario): Readonly<TScenario>;
620
-
621
- type CanonicalJson = null | boolean | number | string | readonly CanonicalJson[] | {
622
- readonly [key: string]: CanonicalJson;
623
- };
624
- declare function isSha256Digest(value: string): boolean;
625
- declare function canonicalizeUIFixtureJson(value: unknown): CanonicalJson;
626
- declare function canonicalUIFixtureJson(value: unknown): string;
627
- declare function digestUIFixtureJson(value: unknown): string;
628
- declare function digestUIFixtureRequest(request: UIReplayRequest): string;
629
- declare function digestUIFixtureTransportRequest(request: {
630
- readonly operation: "validate" | "submit";
631
- readonly basis?: {
632
- readonly version: number;
633
- readonly actionSetVersion: string;
634
- readonly perspectivePlayerId: string;
635
- };
636
- readonly interactionId?: string;
637
- readonly payload?: unknown;
638
- }): string;
639
- declare function digestPluginProtocolTape(tape: PluginProtocolTape): string;
640
- declare function canonicalizeUIScenarioFixture(fixture: UIScenarioFixture): UIScenarioFixture;
641
- declare function serializeUIScenarioFixture(fixture: UIScenarioFixture): string;
642
- declare function digestUIScenarioFixture(fixture: UIScenarioFixture): string;
643
-
644
- interface FixtureHostEvent {
645
- readonly sequence: number;
646
- readonly atMs: number;
647
- readonly kind: "frame-sent" | "submit-received" | "ack-received" | "ready-received" | "diagnostic";
648
- readonly requestDigest?: string;
649
- readonly frameId?: string;
650
- readonly projectionDigest?: string;
651
- readonly result?: "accepted" | "rejected";
652
- }
653
- interface FixtureHostHarness {
654
- readonly transport: PluginTransport;
655
- readonly tape: B;
656
- reset(): void;
657
- flush(): Promise<void>;
658
- advanceHost(): Promise<void>;
659
- getCurrentFrameId(): string;
660
- getEvents(): readonly FixtureHostEvent[];
661
- assertConsumed(): void;
604
+ /** JSON round-trippable tooling checkpoint. Private state stays in testing. */
605
+ interface LocalCheckpoint {
606
+ readonly state: ReducerSessionState;
607
+ readonly terminal: GameOutcome | null;
662
608
  }
663
- interface CreateFixtureHostHarnessOptions {
664
- readonly tape: B;
665
- readonly strict?: boolean;
666
- readonly latencyMs?: number;
667
- readonly channelId?: string;
668
- readonly onEvent?: (event: FixtureHostEvent) => void;
669
- readonly nowMs?: () => number;
609
+ interface LocalSource<Game> extends CommandSource, ApplySource<ScenarioCommandOf<Game>, Promise<SubmitResult>> {
610
+ switchSeat(playerId: string): void;
611
+ checkpoint(): LocalCheckpoint;
612
+ /** Parses untrusted checkpoint JSON before replacing state. */
613
+ restore(checkpoint: unknown): void;
614
+ inspect(): SourceSnapshot;
615
+ explore(options: {
616
+ maxEvaluations: number;
617
+ }): Promise<readonly ScenarioCommandOf<Game>[]>;
670
618
  }
671
- declare function createFixtureHostHarness(options: CreateFixtureHostHarnessOptions): FixtureHostHarness;
672
619
 
673
- declare function FixturePluginRuntime({ harness, runtime, children, }: {
674
- harness: FixtureHostHarness;
675
- runtime?: PluginRuntimeClient;
676
- children: react__default.ReactNode;
677
- }): react_jsx_runtime.JSX.Element;
620
+ declare function localSource<Contract extends ReducerGameContractLike, const Game extends AnyReducerGameDefinition<Contract>>(game: Game & {
621
+ readonly contract: Contract;
622
+ }, options: {
623
+ players: number;
624
+ seed: number;
625
+ as?: string;
626
+ options?: OptionsOfContract<Game["contract"]>;
627
+ }): Promise<LocalSource<Game>>;
678
628
 
679
- interface CompilePluginProtocolTapeOptions {
680
- readonly trace: ReducerScenarioTrace;
681
- readonly session: E;
682
- }
683
- declare function compilePluginProtocolTape(options: CompilePluginProtocolTapeOptions): PluginProtocolTape;
629
+ declare function scenarioSource<Contract extends ReducerGameContractLike, const Game extends AnyReducerGameDefinition<Contract>>(game: Game & {
630
+ readonly contract: Contract;
631
+ }, scenario: ScenarioDefinition<Game>, options?: {
632
+ at?: ScenarioCheckpointSelector;
633
+ as?: string;
634
+ }): Promise<LocalSource<Game>>;
684
635
 
685
- interface FixtureEnvironmentInit {
686
- readonly clockIso: string;
687
- readonly randomSeed: string;
688
- readonly locale: "en-US";
689
- readonly timezone: "UTC";
690
- readonly reducedMotion: true;
691
- readonly network: "blocked";
636
+ interface FuzzResult<Game> {
637
+ readonly commands: readonly ScenarioCommandOf<Game>[];
638
+ readonly checkpoint: LocalCheckpoint;
639
+ readonly error?: Error;
692
640
  }
693
- declare const defaultFixtureEnvironmentInit: FixtureEnvironmentInit;
694
- type DeterministicIdFactory = () => string;
695
- declare function createDeterministicIdFactory(seed: string): DeterministicIdFactory;
696
- declare function fixtureEnvironmentInitFor(options: {
697
- readonly clockIso: string;
698
- readonly randomSeed: string;
699
- }): FixtureEnvironmentInit;
641
+ /** Deterministic testing choice RNG is independent from the game's authoritative RNG. */
642
+ declare function fuzz<Contract extends ReducerGameContractLike, const Game extends AnyReducerGameDefinition<Contract>>(game: Game & {
643
+ readonly contract: Contract;
644
+ }, options: {
645
+ seed: number;
646
+ steps: number;
647
+ players?: number;
648
+ maxEvaluations?: number;
649
+ }): Promise<FuzzResult<Game>>;
700
650
 
701
- interface CompileUIScenarioFixtureOptions {
651
+ type CandidateVerificationScenario<Game> = ScenarioDefinition<Game>;
652
+ type CandidateVerificationInput<Game> = {
653
+ /** The exact compiled production artifact under verification. */
654
+ readonly bundle: ReducerBundleContract;
655
+ /** Authored scenario schemas and inspection metadata; not execution authority. */
656
+ readonly reducer: Game;
657
+ readonly scenarios: Readonly<Record<string, CandidateVerificationScenario<Game>>> | readonly CandidateVerificationScenario<Game>[];
658
+ readonly maxScenarios?: number;
659
+ readonly maxStepsPerScenario?: number;
660
+ };
661
+ type CandidateVerificationReplayDiagnostic = {
662
+ readonly kind: "replay";
663
+ readonly message: string;
664
+ readonly scenarioId?: string;
665
+ readonly segment?: "given" | "when";
666
+ readonly index?: number;
667
+ readonly interactionId?: string;
668
+ readonly errorCode?: string;
669
+ readonly reducerMessage?: string;
670
+ readonly trace?: readonly DispatchTraceSummaryEntry[];
671
+ };
672
+ type CandidateVerificationAssertionDiagnostic = {
673
+ readonly kind: "assertion";
674
+ readonly message: string;
675
+ };
676
+ type CandidateVerificationLimitDiagnostic = {
677
+ readonly kind: "limit";
678
+ readonly message: string;
679
+ readonly actualSteps: number;
680
+ readonly maxStepsPerScenario: number;
681
+ };
682
+ type CandidateVerificationScenarioResult = {
702
683
  readonly id: string;
703
- readonly title: string;
704
- readonly gameId: string;
705
- readonly tags?: readonly string[];
706
- readonly source: UIScenarioFixture["source"];
707
- readonly viewer: UIScenarioFixture["viewer"];
708
- readonly environment: UIScenarioFixture["environment"];
709
- readonly protocol: PluginProtocolTape;
710
- readonly replay?: readonly UIScenarioReplayStep[];
711
- readonly expected?: Partial<UIScenarioFixture["expected"]>;
712
- }
713
- type UIReplayIdentityCandidate = UIResolvedReplayIdentity;
714
- declare function compileUIScenarioFixture(options: CompileUIScenarioFixtureOptions): UIScenarioFixture;
715
- declare function assertDeterministicUIScenarioFixture(first: UIScenarioFixture, second: UIScenarioFixture): void;
716
- declare function assertUniqueReplayIdentity(step: Pick<PortableSemanticReplayStep, "stepId" | "expectedIdentity">, candidates: readonly UIReplayIdentityCandidate[]): UIReplayIdentityCandidate;
717
- declare function assertUIStepExpectationSatisfied(stepId: string, expected: UIStepExpectation, actual: UIStepExpectation): void;
718
-
719
- type ReplayRequest = PortableSemanticReplayStep["resolve"];
720
- type DragTarget = Extract<PortableSemanticReplayStep["execute"], {
721
- kind: "drag";
722
- }>["target"];
723
- interface ReplayStepOptions {
724
- readonly stepId: string;
725
- readonly resolve: ReplayRequest;
726
- readonly expect: UIStepExpectation;
727
- readonly expectedIdentity?: UIResolvedReplayIdentity;
728
- }
729
- interface FillReplayStepOptions extends ReplayStepOptions {
730
- readonly value: string;
731
- }
732
- interface DragReplayStepOptions extends ReplayStepOptions {
733
- readonly target: DragTarget;
734
- }
735
- declare function activate(options: ReplayStepOptions): UIScenarioReplayStep;
736
- declare function fill(options: FillReplayStepOptions): UIScenarioReplayStep;
737
- declare function press(options: ReplayStepOptions): UIScenarioReplayStep;
738
- declare function drag(options: DragReplayStepOptions): UIScenarioReplayStep;
739
- declare function submit(options: ReplayStepOptions): UIScenarioReplayStep;
740
- declare function assertStep(stepId: string, expect: UIStepExpectation): UIScenarioReplayStep;
684
+ readonly status: "passed" | "failed";
685
+ readonly diagnostic?: CandidateVerificationReplayDiagnostic | CandidateVerificationAssertionDiagnostic | CandidateVerificationLimitDiagnostic;
686
+ };
687
+ type CandidateVerificationResult = {
688
+ readonly status: "passed" | "failed";
689
+ readonly scenarioSummary: {
690
+ readonly total: number;
691
+ readonly passed: number;
692
+ readonly failed: number;
693
+ readonly scenarios: readonly CandidateVerificationScenarioResult[];
694
+ };
695
+ };
696
+ declare function runCandidateVerification<Contract extends ReducerGameContractLike, const Game extends AnyReducerGameDefinition<Contract>>(input: CandidateVerificationInput<Game> & {
697
+ readonly reducer: {
698
+ readonly contract: Contract;
699
+ };
700
+ }): Promise<CandidateVerificationResult>;
741
701
 
742
- export { ActorRef, type CompilePluginProtocolTapeOptions, type CompileUIScenarioFixtureOptions, type CreateFixtureHostHarnessOptions, type CreateReducerScenarioRunnerOptions, type DeterministicIdFactory, ExpectFn, type ExploreScenarioOptions, type ExploreScenarioResult, type ExploreSeedResult, type ExploreTransitionResult, type FixtureEnvironmentInit, type FixtureHostEvent, type FixtureHostHarness, FixturePluginRuntime, FlowDiagnostic, InspectEntropy, InspectNode, type InspectScenarioOptions, InspectScenarioResult, PerspectiveRef, PerspectiveSelector, type PluginProtocolTape, type PortableSemanticReplayStep, type ProtocolUIScenarioAuthority, type ReducerScenarioBundle, type ReducerScenarioDiagnostic, type ReducerScenarioExchange, type ReducerScenarioFrame, type ReducerScenarioOperation, type ReducerScenarioRunner, type ReducerScenarioTrace, type ReducerScenarioViewer, type ReducerUIScenarioAuthority, ScenarioAssertionError, ScenarioCheckpoint, ScenarioCommand, ScenarioDispatchTraceEntry, ScenarioIdentity, ScenarioReplayDefinition, Sha256Digest, SnapshotMatcherHandler, type UIFixtureFrame, type UIFixtureProtocolStep, type UIReplayExecution, type UIReplayIdentityCandidate, type UIReplayRequest, type UIResolvedReplayIdentity, type UIScenarioAuthority, type UIScenarioAuthorityKind, type UIScenarioDefinition, type UIScenarioEnvironmentDefinition, type UIScenarioFixture, type UIScenarioFixtureBundleIndex, type UIScenarioReplayStep, type UIStepExpectation, UI_SCENARIO_FIXTURE_BUNDLE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_PLUGIN_RUNTIME_PROTOCOL, UI_SCENARIO_FIXTURE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_SUPPORTED_BROWSER_PROTOCOL_MAJOR, activate, assertDeterministicUIScenarioFixture, assertStep, assertSupportedBrowserInteractionProtocol, assertUIStepExpectationSatisfied, assertUniqueReplayIdentity, canonicalUIFixtureJson, canonicalizeUIFixtureJson, canonicalizeUIScenarioFixture, compilePluginProtocolTape, compileUIScenarioFixture, createDeterministicIdFactory, createExpectApi, createFixtureHostHarness, createReducerScenarioRunner, defaultFixtureEnvironmentInit, defineUIScenario, digestPluginProtocolTape, digestUIFixtureJson, digestUIFixtureRequest, digestUIFixtureTransportRequest, digestUIScenarioFixture, drag, exploreScenario, fill, fixtureEnvironmentInitFor, inspectScenario, isSha256Digest, parseUIScenarioFixture, parseUIScenarioFixtureBundleIndex, pluginProtocolTapeSchema, portableSemanticReplayStepSchema, press, serializeUIScenarioFixture, submit, uiFixtureFrameSchema, uiFixtureProtocolStepSchema, uiReplayExecutionSchema, uiReplayRequestSchema, uiResolvedReplayIdentitySchema, uiScenarioFixtureBundleIndexSchema, uiScenarioFixtureSchema, uiScenarioReplayStepSchema, uiStepExpectationSchema };
702
+ export { type ActorRef, type AssertScenarioOptions, type CandidateVerificationAssertionDiagnostic, type CandidateVerificationInput, type CandidateVerificationLimitDiagnostic, type CandidateVerificationReplayDiagnostic, type CandidateVerificationResult, type CandidateVerificationScenario, type CandidateVerificationScenarioResult, type CapturedSubmission, type CreateReducerScenarioRunnerOptions, type ExpectFn, type ExpectMatchers, type ExploreScenarioOptions, type ExploreScenarioResult, type ExploreSeedResult, type ExploreTransitionResult, type FlowDiagnostic, type FuzzResult, type InspectAction, type InspectEntropy, type InspectInteraction, type InspectInteractionInput, type InspectNode, type InspectScenarioOptions, type InspectScenarioResult, type InteractionAvailabilityLike, type InteractionDescriptorLike, type InteractionExplanationLike, type LocalCheckpoint, type LocalSource, type PerspectiveRef, type PerspectiveSelector, type ReducerScenarioBundle, type ReducerScenarioDiagnostic, type ReducerScenarioExchange, type ReducerScenarioFrame, type ReducerScenarioOperation, type ReducerScenarioRunner, type ReducerScenarioTrace, type ReducerScenarioViewer, type RejectionExpectation, type ReplayScenarioOptions, type RuntimeParamsOfScenarioCommand, type ScenarioActor, type ScenarioAssertionContext, ScenarioAssertionError, type ScenarioAuthoring, type ScenarioCheckpoint, type ScenarioCheckpointId, type ScenarioCheckpointSelector, type ScenarioCommand, type ScenarioCommandOf, type ScenarioCommandTraceEntry, type ScenarioDefinition, type ScenarioDefinitionValidationCode, ScenarioDefinitionValidationError, type ScenarioDiagnostics, type ScenarioDispatchTraceEntry, type ScenarioFlowDiagnostics, type ScenarioIdentity, type ScenarioProbeAccepted, type ScenarioProbeRejected, type ScenarioProbeResult, type ScenarioReplay, type ScenarioReplayDefinition, ScenarioReplayError, type ScenarioReplayErrorOptions, type ScenarioReplaySegment, type ScenarioRuntimeCheckpointMaterialization, type ScenarioSchemaOutput, type ScenarioSeatRef, type ScenarioSetup, type Sha256Digest, type SnapshotMatcherHandler, type TestSource, assertScenario, createExpectApi, createReducerScenarioRunner, createScenarioAuthoring, createTestSource, exploreScenario, fuzz, inspectScenario, localSource, materializeScenarioRuntimeCheckpoint, probeScenarioCommand, replayScenario, resolveScenarioCheckpoint, runCandidateVerification, scenarioSource, toScenarioReplayDefinition };