@threenative/playtest 0.3.1 → 0.3.3
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.
- package/dist/{diagnostics-f8464bJw.d.ts → diagnostics-Bpy15z5f.d.ts} +42 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +253 -49
- package/dist/protocol.d.ts +32 -1
- package/dist/protocol.js +2 -1
- package/dist/runner/cli.d.ts +2 -2
- package/dist/runner/cli.js +843 -312
- package/dist/runner/index.d.ts +19 -6
- package/dist/runner/index.js +602 -92
- package/dist/{shared-BGwYk5HG.d.ts → shared-eFOF5bZO.d.ts} +9 -1
- package/dist/three/index.js +4 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlaytestFramePhase, JsonValue, IPlaytestRenderChainObservation, IPlaytestSceneObservation, IPlaytestSceneNodesObservation, IPlaytestStartupTimeline } from './protocol.js';
|
|
1
|
+
import { PlaytestFramePhase, PlaytestFramePassKind, IPlaytestGeometryCaptureRequest, JsonValue, IPlaytestRenderChainObservation, IPlaytestSceneObservation, IPlaytestSceneNodesObservation, IPlaytestStartupTimeline } from './protocol.js';
|
|
2
2
|
|
|
3
3
|
type PlaytestTarget = "web" | "desktop" | "bevy";
|
|
4
4
|
type PlaytestInputDelivery = "deterministic" | "focused-dom";
|
|
@@ -374,6 +374,14 @@ interface IPlaytestPerformanceAssertion {
|
|
|
374
374
|
* names are the engine's frame-budget phases: hostGap, update, render, overlay, residual.
|
|
375
375
|
*/
|
|
376
376
|
maxPhaseMsP95?: Readonly<Partial<Record<PlaytestFramePhase, number>>>;
|
|
377
|
+
/**
|
|
378
|
+
* Per-pass draw-call ceilings, keyed by pass kind: main, shadow, reflection, nested. The bound
|
|
379
|
+
* is the largest draw count that kind submitted in a sampled frame, so a shadow lane folded into
|
|
380
|
+
* the whole-frame `maxDrawCalls` is bounded on its own.
|
|
381
|
+
*/
|
|
382
|
+
maxPassDrawCalls?: Readonly<Partial<Record<PlaytestFramePassKind, number>>>;
|
|
383
|
+
/** Per-pass triangle ceilings, keyed by pass kind: main, shadow, reflection, nested. */
|
|
384
|
+
maxPassTriangles?: Readonly<Partial<Record<PlaytestFramePassKind, number>>>;
|
|
377
385
|
}
|
|
378
386
|
interface IPlaytestRenderChainAssertion {
|
|
379
387
|
contributions?: {
|
|
@@ -497,8 +505,33 @@ interface IPlaytestDeviceMetricsAssertion {
|
|
|
497
505
|
/** Requires a run the harness judged comparable with a cool one. */
|
|
498
506
|
notThermallyConfounded?: boolean;
|
|
499
507
|
}
|
|
508
|
+
/**
|
|
509
|
+
* What the game actually played, by cue label.
|
|
510
|
+
*
|
|
511
|
+
* Every other audio check in this repository is about a *file* — it exists, it decodes, it is
|
|
512
|
+
* inside its byte budget, its loop seam is clean. All of them stay green while a game says its
|
|
513
|
+
* one-shot general-quarters call a second time in the middle of a match, or plays the same line
|
|
514
|
+
* twice at once, because neither is a property of the clip. This reads the runtime ledger
|
|
515
|
+
* (`runtime.audio`), which a game fills by passing `cue` to `AudioBus.play`/`playAt`.
|
|
516
|
+
*/
|
|
517
|
+
interface IPlaytestAudioAssertion {
|
|
518
|
+
/** The cue label the game passed. */
|
|
519
|
+
cue: string;
|
|
520
|
+
/** Fewest times it must have sounded. Defaults to 1, so naming a cue asserts it was heard. */
|
|
521
|
+
minPlays?: number;
|
|
522
|
+
/** Most times it may have sounded. `0` proves silence; `1` proves a one-shot stayed one. */
|
|
523
|
+
maxPlays?: number;
|
|
524
|
+
/**
|
|
525
|
+
* Fewest milliseconds that must separate this cue from the cue before it.
|
|
526
|
+
*
|
|
527
|
+
* One loudspeaker cannot say two things at once. A game whose urgent line cuts another 250 ms
|
|
528
|
+
* in sounds broken rather than urgent, and nothing but the gap between two plays shows it.
|
|
529
|
+
*/
|
|
530
|
+
minGapMs?: number;
|
|
531
|
+
}
|
|
500
532
|
interface IPlaytestScenarioAssertions {
|
|
501
533
|
aerodynamics?: IPlaytestAerodynamicsAssertion[];
|
|
534
|
+
audio?: IPlaytestAudioAssertion[];
|
|
502
535
|
animation?: IPlaytestAnimationAssertion[];
|
|
503
536
|
camera?: IPlaytestCameraAssertion;
|
|
504
537
|
components?: IPlaytestComponentAssertion[];
|
|
@@ -506,6 +539,12 @@ interface IPlaytestScenarioAssertions {
|
|
|
506
539
|
deviceMetrics?: IPlaytestDeviceMetricsAssertion;
|
|
507
540
|
diagnostics?: IPlaytestDiagnosticsAssertion;
|
|
508
541
|
framebufferCoverage?: IPlaytestFramebufferCoverageAssertion;
|
|
542
|
+
/**
|
|
543
|
+
* Arms one per-object geometry capture and reports it as the `geometry` observation. This is a
|
|
544
|
+
* request rather than a comparison: it bounds nothing, and the report is read from
|
|
545
|
+
* `observations.geometry`, exactly as `pipelineCensus` is read from `observations.pipelineCensus`.
|
|
546
|
+
*/
|
|
547
|
+
geometry?: IPlaytestGeometryCaptureRequest;
|
|
509
548
|
hud?: IPlaytestPathAssertion[];
|
|
510
549
|
movement?: IPlaytestMovementAssertion;
|
|
511
550
|
occluded?: IPlaytestOccludedAssertion[];
|
|
@@ -976,6 +1015,8 @@ interface IPlaytestObservations {
|
|
|
976
1015
|
scale?: Vec3;
|
|
977
1016
|
}>;
|
|
978
1017
|
framebufferCoverage?: IPlaytestFramebufferCoverageObservation;
|
|
1018
|
+
/** The per-object geometry capture report, present only when the scenario requested one. */
|
|
1019
|
+
geometry?: JsonValue;
|
|
979
1020
|
hud: Record<string, {
|
|
980
1021
|
after?: unknown;
|
|
981
1022
|
before?: unknown;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { I as IPlaytestStep, a as IPlaytestScenarioDiagnostic, b as IPlaytestScenario, P as PlaytestTarget, c as IPlaytestReport, d as IPlaytestAssertionResult, e as IPlaytestDiagnostic } from './diagnostics-
|
|
2
|
-
export { D as DEVICE_METRICS_CADENCE_MS, f as DEVICE_METRICS_MAX_SAMPLES, g as DeviceMetricsError, h as DeviceMetricsRecorder, H as HOT_START_TEMPERATURE_C, i as IPlaytestArtifactRequest, j as IPlaytestCaptureProvenance, k as IPlaytestDeviceBattery, l as IPlaytestDeviceMetricsObservation, m as IPlaytestDeviceMetricsSample, n as IPlaytestDeviceMetricsVerdict, o as IPlaytestDeviceThermal, p as IPlaytestDiagnosticsPolicy, q as IPlaytestFramebufferCoverageAssertion, r as IPlaytestFramebufferCoverageObservation, s as IPlaytestObservations, t as IPlaytestPathAssertion, u as IPlaytestPerformanceAssertion, v as IPlaytestPointer, w as IPlaytestProtocolDiagnostic, x as IPlaytestRenderChainAssertion, y as IPlaytestResourceWait, z as IPlaytestSetupApplication, A as IPlaytestSetupRecord, B as IPlaytestSignalAssertion, C as IPlaytestStartupAssertion, E as IPlaytestTrivialityOptOut, F as IPlaytestVisualAssertion, G as IPlaytestVisualElementRegion, J as IPlaytestVisualElementRegionObservation, K as IPlaytestVisualRegion, L as IPlaytestVisualRegionBounds, M as IPlaytestVisualRegionTarget, N as IPlaytestWheel, O as IPlaytestWorldRuntimeAssertion, Q as PlaytestDeviceMeasurement, R as PlaytestDevicePowerRails, S as PlaytestVec3, T as parseDeviceBattery, U as parseDeviceCurrent, V as parseDevicePowerRails, W as parseDeviceThermal, X as playtestDiagnostic, Y as resolveDiagnosticsPolicy, Z as summarizeDeviceMetrics } from './diagnostics-
|
|
3
|
-
export { IPlaytestBridgeDescription, IPlaytestBridgeReady, IPlaytestBridgeV1, IPlaytestCameraObservation, IPlaytestContactObservation, IPlaytestDeviceRequest, IPlaytestDeviceResponse, IPlaytestFogObservation, IPlaytestGameplayObservation, IPlaytestLightObservation, IPlaytestObservationSnapshot, IPlaytestPerformanceObservation, IPlaytestRenderChainObservation, IPlaytestRuntimeDiagnosticsSample, IPlaytestSampleRequest, IPlaytestSceneObservation, IPlaytestSetupConfirmation, IPlaytestSetupRequest, IPlaytestStartupObservation, IPlaytestStartupTimeline, IPlaytestStrideObservation, IPlaytestWorldObservation, IPlaytestWorldRuntimeObservation, JsonValue, PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_FROZEN_MARKER, PLAYTEST_PROTOCOL_LIMITS, PLAYTEST_PROTOCOL_VERSION, PLAYTEST_STARTUP_COMPILE_BUDGET_MS, PLAYTEST_STARTUP_READY_TIMEOUT_MS, assertJsonSafe, jsonByteLength } from './protocol.js';
|
|
1
|
+
import { I as IPlaytestStep, a as IPlaytestScenarioDiagnostic, b as IPlaytestScenario, P as PlaytestTarget, c as IPlaytestReport, d as IPlaytestAssertionResult, e as IPlaytestDiagnostic } from './diagnostics-Bpy15z5f.js';
|
|
2
|
+
export { D as DEVICE_METRICS_CADENCE_MS, f as DEVICE_METRICS_MAX_SAMPLES, g as DeviceMetricsError, h as DeviceMetricsRecorder, H as HOT_START_TEMPERATURE_C, i as IPlaytestArtifactRequest, j as IPlaytestCaptureProvenance, k as IPlaytestDeviceBattery, l as IPlaytestDeviceMetricsObservation, m as IPlaytestDeviceMetricsSample, n as IPlaytestDeviceMetricsVerdict, o as IPlaytestDeviceThermal, p as IPlaytestDiagnosticsPolicy, q as IPlaytestFramebufferCoverageAssertion, r as IPlaytestFramebufferCoverageObservation, s as IPlaytestObservations, t as IPlaytestPathAssertion, u as IPlaytestPerformanceAssertion, v as IPlaytestPointer, w as IPlaytestProtocolDiagnostic, x as IPlaytestRenderChainAssertion, y as IPlaytestResourceWait, z as IPlaytestSetupApplication, A as IPlaytestSetupRecord, B as IPlaytestSignalAssertion, C as IPlaytestStartupAssertion, E as IPlaytestTrivialityOptOut, F as IPlaytestVisualAssertion, G as IPlaytestVisualElementRegion, J as IPlaytestVisualElementRegionObservation, K as IPlaytestVisualRegion, L as IPlaytestVisualRegionBounds, M as IPlaytestVisualRegionTarget, N as IPlaytestWheel, O as IPlaytestWorldRuntimeAssertion, Q as PlaytestDeviceMeasurement, R as PlaytestDevicePowerRails, S as PlaytestVec3, T as parseDeviceBattery, U as parseDeviceCurrent, V as parseDevicePowerRails, W as parseDeviceThermal, X as playtestDiagnostic, Y as resolveDiagnosticsPolicy, Z as summarizeDeviceMetrics } from './diagnostics-Bpy15z5f.js';
|
|
3
|
+
export { IPlaytestBridgeDescription, IPlaytestBridgeReady, IPlaytestBridgeV1, IPlaytestCameraObservation, IPlaytestContactObservation, IPlaytestDeviceRequest, IPlaytestDeviceResponse, IPlaytestFogObservation, IPlaytestFramePassSample, IPlaytestGameplayObservation, IPlaytestLightObservation, IPlaytestObservationSnapshot, IPlaytestPerformanceObservation, IPlaytestRenderChainObservation, IPlaytestRuntimeDiagnosticsSample, IPlaytestSampleRequest, IPlaytestSceneObservation, IPlaytestSetupConfirmation, IPlaytestSetupRequest, IPlaytestStartupObservation, IPlaytestStartupTimeline, IPlaytestStrideObservation, IPlaytestWorldObservation, IPlaytestWorldRuntimeObservation, JsonValue, PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_FRAME_PASS_KINDS, PLAYTEST_FROZEN_MARKER, PLAYTEST_PROTOCOL_LIMITS, PLAYTEST_PROTOCOL_VERSION, PLAYTEST_STARTUP_COMPILE_BUDGET_MS, PLAYTEST_STARTUP_READY_TIMEOUT_MS, PlaytestFramePassKind, assertJsonSafe, jsonByteLength } from './protocol.js';
|
|
4
4
|
|
|
5
|
-
type PlaytestCapability = "browser.canvas" | "browser.console" | "browser.dom" | "browser.input" | "browser.network" | "browser.screenshot" | "browser.trace" | "camera.observe" | "device.metrics" | "entity.bounds" | "entity.observe" | "entity.setup" | "runtime.animation" | "runtime.audio" | "runtime.components" | "runtime.contacts" | "runtime.diagnostics" | "runtime.events" | "runtime.fixedStep" | "runtime.physics" | "runtime.performance" | "runtime.pipelineCensus" | "runtime.renderChain" | "runtime.resources" | "runtime.startup" | "runtime.state" | "runtime.tags" | "runtime.transitions" | "runtime.ui" | "runtime.world" | "scene.nodes" | "scene.observe";
|
|
5
|
+
type PlaytestCapability = "browser.canvas" | "browser.console" | "browser.dom" | "browser.input" | "browser.network" | "browser.screenshot" | "browser.trace" | "camera.observe" | "device.metrics" | "entity.bounds" | "entity.observe" | "entity.setup" | "runtime.animation" | "runtime.audio" | "runtime.components" | "runtime.contacts" | "runtime.diagnostics" | "runtime.events" | "runtime.fixedStep" | "runtime.geometry" | "runtime.physics" | "runtime.performance" | "runtime.pipelineCensus" | "runtime.renderChain" | "runtime.resources" | "runtime.startup" | "runtime.state" | "runtime.tags" | "runtime.transitions" | "runtime.ui" | "runtime.world" | "scene.nodes" | "scene.observe";
|
|
6
6
|
interface IPlaytestCapabilityDescriptor {
|
|
7
7
|
description: string;
|
|
8
8
|
name: PlaytestCapability;
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ var PLAYTEST_CAPABILITY_REGISTRY = [
|
|
|
23
23
|
capability("runtime.diagnostics", "Captures application runtime errors."),
|
|
24
24
|
capability("runtime.events", "Drains bounded application event observations."),
|
|
25
25
|
capability("runtime.fixedStep", "Advances an application-owned deterministic tick."),
|
|
26
|
+
capability("runtime.geometry", "Answers one armed per-object geometry capture for the frame it was requested on."),
|
|
26
27
|
capability("runtime.physics", "Samples bounded application-owned physics observations."),
|
|
27
28
|
capability("runtime.performance", "Samples bounded per-render frame cost and renderer counts."),
|
|
28
29
|
capability("runtime.pipelineCensus", "Samples bounded shader and pipeline creation observations."),
|
|
@@ -557,14 +558,16 @@ var PLAYTEST_ASSERTION_REGISTRY = [
|
|
|
557
558
|
trivialityRationale: "It evaluates captured error and readiness channels across the run; no initial scalar value can satisfy those diagnostics by itself."
|
|
558
559
|
},
|
|
559
560
|
{
|
|
560
|
-
description: "Proves a live render sample exists and optionally bounds frame time, an fps floor, per-phase frame budget, draw calls
|
|
561
|
-
example: { performance: { maxPhaseMsP95: { render: 12 }, minFps: 30 } },
|
|
561
|
+
description: "Proves a live render sample exists and optionally bounds frame time, an fps floor, per-phase frame budget, whole-frame or per-pass draw calls and triangles.",
|
|
562
|
+
example: { performance: { maxPassDrawCalls: { shadow: 400 }, maxPhaseMsP95: { render: 12 }, minFps: 30 } },
|
|
562
563
|
fields: [
|
|
563
564
|
{ description: "Maximum nearest-rank 95th-percentile frame time in milliseconds.", name: "maxFrameMsP95", type: "number" },
|
|
564
565
|
{ description: "Minimum sustained frames per second, from the median sampled frame.", name: "minFps", type: "number" },
|
|
565
566
|
{ description: "Per-phase millisecond ceilings at nearest-rank p95. Phases: hostGap, update, render, overlay, residual.", name: "maxPhaseMsP95", type: "{ [phase]: number }" },
|
|
566
|
-
{ description: "Maximum observed renderer draw-call count.", name: "maxDrawCalls", type: "number" },
|
|
567
|
-
{ description: "
|
|
567
|
+
{ description: "Maximum observed renderer draw-call count across every pass combined.", name: "maxDrawCalls", type: "number" },
|
|
568
|
+
{ description: "Per-pass draw-call ceilings, keyed by pass kind: main, shadow, reflection, nested. Fails closed when a sampled frame carries no pass split or omits the declared kind.", name: "maxPassDrawCalls", type: "{ [pass: 'main' | 'shadow' | 'reflection' | 'nested']: number }" },
|
|
569
|
+
{ description: "Per-pass triangle ceilings, keyed by pass kind: main, shadow, reflection, nested. Fails closed when a sampled frame carries no pass split or omits the declared kind.", name: "maxPassTriangles", type: "{ [pass: 'main' | 'shadow' | 'reflection' | 'nested']: number }" },
|
|
570
|
+
{ description: "Maximum observed renderer triangle count across every pass combined.", name: "maxTriangles", type: "number" }
|
|
568
571
|
],
|
|
569
572
|
cardinality: "object",
|
|
570
573
|
kind: "performance",
|
|
@@ -613,6 +616,24 @@ var PLAYTEST_ASSERTION_REGISTRY = [
|
|
|
613
616
|
triviality: "reject-initial-value",
|
|
614
617
|
trivialityRationale: "An entity can be present and in-frame before input; the scenario must prove visibility after its setup or document why that presence is held."
|
|
615
618
|
},
|
|
619
|
+
{
|
|
620
|
+
description: "Proves which labelled audio cues the game actually played, and how often.",
|
|
621
|
+
example: { audio: [{ cue: "speech:p01", maxPlays: 1 }] },
|
|
622
|
+
fields: [
|
|
623
|
+
{ description: "Cue label the game passed to AudioBus.play/playAt.", name: "cue", required: true, type: "string" },
|
|
624
|
+
{ description: "Fewest plays required. Defaults to 1, so naming a cue asserts it was heard.", name: "minPlays", type: "non-negative integer" },
|
|
625
|
+
{ description: "Most plays allowed; 0 proves silence and 1 proves a one-shot stayed one.", name: "maxPlays", type: "non-negative integer" },
|
|
626
|
+
{ description: "Fewest milliseconds between this cue and the cue played before it, so one line cannot cut another.", name: "minGapMs", type: "non-negative integer" }
|
|
627
|
+
],
|
|
628
|
+
cardinality: "array",
|
|
629
|
+
kind: "audio",
|
|
630
|
+
observationPath: "runtimeObservations",
|
|
631
|
+
requiredCapabilities: ["runtime.audio"],
|
|
632
|
+
resultIdPrefix: "audio.",
|
|
633
|
+
supportedOn: ["web", "desktop"],
|
|
634
|
+
triviality: "not-applicable",
|
|
635
|
+
trivialityRationale: "A cue count starts at zero and only a played cue moves it, so there is no initial value to reject."
|
|
636
|
+
},
|
|
616
637
|
{
|
|
617
638
|
description: "Proves runtime world metadata exposed by the application bridge.",
|
|
618
639
|
example: { world: { seed: 90210 } },
|
|
@@ -852,6 +873,9 @@ function requiredPlaytestCapabilities(scenario, target) {
|
|
|
852
873
|
if (scenario.steps.some((step) => step.kind === "aimAt")) {
|
|
853
874
|
required.add("entity.setup");
|
|
854
875
|
}
|
|
876
|
+
if (scenario.assert?.geometry !== void 0) {
|
|
877
|
+
required.add("runtime.geometry");
|
|
878
|
+
}
|
|
855
879
|
if (scenario.artifacts?.screenshots !== false) {
|
|
856
880
|
required.add("browser.screenshot");
|
|
857
881
|
}
|
|
@@ -1512,6 +1536,53 @@ function contactAssertionSatisfiedAtStep(assertion, observations, scenario) {
|
|
|
1512
1536
|
const minimum = assertion.minCount ?? (assertion.maxCount === void 0 ? 1 : 0);
|
|
1513
1537
|
return stepAvailable && (!anonymous || candidates.length > 0) && count >= minimum && (assertion.maxCount === void 0 || count <= assertion.maxCount);
|
|
1514
1538
|
}
|
|
1539
|
+
function smallestGapBefore(recent, cue) {
|
|
1540
|
+
let smallest;
|
|
1541
|
+
for (let index = 1; index < recent.length; index += 1) {
|
|
1542
|
+
const entry = recent[index];
|
|
1543
|
+
const previous = recent[index - 1];
|
|
1544
|
+
if (!isRecord(entry) || !isRecord(previous)) continue;
|
|
1545
|
+
if (entry.cue !== cue) continue;
|
|
1546
|
+
if (typeof entry.atMs !== "number" || typeof previous.atMs !== "number") continue;
|
|
1547
|
+
const gap = entry.atMs - previous.atMs;
|
|
1548
|
+
if (smallest === void 0 || gap < smallest) smallest = gap;
|
|
1549
|
+
}
|
|
1550
|
+
return smallest;
|
|
1551
|
+
}
|
|
1552
|
+
function evaluateAudioAssertion(assertion, observations) {
|
|
1553
|
+
const gameplay = gameplayObservations(observations);
|
|
1554
|
+
const audio = isRecord(gameplay?.audio) ? gameplay.audio : void 0;
|
|
1555
|
+
const cues = isRecord(audio?.cues) ? audio.cues : void 0;
|
|
1556
|
+
const observed = cues === void 0 ? void 0 : cues[assertion.cue];
|
|
1557
|
+
const plays = typeof observed === "number" ? observed : 0;
|
|
1558
|
+
const minimum = assertion.minPlays ?? 1;
|
|
1559
|
+
const recent = Array.isArray(audio?.recentCues) ? audio.recentCues : [];
|
|
1560
|
+
const gap = smallestGapBefore(recent, assertion.cue);
|
|
1561
|
+
const gapPass = assertion.minGapMs === void 0 || gap === void 0 || gap >= assertion.minGapMs;
|
|
1562
|
+
const pass = cues !== void 0 && plays >= minimum && (assertion.maxPlays === void 0 || plays <= assertion.maxPlays) && gapPass;
|
|
1563
|
+
const result = {
|
|
1564
|
+
details: {
|
|
1565
|
+
cue: assertion.cue,
|
|
1566
|
+
maxPlays: assertion.maxPlays ?? null,
|
|
1567
|
+
minGapMs: assertion.minGapMs ?? null,
|
|
1568
|
+
minPlays: minimum,
|
|
1569
|
+
observed: cues === void 0 ? null : plays,
|
|
1570
|
+
observedGapMs: gap ?? null
|
|
1571
|
+
},
|
|
1572
|
+
id: `audio.${assertion.cue}`,
|
|
1573
|
+
pass
|
|
1574
|
+
};
|
|
1575
|
+
return pass ? { assertion: result } : {
|
|
1576
|
+
assertion: result,
|
|
1577
|
+
diagnostic: {
|
|
1578
|
+
code: "TN_PLAYTEST_AUDIO_ASSERTION_FAILED",
|
|
1579
|
+
message: cues === void 0 ? `No runtime audio ledger was published, so cue '${assertion.cue}' cannot be proved either way.` : gapPass ? `Cue '${assertion.cue}' played ${plays} time(s); expected at least ${minimum}${assertion.maxPlays === void 0 ? "" : ` and at most ${assertion.maxPlays}`}.` : `Cue '${assertion.cue}' started ${gap ?? 0} ms after the line before it, which is under the ${String(assertion.minGapMs)} ms it needs; one of them was cut off.`,
|
|
1580
|
+
observedRuntimePath: "observations.json/runtimeObservations/gameplay/audio/cues",
|
|
1581
|
+
severity: "error",
|
|
1582
|
+
suggestion: cues === void 0 ? "Run on a target whose bridge advertises runtime.audio, and pass `cue` to AudioBus.play/playAt for the lines under test." : "Read observations.json/runtimeObservations/gameplay/audio/recentCues for when each play happened, and check the one-shot flag that gates the cue."
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1515
1586
|
function evaluateWorldAssertion(assertion, observations) {
|
|
1516
1587
|
const gameplay = gameplayObservations(observations);
|
|
1517
1588
|
const world = isRecord(gameplay?.world) ? gameplay.world : void 0;
|
|
@@ -1683,6 +1754,47 @@ function runtimeAnimationObservations(value) {
|
|
|
1683
1754
|
return isRecord(gameplay?.animation) ? gameplay.animation : void 0;
|
|
1684
1755
|
}
|
|
1685
1756
|
|
|
1757
|
+
// src/protocol.ts
|
|
1758
|
+
var PLAYTEST_BRIDGE_GLOBAL = "__THREENATIVE_PLAYTEST_BRIDGE__";
|
|
1759
|
+
var PLAYTEST_PROTOCOL_VERSION = 1;
|
|
1760
|
+
var PLAYTEST_FROZEN_MARKER = "__threenativeFrozen";
|
|
1761
|
+
var PLAYTEST_ADVANCE_TICK_BUDGET_MS = 250;
|
|
1762
|
+
var PLAYTEST_STARTUP_COMPILE_BUDGET_MS = 15e3;
|
|
1763
|
+
var PLAYTEST_PROTOCOL_LIMITS = {
|
|
1764
|
+
maxEntitiesPerSample: 100,
|
|
1765
|
+
maxEventsPerDrain: 1e3,
|
|
1766
|
+
maxPayloadBytes: 1e6,
|
|
1767
|
+
operationTimeoutMs: 5e3
|
|
1768
|
+
};
|
|
1769
|
+
var PLAYTEST_STARTUP_READY_TIMEOUT_MS = 18e4;
|
|
1770
|
+
var PLAYTEST_FRAME_BUDGET_PHASES = ["hostGap", "overlay", "render", "residual", "update"];
|
|
1771
|
+
var PLAYTEST_FRAME_PASS_KINDS = ["main", "shadow", "reflection", "nested"];
|
|
1772
|
+
function jsonByteLength(value) {
|
|
1773
|
+
return new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
1774
|
+
}
|
|
1775
|
+
function assertJsonSafe(value, path = "$") {
|
|
1776
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
1777
|
+
return;
|
|
1778
|
+
}
|
|
1779
|
+
if (typeof value === "number") {
|
|
1780
|
+
if (Number.isFinite(value)) {
|
|
1781
|
+
return;
|
|
1782
|
+
}
|
|
1783
|
+
throw new TypeError(`${path} must contain only finite JSON numbers.`);
|
|
1784
|
+
}
|
|
1785
|
+
if (Array.isArray(value)) {
|
|
1786
|
+
value.forEach((item, index) => assertJsonSafe(item, `${path}[${index}]`));
|
|
1787
|
+
return;
|
|
1788
|
+
}
|
|
1789
|
+
if (typeof value === "object") {
|
|
1790
|
+
for (const [key, item] of Object.entries(value)) {
|
|
1791
|
+
assertJsonSafe(item, `${path}.${key}`);
|
|
1792
|
+
}
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
throw new TypeError(`${path} must be JSON-safe.`);
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1686
1798
|
// src/evaluators/render-evidence.ts
|
|
1687
1799
|
function projectedPixelsForEntity(snapshot, entity, viewport) {
|
|
1688
1800
|
const rendered = renderedEntity(snapshot, entity);
|
|
@@ -1805,13 +1917,47 @@ function evaluatePerformanceAssertion(assertion, series, sourcePath) {
|
|
|
1805
1917
|
samplesPass && triangles.length === samples.length && maxObservedTriangles !== void 0 && maxObservedTriangles <= assertion.maxTriangles
|
|
1806
1918
|
);
|
|
1807
1919
|
}
|
|
1920
|
+
const addPassBound = (unit, kind, ceiling) => {
|
|
1921
|
+
const noun = unit === "draws" ? "draw calls" : "triangles";
|
|
1922
|
+
const measured = observed.flatMap((sample) => {
|
|
1923
|
+
const pass2 = sample.passes?.find((candidate) => candidate.kind === kind);
|
|
1924
|
+
return pass2 === void 0 ? [] : [pass2[unit]];
|
|
1925
|
+
});
|
|
1926
|
+
const actual = measured.length === samples.length ? Math.max(...measured) : void 0;
|
|
1927
|
+
const id = unit === "draws" ? `performance.maxPassDrawCalls.${kind}` : `performance.maxPassTriangles.${kind}`;
|
|
1928
|
+
const pass = samplesPass && actual !== void 0 && actual <= ceiling;
|
|
1929
|
+
results.push({
|
|
1930
|
+
details: { actual: actual ?? null, expected: ceiling, pass: kind, sampleCount: samples.length, unit: noun },
|
|
1931
|
+
id,
|
|
1932
|
+
pass
|
|
1933
|
+
});
|
|
1934
|
+
if (!pass) diagnostics.push({
|
|
1935
|
+
code: "TN_PLAYTEST_PERFORMANCE_ASSERTION_FAILED",
|
|
1936
|
+
message: actual === void 0 ? `${id} received no per-pass samples for '${kind}'; ${measured.length} of ${samples.length} frames carried that pass.` : `${id} expected at most ${ceiling} ${noun}, observed ${actual}.`,
|
|
1937
|
+
observedRuntimePath: path,
|
|
1938
|
+
severity: "error",
|
|
1939
|
+
sourcePath,
|
|
1940
|
+
suggestion: "Keep the engine frame budget installed so the run carries a per-pass split; a renderer that reports no split cannot satisfy a per-pass ceiling."
|
|
1941
|
+
});
|
|
1942
|
+
};
|
|
1943
|
+
for (const [kind, ceiling] of Object.entries(assertion.maxPassDrawCalls ?? {}))
|
|
1944
|
+
addPassBound("draws", kind, ceiling);
|
|
1945
|
+
for (const [kind, ceiling] of Object.entries(assertion.maxPassTriangles ?? {}))
|
|
1946
|
+
addPassBound("triangles", kind, ceiling);
|
|
1808
1947
|
return { assertions: results, diagnostics };
|
|
1809
1948
|
}
|
|
1810
1949
|
function isRuntimeDiagnosticsSample(value) {
|
|
1811
1950
|
if (!isRecord(value) || typeof value.frameMs !== "number" || !Number.isFinite(value.frameMs) || value.frameMs <= 0) {
|
|
1812
1951
|
return false;
|
|
1813
1952
|
}
|
|
1814
|
-
return (value.drawCalls === void 0 || typeof value.drawCalls === "number" && Number.isFinite(value.drawCalls) && value.drawCalls >= 0) && (value.triangles === void 0 || typeof value.triangles === "number" && Number.isFinite(value.triangles) && value.triangles >= 0) && isFramePhaseSplit(value.phases);
|
|
1953
|
+
return (value.drawCalls === void 0 || typeof value.drawCalls === "number" && Number.isFinite(value.drawCalls) && value.drawCalls >= 0) && (value.triangles === void 0 || typeof value.triangles === "number" && Number.isFinite(value.triangles) && value.triangles >= 0) && isFramePhaseSplit(value.phases) && isFramePassSplit(value.passes);
|
|
1954
|
+
}
|
|
1955
|
+
function isFramePassSplit(value) {
|
|
1956
|
+
if (value === void 0) return true;
|
|
1957
|
+
if (!Array.isArray(value)) return false;
|
|
1958
|
+
return value.every(
|
|
1959
|
+
(pass) => isRecord(pass) && PLAYTEST_FRAME_PASS_KINDS.includes(pass.kind) && typeof pass.draws === "number" && Number.isFinite(pass.draws) && pass.draws >= 0 && typeof pass.triangles === "number" && Number.isFinite(pass.triangles) && pass.triangles >= 0
|
|
1960
|
+
);
|
|
1815
1961
|
}
|
|
1816
1962
|
function isFramePhaseSplit(value) {
|
|
1817
1963
|
if (value === void 0) return true;
|
|
@@ -3045,6 +3191,11 @@ function emitPerfSignalsWorld(ctx) {
|
|
|
3045
3191
|
suggestion: "Expose a bounded events callback on the playtest bridge and inspect the emitted signal name and entity."
|
|
3046
3192
|
});
|
|
3047
3193
|
}
|
|
3194
|
+
for (const assertion of scenarioAssertions.audio ?? []) {
|
|
3195
|
+
const result = evaluateAudioAssertion(assertion, input.report.observations?.runtimeObservations);
|
|
3196
|
+
assertions.push(result.assertion);
|
|
3197
|
+
if (result.diagnostic !== void 0) diagnostics.push(result.diagnostic);
|
|
3198
|
+
}
|
|
3048
3199
|
if (scenarioAssertions.world !== void 0) {
|
|
3049
3200
|
const result = evaluateWorldAssertion(scenarioAssertions.world, input.report.observations?.runtimeObservations);
|
|
3050
3201
|
assertions.push(result.assertion);
|
|
@@ -4166,6 +4317,19 @@ function evaluateRichPlaytestAssertions(input) {
|
|
|
4166
4317
|
emitRenderChain(ctx);
|
|
4167
4318
|
emitScene(ctx);
|
|
4168
4319
|
emitSceneNodes(ctx);
|
|
4320
|
+
if (scenarioAssertions.geometry !== void 0) {
|
|
4321
|
+
const observed = input.report.observations?.geometry;
|
|
4322
|
+
const status = observed?.status;
|
|
4323
|
+
const pass = status === "captured";
|
|
4324
|
+
assertions.push({ details: { observed, status }, id: "geometry.observed", pass });
|
|
4325
|
+
if (!pass) diagnostics.push({
|
|
4326
|
+
code: "TN_PLAYTEST_GEOMETRY_UNOBSERVED",
|
|
4327
|
+
message: "A geometry assertion was evaluated against a run whose bridge reported no captured geometry frame.",
|
|
4328
|
+
observedRuntimePath: "observations.json/geometry",
|
|
4329
|
+
severity: "error",
|
|
4330
|
+
suggestion: "Request the capture on a target whose bridge advertises runtime.geometry and is presenting world frames."
|
|
4331
|
+
});
|
|
4332
|
+
}
|
|
4169
4333
|
emitCausedBy(ctx);
|
|
4170
4334
|
emitStartup(ctx);
|
|
4171
4335
|
emitMovementEvidence(ctx);
|
|
@@ -4471,46 +4635,6 @@ function playtestDiagnostic(code, message, instruction, details = {}) {
|
|
|
4471
4635
|
};
|
|
4472
4636
|
}
|
|
4473
4637
|
|
|
4474
|
-
// src/protocol.ts
|
|
4475
|
-
var PLAYTEST_BRIDGE_GLOBAL = "__THREENATIVE_PLAYTEST_BRIDGE__";
|
|
4476
|
-
var PLAYTEST_PROTOCOL_VERSION = 1;
|
|
4477
|
-
var PLAYTEST_FROZEN_MARKER = "__threenativeFrozen";
|
|
4478
|
-
var PLAYTEST_ADVANCE_TICK_BUDGET_MS = 250;
|
|
4479
|
-
var PLAYTEST_STARTUP_COMPILE_BUDGET_MS = 15e3;
|
|
4480
|
-
var PLAYTEST_PROTOCOL_LIMITS = {
|
|
4481
|
-
maxEntitiesPerSample: 100,
|
|
4482
|
-
maxEventsPerDrain: 1e3,
|
|
4483
|
-
maxPayloadBytes: 1e6,
|
|
4484
|
-
operationTimeoutMs: 5e3
|
|
4485
|
-
};
|
|
4486
|
-
var PLAYTEST_STARTUP_READY_TIMEOUT_MS = 18e4;
|
|
4487
|
-
var PLAYTEST_FRAME_BUDGET_PHASES = ["hostGap", "overlay", "render", "residual", "update"];
|
|
4488
|
-
function jsonByteLength(value) {
|
|
4489
|
-
return new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
4490
|
-
}
|
|
4491
|
-
function assertJsonSafe(value, path = "$") {
|
|
4492
|
-
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
4493
|
-
return;
|
|
4494
|
-
}
|
|
4495
|
-
if (typeof value === "number") {
|
|
4496
|
-
if (Number.isFinite(value)) {
|
|
4497
|
-
return;
|
|
4498
|
-
}
|
|
4499
|
-
throw new TypeError(`${path} must contain only finite JSON numbers.`);
|
|
4500
|
-
}
|
|
4501
|
-
if (Array.isArray(value)) {
|
|
4502
|
-
value.forEach((item, index) => assertJsonSafe(item, `${path}[${index}]`));
|
|
4503
|
-
return;
|
|
4504
|
-
}
|
|
4505
|
-
if (typeof value === "object") {
|
|
4506
|
-
for (const [key, item] of Object.entries(value)) {
|
|
4507
|
-
assertJsonSafe(item, `${path}.${key}`);
|
|
4508
|
-
}
|
|
4509
|
-
return;
|
|
4510
|
-
}
|
|
4511
|
-
throw new TypeError(`${path} must be JSON-safe.`);
|
|
4512
|
-
}
|
|
4513
|
-
|
|
4514
4638
|
// src/scenario/errors.ts
|
|
4515
4639
|
var PlaytestScenarioError = class extends Error {
|
|
4516
4640
|
constructor(diagnostic) {
|
|
@@ -4688,6 +4812,8 @@ var GENERATED_ASSERTION_FIELD_VALIDATORS = Object.freeze({
|
|
|
4688
4812
|
"minFps": (value) => typeof value === "number" && Number.isFinite(value),
|
|
4689
4813
|
"maxPhaseMsP95": (value) => isRecord2(value),
|
|
4690
4814
|
"maxDrawCalls": (value) => typeof value === "number" && Number.isFinite(value),
|
|
4815
|
+
"maxPassDrawCalls": (value) => isRecord2(value),
|
|
4816
|
+
"maxPassTriangles": (value) => isRecord2(value),
|
|
4691
4817
|
"maxTriangles": (value) => typeof value === "number" && Number.isFinite(value)
|
|
4692
4818
|
}),
|
|
4693
4819
|
"parity": Object.freeze({
|
|
@@ -4704,6 +4830,12 @@ var GENERATED_ASSERTION_FIELD_VALIDATORS = Object.freeze({
|
|
|
4704
4830
|
"present": (value) => typeof value === "boolean",
|
|
4705
4831
|
"allowTrivial": (value) => typeof value === "string" && value.replace(/\s/gu, "").length >= MIN_TRIVIALITY_REASON_LENGTH
|
|
4706
4832
|
}),
|
|
4833
|
+
"audio": Object.freeze({
|
|
4834
|
+
"cue": (value) => typeof value === "string" && value.trim() !== "",
|
|
4835
|
+
"minPlays": (value) => typeof value === "number" && Number.isInteger(value) && value >= 0,
|
|
4836
|
+
"maxPlays": (value) => typeof value === "number" && Number.isInteger(value) && value >= 0,
|
|
4837
|
+
"minGapMs": (value) => typeof value === "number" && Number.isInteger(value) && value >= 0
|
|
4838
|
+
}),
|
|
4707
4839
|
"world": Object.freeze({
|
|
4708
4840
|
"seed": (value) => true,
|
|
4709
4841
|
"runtime": (value) => isRecord2(value)
|
|
@@ -5007,10 +5139,12 @@ function validateDeviceMetricsAssertion(value, scenarioPath, objectPath) {
|
|
|
5007
5139
|
}
|
|
5008
5140
|
function validatePerformanceAssertion(value, scenarioPath, objectPath) {
|
|
5009
5141
|
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
5010
|
-
rejectUnknownKeys(record4, ["maxDrawCalls", "maxFrameMsP95", "maxPhaseMsP95", "maxTriangles", "minFps"], scenarioPath, objectPath);
|
|
5142
|
+
rejectUnknownKeys(record4, ["maxDrawCalls", "maxFrameMsP95", "maxPassDrawCalls", "maxPassTriangles", "maxPhaseMsP95", "maxTriangles", "minFps"], scenarioPath, objectPath);
|
|
5011
5143
|
return {
|
|
5012
5144
|
...present("maxDrawCalls", optionalNonNegativeNumber(record4, "maxDrawCalls", scenarioPath, objectPath)),
|
|
5013
5145
|
...present("maxFrameMsP95", optionalNonNegativeNumber(record4, "maxFrameMsP95", scenarioPath, objectPath)),
|
|
5146
|
+
...present("maxPassDrawCalls", validatePassBudget(record4.maxPassDrawCalls, scenarioPath, `${objectPath}.maxPassDrawCalls`)),
|
|
5147
|
+
...present("maxPassTriangles", validatePassBudget(record4.maxPassTriangles, scenarioPath, `${objectPath}.maxPassTriangles`)),
|
|
5014
5148
|
...present("maxPhaseMsP95", validatePhaseBudget(record4.maxPhaseMsP95, scenarioPath, `${objectPath}.maxPhaseMsP95`)),
|
|
5015
5149
|
...present("maxTriangles", optionalNonNegativeNumber(record4, "maxTriangles", scenarioPath, objectPath)),
|
|
5016
5150
|
...present("minFps", optionalNonNegativeNumber(record4, "minFps", scenarioPath, objectPath))
|
|
@@ -5147,6 +5281,25 @@ function validateStartupAssertion(value, scenarioPath, objectPath) {
|
|
|
5147
5281
|
}
|
|
5148
5282
|
return result;
|
|
5149
5283
|
}
|
|
5284
|
+
function validatePassBudget(value, scenarioPath, objectPath) {
|
|
5285
|
+
if (value === void 0) return void 0;
|
|
5286
|
+
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
5287
|
+
const entries = Object.entries(record4);
|
|
5288
|
+
if (entries.length === 0)
|
|
5289
|
+
throw invalidScenario(scenarioPath, `${objectPath} must name at least one render pass.`);
|
|
5290
|
+
const budget = {};
|
|
5291
|
+
for (const [pass, ceiling] of entries) {
|
|
5292
|
+
if (!PLAYTEST_FRAME_PASS_KINDS.includes(pass))
|
|
5293
|
+
throw invalidScenario(
|
|
5294
|
+
scenarioPath,
|
|
5295
|
+
`${objectPath}.${pass} is not a render pass. Expected one of: ${PLAYTEST_FRAME_PASS_KINDS.join(", ")}.`
|
|
5296
|
+
);
|
|
5297
|
+
if (typeof ceiling !== "number" || !Number.isFinite(ceiling) || ceiling < 0)
|
|
5298
|
+
throw invalidScenario(scenarioPath, `${objectPath}.${pass} must be a non-negative number of draw calls or triangles.`);
|
|
5299
|
+
budget[pass] = ceiling;
|
|
5300
|
+
}
|
|
5301
|
+
return budget;
|
|
5302
|
+
}
|
|
5150
5303
|
function validatePhaseBudget(value, scenarioPath, objectPath) {
|
|
5151
5304
|
if (value === void 0) return void 0;
|
|
5152
5305
|
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
@@ -6285,14 +6438,16 @@ function validateStepLabels(steps, assertions, scenarioPath) {
|
|
|
6285
6438
|
}
|
|
6286
6439
|
}
|
|
6287
6440
|
function playtestStepHoldTicks(step, fallback = 1) {
|
|
6288
|
-
|
|
6441
|
+
const pointerHold = (step.pointers !== void 0 || step.pointerPosition !== void 0) && step.holdTicks !== void 0;
|
|
6442
|
+
if (step.press === void 0 && !pointerHold || step.holdFrames !== void 0 || step.waitFrames !== void 0)
|
|
6443
|
+
return 0;
|
|
6289
6444
|
return Math.max(1, step.holdTicks ?? fallback);
|
|
6290
6445
|
}
|
|
6291
6446
|
function playtestStepWaitTicks(step) {
|
|
6292
6447
|
return step.waitFrames === void 0 ? Math.max(0, step.waitTicks ?? 0) : 0;
|
|
6293
6448
|
}
|
|
6294
6449
|
function validateAssertions(value, scenarioPath) {
|
|
6295
|
-
rejectUnknownKeys(value, PLAYTEST_ASSERTION_REGISTRY.map((entry) => entry.kind), scenarioPath, "assert");
|
|
6450
|
+
rejectUnknownKeys(value, [...PLAYTEST_ASSERTION_REGISTRY.map((entry) => entry.kind), "geometry"], scenarioPath, "assert");
|
|
6296
6451
|
validateAssertionShapes(value, scenarioPath);
|
|
6297
6452
|
validateAssertionKeys(value, scenarioPath);
|
|
6298
6453
|
if (Array.isArray(value.signals) && value.signals.length === 0) {
|
|
@@ -6318,6 +6473,7 @@ function validateAssertions(value, scenarioPath) {
|
|
|
6318
6473
|
const renderChain = value.renderChain === void 0 ? void 0 : validateRenderChainAssertion(value.renderChain, scenarioPath, "assert.renderChain");
|
|
6319
6474
|
const startup = value.startup === void 0 ? void 0 : validateStartupAssertion(value.startup, scenarioPath, "assert.startup");
|
|
6320
6475
|
const scene = value.scene === void 0 ? void 0 : validateSceneAssertion(value.scene, scenarioPath, "assert.scene");
|
|
6476
|
+
const geometry = value.geometry === void 0 ? void 0 : validateGeometryCaptureRequest(value.geometry, scenarioPath, "assert.geometry");
|
|
6321
6477
|
const world = isRecord3(value.world) ? value.world : void 0;
|
|
6322
6478
|
const optOuts = [
|
|
6323
6479
|
["noConsoleErrors", "consoleErrorsOptOutReason"],
|
|
@@ -6335,6 +6491,7 @@ function validateAssertions(value, scenarioPath) {
|
|
|
6335
6491
|
return {
|
|
6336
6492
|
...Array.isArray(value.aerodynamics) ? { aerodynamics: value.aerodynamics.map((entry, index) => validateAerodynamicsAssertion(entry, scenarioPath, `assert.aerodynamics[${index}]`)) } : {},
|
|
6337
6493
|
...Array.isArray(value.animation) ? { animation: value.animation.map((entry, index) => validateAnimationAssertion(entry, scenarioPath, `assert.animation[${index}]`)) } : {},
|
|
6494
|
+
...Array.isArray(value.audio) ? { audio: value.audio.map((entry, index) => validateAudioAssertion(entry, scenarioPath, `assert.audio[${index}]`)) } : {},
|
|
6338
6495
|
...camera === void 0 ? {} : {
|
|
6339
6496
|
camera: {
|
|
6340
6497
|
...typeof camera.entity === "string" ? { entity: camera.entity } : {},
|
|
@@ -6367,6 +6524,7 @@ function validateAssertions(value, scenarioPath) {
|
|
|
6367
6524
|
...renderChain === void 0 ? {} : { renderChain },
|
|
6368
6525
|
...startup === void 0 ? {} : { startup },
|
|
6369
6526
|
...scene === void 0 ? {} : { scene },
|
|
6527
|
+
...geometry === void 0 ? {} : { geometry },
|
|
6370
6528
|
...hasKey(value, "causedBy") ? {
|
|
6371
6529
|
causedBy: requireArray(value, "causedBy", scenarioPath, "assert.causedBy").map((entry, index) => validateCausedByAssertion(entry, scenarioPath, `assert.causedBy[${index}]`))
|
|
6372
6530
|
} : {},
|
|
@@ -6426,6 +6584,34 @@ function validateAssertions(value, scenarioPath) {
|
|
|
6426
6584
|
...world === void 0 ? {} : { world: validateWorldAssertion(world, scenarioPath) }
|
|
6427
6585
|
};
|
|
6428
6586
|
}
|
|
6587
|
+
function validateAudioAssertion(value, scenarioPath, objectPath) {
|
|
6588
|
+
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
6589
|
+
rejectUnknownKeys(record4, ["cue", "maxPlays", "minGapMs", "minPlays"], scenarioPath, objectPath);
|
|
6590
|
+
if (typeof record4.cue !== "string" || record4.cue.trim() === "")
|
|
6591
|
+
throw invalidScenario(scenarioPath, `Assertion '${objectPath}.cue' must be a non-empty string.`);
|
|
6592
|
+
const bound = (name) => {
|
|
6593
|
+
const raw = record4[name];
|
|
6594
|
+
if (raw === void 0) return void 0;
|
|
6595
|
+
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 0)
|
|
6596
|
+
throw invalidScenario(scenarioPath, `Assertion '${objectPath}.${name}' must be a non-negative integer.`);
|
|
6597
|
+
return raw;
|
|
6598
|
+
};
|
|
6599
|
+
const minPlays = bound("minPlays");
|
|
6600
|
+
const maxPlays = bound("maxPlays");
|
|
6601
|
+
const minGapMs = bound("minGapMs");
|
|
6602
|
+
if (minPlays !== void 0 && maxPlays !== void 0 && maxPlays < minPlays) {
|
|
6603
|
+
throw invalidScenario(
|
|
6604
|
+
scenarioPath,
|
|
6605
|
+
`Assertion '${objectPath}' cannot require at least ${minPlays} play(s) and at most ${maxPlays}.`
|
|
6606
|
+
);
|
|
6607
|
+
}
|
|
6608
|
+
return {
|
|
6609
|
+
cue: record4.cue,
|
|
6610
|
+
...maxPlays === void 0 ? {} : { maxPlays },
|
|
6611
|
+
...minGapMs === void 0 ? {} : { minGapMs },
|
|
6612
|
+
...minPlays === void 0 ? {} : { minPlays }
|
|
6613
|
+
};
|
|
6614
|
+
}
|
|
6429
6615
|
function validateWorldAssertion(value, scenarioPath) {
|
|
6430
6616
|
rejectUnknownKeys(value, ["runtime", "seed"], scenarioPath, "assert.world");
|
|
6431
6617
|
if (!hasKey(value, "seed") || value.seed !== null && (typeof value.seed !== "number" || !Number.isFinite(value.seed))) {
|
|
@@ -6592,6 +6778,24 @@ function validateOccludedAssertion(value, scenarioPath, objectPath) {
|
|
|
6592
6778
|
...present("target", optionalString(record4, "target", scenarioPath, objectPath))
|
|
6593
6779
|
};
|
|
6594
6780
|
}
|
|
6781
|
+
function validateGeometryCaptureRequest(value, scenarioPath, objectPath) {
|
|
6782
|
+
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
6783
|
+
rejectUnknownKeys(record4, ["limit", "sort", "timeoutMs"], scenarioPath, objectPath);
|
|
6784
|
+
if (record4.limit !== void 0 && (typeof record4.limit !== "number" || !Number.isInteger(record4.limit) || record4.limit < 1 || record4.limit > 500)) {
|
|
6785
|
+
throw invalidScenario(scenarioPath, `'${objectPath}.limit' must be an integer from 1 to 500, received ${describeValue(record4.limit)}.`);
|
|
6786
|
+
}
|
|
6787
|
+
if (record4.sort !== void 0 && record4.sort !== "triangles" && record4.sort !== "draws" && record4.sort !== "projected") {
|
|
6788
|
+
throw invalidScenario(scenarioPath, `'${objectPath}.sort' must be one of triangles, draws, projected, received ${describeValue(record4.sort)}.`);
|
|
6789
|
+
}
|
|
6790
|
+
if (record4.timeoutMs !== void 0 && (typeof record4.timeoutMs !== "number" || !Number.isFinite(record4.timeoutMs) || record4.timeoutMs <= 0)) {
|
|
6791
|
+
throw invalidScenario(scenarioPath, `'${objectPath}.timeoutMs' must be a positive finite number, received ${describeValue(record4.timeoutMs)}.`);
|
|
6792
|
+
}
|
|
6793
|
+
return {
|
|
6794
|
+
...record4.limit === void 0 ? {} : { limit: record4.limit },
|
|
6795
|
+
...record4.sort === void 0 ? {} : { sort: record4.sort },
|
|
6796
|
+
...record4.timeoutMs === void 0 ? {} : { timeoutMs: record4.timeoutMs }
|
|
6797
|
+
};
|
|
6798
|
+
}
|
|
6595
6799
|
|
|
6596
6800
|
// src/scenario.ts
|
|
6597
6801
|
async function loadPlaytestScenario(projectPath, scenarioPath) {
|
|
@@ -6714,4 +6918,4 @@ function reachabilityEnvelope(value) {
|
|
|
6714
6918
|
return typeof measurement.maxRise === "number" && Number.isFinite(measurement.maxRise) && measurement.maxRise >= 0 && typeof measurement.forwardReach === "number" && Number.isFinite(measurement.forwardReach) && measurement.forwardReach >= 0 && typeof measurement.fallDistanceToGround === "number" && Number.isFinite(measurement.fallDistanceToGround) && measurement.fallDistanceToGround >= measurement.maxRise ? { fallDistanceToGround: measurement.fallDistanceToGround, forwardReach: measurement.forwardReach, maxRise: measurement.maxRise } : void 0;
|
|
6715
6919
|
}
|
|
6716
6920
|
|
|
6717
|
-
export { DEVICE_METRICS_CADENCE_MS, DEVICE_METRICS_MAX_SAMPLES, DeviceMetricsError, DeviceMetricsRecorder, HOT_START_TEMPERATURE_C, PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_ASSERTION_REGISTRY, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_CAPABILITY_REGISTRY, PLAYTEST_FROZEN_MARKER, PLAYTEST_PROTOCOL_LIMITS, PLAYTEST_PROTOCOL_VERSION, PLAYTEST_STARTUP_COMPILE_BUDGET_MS, PLAYTEST_STARTUP_READY_TIMEOUT_MS, PlaytestScenarioError, assertJsonSafe, evaluateRichPlaytestAssertions, invalidScenario, jsonByteLength, loadPlaytestScenario, missingPlaytestCapabilities, parseDeviceBattery, parseDeviceCurrent, parseDevicePowerRails, parseDeviceThermal, playtestDiagnostic, playtestStepHoldTicks, playtestStepWaitTicks, rejectUnknownKeys, requiredPlaytestCapabilities, resolveDiagnosticsPolicy, summarizeDeviceMetrics, unknownPlaytestCapabilities };
|
|
6921
|
+
export { DEVICE_METRICS_CADENCE_MS, DEVICE_METRICS_MAX_SAMPLES, DeviceMetricsError, DeviceMetricsRecorder, HOT_START_TEMPERATURE_C, PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_ASSERTION_REGISTRY, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_CAPABILITY_REGISTRY, PLAYTEST_FRAME_PASS_KINDS, PLAYTEST_FROZEN_MARKER, PLAYTEST_PROTOCOL_LIMITS, PLAYTEST_PROTOCOL_VERSION, PLAYTEST_STARTUP_COMPILE_BUDGET_MS, PLAYTEST_STARTUP_READY_TIMEOUT_MS, PlaytestScenarioError, assertJsonSafe, evaluateRichPlaytestAssertions, invalidScenario, jsonByteLength, loadPlaytestScenario, missingPlaytestCapabilities, parseDeviceBattery, parseDeviceCurrent, parseDevicePowerRails, parseDeviceThermal, playtestDiagnostic, playtestStepHoldTicks, playtestStepWaitTicks, rejectUnknownKeys, requiredPlaytestCapabilities, resolveDiagnosticsPolicy, summarizeDeviceMetrics, unknownPlaytestCapabilities };
|
package/dist/protocol.d.ts
CHANGED
|
@@ -132,8 +132,19 @@ interface IPlaytestSetupRequest {
|
|
|
132
132
|
value: JsonValue;
|
|
133
133
|
}>;
|
|
134
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* One armed per-object geometry capture request. `limit`, `sort` and `timeoutMs` mirror the
|
|
137
|
+
* runtime collector's own request shape so the runner adds no second vocabulary for it.
|
|
138
|
+
*/
|
|
139
|
+
interface IPlaytestGeometryCaptureRequest {
|
|
140
|
+
/** Rows to return, 1 to 500. */
|
|
141
|
+
readonly limit?: number;
|
|
142
|
+
readonly sort?: "triangles" | "draws" | "projected";
|
|
143
|
+
readonly timeoutMs?: number;
|
|
144
|
+
}
|
|
135
145
|
interface IPlaytestSampleRequest {
|
|
136
146
|
entities?: readonly string[];
|
|
147
|
+
geometry?: IPlaytestGeometryCaptureRequest;
|
|
137
148
|
include?: readonly string[];
|
|
138
149
|
/** Scenario-step label for providers that retain labelled observation series. */
|
|
139
150
|
label?: string;
|
|
@@ -436,6 +447,19 @@ type PlaytestFramePhase = (typeof PLAYTEST_FRAME_BUDGET_PHASES)[number];
|
|
|
436
447
|
* missing evidence rather than passing on nothing.
|
|
437
448
|
*/
|
|
438
449
|
type PlaytestFramePhaseSample = Partial<Record<PlaytestFramePhase, number>>;
|
|
450
|
+
/**
|
|
451
|
+
* The named render-pass kinds a budget can bound. Deliberately the same closed set the engine's
|
|
452
|
+
* `RenderPassBudget` emits, spelled out here rather than imported: this package must run against
|
|
453
|
+
* plain Three.js with zero ThreeNative dependency, exactly as it does for the phase names.
|
|
454
|
+
*/
|
|
455
|
+
declare const PLAYTEST_FRAME_PASS_KINDS: readonly ["main", "shadow", "reflection", "nested"];
|
|
456
|
+
type PlaytestFramePassKind = (typeof PLAYTEST_FRAME_PASS_KINDS)[number];
|
|
457
|
+
/** One render pass's own submissions, attributed to the innermost active render call. */
|
|
458
|
+
interface IPlaytestFramePassSample {
|
|
459
|
+
readonly draws: number;
|
|
460
|
+
readonly kind: PlaytestFramePassKind;
|
|
461
|
+
readonly triangles: number;
|
|
462
|
+
}
|
|
439
463
|
interface IPlaytestRuntimeDiagnosticsSample {
|
|
440
464
|
drawCalls?: number;
|
|
441
465
|
frameMs: number;
|
|
@@ -444,6 +468,11 @@ interface IPlaytestRuntimeDiagnosticsSample {
|
|
|
444
468
|
* frame budget. Absent for a plain Three.js bridge.
|
|
445
469
|
*/
|
|
446
470
|
phases?: PlaytestFramePhaseSample;
|
|
471
|
+
/**
|
|
472
|
+
* Draw calls and triangles per render pass, so a shadow or reflection pass is bounded rather
|
|
473
|
+
* than folded into the whole-frame draw count. Absent when the producer measures no split.
|
|
474
|
+
*/
|
|
475
|
+
passes?: readonly IPlaytestFramePassSample[];
|
|
447
476
|
triangles?: number;
|
|
448
477
|
}
|
|
449
478
|
interface IPlaytestObservationSnapshot {
|
|
@@ -456,6 +485,8 @@ interface IPlaytestObservationSnapshot {
|
|
|
456
485
|
components?: Record<string, Record<string, JsonValue>>;
|
|
457
486
|
entities?: IPlaytestEntityObservation[];
|
|
458
487
|
gameplay?: IPlaytestGameplayObservation;
|
|
488
|
+
/** The per-object geometry capture report, present only when the request asked for one. */
|
|
489
|
+
geometry?: JsonValue;
|
|
459
490
|
physicsDebugSeries?: Array<{
|
|
460
491
|
label: string;
|
|
461
492
|
snapshot: JsonValue;
|
|
@@ -529,4 +560,4 @@ declare function jsonByteLength(value: JsonValue): number;
|
|
|
529
560
|
*/
|
|
530
561
|
declare function assertJsonSafe(value: unknown, path?: string): asserts value is JsonValue;
|
|
531
562
|
|
|
532
|
-
export { type IPlaytestAdvanceResult, type IPlaytestAnimationObservation, type IPlaytestBridgeDescription, type IPlaytestBridgeHost, type IPlaytestBridgeReady, type IPlaytestBridgeV1, type IPlaytestCameraObservation, type IPlaytestContactObservation, type IPlaytestDeviceRequest, type IPlaytestDeviceResponse, type IPlaytestEntityObservation, type IPlaytestEntityTransform, type IPlaytestFogObservation, type IPlaytestGameplayObservation, type IPlaytestLightObservation, type IPlaytestObservationSnapshot, type IPlaytestPerformanceObservation, type IPlaytestRenderChainObservation, type IPlaytestRuntimeDiagnosticsSample, type IPlaytestSampleRequest, type IPlaytestSceneNodeMaterial, type IPlaytestSceneNodeObservation, type IPlaytestSceneNodeSelector, type IPlaytestSceneNodesObservation, type IPlaytestSceneObservation, type IPlaytestSetupConfirmation, type IPlaytestSetupRequest, type IPlaytestStartupObservation, type IPlaytestStartupTimeline, type IPlaytestStrideObservation, type IPlaytestTagObservation, type IPlaytestTransitionObservation, type IPlaytestWorldObservation, type IPlaytestWorldRuntimeObservation, type JsonPrimitive, type JsonValue, PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_FRAME_BUDGET_PHASES, PLAYTEST_FROZEN_MARKER, PLAYTEST_PROTOCOL_LIMITS, PLAYTEST_PROTOCOL_VERSION, PLAYTEST_STARTUP_COMPILE_BUDGET_MS, PLAYTEST_STARTUP_READY_TIMEOUT_MS, type PlaytestClockMode, type PlaytestFramePhase, type PlaytestFramePhaseSample, assertJsonSafe, jsonByteLength };
|
|
563
|
+
export { type IPlaytestAdvanceResult, type IPlaytestAnimationObservation, type IPlaytestBridgeDescription, type IPlaytestBridgeHost, type IPlaytestBridgeReady, type IPlaytestBridgeV1, type IPlaytestCameraObservation, type IPlaytestContactObservation, type IPlaytestDeviceRequest, type IPlaytestDeviceResponse, type IPlaytestEntityObservation, type IPlaytestEntityTransform, type IPlaytestFogObservation, type IPlaytestFramePassSample, type IPlaytestGameplayObservation, type IPlaytestGeometryCaptureRequest, type IPlaytestLightObservation, type IPlaytestObservationSnapshot, type IPlaytestPerformanceObservation, type IPlaytestRenderChainObservation, type IPlaytestRuntimeDiagnosticsSample, type IPlaytestSampleRequest, type IPlaytestSceneNodeMaterial, type IPlaytestSceneNodeObservation, type IPlaytestSceneNodeSelector, type IPlaytestSceneNodesObservation, type IPlaytestSceneObservation, type IPlaytestSetupConfirmation, type IPlaytestSetupRequest, type IPlaytestStartupObservation, type IPlaytestStartupTimeline, type IPlaytestStrideObservation, type IPlaytestTagObservation, type IPlaytestTransitionObservation, type IPlaytestWorldObservation, type IPlaytestWorldRuntimeObservation, type JsonPrimitive, type JsonValue, PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_FRAME_BUDGET_PHASES, PLAYTEST_FRAME_PASS_KINDS, PLAYTEST_FROZEN_MARKER, PLAYTEST_PROTOCOL_LIMITS, PLAYTEST_PROTOCOL_VERSION, PLAYTEST_STARTUP_COMPILE_BUDGET_MS, PLAYTEST_STARTUP_READY_TIMEOUT_MS, type PlaytestClockMode, type PlaytestFramePassKind, type PlaytestFramePhase, type PlaytestFramePhaseSample, assertJsonSafe, jsonByteLength };
|
package/dist/protocol.js
CHANGED
|
@@ -13,6 +13,7 @@ var PLAYTEST_PROTOCOL_LIMITS = {
|
|
|
13
13
|
};
|
|
14
14
|
var PLAYTEST_STARTUP_READY_TIMEOUT_MS = 18e4;
|
|
15
15
|
var PLAYTEST_FRAME_BUDGET_PHASES = ["hostGap", "overlay", "render", "residual", "update"];
|
|
16
|
+
var PLAYTEST_FRAME_PASS_KINDS = ["main", "shadow", "reflection", "nested"];
|
|
16
17
|
function jsonByteLength(value) {
|
|
17
18
|
return new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
18
19
|
}
|
|
@@ -39,4 +40,4 @@ function assertJsonSafe(value, path = "$") {
|
|
|
39
40
|
throw new TypeError(`${path} must be JSON-safe.`);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
export { PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_FRAME_BUDGET_PHASES, PLAYTEST_FROZEN_MARKER, PLAYTEST_PROTOCOL_LIMITS, PLAYTEST_PROTOCOL_VERSION, PLAYTEST_STARTUP_COMPILE_BUDGET_MS, PLAYTEST_STARTUP_READY_TIMEOUT_MS, assertJsonSafe, jsonByteLength };
|
|
43
|
+
export { PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_FRAME_BUDGET_PHASES, PLAYTEST_FRAME_PASS_KINDS, PLAYTEST_FROZEN_MARKER, PLAYTEST_PROTOCOL_LIMITS, PLAYTEST_PROTOCOL_VERSION, PLAYTEST_STARTUP_COMPILE_BUDGET_MS, PLAYTEST_STARTUP_READY_TIMEOUT_MS, assertJsonSafe, jsonByteLength };
|