@threenative/playtest 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,84 @@
1
- import { I as IStandalonePlaytestConfig, b as IRunnerConsoleEntry, c as ILabeledPlaytestSample, d as IMovementSampleInterval, a as IStandalonePlaytestReport, e as IPlaytestBridgeClient, f as IBridgeTransport } from '../shared-DK12BZyS.js';
2
- export { g as IPlaytestFlagHelp, h as IPlaytestServerConfig, i as IRunStepSamples, M as ManagedServerError, P as PLAYTEST_FLAGS, j as PlaytestBridgeError, k as PlaytestCliUsageError, l as PlaywrightTransport, m as advanceFixedStep, n as advanceTimeoutMs, o as bridgeWaitTimeoutMs, p as captureVisualSurface, q as connectPlaytestBridge, r as connectPlaytestBridgeTransport, s as failedDiagnosticsAssertion, t as formatUsage, u as parseStandalonePlaytestArgs, v as playtestStepDrivesMovement } from '../shared-DK12BZyS.js';
3
- import { e as IPlaytestScenario, f as IPlaytestArtifactRequest, k as IPlaytestPointer } from '../schema-base-B5mr_Yr9.js';
4
- import { n as IPlaytestObservations, m as IPlaytestFramebufferCoverageObservation, f as IPlaytestCaptureProvenance, p as IPlaytestSetupApplication, h as IPlaytestDeviceMetricsObservation, b as IPlaytestDiagnostic, o as IPlaytestProtocolDiagnostic, C as IAndroidAppState, E as IAndroidPointer, F as IAndroidPointerInjection, G as IAndroidDriver } from '../diagnostics-BhS6v2n1.js';
5
- export { J as AdbAndroidDriver, K as IAndroidDriverOptions, L as IAndroidLifecycleOperation, M as IAndroidTouchViewport, N as IPlaytestDeviceLifecycleObservation, O as IPlaytestDeviceLifecyclePhase, Q as IPlaytestDeviceLifecyclePhysics, R as IPlaytestDeviceLifecycleSteps, S as androidTouchBatches, T as discoverAdb, U as keyboardIsShown, V as parseAndroidConsole, W as parseAndroidTouchViewport, X as rotatedTouchPosition, Y as tapCommand, Z as touchPositionForViewport, _ as touchRotationFromWindowDump, $ as viewportPresentationCommands, a0 as viewportPresentationObserved, a1 as viewportRestoreCommands } from '../diagnostics-BhS6v2n1.js';
6
- import { IPlaytestObservationSnapshot, JsonValue } from '../protocol.js';
7
- import { ChildProcess } from 'node:child_process';
1
+ import { IPlaytestSetupRequest, JsonValue, IPlaytestBridgeDescription, IPlaytestBridgeReady, IPlaytestSampleRequest, IPlaytestObservationSnapshot } from '../protocol.js';
2
+ import { e as IPlaytestScenario, f as IPlaytestArtifactRequest, k as IPlaytestPointer } from '../schema-base-B26KSBoa.js';
3
+ import { q as IPlaytestSetupApplication, p as IPlaytestProtocolDiagnostic, o as IPlaytestObservations, n as IPlaytestFramebufferCoverageObservation, f as IPlaytestCaptureProvenance, h as IPlaytestDeviceMetricsObservation, b as IPlaytestDiagnostic, E as IAndroidAppState, F as IAndroidPointer, G as IAndroidPointerInjection, J as IAndroidDriver } from '../diagnostics-BKg7C6Lf.js';
4
+ export { K as AdbAndroidDriver, L as IAndroidDriverOptions, M as IAndroidLifecycleOperation, N as IAndroidTouchViewport, O as IPlaytestDeviceLifecycleObservation, Q as IPlaytestDeviceLifecyclePhase, R as IPlaytestDeviceLifecyclePhysics, S as IPlaytestDeviceLifecycleSteps, T as androidTouchBatches, U as discoverAdb, V as keyboardIsShown, W as parseAndroidConsole, X as parseAndroidTouchViewport, Y as rotatedTouchPosition, Z as tapCommand, _ as touchPositionForViewport, $ as touchRotationFromWindowDump, a0 as viewportPresentationCommands, a1 as viewportPresentationObserved, a2 as viewportRestoreCommands } from '../diagnostics-BKg7C6Lf.js';
8
5
  import { Page } from 'playwright';
