@threenative/playtest 0.3.3 → 0.3.5

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,8 +1,53 @@
1
- import { PlaytestFramePhase, PlaytestFramePassKind, IPlaytestGeometryCaptureRequest, JsonValue, IPlaytestRenderChainObservation, IPlaytestSceneObservation, IPlaytestSceneNodesObservation, IPlaytestStartupTimeline } from './protocol.js';
1
+ import { PlaytestFramePhase, PlaytestFramePassKind, IPlaytestGeometryCaptureRequest } from './protocol.js';
2
+
3
+ /** Display-referred Rec.709 luminance, quantized to 256 rounded byte bins. */
4
+ interface IToneMetrics {
5
+ readonly mean: number;
6
+ readonly p1: number;
7
+ readonly p50: number;
8
+ readonly p99: number;
9
+ /** Fraction in bin 255 (display white). */
10
+ readonly clipFraction: number;
11
+ /** Fraction in bin 0 (display black). */
12
+ readonly blackFraction: number;
13
+ }
14
+ /** Top-left coordinates in decoded PNG physical pixels; never CSS pixels. */
15
+ interface IToneRegion {
16
+ readonly x: number;
17
+ readonly y: number;
18
+ readonly width: number;
19
+ readonly height: number;
20
+ }
21
+ interface IToneComparison {
22
+ readonly region: IToneRegion;
23
+ readonly metric: keyof IToneMetrics;
24
+ readonly minDelta: number;
25
+ }
26
+ interface IPlaytestToneObservation extends IToneMetrics {
27
+ readonly code: "TN_TONE";
28
+ readonly label: string;
29
+ /** Absent for the convenience before/after captures. */
30
+ readonly atStep?: string;
31
+ }
32
+ /** Regional failures carry an error and omit unmeasured metrics. */
33
+ interface IPlaytestRegionalToneObservation extends Partial<IToneMetrics> {
34
+ readonly code: "TN_TONE";
35
+ readonly label: string;
36
+ readonly atStep?: string;
37
+ readonly assertionIndex: number;
38
+ readonly region: IToneRegion;
39
+ readonly reference?: {
40
+ readonly region: IToneRegion;
41
+ readonly metrics?: IToneMetrics;
42
+ readonly error?: string;
43
+ };
44
+ readonly error?: string;
45
+ }
46
+ type IPlaytestToneCaptureObservation = IPlaytestToneObservation | IPlaytestRegionalToneObservation;
2
47
 
3
48
  type PlaytestTarget = "web" | "desktop" | "bevy";
4
49
  type PlaytestInputDelivery = "deterministic" | "focused-dom";
