@threenative/playtest 0.2.0 → 0.3.1
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/LICENSE +21 -0
- package/README.md +22 -3
- package/dist/capture.d.ts +48 -0
- package/dist/capture.js +87 -0
- package/dist/diagnostics-f8464bJw.d.ts +1106 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +5576 -2345
- package/dist/protocol.d.ts +532 -0
- package/dist/protocol.js +42 -0
- package/dist/runner/cli.d.ts +63 -0
- package/dist/runner/cli.js +16171 -5804
- package/dist/runner/index.d.ts +785 -0
- package/dist/runner/index.js +10866 -3651
- package/dist/shared-BGwYk5HG.d.ts +280 -0
- package/dist/three/index.d.ts +217 -0
- package/dist/three/index.js +511 -74
- package/package.json +32 -4
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { IPlaytestObservationSnapshot } from './protocol.js';
|
|
2
|
+
import { c as IPlaytestReport, w as IPlaytestProtocolDiagnostic, p as IPlaytestDiagnosticsPolicy, d as IPlaytestAssertionResult } from './diagnostics-f8464bJw.js';
|
|
3
|
+
|
|
4
|
+
interface IPlaytestServerConfig {
|
|
5
|
+
command: string;
|
|
6
|
+
cwd?: string;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
}
|
|
9
|
+
interface IStandalonePlaytestConfig {
|
|
10
|
+
/**
|
|
11
|
+
* Accept a software WebGPU adapter. Off by default: without `--enable-features=Vulkan`, or
|
|
12
|
+
* headless on a host whose GPU the browser will not reach, Chromium serves WebGPU from
|
|
13
|
+
* SwiftShader and nothing errors — the adapter answers, limits look healthy, and the run
|
|
14
|
+
* reports a CPU rasteriser's results. A run that cannot name a hardware adapter is not
|
|
15
|
+
* render evidence, so it fails unless the operator says otherwise.
|
|
16
|
+
*/
|
|
17
|
+
allowSoftwareAdapter?: boolean;
|
|
18
|
+
android?: {
|
|
19
|
+
activity: string;
|
|
20
|
+
packageName: string;
|
|
21
|
+
user?: string;
|
|
22
|
+
};
|
|
23
|
+
adbPath?: string;
|
|
24
|
+
/** @see IAndroidDriverOptions.touchRotation */
|
|
25
|
+
touchRotation?: number;
|
|
26
|
+
artifactDirectory: string;
|
|
27
|
+
/**
|
|
28
|
+
* Capture the run's `before.png`/`after.png` artifact frames. Default true. A scenario that
|
|
29
|
+
* asserts on a frame still captures one — this only drops the convenience captures every run
|
|
30
|
+
* takes whether or not anything reads them.
|
|
31
|
+
*/
|
|
32
|
+
captureArtifactScreenshots?: boolean;
|
|
33
|
+
browserArgs?: readonly string[];
|
|
34
|
+
device?: string;
|
|
35
|
+
desktop?: {
|
|
36
|
+
executable: string;
|
|
37
|
+
hostArgs?: readonly string[];
|
|
38
|
+
};
|
|
39
|
+
endpoint?: string;
|
|
40
|
+
headless: boolean;
|
|
41
|
+
ios?: {
|
|
42
|
+
appPath?: string;
|
|
43
|
+
bundleId: string;
|
|
44
|
+
transport: "device" | "simulator";
|
|
45
|
+
};
|
|
46
|
+
mailboxRoot?: string;
|
|
47
|
+
port?: number;
|
|
48
|
+
projectPath: string;
|
|
49
|
+
scenarioPath: string;
|
|
50
|
+
scenarioPaths?: readonly string[];
|
|
51
|
+
server?: IPlaytestServerConfig;
|
|
52
|
+
timeoutMs: number;
|
|
53
|
+
target?: "android" | "browser" | "desktop" | "ios";
|
|
54
|
+
trace: boolean;
|
|
55
|
+
url: string;
|
|
56
|
+
xcrunPath?: string;
|
|
57
|
+
}
|
|
58
|
+
interface IPlaytestFlagHelp {
|
|
59
|
+
default: string;
|
|
60
|
+
summary: string;
|
|
61
|
+
takesValue: boolean;
|
|
62
|
+
allowDashValue?: boolean;
|
|
63
|
+
repeatable?: boolean;
|
|
64
|
+
}
|
|
65
|
+
declare const PLAYTEST_FLAGS: {
|
|
66
|
+
readonly "--adb": {
|
|
67
|
+
readonly default: "auto-discover";
|
|
68
|
+
readonly summary: "absolute adb executable path";
|
|
69
|
+
readonly takesValue: true;
|
|
70
|
+
};
|
|
71
|
+
readonly "--touch-rotation": {
|
|
72
|
+
readonly default: "read from the device";
|
|
73
|
+
readonly summary: "Android raw-touch rotation (0-3) when the app's window and the display disagree";
|
|
74
|
+
readonly takesValue: true;
|
|
75
|
+
};
|
|
76
|
+
readonly "--allow-software": {
|
|
77
|
+
readonly default: "false";
|
|
78
|
+
readonly summary: "accept a software WebGPU adapter as evidence";
|
|
79
|
+
readonly takesValue: false;
|
|
80
|
+
};
|
|
81
|
+
readonly "--activity": {
|
|
82
|
+
readonly default: ".MystralActivity";
|
|
83
|
+
readonly summary: "Android launch activity";
|
|
84
|
+
readonly takesValue: true;
|
|
85
|
+
};
|
|
86
|
+
readonly "--user": {
|
|
87
|
+
readonly default: "current foreground Android user";
|
|
88
|
+
readonly summary: "Android user id for force-stop and launch";
|
|
89
|
+
readonly takesValue: true;
|
|
90
|
+
};
|
|
91
|
+
readonly "--app": {
|
|
92
|
+
readonly default: "required for iOS";
|
|
93
|
+
readonly summary: "built iOS .app bundle";
|
|
94
|
+
readonly takesValue: true;
|
|
95
|
+
};
|
|
96
|
+
readonly "--artifacts": {
|
|
97
|
+
readonly default: "artifacts/playtest";
|
|
98
|
+
readonly summary: "artifact output directory";
|
|
99
|
+
readonly takesValue: true;
|
|
100
|
+
};
|
|
101
|
+
readonly "--no-screenshots": {
|
|
102
|
+
readonly default: "false";
|
|
103
|
+
readonly summary: "skip the before/after artifact frames; scenarios that assert on a frame still capture one";
|
|
104
|
+
readonly takesValue: false;
|
|
105
|
+
};
|
|
106
|
+
readonly "--browser-arg": {
|
|
107
|
+
readonly allowDashValue: true;
|
|
108
|
+
readonly default: "none (repeatable)";
|
|
109
|
+
readonly repeatable: true;
|
|
110
|
+
readonly summary: "one additional Chromium argument";
|
|
111
|
+
readonly takesValue: true;
|
|
112
|
+
};
|
|
113
|
+
readonly "--browser-recipe": {
|
|
114
|
+
readonly default: "none";
|
|
115
|
+
readonly summary: "named browser recipe (webgpu)";
|
|
116
|
+
readonly takesValue: true;
|
|
117
|
+
};
|
|
118
|
+
readonly "--bundle-id": {
|
|
119
|
+
readonly default: "dev.threenative.runtime";
|
|
120
|
+
readonly summary: "iOS application bundle identifier";
|
|
121
|
+
readonly takesValue: true;
|
|
122
|
+
};
|
|
123
|
+
readonly "--device": {
|
|
124
|
+
readonly default: "platform default";
|
|
125
|
+
readonly summary: "Android serial or iOS device identifier";
|
|
126
|
+
readonly takesValue: true;
|
|
127
|
+
};
|
|
128
|
+
readonly "--executable": {
|
|
129
|
+
readonly default: "required for desktop";
|
|
130
|
+
readonly summary: "native desktop game executable";
|
|
131
|
+
readonly takesValue: true;
|
|
132
|
+
};
|
|
133
|
+
readonly "--endpoint": {
|
|
134
|
+
readonly default: "http://127.0.0.1:41777/playtest";
|
|
135
|
+
readonly summary: "device bridge endpoint";
|
|
136
|
+
readonly takesValue: true;
|
|
137
|
+
};
|
|
138
|
+
readonly "--headed": {
|
|
139
|
+
readonly default: "false";
|
|
140
|
+
readonly summary: "show the browser window";
|
|
141
|
+
readonly takesValue: false;
|
|
142
|
+
};
|
|
143
|
+
readonly "--host-arg": {
|
|
144
|
+
readonly default: "none";
|
|
145
|
+
readonly repeatable: true;
|
|
146
|
+
readonly summary: "argument passed to the native desktop host, repeatable";
|
|
147
|
+
readonly takesValue: true;
|
|
148
|
+
};
|
|
149
|
+
readonly "--mailbox-root": {
|
|
150
|
+
readonly default: "Android external files directory";
|
|
151
|
+
readonly summary: "native device mailbox directory";
|
|
152
|
+
readonly takesValue: true;
|
|
153
|
+
};
|
|
154
|
+
readonly "--ios-transport": {
|
|
155
|
+
readonly default: "simulator";
|
|
156
|
+
readonly summary: "iOS transport (simulator or device)";
|
|
157
|
+
readonly takesValue: true;
|
|
158
|
+
};
|
|
159
|
+
readonly "--project": {
|
|
160
|
+
readonly default: ".";
|
|
161
|
+
readonly summary: "project root used to resolve paths";
|
|
162
|
+
readonly takesValue: true;
|
|
163
|
+
};
|
|
164
|
+
readonly "--package": {
|
|
165
|
+
readonly default: "com.mystral.engine";
|
|
166
|
+
readonly summary: "Android application id";
|
|
167
|
+
readonly takesValue: true;
|
|
168
|
+
};
|
|
169
|
+
readonly "--scenario": {
|
|
170
|
+
readonly default: "required (or positional; repeatable)";
|
|
171
|
+
readonly repeatable: true;
|
|
172
|
+
readonly summary: "scenario JSON path or glob";
|
|
173
|
+
readonly takesValue: true;
|
|
174
|
+
};
|
|
175
|
+
readonly "--server-command": {
|
|
176
|
+
readonly default: "none";
|
|
177
|
+
readonly summary: "command for a managed app server";
|
|
178
|
+
readonly takesValue: true;
|
|
179
|
+
};
|
|
180
|
+
readonly "--server-timeout": {
|
|
181
|
+
readonly default: "15000";
|
|
182
|
+
readonly summary: "managed server readiness timeout in ms";
|
|
183
|
+
readonly takesValue: true;
|
|
184
|
+
};
|
|
185
|
+
readonly "--timeout": {
|
|
186
|
+
readonly default: "15000";
|
|
187
|
+
readonly summary: "page operation timeout in ms";
|
|
188
|
+
readonly takesValue: true;
|
|
189
|
+
};
|
|
190
|
+
readonly "--target": {
|
|
191
|
+
readonly default: "browser";
|
|
192
|
+
readonly summary: "execution target (browser, android, desktop, or ios)";
|
|
193
|
+
readonly takesValue: true;
|
|
194
|
+
};
|
|
195
|
+
readonly "--trace": {
|
|
196
|
+
readonly default: "false";
|
|
197
|
+
readonly summary: "write a Playwright trace";
|
|
198
|
+
readonly takesValue: false;
|
|
199
|
+
};
|
|
200
|
+
readonly "--url": {
|
|
201
|
+
readonly default: "http://127.0.0.1:5173 (or a free managed port)";
|
|
202
|
+
readonly summary: "application URL";
|
|
203
|
+
readonly takesValue: true;
|
|
204
|
+
};
|
|
205
|
+
readonly "--port": {
|
|
206
|
+
readonly default: "free when managing a server";
|
|
207
|
+
readonly summary: "managed server port (0 chooses a free port)";
|
|
208
|
+
readonly takesValue: true;
|
|
209
|
+
};
|
|
210
|
+
readonly "--xcrun": {
|
|
211
|
+
readonly default: "auto-discover";
|
|
212
|
+
readonly summary: "absolute xcrun executable path";
|
|
213
|
+
readonly takesValue: true;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
declare class PlaytestCliUsageError extends Error {
|
|
217
|
+
constructor(message: string);
|
|
218
|
+
}
|
|
219
|
+
declare function formatUsage(): string;
|
|
220
|
+
declare function parseStandalonePlaytestArgs(argv: readonly string[], cwd?: string): IStandalonePlaytestConfig;
|
|
221
|
+
|
|
222
|
+
interface ILabeledPlaytestSample {
|
|
223
|
+
label: string;
|
|
224
|
+
signals: unknown[];
|
|
225
|
+
snapshot: IPlaytestObservationSnapshot;
|
|
226
|
+
}
|
|
227
|
+
interface IRunnerConsoleEntry {
|
|
228
|
+
source?: "browser-console" | "page-error" | "unhandled-rejection";
|
|
229
|
+
text: string;
|
|
230
|
+
type: string;
|
|
231
|
+
}
|
|
232
|
+
interface IMovementSampleInterval {
|
|
233
|
+
after: IPlaytestObservationSnapshot;
|
|
234
|
+
before: IPlaytestObservationSnapshot;
|
|
235
|
+
inputDriven: boolean;
|
|
236
|
+
}
|
|
237
|
+
interface IRunStepSamples {
|
|
238
|
+
afterInput?: IPlaytestObservationSnapshot;
|
|
239
|
+
afterStep?: IPlaytestObservationSnapshot;
|
|
240
|
+
inputDriven: boolean;
|
|
241
|
+
}
|
|
242
|
+
interface IStandalonePlaytestReport extends IPlaytestReport {
|
|
243
|
+
artifactDirectory: string;
|
|
244
|
+
/**
|
|
245
|
+
* What the run waited for before it observed anything, and what it settled on.
|
|
246
|
+
*
|
|
247
|
+
* `rule: "compile-settled"` means the sustained in-budget frame window was not required,
|
|
248
|
+
* because the operator declared a software adapter. A pass from such a run is not a smoothness
|
|
249
|
+
* measurement and must not be read as one, so the report says which rule applied rather than
|
|
250
|
+
* leaving a reader to assume the stricter one.
|
|
251
|
+
*/
|
|
252
|
+
startup?: {
|
|
253
|
+
compileSettled?: boolean;
|
|
254
|
+
phase: string;
|
|
255
|
+
progress: number;
|
|
256
|
+
rule: string;
|
|
257
|
+
timeline?: {
|
|
258
|
+
loadStartedMs?: number;
|
|
259
|
+
enteredMs?: number;
|
|
260
|
+
compileSettledMs?: number;
|
|
261
|
+
readyMs?: number;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
debugColliders?: boolean;
|
|
265
|
+
input?: string;
|
|
266
|
+
movementThreshold?: number;
|
|
267
|
+
pass: boolean;
|
|
268
|
+
runtime: "native" | "web";
|
|
269
|
+
scenario: string;
|
|
270
|
+
target: string;
|
|
271
|
+
trivialityOptOutCount: number;
|
|
272
|
+
url: string;
|
|
273
|
+
}
|
|
274
|
+
declare class ManagedServerError extends Error {
|
|
275
|
+
readonly diagnostic: IPlaytestProtocolDiagnostic;
|
|
276
|
+
constructor(diagnostic: IPlaytestProtocolDiagnostic);
|
|
277
|
+
}
|
|
278
|
+
declare function failedDiagnosticsAssertion(policy: IPlaytestDiagnosticsPolicy): IPlaytestAssertionResult;
|
|
279
|
+
|
|
280
|
+
export { type IStandalonePlaytestConfig as I, ManagedServerError as M, PLAYTEST_FLAGS as P, type IStandalonePlaytestReport as a, type IRunnerConsoleEntry as b, type ILabeledPlaytestSample as c, type IMovementSampleInterval as d, type IPlaytestFlagHelp as e, type IPlaytestServerConfig as f, type IRunStepSamples as g, PlaytestCliUsageError as h, failedDiagnosticsAssertion as i, formatUsage as j, parseStandalonePlaytestArgs as p };
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Camera, Scene, Object3D, Vector2 } from 'three';
|
|
2
|
+
import { IPlaytestSampleRequest, IPlaytestObservationSnapshot, IPlaytestBridgeV1, JsonValue, IPlaytestGameplayObservation, IPlaytestRuntimeDiagnosticsSample, IPlaytestRenderChainObservation, IPlaytestStartupObservation, IPlaytestSceneObservation } from '../protocol.js';
|
|
3
|
+
|
|
4
|
+
type RenderAdvisorOwner = "framework" | "generated-src";
|
|
5
|
+
type RenderAdvisorSeverity = "info" | "warning";
|
|
6
|
+
type RenderAdvisorTransformSafety = "caller-declared-static" | "unknown";
|
|
7
|
+
interface IRenderAdvisorExamplePaths {
|
|
8
|
+
readonly gpuParticles: string;
|
|
9
|
+
readonly hudInstancing: string;
|
|
10
|
+
readonly materialSharing: string;
|
|
11
|
+
readonly staticMerge: string;
|
|
12
|
+
}
|
|
13
|
+
interface IRenderAdvisorObservedRendererCounters {
|
|
14
|
+
readonly drawCalls?: number;
|
|
15
|
+
readonly triangles?: number;
|
|
16
|
+
}
|
|
17
|
+
interface IRenderAdvisorObservedPass {
|
|
18
|
+
readonly cameraToken: string;
|
|
19
|
+
readonly depthToken?: string;
|
|
20
|
+
readonly equivalenceToken?: string;
|
|
21
|
+
readonly purpose?: "color" | "depth-prepass" | "other" | "post" | "shadow";
|
|
22
|
+
readonly renderCalls?: number;
|
|
23
|
+
readonly sceneToken: string;
|
|
24
|
+
readonly targetToken?: string;
|
|
25
|
+
}
|
|
26
|
+
interface IRenderAdvisorObservedInput {
|
|
27
|
+
readonly passes?: readonly IRenderAdvisorObservedPass[];
|
|
28
|
+
readonly renderer?: IRenderAdvisorObservedRendererCounters;
|
|
29
|
+
}
|
|
30
|
+
interface IRenderAdvisorInput {
|
|
31
|
+
readonly camera?: Camera;
|
|
32
|
+
readonly materialMutationSafety?: "caller-declared-stable" | "unknown";
|
|
33
|
+
readonly observed?: IRenderAdvisorObservedInput;
|
|
34
|
+
readonly particleWorkload?: "caller-declared-many-independent-objects" | "unknown";
|
|
35
|
+
readonly scene: Scene;
|
|
36
|
+
readonly spriteWorkload?: "caller-declared-camera-overlay" | "unknown";
|
|
37
|
+
readonly topN?: number;
|
|
38
|
+
readonly transformSafety?: RenderAdvisorTransformSafety;
|
|
39
|
+
readonly verifiedExamplePaths: IRenderAdvisorExamplePaths;
|
|
40
|
+
}
|
|
41
|
+
interface IRenderAdvisorGroup {
|
|
42
|
+
readonly constraintReasonCounts: Record<string, number>;
|
|
43
|
+
readonly eligibleDynamicCount: number;
|
|
44
|
+
readonly eligibleStaticCount: number;
|
|
45
|
+
readonly geometryIdentities: number;
|
|
46
|
+
readonly materialIdentities: number;
|
|
47
|
+
readonly memberCount: number;
|
|
48
|
+
}
|
|
49
|
+
interface IRenderAdvisorRecommendation {
|
|
50
|
+
readonly caveats: readonly string[];
|
|
51
|
+
readonly code: string;
|
|
52
|
+
readonly constraints: Record<string, number>;
|
|
53
|
+
readonly evidence: {
|
|
54
|
+
readonly metric: string;
|
|
55
|
+
readonly path: string;
|
|
56
|
+
};
|
|
57
|
+
readonly examplePath: string;
|
|
58
|
+
readonly expectedReducedCount?: number;
|
|
59
|
+
readonly observedCount: number;
|
|
60
|
+
readonly owner: RenderAdvisorOwner;
|
|
61
|
+
readonly severity: RenderAdvisorSeverity;
|
|
62
|
+
}
|
|
63
|
+
interface IRenderAdvisorReport {
|
|
64
|
+
readonly schemaVersion: 1;
|
|
65
|
+
readonly observed: {
|
|
66
|
+
readonly passes: {
|
|
67
|
+
readonly recorded: number;
|
|
68
|
+
readonly truncated: number;
|
|
69
|
+
};
|
|
70
|
+
readonly renderer: IRenderAdvisorObservedRendererCounters;
|
|
71
|
+
};
|
|
72
|
+
readonly passObservations: readonly {
|
|
73
|
+
readonly count: number;
|
|
74
|
+
readonly reasonCode: string;
|
|
75
|
+
}[];
|
|
76
|
+
readonly recommendations: readonly IRenderAdvisorRecommendation[];
|
|
77
|
+
readonly snapshot: {
|
|
78
|
+
readonly geometryIdentityCount: number;
|
|
79
|
+
readonly instancedRenderableCount: number;
|
|
80
|
+
readonly logicalObjectCount: number;
|
|
81
|
+
readonly logicalObjectCountIncludesRootScene: true;
|
|
82
|
+
readonly materialIdentityCount: number;
|
|
83
|
+
readonly pointsCount: number;
|
|
84
|
+
readonly renderableCount: number;
|
|
85
|
+
readonly spriteCount: number;
|
|
86
|
+
readonly visibleFlagRenderableCount: number;
|
|
87
|
+
};
|
|
88
|
+
readonly topGroups: readonly IRenderAdvisorGroup[];
|
|
89
|
+
}
|
|
90
|
+
declare function adviseThreeRenderWorkload(input: IRenderAdvisorInput): IRenderAdvisorReport;
|
|
91
|
+
|
|
92
|
+
interface IThreePlaytestEntity {
|
|
93
|
+
id: string;
|
|
94
|
+
object: Object3D;
|
|
95
|
+
path?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface IThreePlaytestRenderer {
|
|
99
|
+
getDrawingBufferSize(target: Vector2): Vector2;
|
|
100
|
+
info?: {
|
|
101
|
+
render?: {
|
|
102
|
+
drawCalls?: unknown;
|
|
103
|
+
calls?: unknown;
|
|
104
|
+
triangles?: unknown;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Physics evidence for a project that drives its own simulation.
|
|
111
|
+
*
|
|
112
|
+
* The `settled` and `aerodynamics` assertions read a `physicsDebugSeries` whose snapshots have
|
|
113
|
+
* a specific interior shape -- `artifact.primitives[]` entries categorised `sleep` and
|
|
114
|
+
* `center-of-mass`, plus an `artifact.overflow.omittedBodies` count. That shape is a harness
|
|
115
|
+
* contract, not something a caller should have to rediscover by reading a failed assertion, so
|
|
116
|
+
* the bridge builds it here from a flat body list. A caller supplies what it already knows.
|
|
117
|
+
*/
|
|
118
|
+
interface IThreePlaytestPhysicsBody {
|
|
119
|
+
/** Body id. An assertion matches it exactly or by prefix, so `crate.3` matches entity `crate`. */
|
|
120
|
+
readonly id: string;
|
|
121
|
+
readonly position: readonly [number, number, number];
|
|
122
|
+
readonly sleeping: boolean;
|
|
123
|
+
}
|
|
124
|
+
interface IThreePlaytestPhysics {
|
|
125
|
+
bodies(): readonly IThreePlaytestPhysicsBody[];
|
|
126
|
+
}
|
|
127
|
+
/** Retained bodies per labelled sample. Bodies past the limit are reported, never dropped. */
|
|
128
|
+
declare const PLAYTEST_PHYSICS_BODY_LIMIT = 100;
|
|
129
|
+
/** Labelled samples retained per run. */
|
|
130
|
+
declare const PLAYTEST_PHYSICS_SAMPLE_LIMIT = 100;
|
|
131
|
+
type PhysicsDebugSeries = NonNullable<IPlaytestObservationSnapshot["physicsDebugSeries"]>;
|
|
132
|
+
/**
|
|
133
|
+
* Retains one physics snapshot per scenario step label.
|
|
134
|
+
*
|
|
135
|
+
* Fails closed throughout: a duplicate label, an exhausted retention budget, and a malformed
|
|
136
|
+
* body all throw rather than yielding a series an assertion would read as merely empty. An
|
|
137
|
+
* assertion that cannot see its evidence must fail loudly; one that silently sees nothing is
|
|
138
|
+
* the vacuous pass this package exists to prevent.
|
|
139
|
+
*/
|
|
140
|
+
declare class ThreePlaytestPhysicsRecorder {
|
|
141
|
+
#private;
|
|
142
|
+
constructor(physics: IThreePlaytestPhysics);
|
|
143
|
+
sample(request: IPlaytestSampleRequest, tick: number): PhysicsDebugSeries;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface IThreePlaytestResources {
|
|
147
|
+
read(): Record<string, JsonValue>;
|
|
148
|
+
write?(id: string, path: string | undefined, value: JsonValue): boolean;
|
|
149
|
+
}
|
|
150
|
+
interface IThreePlaytestBridgeOptions {
|
|
151
|
+
camera: Camera;
|
|
152
|
+
components?: () => Record<string, Record<string, JsonValue>>;
|
|
153
|
+
/**
|
|
154
|
+
* Runtime diagnostics for the current frame.
|
|
155
|
+
*
|
|
156
|
+
* An entry shaped `{ label: string, value: string | number | boolean }` is treated as a
|
|
157
|
+
* **readout** — publish your FPS counter, coin tally or backend name here freely, and a proof
|
|
158
|
+
* asserting `noRuntimeDiagnostics` will not fail because of it. Anything else counts as a
|
|
159
|
+
* runtime **error**, including an entry carrying `severity: "error"`, `type: "error"` or an
|
|
160
|
+
* `error` field. Ambiguous entries count as errors on purpose: this harness fails closed.
|
|
161
|
+
*/
|
|
162
|
+
diagnostics?: () => JsonValue[];
|
|
163
|
+
entities?: readonly IThreePlaytestEntity[] | (() => readonly IThreePlaytestEntity[]);
|
|
164
|
+
fixedStep?: (ticks: number) => Promise<number | void> | number | void;
|
|
165
|
+
gameplay?: () => IPlaytestGameplayObservation;
|
|
166
|
+
gameplayChannels?: () => readonly ("runtime.contacts" | "runtime.tags" | "runtime.transitions" | "runtime.world")[];
|
|
167
|
+
runtimeDiagnosticsSeries?: () => readonly IPlaytestRuntimeDiagnosticsSample[];
|
|
168
|
+
events?: () => JsonValue[];
|
|
169
|
+
/** Physics bodies to retain per labelled step. Requires the authoritative tick provider. */
|
|
170
|
+
physics?: IThreePlaytestPhysics;
|
|
171
|
+
renderer: IThreePlaytestRenderer;
|
|
172
|
+
renderChain?: () => IPlaytestRenderChainObservation | undefined;
|
|
173
|
+
resources?: IThreePlaytestResources;
|
|
174
|
+
scene: Scene;
|
|
175
|
+
/** First-use startup progress, so a runner can wait for the world instead of the loader. */
|
|
176
|
+
startup?: () => IPlaytestStartupObservation;
|
|
177
|
+
tick?: () => number;
|
|
178
|
+
}
|
|
179
|
+
interface IThreePlaytestBridgeInstallation {
|
|
180
|
+
bridge: IPlaytestBridgeV1;
|
|
181
|
+
dispose(): void;
|
|
182
|
+
registerEntity(entry: IThreePlaytestEntity): void;
|
|
183
|
+
syncEntities(): void;
|
|
184
|
+
}
|
|
185
|
+
declare function installThreePlaytestBridge(options: IThreePlaytestBridgeOptions): IThreePlaytestBridgeInstallation;
|
|
186
|
+
|
|
187
|
+
interface IDeviceBridgeInstallation {
|
|
188
|
+
close(): void;
|
|
189
|
+
}
|
|
190
|
+
declare function connectDevicePlaytestBridge(bridge: IPlaytestBridgeV1, endpoint: string): IDeviceBridgeInstallation;
|
|
191
|
+
declare function readPlaytestEndpoint(): string | undefined;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The room the game is played in, read off the scene graph.
|
|
195
|
+
*
|
|
196
|
+
* `doctor --url` listed lights, materials and camera framing under "not observed", so an agent
|
|
197
|
+
* looking at a black or washed-out frame had nothing to read and went to screenshots — the one
|
|
198
|
+
* instrument that cannot say *why*. Everything here is a count or a name taken from the objects
|
|
199
|
+
* the renderer will use. It decides nothing about how the game looks.
|
|
200
|
+
*/
|
|
201
|
+
/**
|
|
202
|
+
* Ceilings on the walk. A scene past either is described as far as the cap and says so; a count
|
|
203
|
+
* silently capped would be read as a total, and a total nobody measured is exactly the confident
|
|
204
|
+
* empty number this harness exists to prevent.
|
|
205
|
+
*/
|
|
206
|
+
declare const SCENE_WALK_OBJECT_CAP = 20000;
|
|
207
|
+
declare const SCENE_LIGHT_CAP = 64;
|
|
208
|
+
/**
|
|
209
|
+
* Walk the scene once and report what is mounted in it.
|
|
210
|
+
* @situation ask what lights, materials and framing a running game actually has
|
|
211
|
+
* @constraint reports counts and names only; nothing here decides how the game looks
|
|
212
|
+
* @constraint a walk that hits {@link SCENE_WALK_OBJECT_CAP} reports `truncated: true`
|
|
213
|
+
* @example const room = observeSceneResources(ctx.scene, ctx.camera);
|
|
214
|
+
*/
|
|
215
|
+
declare function observeSceneResources(scene: Scene, camera: Camera): IPlaytestSceneObservation;
|
|
216
|
+
|
|
217
|
+
export { type IDeviceBridgeInstallation, type IRenderAdvisorExamplePaths, type IRenderAdvisorInput, type IRenderAdvisorObservedInput, type IRenderAdvisorObservedPass, type IRenderAdvisorRecommendation, type IRenderAdvisorReport, type IThreePlaytestBridgeInstallation, type IThreePlaytestBridgeOptions, type IThreePlaytestEntity, type IThreePlaytestPhysics, type IThreePlaytestPhysicsBody, type IThreePlaytestResources, PLAYTEST_PHYSICS_BODY_LIMIT, PLAYTEST_PHYSICS_SAMPLE_LIMIT, SCENE_LIGHT_CAP, SCENE_WALK_OBJECT_CAP, ThreePlaytestPhysicsRecorder, adviseThreeRenderWorkload, connectDevicePlaytestBridge, installThreePlaytestBridge, observeSceneResources, readPlaytestEndpoint };
|