6
+ import { I as IStandalonePlaytestConfig, b as IRunnerConsoleEntry, c as ILabeledPlaytestSample, d as IMovementSampleInterval, a as IStandalonePlaytestReport } from '../shared-Dg-3kiU8.js';
7
+ export { e as IPlaytestFlagHelp, f as IPlaytestServerConfig, g as IRunStepSamples, M as ManagedServerError, P as PLAYTEST_FLAGS, h as PlaytestCliUsageError, i as advanceFixedStep, j as captureVisualSurface, k as failedDiagnosticsAssertion, l as formatUsage, p as parseStandalonePlaytestArgs, m as playtestStepDrivesMovement, w as withScenarioClock } from '../shared-Dg-3kiU8.js';
8
+ import { ChildProcess } from 'node:child_process';
9
+
10
+ /** The only seam between assertion orchestration and an application bridge. */
11
+ interface IBridgeTransport {
12
+ readonly capabilities: readonly string[];
13
+ call<T>(method: string, argument?: unknown, timeoutMs?: number, options?: unknown): Promise<T>;
14
+ close(): Promise<void>;
15
+ waitForBridge(timeoutMs: number): Promise<boolean>;
16
+ }
17
+ /**
18
+ * The budget for one `advance` call: the round-trip allowance plus time for the ticks themselves.
19
+ *
20
+ * Every other bridge method is a request and a reply, so `operationTimeoutMs` fits. `advance` runs
21
+ * the game loop N times before replying, so its honest bound grows with N. Fixed at 5 s it failed
22
+ * `starter-game-over` — 600 ticks in one call — on a two-core runner, and reported it as
23
+ * `TN_PLAYTEST_OPERATION_TIMEOUT`, which reads as a hung page rather than a slow one.
24
+ */
25
+ declare function advanceTimeoutMs(ticks: number, perTickMs?: number): number;
26
+ declare class PlaytestBridgeError extends Error {
27
+ readonly diagnostic: IPlaytestProtocolDiagnostic;
28
+ constructor(diagnostic: IPlaytestProtocolDiagnostic);
29
+ }
30
+ interface IPlaytestBridgeClient {
31
+ /** `render: true` draws a world frame per tick; the default advances without drawing. Browser bridges only. */
32
+ /** Resolves with the ticks the game reported running, which a live clock can put above `ticks`. */
33
+ advance(ticks: number, options?: {
34
+ render?: boolean;
35
+ }): Promise<number | undefined>;
36
+ applySetup(request: IPlaytestSetupRequest): Promise<void>;
37
+ close(): Promise<void>;
38
+ drainEvents(limit?: number): Promise<JsonValue[]>;
39
+ description: IPlaytestBridgeDescription;
40
+ /** Setup applied before the handshake released a held game, when the scenario declared setup. */
41
+ setupApplication?: IPlaytestSetupApplication;
42
+ /** Re-reads the bridge's readiness, including startup progress when it reports any. */
43
+ readiness(): Promise<IPlaytestBridgeReady>;
44
+ /** Draws the current world once without advancing it. Requires `runtime.renderOnly`. */
45
+ renderOnly(): Promise<void>;
46
+ sample(request: IPlaytestSampleRequest): Promise<IPlaytestObservationSnapshot>;
47
+ }
48
+ declare class PlaywrightTransport implements IBridgeTransport {
49
+ private readonly page;
50
+ private readonly operationTimeoutMs;
51
+ readonly capabilities: readonly ["browser.canvas", "browser.console", "browser.dom", "browser.input", "browser.network", "browser.screenshot", "browser.trace", "runtime.diagnostics", "runtime.ui"];
52
+ constructor(page: Page, operationTimeoutMs?: number);
53
+ call<T>(method: string, argument?: unknown, timeoutMs?: number, options?: unknown): Promise<T>;
54
+ close(): Promise<void>;
55
+ waitForBridge(timeoutMs: number): Promise<boolean>;
56
+ }
57
+ declare function connectPlaytestBridge(page: Page, scenario: IPlaytestScenario, timeoutMs?: number): Promise<IPlaytestBridgeClient | undefined>;
58
+ /**
59
+ * How long to wait for the page to install its playtest bridge — and for the handshake to answer.
60
+ *
61
+ * The bridge appears during application startup, not during a request/response round trip, so
62
+ * `operationTimeoutMs` is the wrong budget for it by construction — the same mistake, in the same
63
+ * direction, as timing a bulk `advance` with it. On a software-rendered two-core runner the
64
+ * scaffolded starter spends seconds in first-use compilation before the bridge exists, and the run
65
+ * was reported as `TN_PLAYTEST_BRIDGE_MISSING` with `frames: 0`: not a page without a bridge, a
66
+ * page that had not finished booting yet.
67
+ *
68
+ * One operation plus the startup budget, matching `advanceTimeoutMs`. A page that genuinely
69
+ * installs no bridge still fails with the same diagnostic, just later.
70
+ */
71
+ declare function bridgeWaitTimeoutMs(operationMs?: number): number;
72
+ declare function connectPlaytestBridgeTransport(transport: IBridgeTransport, scenario: IPlaytestScenario, timeoutMs?: number, target?: string): Promise<IPlaytestBridgeClient | undefined>;
73
+ /**
74
+ * The page global that keeps a pending bridge promise reachable while Chromium awaits it.
75
+ *
76
+ * `Runtime.awaitPromise` holds the awaited promise weakly. A major GC while a call waits on
77
+ * engine work — the start scene's `load()` before setup can name its entities, a long `advance` —
78
+ * collected it and the run failed with Playwright's "Resulting promise was garbage collected."
79
+ * Rooting the promise in the page until it settles makes the collector leave it alone.
80
+ */
81
+ declare const PENDING_BRIDGE_OPERATIONS_GLOBAL = "__THREENATIVE_PLAYTEST_PENDING_OPERATIONS__";
9
82
 
