@threenative/core 0.1.0 → 0.3.0

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,42 @@
1
- import { JsonValue } from '@threenative/playtest';
2
- import { b as GamePluginHooks } from './game-DRPs3M7r.js';
1
+ import { JsonValue } from '@threenative/playtest/protocol';
2
+ import { b as IGamePluginHooks } from './game-CYIaKhgl.js';
3
3
  import 'three';
4
+ import './canvas-layer-CtrZHgIh.js';
5
+ import 'three/webgpu';
4
6
  import 'zustand/vanilla';
5
7
 
6
- declare function playtest<TState extends Record<string, unknown> = Record<string, unknown>, TPhysics = undefined>(options?: PlaytestOptions): GamePluginHooks<TState, TPhysics>;
7
- interface PlaytestOptions {
8
+ /**
9
+ * Install the playtest bridge into a portable game.
10
+ * @situation expose movement and world observations to a playtest
11
+ * @situation connect a game to the ThreeNative scenario runner
12
+ * @constraint install once in the game's plugin list
13
+ * @example const game = defineGame({ plugins: [playtest()] });
14
+ */
15
+ declare function playtest<TState extends Record<string, unknown> = Record<string, unknown>, TPhysics = undefined>(options?: IPlaytestOptions): IGamePluginHooks<TState, TPhysics>;
16
+ declare const PLAYTEST_ATTACH_TIMEOUT_MS = 30000;
17
+ /**
18
+ * Resolves when a runner first calls `describe()`, the handshake every runner performs before
19
+ * it observes anything.
20
+ *
21
+ * Without this, a scenario races the game: a proof that does finite work at startup can finish
22
+ * before the runner takes its first observation, and the assertion then reports
23
+ * TN_PLAYTEST_ASSERTION_TRIVIAL or a zero-delta failure depending only on how fast the device
24
+ * booted. Opt-in, because a game that holds for a runner that never arrives is worse than the
25
+ * race for every non-test caller.
26
+ *
27
+ * Fails closed: if no runner attaches within the timeout, setup throws rather than quietly
28
+ * starting anyway and reproducing the race it was added to remove.
29
+ */
30
+ /** The global a playtest runner sets before the page loads, so a game can tell one is coming. */
31
+ declare const PLAYTEST_RUNNER_EXPECTED_GLOBAL = "__THREENATIVE_PLAYTEST_RUNNER_EXPECTED__";
32
+ interface IPlaytestOptions {
8
33
  readonly events?: () => JsonValue[];
34
+ /**
35
+ * Hold the frame loop until a runner attaches. Default false.
36
+ */
37
+ readonly holdUntilAttached?: boolean;
38
+ /** Milliseconds to wait when `holdUntilAttached` is set. Default {@link PLAYTEST_ATTACH_TIMEOUT_MS}. */
39
+ readonly attachTimeoutMs?: number;
9
40
  }
10
41
 
11
- export { type PlaytestOptions, playtest };
42
+ export { type IPlaytestOptions, PLAYTEST_ATTACH_TIMEOUT_MS, PLAYTEST_RUNNER_EXPECTED_GLOBAL, playtest };