@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.
- package/README.md +40 -2
- package/dist/capture.d.ts +23 -1
- package/dist/capture.js +92 -2
- package/dist/{diagnostics-BXhYI2sc.d.ts → diagnostics-BhS6v2n1.d.ts} +17 -748
- package/dist/index.d.ts +5 -3
- package/dist/index.js +1693 -108
- package/dist/protocol.d.ts +43 -2
- package/dist/protocol.js +10 -1
- package/dist/runner/cli.d.ts +4 -2
- package/dist/runner/cli.js +11002 -8514
- package/dist/runner/index.d.ts +101 -83
- package/dist/runner/index.js +11928 -9916
- package/dist/schema-base-B5mr_Yr9.d.ts +844 -0
- package/dist/{shared-CHIDDJpp.d.ts → shared-DK12BZyS.d.ts} +171 -3
- package/dist/three/index.d.ts +9 -1
- package/dist/three/index.js +94 -27
- package/package.json +3 -2
package/dist/protocol.d.ts
CHANGED
|
@@ -37,6 +37,31 @@ type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
|
37
37
|
[key: string]: JsonValue;
|
|
38
38
|
};
|
|
39
39
|
type PlaytestClockMode = "fixed-step" | "render-frame" | "wall-clock";
|
|
40
|
+
/**
|
|
41
|
+
* The clock a consumer asks this game to run on, named in this protocol's own vocabulary.
|
|
42
|
+
*
|
|
43
|
+
* Set before the game module evaluates — the production profile injects it into the instrumentation
|
|
44
|
+
* it puts ahead of the bundle, and the browser runner puts it in an `addInitScript` ahead of every
|
|
45
|
+
* page script — and read by the producer that owns the loop. It lives here, next to the mode it
|
|
46
|
+
* names, because a request the producer cannot read is how a live loop came to be judged a
|
|
47
|
+
* fixed-step one.
|
|
48
|
+
*/
|
|
49
|
+
declare const PLAYTEST_CLOCK_GLOBAL = "__THREENATIVE_PLAYTEST_CLOCK__";
|
|
50
|
+
/**
|
|
51
|
+
* The clock the host asked for, or `undefined` for the default deterministic run.
|
|
52
|
+
*
|
|
53
|
+
* `wall-clock` is the production profile's opt-in and the only one this protocol has. An
|
|
54
|
+
* unrecognised value throws instead of falling back, because a misspelling that quietly left the
|
|
55
|
+
* loop frozen would publish a frame rate for a game that was not playing.
|
|
56
|
+
*
|
|
57
|
+
* Read at the moment it is needed rather than once at install: a request that arrives after the
|
|
58
|
+
* producer was installed is still a request, and a producer that missed it would judge a live
|
|
59
|
+
* frame pump by a count it never asked for.
|
|
60
|
+
* @situation report which clock a playtest producer is really running on, before judging its ticks
|
|
61
|
+
* @constraint throws on an unrecognised value instead of falling back to a fixed-step run
|
|
62
|
+
* @example if (requestedPlaytestClockMode() === "wall-clock") host.pumpDrivesTheSimulation();
|
|
63
|
+
*/
|
|
64
|
+
declare function requestedPlaytestClockMode(): PlaytestClockMode | undefined;
|
|
40
65
|
interface IPlaytestBridgeDescription {
|
|
41
66
|
capabilities: readonly string[];
|
|
42
67
|
limits: typeof PLAYTEST_PROTOCOL_LIMITS;
|
|
@@ -499,6 +524,13 @@ interface IPlaytestObservationSnapshot {
|
|
|
499
524
|
* `runtime.physics`.
|
|
500
525
|
*/
|
|
501
526
|
physicsSteps?: number;
|
|
527
|
+
network?: {
|
|
528
|
+
requests: number;
|
|
529
|
+
entries: Array<{
|
|
530
|
+
method: string;
|
|
531
|
+
url: string;
|
|
532
|
+
}>;
|
|
533
|
+
};
|
|
502
534
|
performance?: IPlaytestPerformanceObservation;
|
|
503
535
|
/** Bounded shader/pipeline creation capture supplied by the engine when diagnostics are enabled. */
|
|
504
536
|
pipelineCensus?: JsonValue;
|
|
@@ -529,12 +561,21 @@ interface IPlaytestAdvanceResult {
|
|
|
529
561
|
ticks: number;
|
|
530
562
|
}
|
|
531
563
|
interface IPlaytestBridgeV1 {
|
|
532
|
-
|
|
564
|
+
/** A core bridge draws a driven frame only when asked (`render: true`), as a measurement that couples updates to draws does. */
|
|
565
|
+
advance?(ticks: number, options?: {
|
|
566
|
+
render?: boolean;
|
|
567
|
+
}): Promise<IPlaytestAdvanceResult>;
|
|
533
568
|
applySetup?(request: IPlaytestSetupRequest): Promise<IPlaytestSetupConfirmation | void>;
|
|
534
569
|
describe(): IPlaytestBridgeDescription | Promise<IPlaytestBridgeDescription>;
|
|
535
570
|
drainEvents?(limit?: number): Promise<JsonValue[]>;
|
|
536
571
|
focus?(): boolean | Promise<boolean>;
|
|
537
572
|
ready(): IPlaytestBridgeReady | Promise<IPlaytestBridgeReady>;
|
|
573
|
+
/**
|
|
574
|
+
* Draw the current world once without advancing it, so a capture can see a present while a
|
|
575
|
+
* deterministic run's loop is driven and presents nothing between ticks. Present only when the
|
|
576
|
+
* bridge advertises `runtime.renderOnly`.
|
|
577
|
+
*/
|
|
578
|
+
renderOnly?(): number | void | Promise<number | void>;
|
|
538
579
|
sample(request: IPlaytestSampleRequest): IPlaytestObservationSnapshot | Promise<IPlaytestObservationSnapshot>;
|
|
539
580
|
}
|
|
540
581
|
/** Request/response envelope used by the host-neutral device transport. */
|
|
@@ -567,4 +608,4 @@ declare function jsonByteLength(value: JsonValue): number;
|
|
|
567
608
|
*/
|
|
568
609
|
declare function assertJsonSafe(value: unknown, path?: string): asserts value is JsonValue;
|
|
569
610
|
|
|
570
|
-
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 };
|
|
611
|
+
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_CLOCK_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, requestedPlaytestClockMode };
|
package/dist/protocol.js
CHANGED
|
@@ -11,6 +11,15 @@ var PLAYTEST_PROTOCOL_LIMITS = {
|
|
|
11
11
|
maxPayloadBytes: 1e6,
|
|
12
12
|
operationTimeoutMs: 5e3
|
|
13
13
|
};
|
|
14
|
+
var PLAYTEST_CLOCK_GLOBAL = "__THREENATIVE_PLAYTEST_CLOCK__";
|
|
15
|
+
function requestedPlaytestClockMode() {
|
|
16
|
+
const requested = globalThis[PLAYTEST_CLOCK_GLOBAL];
|
|
17
|
+
if (requested === void 0) return void 0;
|
|
18
|
+
if (requested === "wall-clock") return "wall-clock";
|
|
19
|
+
throw new Error(
|
|
20
|
+
`TN_PLAYTEST_CLOCK_UNSUPPORTED: '${PLAYTEST_CLOCK_GLOBAL}' is ${JSON.stringify(requested)}; this protocol knows 'wall-clock' and nothing else.`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
14
23
|
var PLAYTEST_STARTUP_READY_TIMEOUT_MS = 18e4;
|
|
15
24
|
var PLAYTEST_FRAME_BUDGET_PHASES = ["hostGap", "overlay", "render", "residual", "update"];
|
|
16
25
|
var PLAYTEST_FRAME_PASS_KINDS = ["main", "shadow", "reflection", "nested"];
|
|
@@ -40,4 +49,4 @@ function assertJsonSafe(value, path = "$") {
|
|
|
40
49
|
throw new TypeError(`${path} must be JSON-safe.`);
|
|
41
50
|
}
|
|
42
51
|
|
|
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 };
|
|
52
|
+
export { PLAYTEST_ADVANCE_TICK_BUDGET_MS, PLAYTEST_BRIDGE_GLOBAL, PLAYTEST_CLOCK_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, requestedPlaytestClockMode };
|
package/dist/runner/cli.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { I as IStandalonePlaytestConfig, a as IStandalonePlaytestReport } from '../shared-
|
|
2
|
-
import '../
|
|
1
|
+
import { I as IStandalonePlaytestConfig, a as IStandalonePlaytestReport } from '../shared-DK12BZyS.js';
|
|
2
|
+
import '../schema-base-B5mr_Yr9.js';
|
|
3
3
|
import '../protocol.js';
|
|
4
|
+
import 'playwright';
|
|
5
|
+
import '../diagnostics-BhS6v2n1.js';
|
|
4
6
|
|
|
5
7
|
interface IRunnerDiagnostic {
|
|
6
8
|
code: string;
|