10
83
  /**
11
84
  * The display half of the capture environment bake-in (abstraction report §2.10).
@@ -66,7 +139,7 @@ declare function buildReport(config: IStandalonePlaytestConfig, scenario: IPlayt
66
139
  code: "TN_CAPTURE_BLANK";
67
140
  label: string;
68
141
  reason: string;
69
- } | undefined, movementSamples?: readonly IMovementSampleInterval[], setup?: IPlaytestSetupApplication | undefined, deviceMetrics?: IPlaytestDeviceMetricsObservation | undefined, movementBaselineSnapshot?: IPlaytestObservationSnapshot | undefined, startup?: IStandalonePlaytestReport["startup"], deviceLifecycle?: IPlaytestObservations["deviceLifecycle"], tone?: IPlaytestObservations["tone"]): IStandalonePlaytestReport;
142
+ } | undefined, movementSamples?: readonly IMovementSampleInterval[], setup?: IPlaytestSetupApplication | undefined, deviceMetrics?: IPlaytestDeviceMetricsObservation | undefined, movementBaselineSnapshot?: IPlaytestObservationSnapshot | undefined, startup?: IStandalonePlaytestReport["startup"], deviceLifecycle?: IPlaytestObservations["deviceLifecycle"], tone?: IPlaytestObservations["tone"], footSlip?: IPlaytestObservations["footSlip"], sightLine?: IPlaytestObservations["sightLine"], hudAudit?: IPlaytestObservations["hudAudit"]): IStandalonePlaytestReport;
70
143
 
71
144
  /**
72
145
  * A published diagnostic that is unmistakably a *readout* rather than an error.
@@ -150,7 +223,7 @@ declare function runStandalonePlaytests(config: IStandalonePlaytestConfig): Prom
150
223
  declare function batchArtifactDirectory(base: string, scenarioPath: string, index: number): string;
151
224
  declare function resolveManagedServerConfig(config: IStandalonePlaytestConfig): Promise<IStandalonePlaytestConfig>;
152
225
 
153
- declare const WEBGPU_BROWSER_ARGS: readonly ["--ozone-platform=x11", "--enable-unsafe-webgpu", "--disable-gpu-sandbox", "--ignore-gpu-blocklist", "--enable-features=Vulkan", ...string[]];
226
+ declare const WEBGPU_BROWSER_ARGS: readonly ["--ozone-platform=x11", "--enable-unsafe-webgpu", "--disable-gpu-sandbox", "--ignore-gpu-blocklist", "--enable-features=Vulkan"];
154
227
  /** Allow performance probes to sample render work instead of Xvfb's compositor cadence. */
