@threenative/playtest 0.3.0 → 0.3.2

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.
@@ -52,10 +52,35 @@ interface IPlaytestBridgeDescription {
52
52
  * can wait for the world instead of photographing the loader and asserting against a frozen
53
53
  * simulation.
54
54
  */
55
+ /**
56
+ * When the application's startup milestones happened, in milliseconds on the host's monotonic
57
+ * clock (since navigation on the web, since process start on native). Absent members have not
58
+ * happened yet.
59
+ */
60
+ interface IPlaytestStartupTimeline {
61
+ loadStartedMs?: number;
62
+ enteredMs?: number;
63
+ compileSettledMs?: number;
64
+ readyMs?: number;
65
+ }
55
66
  interface IPlaytestStartupObservation {
56
67
  phase: "observing" | "collapsing" | "ready";
57
68
  /** 0 while first-use work is pending, then 1. */
58
69
  progress: number;
70
+ /** Candidate and backend observation counts from the most recent engine warm-up. */
71
+ warmup?: {
72
+ attempted?: number;
73
+ candidates?: number;
74
+ observed?: {
75
+ created: number;
76
+ failed: number;
77
+ pending: number;
78
+ status: "complete" | "incomplete" | "unavailable";
79
+ uniquePipelines: number;
80
+ uniquePrograms: number;
81
+ };
82
+ status: "complete" | "incomplete" | "unavailable";
83
+ };
59
84
  /**
60
85
  * Whether first-use compilation has settled, which happens strictly before `phase` reaches
61
86
  * `"ready"`: readiness additionally requires a sustained in-budget frame window. Reported
@@ -63,6 +88,8 @@ interface IPlaytestStartupObservation {
63
88
  * the machine has no GPU has already conceded it is not measuring that.
64
89
  */
65
90
  compileSettled?: boolean;
91
+ /** Present when the application records its startup milestones. */
92
+ timeline?: IPlaytestStartupTimeline;
66
93
  }
67
94
  /**
68
95
  * How long a run will wait for an application to finish its own first-use startup work.
@@ -111,6 +138,8 @@ interface IPlaytestSampleRequest {
111
138
  /** Scenario-step label for providers that retain labelled observation series. */
112
139
  label?: string;
113
140
  resources?: readonly string[];
141
+ /** Scene-graph selectors to report, one observation per selector, in request order. */
142
+ sceneNodes?: readonly IPlaytestSceneNodeSelector[];
114
143
  }
