@threenative/playtest 0.3.4 → 0.3.6

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.
@@ -1,749 +1,5 @@
1
- import { PlaytestFramePhase, PlaytestFramePassKind, IPlaytestGeometryCaptureRequest, JsonValue, IPlaytestRenderChainObservation, IPlaytestSceneObservation, IPlaytestSceneNodesObservation, IPlaytestStartupTimeline } from './protocol.js';
2
-
3
- type PlaytestTarget = "web" | "desktop" | "bevy";
4
- type PlaytestInputDelivery = "deterministic" | "focused-dom";
5
- interface IPlaytestViewport$1 {
6
- height: number;
7
- width: number;
8
- }
9
- interface IPlaytestPointer {
10
- buttons?: number;
11
- id: number;
12
- x: number;
13
- y: number;
14
- }
15
- interface IPlaytestWheel {
16
- deltaX?: number;
17
- deltaY: number;
18
- }
19
- type IPlaytestResourceWait = {
20
- equals: unknown;
21
- gte?: never;
22
- id: string;
23
- lte?: never;
24
- path: string;
25
- } | {
26
- equals?: never;
27
- gte: number;
28
- id: string;
29
- lte?: never;
30
- path: string;
31
- } | {
32
- equals?: never;
33
- gte?: never;
34
- id: string;
35
- lte: number;
36
- path: string;
37
- };
38
- interface IPlaytestStep {
39
- kind?: "aimAt" | "click" | "input" | "lifecycle" | "wait";
40
- /** @deprecated Use holdTicks. Fixed-step bridges treat this as a tick alias. */
41
- holdFrames?: number;
42
- holdTicks?: number;
43
- /** A viewport-pixel click target, resolved directly or from a registered entity's bounds. */
44
- at?: IPlaytestClickTarget;
45
- label?: string;
46
- /**
47
- * One device-lifecycle operation the runner drives through the platform driver, so the phases it
48
- * then reports are read off the device rather than asserted by the game about itself.
49
- */
50
- lifecycle?: IPlaytestLifecycleStep;
51
- overlayMessage?: {
52
- overlayId: string;
53
- payload: unknown;
54
- type: string;
55
- };
56
- pitch?: number;
57
- pointerPosition?: {
58
- buttons?: number;
59
- x: number;
60
- y: number;
61
- };
62
- /** The complete held-pointer set for this step, in arrival order. */
63
- pointers?: readonly IPlaytestPointer[];
64
- /** A string presses one key; an array describes the complete held-key set. */
65
- press?: string | readonly string[];
66
- release: boolean;
67
- screenshot?: string;
68
- /** Runner-native aim: yaw/pitch are computed from the sampled subject position. */
69
- target?: IPlaytestAimTarget;
70
- timeoutMs?: number;
71
- /** @deprecated Use waitTicks. Fixed-step bridges treat this as a tick alias. */
72
- waitFrames?: number;
73
- waitForResource?: IPlaytestResourceWait;
74
- waitTicks?: number;
75
- /** A browser/native wheel sample; negative DOM deltaY is the conventional toward-user gesture. */
76
- wheel?: IPlaytestWheel;
77
- window?: {
78
- height?: number;
79
- operation: "minimize" | "resize" | "restore";
80
- width?: number;
81
- };
82
- }
83
- /** Where an aimAt step points: a world xz position or another registered entity. */
84
- type IPlaytestAimTarget = {
85
- entity: string;
86
- } | {
87
- x: number;
88
- z: number;
89
- };
90
- /**
91
- * The device operations a `lifecycle` step names.
92
- *
93
- * `rotate` is the only one that carries an argument, and the `?: never` arms are what stop a
94
- * scenario from writing `{ operation: "background", rotation: 1 }` and having the rotation
95
- * silently dropped.
96
- */
97
- type IPlaytestLifecycleStep = {
98
- operation: "background";
99
- rotation?: never;
100
- } | {
101
- operation: "foreground";
102
- rotation?: never;
103
- } | {
104
- operation: "rotate";
105
- rotation: number;
106
- };
107
- type IPlaytestClickTarget = {
108
- entity: string;
109
- } | {
110
- x: number;
111
- y: number;
112
- };
113
- interface IPlaytestMovementAssertion {
114
- axis?: string;
115
- closesDistanceToPosition?: {
116
- position: [number, number, number];
117
- min: number;
118
- };
119
- entity?: string;
120
- facesMovementWithinDegrees?: number;
121
- minAxisDelta?: {
122
- axis: string;
123
- min: number;
124
- };
125
- minResolvedAxisDelta?: {
126
- axis: string;
127
- min: number;
128
- };
129
- maxTiltDegrees?: number;
130
- minDistance?: number;
131
- minVelocity?: number;
132
- maxDistance?: number;
133
- pathLength?: number;
134
- notFacing?: {
135
- entity: string;
136
- minDegrees: number;
137
- };
138
- notFacingPosition?: {
139
- position: [number, number, number];
140
- minDegrees: number;
141
- };
142
- reachesPositionWithin?: {
143
- atStep?: string;
144
- position: [number, number, number];
145
- maxDistance: number;
146
- };
147
- rotationChanged?: boolean;
148
- }
149
- interface IPlaytestCameraAssertion {
150
- entity?: string;
151
- follows?: string;
152
- targetInViewport?: boolean;
153
- within?: number;
154
- }
155
- interface IPlaytestPathAssertion {
156
- atSteps?: Array<{
157
- equals?: unknown;
158
- label: string;
159
- textIncludes?: string;
160
- }>;
161
- changed?: boolean;
162
- equals?: unknown;
163
- gte?: number;
164
- id: string;
165
- lte?: number;
166
- allowTrivial?: string;
167
- path?: string;
168
- textIncludes?: string;
169
- throughoutSteps?: boolean;
170
- /** Require a DOM node to occupy pixels above the page at the sampled viewport centre. */
171
- visible?: boolean;
172
- }
173
- interface IPlaytestResourcePathAlternative {
174
- changed?: boolean;
175
- equals?: unknown;
176
- gte?: number;
177
- lte?: number;
178
- path: string;
179
- textIncludes?: string;
180
- }
181
- interface IPlaytestResourcePathAssertion extends IPlaytestPathAssertion {
182
- anyOf?: never;
183
- }
184
- interface IPlaytestResourceAnyOfAssertion {
185
- anyOf: IPlaytestResourcePathAlternative[];
186
- atSteps?: never;
187
- changed?: never;
188
- equals?: never;
189
- gte?: never;
190
- id: string;
191
- lte?: never;
192
- allowTrivial?: never;
193
- path?: never;
194
- textIncludes?: never;
195
- throughoutSteps?: never;
196
- }
197
- type IPlaytestResourceAssertion = IPlaytestResourceAnyOfAssertion | IPlaytestResourcePathAssertion;
198
- interface IPlaytestComponentAssertion extends Omit<IPlaytestPathAssertion, "id" | "textIncludes" | "throughoutSteps"> {
199
- component: string;
200
- entity: string;
201
- }
202
- interface IPlaytestContactAssertion {
203
- atStep?: string;
204
- entity?: string;
205
- kind?: string;
206
- maxCount?: number;
207
- minCount?: number;
208
- requiredOn?: PlaytestTarget[];
209
- with?: string;
210
- }
211
- interface IPlaytestSignalAssertion {
212
- atStep?: string;
213
- entity?: string;
214
- maxCount?: number;
215
- minCount?: number;
216
- name: string;
217
- }
218
- interface IPlaytestSettledAssertion {
219
- atStep?: string;
220
- allowTrivial?: string;
221
- compareToStep?: string;
222
- entity?: string;
223
- minBodies?: number;
224
- minMeanPoseDistance?: number;
225
- requiredOn?: PlaytestTarget[];
226
- }
227
- interface IPlaytestOccludedAssertion {
228
- allowTrivial?: string;
229
- entity?: string;
230
- target?: string;
231
- }
232
- interface IPlaytestOverlayNodeAssertion {
233
- attribute?: string;
234
- equals?: unknown;
235
- overlayId: string;
236
- selector: string;
237
- textIncludes?: string;
238
- visible?: boolean;
239
- }
240
- /**
241
- * Bounds on the room the game is played in — what a screenshot would have shown, as numbers.
242
- *
243
- * Every member fails closed on an unobserved scene: a bridge that does not report `scene.observe`
244
- * has not reported a well-lit one.
245
- */
246
- interface IPlaytestSceneAssertion {
247
- allowTrivial?: string;
248
- /** Fail when the camera's far plane cuts the scene it is pointed at. */
249
- cameraClearsScene?: boolean;
250
- /** Fail when a linear fog reaches full colour in front of the scene it is fogging. */
251
- fogClearsScene?: boolean;
252
- /** Fail when lit materials are mounted and no light in the scene is visible. */
253
- litMaterialsAreLit?: boolean;
254
- /** Floor on how many lights the renderer will actually see. */
255
- minVisibleLights?: number;
256
- }
257
- /**
258
- * Bounds on named nodes of the scene graph — the questions a screenshot gets taken for.
259
- *
260
- * `scene` bounds the room as a whole: is anything lit, does the fog clear the world. This bounds
261
- * one object: is the crate where the game says it is, is it inside the camera's frustum, did its
262
- * texture load, is the character's mesh actually visible once every ancestor's flag is taken into
263
- * account. Each is a frame-destroying failure that leaves every count healthy.
264
- *
265
- * `select` is required and every other member is optional, but an assertion that sets only
266
- * `select` throws at load: selecting nodes and bounding nothing is the vacuous pass this package
267
- * refuses. Every bound fails closed — a run whose bridge reported no scene nodes has not reported
268
- * a visible crate, it has reported nothing.
269
- */
270
- interface IPlaytestSceneNodesAssertion {
271
- allowTrivial?: string;
272
- /** Require every matched node to have at least one clip mounted, or none to. */
273
- animated?: boolean;
274
- /** Require every matched node's world bounds to intersect the active camera's frustum. */
275
- inFrustum?: boolean;
276
- /** Ceiling on how many nodes the selector may match. Zero asserts absence. */
277
- maxCount?: number;
278
- /** Floor on how many nodes the selector must match. Defaults to 1 when absent. */
279
- minCount?: number;
280
- /** Floor on the summed triangle count of every matched node. */
281
- minTriangles?: number;
282
- /** Which nodes to bound. A selector that matches fewer than `minCount` fails. */
283
- select: IPlaytestSceneNodeSelectorSpec;
284
- /** Require every bound texture slot on every matched node to carry pixels. */
285
- texturesLoaded?: boolean;
286
- /** Require every matched node to be visible with every ancestor visible too. */
287
- visible?: boolean;
288
- }
289
- /**
290
- * Which nodes an assertion is about. Every present field must match; an absent field does not
291
- * filter. At least one field is required — a selector that filters nothing selects the whole
292
- * scene graph and bounds nothing in particular.
293
- */
294
- interface IPlaytestSceneNodeSelectorSpec {
295
- limit?: number;
296
- name?: string;
297
- nameContains?: string;
298
- pathContains?: string;
299
- type?: string;
300
- }
301
- /**
302
- * "It happened **because** of that, and never before it."
303
- *
304
- * The one sentence a proof of a physics puzzle actually has to make, and the one this harness
305
- * could not make. A run could already say *a contact happened* and *the state reads `won`*, and
306
- * `atSteps` could order them at step boundaries — where a win arriving one tick after the contact
307
- * and a win arriving 199 ticks later inside the same step are the same observation. That is the
308
- * signature of a terminal state driven by a timer or a distance check that merely lands near a
309
- * contact, and it is what a sealed proof exists to refuse.
310
- *
311
- * Both sides are tick-stamped by the producer. A run whose contacts or transitions carry no ticks
312
- * fails closed and names which side was unstamped; it never falls back to step granularity, which
313
- * is a different measurement wearing the same name.
314
- */
315
- interface IPlaytestCausedByAssertion {
316
- allowTrivial?: string;
317
- cause: IPlaytestCauseSpec;
318
- effect: IPlaytestEffectSpec;
319
- /**
320
- * Fail when the effect is ever observed before the first matching cause. This is the frame-one
321
- * fake win: a goal volume overlapping the floor reports `won` before anything touched it.
322
- */
323
- neverBefore?: boolean;
324
- /** Ceiling on `effectTick - causeTick`. A win long after the contact was not caused by it. */
325
- withinTicks?: number;
326
- }
327
- /** What must have happened first. */
328
- interface IPlaytestCauseSpec {
329
- contact?: {
330
- entity: string;
331
- kind?: string;
332
- with: string;
333
- };
334
- /** A published value reaching a given value, named the same way an effect is. */
335
- transition?: IPlaytestEffectSpec;
336
- }
337
- /** The published value whose change is being explained. */
338
- interface IPlaytestEffectSpec {
339
- /** `states.<entity>` or `state.<field>`, exactly as the transition log reports it. */
340
- path: string;
341
- /** The value the path must reach. */
342
- becomes: boolean | number | string;
343
- }
344
- interface IPlaytestAnimationAssertion {
345
- advancedFrames?: number;
346
- allowTrivial?: string;
347
- clip?: string;
348
- entered?: boolean;
349
- entity?: string;
350
- finished?: boolean;
351
- /**
352
- * Ceiling on |feet − ground| / ground for the observed clip. A run whose producer reports no
353
- * stride fails closed: the convention is on by default, so silence is a missing observation,
354
- * not agreement.
355
- */
356
- maxFootSlide?: number;
357
- /** Require the stride convention to be applied (`true`) or deliberately overridden (`false`). */
358
- strideSynced?: boolean;
359
- }
360
- interface IPlaytestTagCountAssertion {
361
- allowTrivial?: string;
362
- count?: number;
363
- gte?: number;
364
- lte?: number;
365
- tag: string;
366
- }
367
- interface IPlaytestStateAssertion {
368
- allowTrivial?: string;
369
- entity?: string;
370
- equals: string;
371
- }
372
- interface IPlaytestVisibilityAssertion {
373
- allowTrivial?: string;
374
- entity?: string;
375
- maxOffscreenRatio?: number;
376
- minProjectedPixels?: number;
377
- present?: boolean;
378
- }
379
- interface IPlaytestDiagnosticsAssertion {
380
- noConsoleErrors?: boolean;
381
- noNetworkErrors?: boolean;
382
- noRuntimeDiagnostics?: boolean;
383
- consoleErrorsOptOutReason?: string;
384
- networkErrorsOptOutReason?: string;
385
- runtimeDiagnosticsOptOutReason?: string;
386
- runtimeReady?: boolean;
387
- }
388
- interface IPlaytestPerformanceAssertion {
389
- maxDrawCalls?: number;
390
- maxFrameMsP95?: number;
391
- maxTriangles?: number;
392
- /** Frame-budget floor: the median presented frame must sustain at least this many frames a second. */
393
- minFps?: number;
394
- /**
395
- * Per-phase ceilings in milliseconds, nearest-rank p95 across the sampled frames. The phase
396
- * names are the engine's frame-budget phases: hostGap, update, render, overlay, residual.
397
- */
398
- maxPhaseMsP95?: Readonly<Partial<Record<PlaytestFramePhase, number>>>;
399
- /**
400
- * Per-pass draw-call ceilings, keyed by pass kind: main, shadow, reflection, nested. The bound
401
- * is the largest draw count that kind submitted in a sampled frame, so a shadow lane folded into
402
- * the whole-frame `maxDrawCalls` is bounded on its own.
403
- */
404
- maxPassDrawCalls?: Readonly<Partial<Record<PlaytestFramePassKind, number>>>;
405
- /** Per-pass triangle ceilings, keyed by pass kind: main, shadow, reflection, nested. */
406
- maxPassTriangles?: Readonly<Partial<Record<PlaytestFramePassKind, number>>>;
407
- }
408
- /** The stage expectations a render-chain assertion can hold, without its own per-adapter branches. */
409
- interface IPlaytestRenderChainExpectation {
410
- contributions?: {
411
- graphOutputChanged: string[];
412
- };
413
- tier?: "high" | "medium" | "low" | "off";
414
- stages?: {
415
- includes?: string[];
416
- excludes?: string[];
417
- /** Ordered subsequence of applied stage ids, not necessarily the complete chain. */
418
- order?: string[];
419
- };
420
- velocity?: {
421
- maxRejectionFraction: number;
422
- };
423
- }
424
- interface IPlaytestRenderChainAssertion extends IPlaytestRenderChainExpectation {
425
- /**
426
- * What the chain must look like on each adapter the run's own `adapter.info` classified, chosen
427
- * by the harness's software-adapter detector rather than by anything the game reported. A lane
428
- * whose adapter cannot be classified is a failed observation, not a hardware one: a missing
429
- * branch is not a licence to pass.
430
- */
431
- perAdapter?: Partial<Record<PlaytestAdapterClass, IPlaytestRenderChainExpectation>>;
432
- }
433
- /** What the harness read out of `adapter.info` for this run, before any game code answered. */
434
- type PlaytestAdapterClass = "hardware" | "software";
435
- /** Ceilings on the application's startup milestones, in milliseconds since navigation. */
436
- interface IPlaytestStartupAssertion {
437
- /** The start scene's `enter()` returned: a controllable world exists. */
438
- maxEnteredMs?: number;
439
- /** First-use compilation settled or its budget expired. */
440
- maxCompileSettledMs?: number;
441
- /** `whenReady()` resolved: the world is safe to show. */
442
- maxReadyMs?: number;
443
- }
444
- interface IPlaytestFramebufferCoverageAssertion {
445
- backdrop: [number, number, number];
446
- grid?: {
447
- columns: number;
448
- rows: number;
449
- };
450
- tolerance: number;
451
- window: {
452
- endStep: string;
453
- startStep: string;
454
- };
455
- }
456
- interface IPlaytestVisualRegionTarget {
457
- id?: string;
458
- selector?: string;
459
- }
460
- interface IPlaytestVisualRegionBounds {
461
- height: number;
462
- width: number;
463
- x: number;
464
- y: number;
465
- }
466
- interface IPlaytestVisualRegionThresholds {
467
- maxDarkPixelRatio?: number;
468
- maxLuminance?: number;
469
- minDarkPixelRatio?: number;
470
- minNonblankPixelRatio?: number;
471
- }
472
- interface IPlaytestVisualStaticRegion extends IPlaytestVisualRegionBounds, IPlaytestVisualRegionThresholds {
473
- }
474
- interface IPlaytestVisualElementRegion extends IPlaytestVisualRegionThresholds {
475
- element: IPlaytestVisualRegionTarget;
476
- }
477
- type IPlaytestVisualRegion = IPlaytestVisualStaticRegion | IPlaytestVisualElementRegion;
478
- interface IPlaytestVisualAssertion {
479
- entityVisible?: {
480
- entity: string;
481
- minProjectedPixels: number;
482
- throughoutFrames?: boolean;
483
- };
484
- frameDiff?: {
485
- baselineImage?: string;
486
- maxChangedPixelRatio?: number;
487
- minChangedPixelRatio?: number;
488
- };
489
- region?: IPlaytestVisualRegion;
490
- }
491
- interface IPlaytestAerodynamicsAssertion {
492
- controls?: Array<{
493
- minAbs?: number;
494
- sign: "negative" | "positive";
495
- surface: string;
496
- }>;
497
- entity: string;
498
- minForceSamples?: number;
499
- torques?: Array<{
500
- axis: "x" | "y" | "z";
501
- label: string;
502
- minAbs?: number;
503
- relativeToLabel?: string;
504
- sign: "negative" | "positive";
505
- }>;
506
- }
507
- interface IPlaytestReachabilityAssertion {
508
- artifact: string;
509
- entities: string[];
510
- /** Loaded from artifact by loadPlaytestScenario; not authored in scenario JSON. */
511
- envelope?: {
512
- fallDistanceToGround: number;
513
- forwardReach: number;
514
- maxRise: number;
515
- };
516
- }
517
- interface IPlaytestWorldRuntimeAssertion {
518
- agent: string;
519
- core: string;
520
- portable?: boolean;
521
- randomState: number;
522
- rapier: string | null;
523
- step: number;
524
- }
525
- interface IPlaytestWorldAssertion {
526
- runtime?: IPlaytestWorldRuntimeAssertion;
527
- seed: number | null;
528
- }
529
- /**
530
- * Thermal, power and battery state measured around the run itself. Its point is comparability:
531
- * a run that started hot, or whose thermal status rose while it ran, is not evidence against a
532
- * cool baseline, and this is how a scenario says so out loud.
533
- */
534
- interface IPlaytestDeviceMetricsAssertion {
535
- /** Ceiling on the battery temperature climb from the first to the last sample, in °C. */
536
- maxTemperatureRiseC?: number;
537
- /** Ceiling on the highest Android thermal status observed during the run (0 is NONE). */
538
- maxThermalStatus?: number;
539
- /** Requires a run the harness judged comparable with a cool one. */
540
- notThermallyConfounded?: boolean;
541
- }
542
- /**
543
- * What the game actually played, by cue label.
544
- *
545
- * Every other audio check in this repository is about a *file* — it exists, it decodes, it is
546
- * inside its byte budget, its loop seam is clean. All of them stay green while a game says its
547
- * one-shot general-quarters call a second time in the middle of a match, or plays the same line
548
- * twice at once, because neither is a property of the clip. This reads the runtime ledger
549
- * (`runtime.audio`), which a game fills by passing `cue` to `AudioBus.play`/`playAt`.
550
- */
551
- interface IPlaytestAudioAssertion {
552
- /** The cue label the game passed. */
553
- cue: string;
554
- /** Fewest times it must have sounded. Defaults to 1, so naming a cue asserts it was heard. */
555
- minPlays?: number;
556
- /** Most times it may have sounded. `0` proves silence; `1` proves a one-shot stayed one. */
557
- maxPlays?: number;
558
- /**
559
- * Fewest milliseconds that must separate this cue from the cue before it.
560
- *
561
- * One loudspeaker cannot say two things at once. A game whose urgent line cuts another 250 ms
562
- * in sounds broken rather than urgent, and nothing but the gap between two plays shows it.
563
- */
564
- minGapMs?: number;
565
- }
566
- interface IPlaytestScenarioAssertions {
567
- aerodynamics?: IPlaytestAerodynamicsAssertion[];
568
- audio?: IPlaytestAudioAssertion[];
569
- animation?: IPlaytestAnimationAssertion[];
570
- camera?: IPlaytestCameraAssertion;
571
- components?: IPlaytestComponentAssertion[];
572
- contacts?: IPlaytestContactAssertion[];
573
- deviceMetrics?: IPlaytestDeviceMetricsAssertion;
574
- diagnostics?: IPlaytestDiagnosticsAssertion;
575
- framebufferCoverage?: IPlaytestFramebufferCoverageAssertion;
576
- /**
577
- * Arms one per-object geometry capture and reports it as the `geometry` observation. This is a
578
- * request rather than a comparison: it bounds nothing, and the report is read from
579
- * `observations.geometry`, exactly as `pipelineCensus` is read from `observations.pipelineCensus`.
580
- */
581
- geometry?: IPlaytestGeometryCaptureRequest;
582
- hud?: IPlaytestPathAssertion[];
583
- movement?: IPlaytestMovementAssertion;
584
- occluded?: IPlaytestOccludedAssertion[];
585
- overlayNodes?: IPlaytestOverlayNodeAssertion[];
586
- parity?: IPlaytestParityAssertion;
587
- performance?: IPlaytestPerformanceAssertion;
588
- renderChain?: IPlaytestRenderChainAssertion;
589
- reachability?: IPlaytestReachabilityAssertion;
590
- resources?: IPlaytestResourceAssertion[];
591
- settled?: IPlaytestSettledAssertion[];
592
- signals?: IPlaytestSignalAssertion[];
593
- scene?: IPlaytestSceneAssertion;
594
- causedBy?: IPlaytestCausedByAssertion[];
595
- sceneNodes?: IPlaytestSceneNodesAssertion[];
596
- startup?: IPlaytestStartupAssertion;
597
- states?: IPlaytestStateAssertion[];
598
- tags?: IPlaytestTagCountAssertion[];
599
- visibility?: IPlaytestVisibilityAssertion[];
600
- visual?: IPlaytestVisualAssertion[];
601
- world?: IPlaytestWorldAssertion;
602
- }
603
- interface IPlaytestParityConfig {
604
- animation?: Array<{
605
- clip?: string;
606
- entity: string;
607
- requiredOn?: PlaytestTarget[];
608
- }>;
609
- axisDelta?: Partial<Record<"x" | "y" | "z", number>>;
610
- contacts?: {
611
- minSharedCount?: number;
612
- };
613
- movementDistance?: {
614
- maxDelta: number;
615
- };
616
- resources?: string[];
617
- targets?: PlaytestTarget[];
618
- }
619
- /** What the parity reference's saved run report yielded, extracted at scenario load. */
620
- interface IPlaytestParityReference {
621
- /** Frames per second of the reference run: 1000 ÷ the median frame time of its series. */
622
- fps: number;
623
- /** Render-phase p95 of the reference run, when its series carries the phase split. */
624
- renderP95?: number;
625
- /** The device the reference run executed on, when it measured one. */
626
- serial?: string;
627
- /** The reference run's own thermal verdict, when it measured one. */
628
- thermallyConfounded?: boolean;
629
- }
630
- /**
631
- * PRD-222 Tier 2: the same scene on the same device, twice — once in the platform's browser,
632
- * once on the native host. The assertion lives in the second run of the pair and names the
633
- * first run's saved report.
634
- *
635
- * It proves what the artifacts can prove: the same device (both halves' `deviceMetrics.serial`),
636
- * a thermally comparable pair, and the directed fps ratio. Which scene the reference ran is the
637
- * pair protocol the operator owns — the report format carries no scene identity — so this
638
- * assertion never claims it did.
639
- */
640
- interface IPlaytestParityAssertion {
641
- /** Floor on nativeFps ÷ webFps. Tier 2's Floor is 0.85; Target 0.95. */
642
- minFpsRatio: number;
643
- /** Optional floor on the inverted render-phase p95 ratio; fails closed when either side's series lacks the split. */
644
- minRenderParity?: number;
645
- /** Path to the other half's saved run report JSON, resolved against the project. */
646
- referenceReport: string;
647
- /** Which side of the pair the reference report is; the directed ratio needs it. */
648
- referenceSide: "browser" | "native";
649
- /** Hydrated from the reference report at scenario load; never set by hand. */
650
- reference?: IPlaytestParityReference;
651
- }
652
- interface IPlaytestArtifactRequest {
653
- console?: boolean;
654
- contactSheet?: boolean;
655
- effectLog?: "focused" | boolean;
656
- network?: boolean;
657
- runtimeTrace?: boolean;
658
- screenshots?: "before-after" | "after" | false;
659
- }
660
- interface IPlaytestSetupEntityTransform {
661
- entity: string;
662
- position?: [number, number, number];
663
- rotation?: [number, number, number, number];
664
- scale?: [number, number, number];
665
- }
666
- /** Overrides the subject player start. y is optional and preserves the game's own height when absent. */
667
- interface IPlaytestSpawnRequest {
668
- x: number;
669
- y?: number;
670
- z: number;
671
- }
672
- /** Overrides the subject player-start aim; both angles are radians (Three.js convention). */
673
- interface IPlaytestAimRequest {
674
- pitch: number;
675
- yaw: number;
676
- }
677
- /**
678
- * Places a named entity at an explicit world transform before input. Orientation comes
679
- * from facing yaw or a lookAt point (never both); frozen delivers the placed-frozen
680
- * marker the game reads to suppress physics motion — placement is data, not teleports.
681
- */
682
- interface IPlaytestPlaceRequest {
683
- at: {
684
- x: number;
685
- y: number;
686
- z: number;
687
- };
688
- entity: string;
689
- facing?: {
690
- yaw: number;
691
- };
692
- frozen?: boolean;
693
- lookAt?: {
694
- x: number;
695
- y: number;
696
- z: number;
697
- };
698
- }
699
- interface IPlaytestSetupResource {
700
- id: string;
701
- path?: string;
702
- value: unknown;
703
- }
704
- interface IPlaytestScenarioSetup {
705
- aim?: IPlaytestAimRequest;
706
- entities?: IPlaytestSetupEntityTransform[];
707
- place?: IPlaytestPlaceRequest[];
708
- resources?: IPlaytestSetupResource[];
709
- spawn?: IPlaytestSpawnRequest;
710
- }
711
- interface IPlaytestScenario {
712
- acceptanceId?: string;
713
- artifacts?: IPlaytestArtifactRequest;
714
- assert?: IPlaytestScenarioAssertions;
715
- /** Test-only browser seam that makes the renderer's no-adapter boot path deterministic. */
716
- bootFailure?: "renderer-no-adapter";
717
- /**
718
- * Wait for the application to finish its own startup before the first observation. Default
719
- * true, because a fixed-step run otherwise observes a game that has not finished loading.
720
- * Set false only when the launch *is* the subject — a loading-screen scenario has to be
721
- * allowed to look at the loading screen.
722
- */
723
- awaitStartup?: boolean;
724
- inputDelivery?: PlaytestInputDelivery;
725
- name: string;
726
- parity?: IPlaytestParityConfig;
727
- schemaVersion: 1;
728
- setup?: IPlaytestScenarioSetup;
729
- sourcePath?: string;
730
- steps: IPlaytestStep[];
731
- subject?: string;
732
- target: PlaytestTarget;
733
- viewport: IPlaytestViewport$1;
734
- warmupFrames: number;
735
- }
736
- interface IPlaytestScenarioDiagnostic {
737
- code: "TN_PLAYTEST_SCENARIO_INVALID" | "TN_PLAYTEST_SCENARIO_NOT_FOUND" | "TN_PLAYTEST_SCENARIO_STEP_INVALID";
738
- fix?: {
739
- docs?: string;
740
- instruction: string;
741
- snippet?: string;
742
- };
743
- message: string;
744
- severity: "error";
745
- suggestion?: string;
746
- }
1
+ import { x as IPlaytestToneCaptureObservation, t as IPlaytestVisualRegionBounds, u as IPlaytestVisualRegionTarget, y as IPlaytestDiagnosticsAssertion } from './schema-base-B5mr_Yr9.js';
2
+ import { JsonValue, IPlaytestRenderChainObservation, IPlaytestSceneObservation, IPlaytestSceneNodesObservation, IPlaytestStartupTimeline } from './protocol.js';
747
3
 