155
228
  declare const PERFORMANCE_BROWSER_ARGS: readonly ["--disable-frame-rate-limit", "--disable-gpu-vsync"];
156
229
  declare function resolveBrowserArguments(browserArgs: readonly string[] | undefined): string[];
@@ -409,6 +482,8 @@ declare class XcrunIosDriver implements IDevicePlaytestDriver {
409
482
  getMailboxRoot(): string;
410
483
  private prepareSimulator;
411
484
  private prepareDevice;
485
+ private awaitInstalledBundle;
486
+ private registeredBundlePath;
412
487
  private device;
413
488
  private mailboxPath;
414
489
  }
@@ -644,4 +719,4 @@ interface IBrowserCaptureSession {
644
719
  */
645
720
  declare function withBrowserCapture<T>(config: IStandalonePlaytestConfig, capture: (session: IBrowserCaptureSession) => Promise<T>, signal?: AbortSignal): Promise<T>;
646
721
 
647
- export { ANDROID_TRANSPORT_CAPABILITIES, DesktopPlaytestDriver, DeviceBridgeTransport, DeviceMailboxTransport, IAndroidAppState, IAndroidDriver, type IAndroidPlaytestDependencies, IAndroidPointer, IAndroidPointerInjection, IBridgeTransport, type IBrowserCaptureSession, type IBrowserPointerChange, type IDesktopPlaytestDependencies, type IDesktopPlaytestDriverOptions, type IDeviceMailbox, type IDeviceMailboxPaths, type IDevicePlaytestDriver, type IDevicePlaytestTarget, type IDevicePlaytestTransport, type IDeviceRequestContext, type IDeviceResponseObservation, type IDisplayStrategy, type IIosCommandOptions, type IIosDriverOptions, type IIosPlaytestDependencies, ILabeledPlaytestSample, IMovementSampleInterval, type IPipelineCapture, type IPipelineCaptureBoundary, type IPipelineCaptureCounts, type IPipelineCaptureEvent, type IPipelineCaptureNodeBuild, type IPipelineCaptureProvenance, type IPipelineCaptureShader, type IPipelineContributorSummary, type IPipelinePassSummary, type IPipelineProgramReasonSummary, type IPipelineSizeTimePassSummary, type IPipelineSizeTimeSummary, type IPipelineSummary, type IPipelineWarmupSummary, IPlaytestBridgeClient, type IRunIosCommand, IRunnerConsoleEntry, IStandalonePlaytestConfig, IStandalonePlaytestReport, type IStandalonePlaytestRunOptions, type IosTransportKind, LocalDeviceMailbox, PERFORMANCE_BROWSER_ARGS, PIPELINE_CAPTURE_VERSION, PIPELINE_EVENT_MARKER, type PipelineCaptureKind, type PipelineCaptureMode, type PipelineCaptureSource, type PipelineCaptureStatus, STANDALONE_PLAYTEST_OBSERVATION_FIELDS, WEBGPU_BROWSER_ARGS, XcrunIosDriver, androidMailboxPaths, batchArtifactDirectory, boundedTeardownStep, buildReport, decideDisplayStrategy, desktopConsoleType, deviceMailboxPaths, deviceTimeoutDiagnostic, formatPipelineSummary, handlePlaytestSignal, initStandalonePlaytest, isRuntimeReadout, openPageAndConnectBridge, pageLifecycleDiagnostic, parseLaunchedPid, parsePipelineCapture, parsePipelineEventMarkers, preflightDisplay, reconcileBrowserPointers, recordToScenario, requireAssertions, resolveBrowserArguments, resolveManagedServerCommand, resolveManagedServerConfig, runAndroidPlaytest, runDesktopPlaytest, runDevicePlaytest, runIosPlaytest, runStandalonePlaytest, runStandalonePlaytests, softwareAdapterName, substituteManagedPort, summarizePipelineCapture, validateDeviceEndpoint, withBrowserCapture, writeCaptureProvenance, writeObservationArtifacts };
722
+ export { ANDROID_TRANSPORT_CAPABILITIES, DesktopPlaytestDriver, DeviceBridgeTransport, DeviceMailboxTransport, IAndroidAppState, IAndroidDriver, type IAndroidPlaytestDependencies, IAndroidPointer, IAndroidPointerInjection, type IBridgeTransport, type IBrowserCaptureSession, type IBrowserPointerChange, type IDesktopPlaytestDependencies, type IDesktopPlaytestDriverOptions, type IDeviceMailbox, type IDeviceMailboxPaths, type IDevicePlaytestDriver, type IDevicePlaytestTarget, type IDevicePlaytestTransport, type IDeviceRequestContext, type IDeviceResponseObservation, type IDisplayStrategy, type IIosCommandOptions, type IIosDriverOptions, type IIosPlaytestDependencies, ILabeledPlaytestSample, IMovementSampleInterval, type IPipelineCapture, type IPipelineCaptureBoundary, type IPipelineCaptureCounts, type IPipelineCaptureEvent, type IPipelineCaptureNodeBuild, type IPipelineCaptureProvenance, type IPipelineCaptureShader, type IPipelineContributorSummary, type IPipelinePassSummary, type IPipelineProgramReasonSummary, type IPipelineSizeTimePassSummary, type IPipelineSizeTimeSummary, type IPipelineSummary, type IPipelineWarmupSummary, type IPlaytestBridgeClient, type IRunIosCommand, IRunnerConsoleEntry, IStandalonePlaytestConfig, IStandalonePlaytestReport, type IStandalonePlaytestRunOptions, type IosTransportKind, LocalDeviceMailbox, PENDING_BRIDGE_OPERATIONS_GLOBAL, PERFORMANCE_BROWSER_ARGS, PIPELINE_CAPTURE_VERSION, PIPELINE_EVENT_MARKER, type PipelineCaptureKind, type PipelineCaptureMode, type PipelineCaptureSource, type PipelineCaptureStatus, PlaytestBridgeError, PlaywrightTransport, STANDALONE_PLAYTEST_OBSERVATION_FIELDS, WEBGPU_BROWSER_ARGS, XcrunIosDriver, advanceTimeoutMs, androidMailboxPaths, batchArtifactDirectory, boundedTeardownStep, bridgeWaitTimeoutMs, buildReport, connectPlaytestBridge, connectPlaytestBridgeTransport, decideDisplayStrategy, desktopConsoleType, deviceMailboxPaths, deviceTimeoutDiagnostic, formatPipelineSummary, handlePlaytestSignal, initStandalonePlaytest, isRuntimeReadout, openPageAndConnectBridge, pageLifecycleDiagnostic, parseLaunchedPid, parsePipelineCapture, parsePipelineEventMarkers, preflightDisplay, reconcileBrowserPointers, recordToScenario, requireAssertions, resolveBrowserArguments, resolveManagedServerCommand, resolveManagedServerConfig, runAndroidPlaytest, runDesktopPlaytest, runDevicePlaytest, runIosPlaytest, runStandalonePlaytest, runStandalonePlaytests, softwareAdapterName, substituteManagedPort, summarizePipelineCapture, validateDeviceEndpoint, withBrowserCapture, writeCaptureProvenance, writeObservationArtifacts };