115
144
  interface IPlaytestEntityObservation {
116
145
  bounds?: {
@@ -123,16 +152,229 @@ interface IPlaytestEntityObservation {
123
152
  transform?: IPlaytestEntityTransform;
124
153
  visible?: boolean;
125
154
  }
155
+ /**
156
+ * What the feet are doing against what the body is doing, for the clip currently playing.
157
+ *
158
+ * The stride convention is on by default and has a named override, so its measurement has to
159
+ * cross the bridge whether or not it is applied — a game that turned it off otherwise has no way
160
+ * to see what that cost, and a scenario has no way to catch a character skating across the floor.
161
+ * Every member is the producer's own measurement; nothing here is derived by the runner.
162
+ */
163
+ interface IPlaytestStrideObservation {
164
+ /** Metres of ground the clip carries per clip-second at rate 1. Zero when it travels none. */
165
+ clipGroundSpeed: number;
166
+ /** Metres per second the body actually covered, as the producer smoothed it. */
167
+ groundSpeed: number;
168
+ /** True when a rate was measured and deliberately not applied. */
169
+ overridden: boolean;
170
+ /** The playback rate those two imply, after the producer's own clamping. */
171
+ rate: number;
172
+ /** True when that rate is being applied to the action. */
173
+ synced: boolean;
174
+ }
126
175
  interface IPlaytestAnimationObservation {
127
176
  advancedFrames: number;
128
177
  clip: string;
129
178
  finished?: boolean;
179
+ /** Present only when the producer measures stride. Absent is unobserved, never zero. */
180
+ stride?: IPlaytestStrideObservation;
181
+ }
182
+ /**
183
+ * One light in the scene, as the renderer will read it.
184
+ *
185
+ * Counted rather than judged: a light's colour and intensity decide how the game looks, and this
186
+ * harness never owns the look. It reports what is there so a black frame can be told from a lit
187
+ * one without a human opening the page.
188
+ */
189
+ interface IPlaytestLightObservation {
190
+ /** `#rrggbb`, or `unobserved` when the light carries no readable colour. */
191
+ color: string;
192
+ /** Absent when the light reports no finite intensity. Never an unmeasured zero. */
193
+ intensity?: number;
194
+ /** The light's constructor name — `DirectionalLight`, `AmbientLight`, and so on. */
195
+ type: string;
196
+ visible: boolean;
197
+ }
198
+ /**
199
+ * The scene's distance fade, if it has one. Absent means no fog, never "fog at zero".
200
+ */
201
+ interface IPlaytestFogObservation {
202
+ color: string;
203
+ /** Present for `FogExp2`. */
204
+ density?: number;
205
+ /** Present for linear `Fog`. */
206
+ far?: number;
207
+ /** Present for linear `Fog`. */
208
+ near?: number;
209
+ type: "exponential" | "linear";
210
+ }
211
+ /**
212
+ * Where the camera is and what it can see, which is the framing an entity transform cannot say.
213
+ */
214
+ interface IPlaytestCameraObservation {
215
+ /** Absent on a bare `Camera`, which carries no clip planes. */
216
+ far?: number;
217
+ /** Unit world-space forward vector. */
218
+ forward: [number, number, number];
219
+ /** Vertical field of view in degrees. Absent for an orthographic camera. */
220
+ fov?: number;
221
+ /** Absent on a bare `Camera`, which carries no clip planes. */
222
+ near?: number;
223
+ position: [number, number, number];
224
+ /** The camera's constructor name. */
225
+ type: string;
226
+ }
227
+ /**
228
+ * The room the game is being played in — lights, materials, fog, background and camera framing.
229
+ *
230
+ * `doctor --url` used to list all of this under "not observed", which meant an agent debugging a
231
+ * washed-out or black frame had no instrument at all and went to screenshots. Round 9's visual
232
+ * column was lost to a fog whose far plane sat in front of the sky dome; nothing in the harness
233
+ * could say so. Counts and names only: every value here is read off the scene, and none of it
234
+ * decides how anything looks.
235
+ */
236
+ interface IPlaytestSceneObservation {
237
+ /** `none`, `color:#rrggbb`, or the background object's constructor name. */
238
+ background: string;
239
+ camera: IPlaytestCameraObservation;
240
+ fog?: IPlaytestFogObservation;
241
+ lights: IPlaytestLightObservation[];
242
+ /**
243
+ * How many materials of each constructor name are mounted in the scene, counted per distinct
244
+ * material rather than per mesh.
245
+ */
246
+ materials: Record<string, number>;
247
+ /** Objects the walk visited. */
248
+ objects: number;
249
+ /**
250
+ * True when the walk stopped at its cap, so every count above is a floor rather than a total.
251
+ * Reported instead of silently truncating, because a partial count read as a total is the
252
+ * confident-number-with-nothing-behind-it this harness exists to prevent.
253
+ */
254
+ truncated: boolean;
255
+ /** World-space extent of everything the walk visited, or absent when the scene is empty. */
256
+ worldExtent?: {
257
+ max: [number, number, number];
258
+ min: [number, number, number];
259
+ };
260
+ }
261
+ /**
262
+ * One node of the scene graph, read as numbers instead of looked at.
263
+ *
264
+ * `scene.observe` reports the room as counts — how many lights, how many materials of each
265
+ * constructor. That answers "is anything lit" and cannot answer "is the crate on screen", "did
266
+ * the seal plate load its texture", "is this mesh inside the wall". Those are the questions an
267
+ * agent otherwise takes a screenshot for, and a screenshot cannot say why. Every field here is
268
+ * read off the object the renderer will draw; nothing is inferred and nothing decides how the
269
+ * game looks.
270
+ */
271
+ interface IPlaytestSceneNodeObservation {
272
+ /** Clips mounted on this node's mixer, and which of them are advancing. */
273
+ animation?: {
274
+ clips: string[];
275
+ playing: string[];
276
+ };
277
+ /** World-space axis-aligned bounds, absent when the node encloses nothing. */
278
+ bounds?: {
279
+ max: [number, number, number];
280
+ min: [number, number, number];
281
+ };
282
+ geometry?: {
283
+ attributes: string[];
284
+ triangles: number;
285
+ vertices: number;
286
+ };
287
+ /** Whether the node's world bounds intersect the active camera's frustum. */
288
+ inFrustum?: boolean;
289
+ /** Instance count for an InstancedMesh or BatchedMesh. */
290
+ instances?: number;
291
+ materials?: IPlaytestSceneNodeMaterial[];
292
+ name: string;
293
+ /** Slash-joined path from the scene root, the same shape `entity.observe` reports. */
294
+ path: string;
295
+ position: [number, number, number];
296
+ scale: [number, number, number];
297
+ skinned?: {
298
+ bones: number;
299
+ };
300
+ type: string;
301
+ /** The node's own visible flag. */
302
+ visible: boolean;
303
+ /** The node's flag and every ancestor's — what the renderer actually acts on. */
304
+ visibleInTree: boolean;
305
+ }
306
+ /**
307
+ * A material as mounted, including the two facts that make a mesh render black while every
308
+ * count above it reads healthy: a map slot bound to a texture that never loaded, and a lit
309
+ * material in a scene with nothing to light it.
310
+ */
311
+ interface IPlaytestSceneNodeMaterial {
312
+ color?: string;
313
+ emissive?: string;
314
+ /** True when the material reads scene lighting, so an unlit scene renders it black. */
315
+ lit: boolean;
316
+ /** Map slots bound to a texture, by property name. */
317
+ maps: string[];
318
+ /** Bound slots whose texture carries no image — the black-texture case a count cannot show. */
319
+ mapsUnloaded: string[];
320
+ metalness?: number;
321
+ name: string;
322
+ opacity?: number;
323
+ roughness?: number;
324
+ transparent: boolean;
325
+ type: string;
326
+ visible: boolean;
327
+ }
328
+ /**
329
+ * Which nodes to report. An absent field does not filter; every present field must match.
330
+ * A selector that matches nothing is reported as `matched: 0`, never as an empty success.
331
+ */
332
+ interface IPlaytestSceneNodeSelector {
333
+ /** Ceiling on reported nodes. The walk still counts every match, so `matched` is a total. */
334
+ limit?: number;
335
+ /** Exact `Object3D.name`. */
336
+ name?: string;
337
+ /** Case-insensitive substring of `Object3D.name`. */
338
+ nameContains?: string;
339
+ /** Case-insensitive substring of the slash-joined path. */
340
+ pathContains?: string;
341
+ /** Exact `Object3D.type` — `Mesh`, `SkinnedMesh`, `PointLight`, `Group`. */
342
+ type?: string;
343
+ }
344
+ interface IPlaytestSceneNodesObservation {
345
+ /** Total nodes the selector matched, before `limit` was applied. */
346
+ matched: number;
347
+ nodes: IPlaytestSceneNodeObservation[];
348
+ selector: IPlaytestSceneNodeSelector;
349
+ /** True when `limit` or the walk cap cut the list, so `nodes` is a sample and not the set. */
350
+ truncated: boolean;
130
351
  }
131
352
  interface IPlaytestContactObservation {
132
353
  entity: string;
133
354
  kind: string;
355
+ /**
356
+ * The tick the contact happened on, when the producer drains its contact log per tick. Absent
357
+ * from a producer that drains only at sample time, and an assertion that needs it fails closed
358
+ * rather than falling back to step granularity — the two are not the same measurement.
359
+ */
360
+ tick?: number;
134
361
  with: string;
135
362
  }
363
+ /**
364
+ * A published value changing, and the tick it changed on.
365
+ *
366
+ * Without this a run can say *a contact happened* and *the state reads `won`*, and nothing relates
367
+ * them. Comparing at step boundaries cannot separate a win that arrived with the contact from one
368
+ * that arrived 199 ticks later in the same step — which is the signature of a timer or a distance
369
+ * check that happens to land near a contact.
370
+ */
371
+ interface IPlaytestTransitionObservation {
372
+ from: JsonPrimitive;
373
+ /** `states.<entity>` for a registered entity, or `state.<field>` for a published field. */
374
+ path: string;
375
+ tick: number;
376
+ to: JsonPrimitive;
377
+ }
136
378
  interface IPlaytestTagObservation {
137
379
  count: number;
138
380
  }
@@ -141,6 +383,10 @@ interface IPlaytestPerformanceObservation {
141
383
  triangles?: number;
142
384
  }
143
385
  interface IPlaytestRenderChainObservation {
386
+ contributions?: Array<{
387
+ graphOutputChanged: boolean;
388
+ name: string;
389
+ }>;
144
390
  dropped: Array<{
145
391
  name: string;
146
392
  reason: string;
@@ -173,6 +419,8 @@ interface IPlaytestGameplayObservation {
173
419
  contacts?: IPlaytestContactObservation[];
174
420
  states: Record<string, string>;
175
421
  tags?: Record<string, IPlaytestTagObservation>;
422
+ /** Tick-stamped changes to published values. Absent from a run whose loop never ticked. */
423
+ transitions?: IPlaytestTransitionObservation[];
176
424
  world?: IPlaytestWorldObservation;
177
425
  }
178
426
  /** Per-render samples shared by the browser and native playtest bridges. */
@@ -214,9 +462,29 @@ interface IPlaytestObservationSnapshot {
214
462
  tick: number;
215
463
  }>;
216
464
  performance?: IPlaytestPerformanceObservation;
465
+ /** Bounded shader/pipeline creation capture supplied by the engine when diagnostics are enabled. */
466
+ pipelineCensus?: JsonValue;
217
467
  renderChain?: IPlaytestRenderChainObservation;
218
468
  runtimeDiagnosticsSeries?: IPlaytestRuntimeDiagnosticsSample[];
219
469
  resources?: Record<string, JsonValue>;
470
+ scene?: IPlaytestSceneObservation;
471
+ sceneNodes?: IPlaytestSceneNodesObservation[];
472
+ }
473
+ /**
474
+ * What the bridge says it actually applied, as opposed to what the runner asked for.
475
+ *
476
+ * The setup contract used to rest entirely on the bridge throwing: `applied` was assigned the
477
+ * *requested* records, so a bridge that partially applied and resolved reported full application
478
+ * and `applied === requested` always. A bridge that returns this instead lets the report show the
479
+ * difference, and lets the runner fail on a request nobody confirmed.
480
+ *
481
+ * `entities` and `resources` are the ids the bridge applied. Returning nothing at all is still
482
+ * accepted — the runner then records that the evidence is the throw contract and not a read-back,
483
+ * rather than claiming a confirmation it never received.
484
+ */
485
+ interface IPlaytestSetupConfirmation {
486
+ entities?: readonly string[];
487
+ resources?: readonly string[];
220
488
  }
221
489
  interface IPlaytestAdvanceResult {
222
490
  clock: IPlaytestObservationSnapshot["clock"];
@@ -224,7 +492,7 @@ interface IPlaytestAdvanceResult {
224
492
  }
225
493
  interface IPlaytestBridgeV1 {
226
494
  advance?(ticks: number): Promise<IPlaytestAdvanceResult>;
227
- applySetup?(request: IPlaytestSetupRequest): Promise<void>;
495
+ applySetup?(request: IPlaytestSetupRequest): Promise<IPlaytestSetupConfirmation | void>;
228
496
  describe(): IPlaytestBridgeDescription | Promise<IPlaytestBridgeDescription>;
229
497
  drainEvents?(limit?: number): Promise<JsonValue[]>;
230
498
  focus?(): boolean | Promise<boolean>;
@@ -261,4 +529,4 @@ declare function jsonByteLength(value: JsonValue): number;
261
529
  */
262
530
  declare function assertJsonSafe(value: unknown, path?: string): asserts value is JsonValue;
263
531
 
264
- export { type IPlaytestAdvanceResult, type IPlaytestAnimationObservation, type IPlaytestBridgeDescription, type IPlaytestBridgeHost, type IPlaytestBridgeReady, type IPlaytestBridgeV1, type IPlaytestContactObservation, type IPlaytestDeviceRequest, type IPlaytestDeviceResponse, type IPlaytestEntityObservation, type IPlaytestEntityTransform, type IPlaytestGameplayObservation, type IPlaytestObservationSnapshot, type IPlaytestPerformanceObservation, type IPlaytestRenderChainObservation, type IPlaytestRuntimeDiagnosticsSample, type IPlaytestSampleRequest, type IPlaytestSetupRequest, type IPlaytestStartupObservation, type IPlaytestTagObservation, 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 };
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 };
@@ -1,6 +1,6 @@
1
- import { I as IStandalonePlaytestConfig, a as IStandalonePlaytestReport } from '../shared-Ax3-pneQ.js';
1
+ import { I as IStandalonePlaytestConfig, a as IStandalonePlaytestReport } from '../shared-BGwYk5HG.js';
2
2
  import '../protocol.js';
3
- import '../diagnostics-D89qJhf0.js';
3
+ import '../diagnostics-f8464bJw.js';
4
4
 
5
5
  interface IRunnerDiagnostic {
6
6
  code: string;
@@ -38,6 +38,7 @@ declare function classifyRunnerError(error: unknown, options?: {
38
38
  */
39
39
  interface IDoctorArgs {
40
40
  readonly browserArgs: readonly string[];
41
+ readonly capture?: string;
41
42
  readonly device: string | undefined;
42
43
  readonly text: boolean;
43
44
  readonly url: string | undefined;
@@ -47,5 +48,16 @@ declare function parseDoctorArgs(argv: readonly string[]): IDoctorArgs;
47
48
  declare function doctorBrowserArgs(extra: readonly string[]): string[];
48
49
  declare function doctorCommand(argv: readonly string[]): Promise<number>;
49
50
  declare function main(argv?: readonly string[]): Promise<number>;
51
+ /**
52
+ * Wait for stdout to reach the far end before exiting, bounded.
53
+ *
54
+ * Returns true when the stream drained, false when the deadline passed with bytes still pending —
55
+ * the caller exits either way, because a stalled reader must not outrank the exit.
56
+ */
57
+ interface IDrainableStream {
58
+ readonly writableLength: number;
59
+ write(chunk: string, callback: () => void): unknown;
60
+ }
61
+ declare function flushStdout(timeoutMs?: number, stream?: IDrainableStream): Promise<boolean>;
50
62
 
51
- export { type IConfiguredPlaytestRunner, type IDoctorArgs, type IPlaytestTargetRunners, type IRunnerDiagnostic, classifyRunnerError, doctorBrowserArgs, doctorCommand, exitCodeForReport, main, parseDoctorArgs, runConfiguredPlaytest };
63
+ export { type IConfiguredPlaytestRunner, type IDoctorArgs, type IDrainableStream, type IPlaytestTargetRunners, type IRunnerDiagnostic, classifyRunnerError, doctorBrowserArgs, doctorCommand, exitCodeForReport, flushStdout, main, parseDoctorArgs, runConfiguredPlaytest };