748
4
  interface IAndroidDriverOptions {
749
5
  activity: string;
@@ -927,6 +183,7 @@ declare class AdbAndroidDriver implements IAndroidDriver {
927
183
  private touchViewport?;
928
184
  private readonly user?;
929
185
  private activeUser?;
186
+ private readonly consolePids;
930
187
  /** Set by a lifecycle `rotate`, whose display lock `stop()` has to free on its own account. */
931
188
  private lifecycleRotationLocked;
932
189
  private viewportPresented;
@@ -935,6 +192,7 @@ declare class AdbAndroidDriver implements IAndroidDriver {
935
192
  height: number;
936
193
  width: number;
937
194
  }): Promise<void>;
195
+ private rememberConsolePids;
938
196
  private resolveUser;
939
197
  /**
940
198
  * Put the device into the scenario's viewport, and fail closed if it did not take.
@@ -973,6 +231,16 @@ declare class AdbAndroidDriver implements IAndroidDriver {
973
231
  * halfway through moving.
974
232
  */
975
233
  hideKeyboard(): Promise<boolean>;
234
+ /**
235
+ * The device's own diagnostics, read once and parsed once.
236
+ *
237
+ * The read is the only step here that can fail for a reason the game did not cause: a hosted
238
+ * SwiftShader emulator drops the adb transport mid-dump, and `adb logcat -d` exits non-zero after
239
+ * printing part of the buffer — a run whose assertions all passed died on a truncated line (CI
240
+ * `clean-consumer`, 5th of 6 sequential runs). The native harnesses already answer that with one
241
+ * re-read after `wait-for-device` (#310, b12becde6); this mirrors it, including the named refusal
242
+ * exemption: a `KO:` reply is the device rejecting the command, and retrying it would hide that.
243
+ */
976
244
  captureConsole(): Promise<Array<{
977
245
  text: string;
978
246
  type: string;
@@ -1362,6 +630,7 @@ interface IPlaytestVisualElementRegionObservation {
1362
630
  rendered: boolean;
1363
631
  }
1364
632
  interface IPlaytestObservations {
633
+ tone?: IPlaytestToneCaptureObservation[];
1365
634
  animation?: unknown;
1366
635
  components?: Record<string, Record<string, {
1367
636
  after?: unknown;
@@ -1512,7 +781,7 @@ interface IPlaytestFramebufferCoverageObservation {
1512
781
  windowStarted: boolean;
1513
782
  }
1514
783
 
1515
- type PlaytestDiagnosticCode = "TN_PLAYTEST_ANDROID_LIFECYCLE_NOT_APPLIED" | "TN_PLAYTEST_ANDROID_LIFECYCLE_PHYSICS_UNOBSERVED" | "TN_PLAYTEST_ANDROID_LIFECYCLE_SESSION_CHANGED" | "TN_PLAYTEST_ANDROID_LIFECYCLE_UNOBSERVED" | "TN_PLAYTEST_BRIDGE_INCOMPATIBLE" | "TN_PLAYTEST_BRIDGE_CAPABILITY_UNKNOWN" | "TN_PLAYTEST_BRIDGE_MISSING" | "TN_PLAYTEST_BRIDGE_NOT_READY" | "TN_PLAYTEST_CAPTURE_PROVENANCE_MISSING" | "TN_PLAYTEST_CAPABILITY_MISSING" | "TN_PLAYTEST_DEVICE_FAILED" | "TN_PLAYTEST_HOST_EXITED" | "TN_PLAYTEST_MAILBOX_POLL_STALLED" | "TN_PLAYTEST_OBSERVATION_UNAVAILABLE" | "TN_PLAYTEST_OPERATION_TIMEOUT" | "TN_PLAYTEST_PAGE_CLOSED" | "TN_PLAYTEST_PAGE_CRASHED" | "TN_PLAYTEST_PAGE_NAVIGATED" | "TN_PLAYTEST_PAYLOAD_TOO_LARGE" | "TN_PLAYTEST_SERVER_FAILED" | "TN_PLAYTEST_SETUP_UNAPPLIED" | "TN_PLAYTEST_STARTUP_ABORTED" | "TN_PLAYTEST_STARTUP_HOST_EXITED" | "TN_PLAYTEST_STARTUP_NOT_READY" | "TN_PLAYTEST_UNSUPPORTED_ON_TARGET";
784
+ type PlaytestDiagnosticCode = "TN_PLAYTEST_ANDROID_LIFECYCLE_NOT_APPLIED" | "TN_PLAYTEST_ANDROID_LIFECYCLE_PHYSICS_UNOBSERVED" | "TN_PLAYTEST_ANDROID_LIFECYCLE_SESSION_CHANGED" | "TN_PLAYTEST_ANDROID_LIFECYCLE_UNOBSERVED" | "TN_PLAYTEST_BRIDGE_INCOMPATIBLE" | "TN_PLAYTEST_BRIDGE_CAPABILITY_UNKNOWN" | "TN_PLAYTEST_BRIDGE_MISSING" | "TN_PLAYTEST_BRIDGE_NOT_READY" | "TN_PLAYTEST_CAPTURE_PROVENANCE_MISSING" | "TN_PLAYTEST_CAPABILITY_MISSING" | "TN_PLAYTEST_DEVICE_FAILED" | "TN_PLAYTEST_HOST_EXITED" | "TN_PLAYTEST_MAILBOX_POLL_STALLED" | "TN_PLAYTEST_OBSERVATION_UNAVAILABLE" | "TN_PLAYTEST_OPERATION_TIMEOUT" | "TN_PLAYTEST_PAGE_CLOSED" | "TN_PLAYTEST_PAGE_CRASHED" | "TN_PLAYTEST_PAGE_NAVIGATED" | "TN_PLAYTEST_PAYLOAD_TOO_LARGE" | "TN_PLAYTEST_SERVER_FAILED" | "TN_PLAYTEST_SETUP_UNAPPLIED" | "TN_PLAYTEST_START_TICK_INVALID" | "TN_PLAYTEST_STARTUP_ABORTED" | "TN_PLAYTEST_STARTUP_HOST_EXITED" | "TN_PLAYTEST_STARTUP_NOT_READY" | "TN_PLAYTEST_UNSUPPORTED_ON_TARGET";
1516
785
  interface IPlaytestProtocolDiagnostic {
1517
786
  capability?: string;
1518
787
  code: PlaytestDiagnosticCode;
@@ -1528,4 +797,4 @@ declare function playtestDiagnostic(code: PlaytestDiagnosticCode, message: strin
1528
797
  nextCommand?: string;
1529
798
  }): IPlaytestProtocolDiagnostic;
1530
799
 
1531
- export { type IAndroidPointer as $, type IPlaytestSetupRecord as A, type IPlaytestSignalAssertion as B, type IPlaytestStartupAssertion as C, DEVICE_METRICS_CADENCE_MS as D, type IPlaytestTrivialityOptOut as E, type IPlaytestVisualAssertion as F, type IPlaytestVisualElementRegion as G, HOT_START_TEMPERATURE_C as H, type IPlaytestStep as I, type IPlaytestVisualElementRegionObservation as J, type IPlaytestVisualRegion as K, type IPlaytestVisualRegionBounds as L, type IPlaytestVisualRegionTarget as M, type IPlaytestWheel as N, type IPlaytestWorldRuntimeAssertion as O, type PlaytestTarget as P, type PlaytestDeviceMeasurement as Q, type PlaytestDevicePowerRails as R, type PlaytestVec3 as S, parseDeviceBattery as T, parseDeviceCurrent as U, parseDevicePowerRails as V, parseDeviceThermal as W, playtestDiagnostic as X, resolveDiagnosticsPolicy as Y, summarizeDeviceMetrics as Z, type IAndroidAppState as _, type IPlaytestScenarioDiagnostic as a, type IAndroidPointerInjection as a0, type IAndroidDriver as a1, AdbAndroidDriver as a2, type IAndroidDriverOptions as a3, type IAndroidLifecycleOperation as a4, type IAndroidTouchViewport as a5, type IPlaytestDeviceLifecycleObservation as a6, type IPlaytestDeviceLifecyclePhase as a7, type IPlaytestDeviceLifecyclePhysics as a8, type IPlaytestDeviceLifecycleSteps as a9, androidTouchBatches as aa, discoverAdb as ab, keyboardIsShown as ac, parseAndroidConsole as ad, parseAndroidTouchViewport as ae, rotatedTouchPosition as af, tapCommand as ag, touchPositionForViewport as ah, touchRotationFromWindowDump as ai, viewportPresentationCommands as aj, viewportPresentationObserved as ak, viewportRestoreCommands as al, type IPlaytestScenario as b, type IPlaytestReport as c, type IPlaytestAssertionResult as d, type IPlaytestDiagnostic as e, DEVICE_METRICS_MAX_SAMPLES as f, DeviceMetricsError as g, DeviceMetricsRecorder as h, type IPlaytestArtifactRequest as i, type IPlaytestCaptureProvenance as j, type IPlaytestDeviceBattery as k, type IPlaytestDeviceMetricsObservation as l, type IPlaytestDeviceMetricsSample as m, type IPlaytestDeviceMetricsVerdict as n, type IPlaytestDeviceThermal as o, type IPlaytestDiagnosticsPolicy as p, type IPlaytestFramebufferCoverageAssertion as q, type IPlaytestFramebufferCoverageObservation as r, type IPlaytestObservations as s, type IPlaytestPathAssertion as t, type IPlaytestPerformanceAssertion as u, type IPlaytestPointer as v, type IPlaytestProtocolDiagnostic as w, type IPlaytestRenderChainAssertion as x, type IPlaytestResourceWait as y, type IPlaytestSetupApplication as z };
800
+ export { viewportPresentationCommands as $, resolveDiagnosticsPolicy as A, summarizeDeviceMetrics as B, type IAndroidAppState as C, DEVICE_METRICS_CADENCE_MS as D, type IAndroidPointer as E, type IAndroidPointerInjection as F, type IAndroidDriver as G, HOT_START_TEMPERATURE_C as H, type IPlaytestReport as I, AdbAndroidDriver as J, type IAndroidDriverOptions as K, type IAndroidLifecycleOperation as L, type IAndroidTouchViewport as M, type IPlaytestDeviceLifecycleObservation as N, type IPlaytestDeviceLifecyclePhase as O, type PlaytestDeviceMeasurement as P, type IPlaytestDeviceLifecyclePhysics as Q, type IPlaytestDeviceLifecycleSteps as R, androidTouchBatches as S, discoverAdb as T, keyboardIsShown as U, parseAndroidConsole as V, parseAndroidTouchViewport as W, rotatedTouchPosition as X, tapCommand as Y, touchPositionForViewport as Z, touchRotationFromWindowDump as _, type IPlaytestAssertionResult as a, viewportPresentationObserved as a0, viewportRestoreCommands as a1, type IPlaytestDiagnostic as b, DEVICE_METRICS_MAX_SAMPLES as c, DeviceMetricsError as d, DeviceMetricsRecorder as e, type IPlaytestCaptureProvenance as f, type IPlaytestDeviceBattery as g, type IPlaytestDeviceMetricsObservation as h, type IPlaytestDeviceMetricsSample as i, type IPlaytestDeviceMetricsVerdict as j, type IPlaytestDeviceThermal as k, type IPlaytestDiagnosticsPolicy as l, type IPlaytestFramebufferCoverageObservation as m, type IPlaytestObservations as n, type IPlaytestProtocolDiagnostic as o, type IPlaytestSetupApplication as p, type IPlaytestSetupRecord as q, type IPlaytestTrivialityOptOut as r, type IPlaytestVisualElementRegionObservation as s, type PlaytestDevicePowerRails as t, type PlaytestVec3 as u, parseDeviceBattery as v, parseDeviceCurrent as w, parseDevicePowerRails as x, parseDeviceThermal as y, playtestDiagnostic as z };