5
- interface IPlaytestViewport$1 {
50
+ interface IPlaytestViewport {
6
51
  height: number;
7
52
  width: number;
8
53
  }
@@ -15,6 +60,14 @@ interface IPlaytestPointer {
15
60
  interface IPlaytestWheel {
16
61
  deltaX?: number;
17
62
  deltaY: number;
63
+ /** Normalized viewport point the wheel turns over (both or neither); the viewport centre when absent. */
64
+ x?: number;
65
+ y?: number;
66
+ }
67
+ /** Emulated media features, Playwright's `emulateMedia` vocabulary; an absent key keeps its value. */
68
+ interface IPlaytestMedia {
69
+ colorScheme?: "dark" | "light";
70
+ reducedMotion?: "no-preference" | "reduce";
18
71
  }
19
72
  type IPlaytestResourceWait = {
20
73
  equals: unknown;
@@ -36,13 +89,20 @@ type IPlaytestResourceWait = {
36
89
  path: string;
37
90
  };
38
91
  interface IPlaytestStep {
39
- kind?: "aimAt" | "click" | "input" | "wait";
92
+ kind?: "aimAt" | "click" | "input" | "lifecycle" | "wait";
40
93
  /** @deprecated Use holdTicks. Fixed-step bridges treat this as a tick alias. */
41
94
  holdFrames?: number;
42
95
  holdTicks?: number;
43
96
  /** A viewport-pixel click target, resolved directly or from a registered entity's bounds. */
44
97
  at?: IPlaytestClickTarget;
45
98
  label?: string;
99
+ /** Emulate media features from this step on (browser, and the desktop native-css UI). */
100
+ media?: IPlaytestMedia;
101
+ /**
102
+ * One device-lifecycle operation the runner drives through the platform driver, so the phases it
103
+ * then reports are read off the device rather than asserted by the game about itself.
104
+ */
105
+ lifecycle?: IPlaytestLifecycleStep;
46
106
  overlayMessage?: {
47
107
  overlayId: string;
48
108
  payload: unknown;
@@ -82,8 +142,32 @@ type IPlaytestAimTarget = {
82
142
  x: number;
83
143
  z: number;
84
144
  };
145
+ /**
146
+ * The device operations a `lifecycle` step names.
147
+ *
148
+ * `rotate` is the only one that carries an argument, and the `?: never` arms are what stop a
149
+ * scenario from writing `{ operation: "background", rotation: 1 }` and having the rotation
150
+ * silently dropped.
151
+ */
152
+ type IPlaytestLifecycleStep = {
153
+ operation: "background";
154
+ rotation?: never;
155
+ } | {
156
+ operation: "foreground";
157
+ rotation?: never;
158
+ } | {
159
+ operation: "rotate";
160
+ rotation: number;
161
+ };
162
+ /**
163
+ * Where a click lands: viewport pixels, a registered entity's screen bounds, or (browser only) the
164
+ * centre of a DOM element by `id` or CSS `selector`. Pixels depend on the page's layout, which
165
+ * depends on the fonts a machine has; an element target does not.
166
+ */
85
167
  type IPlaytestClickTarget = {
86
168
  entity: string;
169
+ } | {
170
+ element: IPlaytestVisualRegionTarget;
87
171
  } | {
88
172
  x: number;
89
173
  y: number;
@@ -383,7 +467,8 @@ interface IPlaytestPerformanceAssertion {
383
467
  /** Per-pass triangle ceilings, keyed by pass kind: main, shadow, reflection, nested. */
384
468
  maxPassTriangles?: Readonly<Partial<Record<PlaytestFramePassKind, number>>>;
385
469
  }
386
- interface IPlaytestRenderChainAssertion {
470
+ /** The stage expectations a render-chain assertion can hold, without its own per-adapter branches. */
471
+ interface IPlaytestRenderChainExpectation {
387
472
  contributions?: {
388
473
  graphOutputChanged: string[];
389
474
  };
@@ -398,6 +483,24 @@ interface IPlaytestRenderChainAssertion {
398
483
  maxRejectionFraction: number;
399
484
  };
400
485
  }
486
+ interface IPlaytestRenderChainAssertion extends IPlaytestRenderChainExpectation {
487
+ /**
488
+ * What the chain must look like on each adapter the run's own `adapter.info` classified, chosen
489
+ * by the harness's software-adapter detector rather than by anything the game reported. A lane
490
+ * whose adapter cannot be classified is a failed observation, not a hardware one: a missing
491
+ * branch is not a licence to pass.
492
+ */
493
+ perAdapter?: Partial<Record<PlaytestAdapterClass | PlaytestGpuFamily, IPlaytestRenderChainExpectation>>;
494
+ }
495
+ /** What the harness read out of `adapter.info` for this run, before any game code answered. */
496
+ type PlaytestAdapterClass = "hardware" | "software";
497
+ /**
498
+ * The GPU family the same `adapter.info` fields prove on a hardware run. A family row beside
499
+ * `hardware` is how a scenario holds an iGPU or a phone to the tier a template starts that family
500
+ * at; it overrides `hardware` only when the observed fields prove the family.
501
+ */
502
+ declare const PLAYTEST_GPU_FAMILIES: readonly ["discrete", "integrated", "mobile-high", "mobile-low", "mobile-mid"];
503
+ type PlaytestGpuFamily = (typeof PLAYTEST_GPU_FAMILIES)[number];
401
504
  /** Ceilings on the application's startup milestones, in milliseconds since navigation. */
402
505
  interface IPlaytestStartupAssertion {
403
506
  /** The start scene's `enter()` returned: a controllable world exists. */
@@ -407,6 +510,14 @@ interface IPlaytestStartupAssertion {
407
510
  /** `whenReady()` resolved: the world is safe to show. */
408
511
  maxReadyMs?: number;
409
512
  }
513
+ /** Ceilings on work observed after the runtime's explicit shader warm-up settled. */
514
+ interface IPlaytestPipelineCensusAssertion {
515
+ maxNodeBuildsAfterWarmUpSettled?: number;
516
+ maxRenderPipelineCreationsAfterWarmUpSettled?: number;
517
+ warmUpScope?: string;
518
+ maxNodeBuildsAfterWarmUpScope?: number;
519
+ maxRenderPipelineCreationsAfterWarmUpScope?: number;
520
+ }
410
521
  interface IPlaytestFramebufferCoverageAssertion {
411
522
  backdrop: [number, number, number];
412
523
  grid?: {
@@ -529,7 +640,17 @@ interface IPlaytestAudioAssertion {
529
640
  */
530
641
  minGapMs?: number;
531
642
  }
643
+ interface IPlaytestToneAssertion extends Partial<Record<keyof IToneMetrics, {
644
+ min?: number;
645
+ max?: number;
646
+ }>> {
647
+ region?: IToneRegion;
648
+ compare?: IToneComparison;
649
+ /** Omit to bound the final capture, otherwise capture after this named step. */
650
+ atStep?: string;
651
+ }
532
652
  interface IPlaytestScenarioAssertions {
653
+ tone?: IPlaytestToneAssertion[];
533
654
  aerodynamics?: IPlaytestAerodynamicsAssertion[];
534
655
  audio?: IPlaytestAudioAssertion[];
535
656
  animation?: IPlaytestAnimationAssertion[];
@@ -551,6 +672,7 @@ interface IPlaytestScenarioAssertions {
551
672
  overlayNodes?: IPlaytestOverlayNodeAssertion[];
552
673
  parity?: IPlaytestParityAssertion;
553
674
  performance?: IPlaytestPerformanceAssertion;
675
+ pipelineCensus?: IPlaytestPipelineCensusAssertion;
554
676
  renderChain?: IPlaytestRenderChainAssertion;
555
677
  reachability?: IPlaytestReachabilityAssertion;
556
678
  resources?: IPlaytestResourceAssertion[];
@@ -621,7 +743,8 @@ interface IPlaytestArtifactRequest {
621
743
  effectLog?: "focused" | boolean;
622
744
  network?: boolean;
623
745
  runtimeTrace?: boolean;
624
- screenshots?: "before-after" | "after" | false;
746
+ /** `true` captures like `"after"`; only `false` and `"before-after"` change the runner. */
747
+ screenshots?: "before-after" | "after" | boolean;
625
748
  }
626
749
  interface IPlaytestSetupEntityTransform {
627
750
  entity: string;
@@ -690,13 +813,20 @@ interface IPlaytestScenario {
690
813
  inputDelivery?: PlaytestInputDelivery;
691
814
  name: string;
692
815
  parity?: IPlaytestParityConfig;
816
+ /**
817
+ * Browser-only: open the page with `prefers-reduced-motion: reduce` emulated, so a game that
818
+ * honours the preference can prove it. Applied before navigation, so the first read sees it.
819
+ */
820
+ reducedMotion?: "reduce";
693
821
  schemaVersion: 1;
694
822
  setup?: IPlaytestScenarioSetup;
695
823
  sourcePath?: string;
824
+ /** Absolute fixed-step tick reached after startup and warmup, before baseline and input. */
825
+ startTick?: number;
696
826
  steps: IPlaytestStep[];
697
827
  subject?: string;
698
828
  target: PlaytestTarget;
699
- viewport: IPlaytestViewport$1;
829
+ viewport: IPlaytestViewport;
700
830
  warmupFrames: number;
701
831
  }
702
832
  interface IPlaytestScenarioDiagnostic {
@@ -711,437 +841,4 @@ interface IPlaytestScenarioDiagnostic {
711
841
  suggestion?: string;
712
842
  }
713
843
 
714
- /**
715
- * Device thermal, power and battery state as a first-class measured observation.
716
- *
717
- * Why this exists, measured on 2026-08-24 against a physical Pixel 8: two cold-launch runs
718
- * reported 44 s to first frame against a 14.7 s baseline, and the difference was attributed to a
719
- * code change. It was not. The device had climbed to 43.2 °C at thermal status 2 while the
720
- * baseline ran at 38.2 °C at status 0 — the run was throttled, and nothing in the playtest report
721
- * said so. Every agent that needs this answer has been hand-rolling `adb shell dumpsys` for it.
722
- *
723
- * Two rules this module holds to:
724
- *
725
- * 1. **Never report a zero for something that was not measured.** A rail breakdown a device does
726
- * not expose comes back `{ available: false, reason }`, never `0 mW`. Google's per-rail ODPM
727
- * numbers exist on Pixel hardware and nowhere else.
728
- * 2. **Never discard a confounded run's numbers, and never let it pass as comparable.** The
729
- * samples are always reported; the verdict says whether the run may be compared with a cool
730
- * one. A missing sample is a failure, not a skip.
731
- *
732
- * The parsers here read real `dumpsys` and `logcat` text. Captured samples of every format live in
733
- * `__tests__/fixtures/device-metrics/`.
734
- */
735
- /** Battery temperature at or above which a run is treated as having started hot, in °C. */
736
- declare const HOT_START_TEMPERATURE_C = 40;
737
- /** How often the recorder samples while a scenario runs, in milliseconds. */
738
- declare const DEVICE_METRICS_CADENCE_MS = 5000;
739
- /** Ceiling on retained samples, so a long run cannot outgrow the bridge payload budget. */
740
- declare const DEVICE_METRICS_MAX_SAMPLES = 240;
741
- declare class DeviceMetricsError extends Error {
742
- readonly code: string;
743
- readonly observed: string;
744
- constructor(code: string, detail: string, observed: string);
745
- }
746
- /** A reading that a given device may simply not expose. Absent means absent, never zero. */
747
- type PlaytestDeviceMeasurement<T> = {
748
- available: false;
749
- reason: string;
750
- } | {
751
- available: true;
752
- value: T;
753
- };
754
- interface IPlaytestDeviceBattery {
755
- chargeCounterUah?: number;
756
- charging: boolean;
757
- levelPercent: number;
758
- /** `dumpsys battery` status: 2 charging, 3 discharging, 4 not charging, 5 full. */
759
- status: number;
760
- temperatureC: number;
761
- voltageMv?: number;
762
- }
763
- interface IPlaytestDeviceThermal {
764
- sensors: Record<string, number>;
765
- skinSensorName?: string;
766
- skinTemperatureC: PlaytestDeviceMeasurement<number>;
767
- status: number;
768
- statusName: string;
769
- }
770
- type PlaytestDevicePowerRails = {
771
- available: false;
772
- reason: string;
773
- } | {
774
- at: string;
775
- available: true;
776
- rails: Record<string, number>;
777
- totalMw: number;
778
- windowMs: number;
779
- };
780
- interface IPlaytestDeviceMetricsSample {
781
- /** Milliseconds since the recorder was created. */
782
- at: number;
783
- batteryLevelPercent: number;
784
- batteryStatus: number;
785
- batteryTemperatureC: number;
786
- charging: boolean;
787
- /** Negative is discharge, matching the sysfs sign convention. */
788
- currentMa: PlaytestDeviceMeasurement<number>;
789
- phase: "after" | "before" | "during";
790
- powerRails: PlaytestDevicePowerRails;
791
- skinTemperatureC: PlaytestDeviceMeasurement<number>;
792
- thermalStatus: number;
793
- thermalStatusName: string;
794
- }
795
- interface IPlaytestDeviceMetricsVerdict {
796
- endTemperatureC: number | null;
797
- endThermalStatus: number | null;
798
- maxThermalStatus: number | null;
799
- peakTemperatureC: number | null;
800
- /**
801
- * Whether a fresh per-rail power window was logged between the first and last sample. When it
802
- * is false the rail figures describe a window that predates the run and are not attributable
803
- * to it; `null` when the device exposes no rails at all.
804
- */
805
- powerRailWindowAdvanced: boolean | null;
806
- /** Named codes: charging, hot-start, incomplete, thermal-status-rose, throttled-start. */
807
- reasons: string[];
808
- startTemperatureC: number | null;
809
- startThermalStatus: number | null;
810
- temperatureRiseC: number | null;
811
- thermallyConfounded: boolean;
812
- }
813
- interface IPlaytestDeviceMetricsObservation {
814
- available: boolean;
815
- /** Probe failures, kept rather than dropped: an unexplained gap is itself the finding. */
816
- errors: string[];
817
- samples: IPlaytestDeviceMetricsSample[];
818
- serial?: string;
819
- source: string;
820
- verdict: IPlaytestDeviceMetricsVerdict;
821
- }
822
- declare function parseDeviceBattery(output: string): IPlaytestDeviceBattery;
823
- declare function parseDeviceThermal(output: string): IPlaytestDeviceThermal;
824
- /**
825
- * `/sys/class/power_supply/battery/current_now` in microamps. A device that does not expose the
826
- * node answers with `cat`'s error text, which is unavailability, not a zero-current reading.
827
- */
828
- declare function parseDeviceCurrent(output: string): PlaytestDeviceMeasurement<number>;
829
- /**
830
- * Pixel's on-device power monitor writes a whole-rail breakdown to logcat once per ~60 s window,
831
- * as `Power rails total power: 547.76 mW for 60014 ms` followed by `[RAIL: n mW]` groups. Devices
832
- * without Google's ODPM hardware log nothing here, and must say so rather than report zeros.
833
- */
834
- declare function parseDevicePowerRails(output: string): PlaytestDevicePowerRails;
835
- /**
836
- * The thermal verdict. It never removes a number — a confounded run reports everything it
837
- * measured — it only states whether this run may be compared with a cool one.
838
- */
839
- declare function summarizeDeviceMetrics(samples: readonly IPlaytestDeviceMetricsSample[]): IPlaytestDeviceMetricsVerdict;
840
- interface IDeviceMetricsRecorderOptions {
841
- adb(args: readonly string[]): Promise<string>;
842
- cadenceMs?: number;
843
- now?(): number;
844
- serial?: string;
845
- }
846
- /**
847
- * Samples the device around and during a run. The periodic sampler is wall-clock paced on
848
- * purpose and deliberately reads nothing the scenario depends on: it observes the phone, it
849
- * never advances or gates a tick, so scenario determinism is untouched.
850
- */
851
- declare class DeviceMetricsRecorder {
852
- private readonly options;
853
- private readonly errors;
854
- private readonly samples;
855
- private readonly startedAt;
856
- private timer?;
857
- constructor(options: IDeviceMetricsRecorderOptions);
858
- sampleNow(phase: IPlaytestDeviceMetricsSample["phase"]): Promise<IPlaytestDeviceMetricsSample>;
859
- /** Begins periodic `during` sampling. A periodic probe failure is recorded, never thrown away. */
860
- start(): void;
861
- stop(): void;
862
- observation(): IPlaytestDeviceMetricsObservation;
863
- private now;
864
- private probe;
865
- }
866
-
867
- type PlaytestVec3 = [number, number, number];
868
- /** One honest-reporting line: a placement/aim/spawn override the scenario requested. */
869
- interface IPlaytestSetupRecord {
870
- entity?: string;
871
- kind: "aim" | "entities" | "place" | "resources" | "spawn";
872
- value: JsonValue;
873
- }
874
- /**
875
- * Requested overrides next to what actually applied; an unapplied request fails the run.
876
- *
877
- * `confirmedBy` says which of those two sentences the evidence supports. `read-back` means the
878
- * bridge named the ids it applied and `applied` is that answer. `throw-contract` means the bridge
879
- * resolved without naming anything, so the only evidence is that it did not throw — `applied`
880
- * mirrors `requested` there, and the field is what stops the report reading as a confirmation it
881
- * never received.
882
- */
883
- interface IPlaytestSetupApplication {
884
- applied: IPlaytestSetupRecord[];
885
- requested: IPlaytestSetupRecord[];
886
- confirmedBy?: "read-back" | "throw-contract";
887
- }
888
- interface IPlaytestTransformSample {
889
- frame: number;
890
- position: PlaytestVec3;
891
- rotation?: readonly [number, number, number, number];
892
- tick: number;
893
- }
894
- interface IPlaytestFollowReport {
895
- after?: IPlaytestTransformSample;
896
- before?: IPlaytestTransformSample;
897
- entity: string;
898
- moved?: number;
899
- separation?: number;
900
- within: number;
901
- }
902
- interface IPlaytestDiagnosticsPolicy {
903
- consoleErrorsOptOutReason?: string;
904
- networkErrorsOptOutReason?: string;
905
- noConsoleErrors: boolean;
906
- noNetworkErrors: boolean;
907
- noRuntimeDiagnostics: boolean;
908
- runtimeReady?: boolean;
909
- runtimeDiagnosticsOptOutReason?: string;
910
- }
911
- interface IPlaytestCaptureProvenance {
912
- adapter: Record<string, string>;
913
- browserArgs: readonly string[];
914
- captureMethod: "page.screenshot";
915
- rendererKind: "webgl" | "webgpu";
916
- target: string;
917
- viewport: IPlaytestViewport;
918
- }
919
- interface IPlaytestTrivialityOptOut {
920
- id: string;
921
- reason: string;
922
- }
923
- interface IPlaytestViewport {
924
- height: number;
925
- width: number;
926
- }
927
- interface IPlaytestReport {
928
- after?: IPlaytestTransformSample;
929
- assertionResults?: IPlaytestAssertionResult[];
930
- before?: IPlaytestTransformSample;
931
- capture?: IPlaytestCaptureProvenance;
932
- diagnostics: IPlaytestDiagnostic[];
933
- diagnosticsPolicy?: IPlaytestDiagnosticsPolicy;
934
- distance: number;
935
- effectLog?: unknown;
936
- entity: string;
937
- expectAxis?: string;
938
- expectMoved: boolean;
939
- follow?: IPlaytestFollowReport;
940
- frames: number;
941
- movementDelta?: PlaytestVec3;
942
- observations?: IPlaytestObservations;
943
- pathLength?: number;
944
- setup?: IPlaytestSetupApplication;
945
- /**
946
- * The target the run executed on — `browser`, `android`, `desktop`, `ios`.
947
- *
948
- * Not the scenario file's `target` field, which the two differ from routinely:
949
- * `examples/native-smoke/playtests/*.json` say `"target": "web"` and are driven with
950
- * `--target android`. Evaluators that must know what the lane can observe read this one.
951
- */
952
- target?: string;
953
- trivialityOptOuts: IPlaytestTrivialityOptOut[];
954
- }
955
-
956
- type Vec3 = [number, number, number];
957
- interface IPlaytestDiagnostic {
958
- artifactPath?: string;
959
- code: string;
960
- exportName?: string;
961
- gate?: "waived-headless";
962
- message: string;
963
- modulePath?: string;
964
- observedRuntimePath?: string;
965
- path?: string;
966
- resourceId?: string;
967
- severity: "error" | "warning";
968
- sourcePath?: string;
969
- suggestion?: string;
970
- systemId?: string;
971
- }
972
- interface IPlaytestAssertionResult {
973
- details?: Record<string, unknown>;
974
- id: string;
975
- pass: boolean;
976
- }
977
- interface IPlaytestVisualElementRegionObservation {
978
- assertionIndex: number;
979
- bounds?: IPlaytestVisualRegionBounds;
980
- darkPixelRatio?: number;
981
- element: IPlaytestVisualRegionTarget;
982
- nonblankPixelRatio?: number;
983
- rendered: boolean;
984
- }
985
- interface IPlaytestObservations {
986
- animation?: unknown;
987
- components?: Record<string, Record<string, {
988
- after?: unknown;
989
- before?: unknown;
990
- }>>;
991
- componentSeries?: Array<{
992
- label: string;
993
- snapshots: Record<string, Record<string, unknown>>;
994
- tick: number;
995
- }>;
996
- console: Array<{
997
- source?: "browser-console" | "page-error" | "unhandled-rejection";
998
- text: string;
999
- type: string;
1000
- }>;
1001
- contacts?: unknown;
1002
- debugColliderCount?: number;
1003
- /** Host-measured device thermal, power and battery state; produced by the android target. */
1004
- deviceMetrics?: IPlaytestDeviceMetricsObservation;
1005
- effectLog?: unknown;
1006
- effectLogBefore?: unknown;
1007
- effectLogSeries?: Array<{
1008
- label: string;
1009
- snapshot: unknown;
1010
- tick: number;
1011
- }>;
1012
- entityTransforms?: Record<string, {
1013
- halfExtents?: Vec3;
1014
- position?: Vec3;
1015
- scale?: Vec3;
1016
- }>;
1017
- framebufferCoverage?: IPlaytestFramebufferCoverageObservation;
1018
- /** The per-object geometry capture report, present only when the scenario requested one. */
1019
- geometry?: JsonValue;
1020
- hud: Record<string, {
1021
- after?: unknown;
1022
- before?: unknown;
1023
- }>;
1024
- overlayNodes?: Record<string, {
1025
- after?: unknown;
1026
- before?: unknown;
1027
- }>;
1028
- network: Array<{
1029
- method: string;
1030
- url: string;
1031
- }>;
1032
- physicsDebug?: unknown;
1033
- physicsDebugBefore?: unknown;
1034
- physicsDebugSeries?: Array<{
1035
- label: string;
1036
- snapshot: unknown;
1037
- tick: number;
1038
- }>;
1039
- performanceSeries?: unknown[];
1040
- /** Bounded shader/pipeline creation capture from the engine's renderer boundary. */
1041
- pipelineCensus?: JsonValue;
1042
- renderChain?: IPlaytestRenderChainObservation;
1043
- resources: Record<string, {
1044
- after?: unknown;
1045
- before?: unknown;
1046
- }>;
1047
- /** Lights, materials, fog, background, camera framing and world extent, as the bridge found them. */
1048
- scene?: IPlaytestSceneObservation;
1049
- sceneNodes?: IPlaytestSceneNodesObservation[];
1050
- /** The startup observation the runner waited on, with the rule it resolved under. */
1051
- startup?: {
1052
- compileSettled?: boolean;
1053
- phase: string;
1054
- progress: number;
1055
- rule?: string;
1056
- timeline?: IPlaytestStartupTimeline;
1057
- };
1058
- resourceSeries?: Array<{
1059
- label: string;
1060
- snapshots: Record<string, unknown>;
1061
- tick: number;
1062
- }>;
1063
- runtimeObservations?: unknown;
1064
- runtimeDiagnostics?: unknown;
1065
- runtimeDiagnosticsBefore?: unknown;
1066
- signals?: unknown[];
1067
- signalSeries?: Array<{
1068
- label: string;
1069
- signals: unknown[];
1070
- tick: number;
1071
- }>;
1072
- visibility?: Record<string, unknown>;
1073
- visual?: {
1074
- captureFailure?: {
1075
- code: "TN_CAPTURE_BLANK";
1076
- label: string;
1077
- reason: string;
1078
- };
1079
- changedPixelRatio?: number;
1080
- comparisonSource?: string;
1081
- elementRegions?: IPlaytestVisualElementRegionObservation[];
1082
- nonblankRegions?: Array<{
1083
- darkPixelRatio?: number;
1084
- height: number;
1085
- nonblankPixelRatio: number;
1086
- width: number;
1087
- x: number;
1088
- y: number;
1089
- }>;
1090
- /** Visual frame observations only; performance samples live in performanceSeries. */
1091
- runtimeDiagnosticsSeries?: unknown[];
1092
- };
1093
- }
1094
- /**
1095
- * The policy the evaluator actually applies, defaults included.
1096
- *
1097
- * `target` is the target the run *executed on*, not the scenario file's `target` field — the two
1098
- * differ routinely, because `examples/native-smoke/playtests/*.json` say `"target": "web"` and are
1099
- * driven with `--target android`.
1100
- *
1101
- * Why the target matters: the three channels default to on, and the evaluator applies that default
1102
- * on every run. On a device lane the network observation is hardwired empty, so
1103
- * `noNetworkErrors: true` was compared against an empty array and reported a passing row — a green
1104
- * computed from evidence the target structurally cannot produce, which is the one thing this
1105
- * harness exists not to do. The asymmetry was visible in the scenarios too: one that spelled out
1106
- * `noNetworkErrors: true` failed honestly with `TN_PLAYTEST_UNSUPPORTED_ON_TARGET`, and the same
1107
- * scenario with the field omitted passed.
1108
- *
1109
- * So on a network-blind target the default is **off, with the reason recorded in the policy the
1110
- * report prints**. An explicit `true` is left exactly as written, because that is a scenario asking
1111
- * for something the target cannot do, and the runner still fails it by name.
1112
- */
1113
- declare function resolveDiagnosticsPolicy(policy: IPlaytestDiagnosticsAssertion | undefined, target?: string): IPlaytestDiagnosticsPolicy;
1114
- interface IPlaytestFramebufferCoverageObservation {
1115
- boundarySource: "scenario-steps" | "video-backdrop-dominance";
1116
- firstViolation?: {
1117
- frameIndex: number;
1118
- grid: {
1119
- columns: number;
1120
- rows: number;
1121
- samples: Array<[number, number, number]>;
1122
- };
1123
- screenshotPath: string;
1124
- };
1125
- frameCount: number;
1126
- unreadableReason?: string;
1127
- windowCompleted: boolean;
1128
- windowStarted: boolean;
1129
- }
1130
-
1131
- type PlaytestDiagnosticCode = "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_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";
1132
- interface IPlaytestProtocolDiagnostic {
1133
- capability?: string;
1134
- code: PlaytestDiagnosticCode;
1135
- fix: {
1136
- instruction: string;
1137
- nextCommand?: string;
1138
- };
1139
- message: string;
1140
- path?: string;
1141
- severity: "error";
1142
- }
1143
- declare function playtestDiagnostic(code: PlaytestDiagnosticCode, message: string, instruction: string, details?: Pick<IPlaytestProtocolDiagnostic, "capability" | "path"> & {
1144
- nextCommand?: string;
1145
- }): IPlaytestProtocolDiagnostic;
1146
-
1147
- export { 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 IPlaytestScenarioDiagnostic as a, 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 };
844
+ export type { IToneMetrics as I, PlaytestTarget as P, IPlaytestToneAssertion as a, IPlaytestRegionalToneObservation as b, IPlaytestStep as c, IPlaytestScenarioDiagnostic as d, IPlaytestScenario as e, IPlaytestArtifactRequest as f, IPlaytestFramebufferCoverageAssertion as g, IPlaytestMedia as h, IPlaytestPathAssertion as i, IPlaytestPerformanceAssertion as j, IPlaytestPointer as k, IPlaytestRenderChainAssertion as l, IPlaytestResourceWait as m, IPlaytestSignalAssertion as n, IPlaytestStartupAssertion as o, IPlaytestToneObservation as p, IPlaytestVisualAssertion as q, IPlaytestVisualElementRegion as r, IPlaytestVisualRegion as s, IPlaytestVisualRegionBounds as t, IPlaytestVisualRegionTarget as u, IPlaytestWheel as v, IPlaytestWorldRuntimeAssertion as w, IPlaytestToneCaptureObservation as x, IPlaytestDiagnosticsAssertion as y };