@vgai/live 0.5.53 → 0.5.57

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/dist/editor.js CHANGED
@@ -258,6 +258,19 @@ export class LiveEditor {
258
258
  case 'build':
259
259
  await this.#client.showBuild();
260
260
  return;
261
+ default: {
262
+ // A silent no-op on an unknown name is the door failure that sends
263
+ // an agent to a browser. Refuse by name and point at the real door.
264
+ const known = [
265
+ 'viewport-edit',
266
+ 'viewport-play',
267
+ 'inspector',
268
+ 'console',
269
+ 'build',
270
+ ];
271
+ throw new Error(`showPanel: "${String(name)}" is not a panel. Known: ${known.join(', ')}. ` +
272
+ `Drawer utilities (profiler, network, audio, …) open through editor.present({ version: 1, utility: '<id>' }).`);
273
+ }
261
274
  }
262
275
  }
263
276
  /** `kind` inferred from `path`'s extension when omitted (`inferAssetKind`) — pass it explicitly to override. */
@@ -275,9 +275,7 @@ export declare class GameClient {
275
275
  * throwing the same `WaitForTimeoutError` shape so it renders through the
276
276
  * same honest failure block as an ordinary `waitFor`/`waitSimTime` budget
277
277
  * exhaustion. */
278
- waitSimTime(budget: {
279
- simSeconds: number;
280
- }): Promise<void>;
278
+ waitSimTime(budget: WaitForBudget): Promise<void>;
281
279
  /**
282
280
  * Capture the running game to disk and return the ABSOLUTE path written.
283
281
  *
@@ -17,7 +17,7 @@ import { runFastForward, } from './fast-forward.js';
17
17
  import { HiddenRecoveryDriver } from './hidden-recovery.js';
18
18
  import { TpsAccumulator } from './perf-sampling.js';
19
19
  import { resolveScreenshotTarget } from './screenshot-target.js';
20
- import { assertValidWaitForBudget, maybeHeartbeat, runWaitFor, WAIT_FOR_STALL_POLL_LIMIT, WaitForTimeoutError, } from './wait-for.js';
20
+ import { assertValidWaitForBudget, budgetTarget, maybeHeartbeat, runWaitFor, WAIT_FOR_STALL_POLL_LIMIT, WaitForTimeoutError, } from './wait-for.js';
21
21
  /** Runs inside the page. Kept as a single exported plain function (not a
22
22
  * closure over Node state) because `page.evaluate(fn, arg)` only ships
23
23
  * `fn`'s own source across the boundary. */
@@ -657,7 +657,10 @@ export class GameClient {
657
657
  let heartbeat = { lastEmitWallMs: startWall, lastEmitTick: startTime.tick };
658
658
  for (;;) {
659
659
  const currentTime = await this.readTime();
660
- if (currentTime.simSeconds - startTime.simSeconds >= budget.simSeconds)
660
+ const elapsed = 'simSeconds' in budget
661
+ ? currentTime.simSeconds - startTime.simSeconds
662
+ : currentTime.tick - startTime.tick;
663
+ if (elapsed >= budgetTarget(budget))
661
664
  return;
662
665
  stalledPolls = lastTick !== null && currentTime.tick === lastTick ? stalledPolls + 1 : 0;
663
666
  lastTick = currentTime.tick;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vgai/live",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.5.53",
5
+ "version": "0.5.57",
6
6
  "type": "module",
7
7
  "repository": {
8
8
  "type": "git",
@@ -32,8 +32,8 @@
32
32
  "prepack": "npm run build"
33
33
  },
34
34
  "dependencies": {
35
- "@vgai/editor-sdk": "0.5.53",
36
- "@vgai/sdk": "0.5.53"
35
+ "@vgai/editor-sdk": "0.5.57",
36
+ "@vgai/sdk": "0.5.57"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@playwright/test": ">=1.58.2 <2"
package/src/editor.ts CHANGED
@@ -343,6 +343,21 @@ export class LiveEditor {
343
343
  case 'build':
344
344
  await this.#client.showBuild();
345
345
  return;
346
+ default: {
347
+ // A silent no-op on an unknown name is the door failure that sends
348
+ // an agent to a browser. Refuse by name and point at the real door.
349
+ const known: PanelName[] = [
350
+ 'viewport-edit',
351
+ 'viewport-play',
352
+ 'inspector',
353
+ 'console',
354
+ 'build',
355
+ ];
356
+ throw new Error(
357
+ `showPanel: "${String(name)}" is not a panel. Known: ${known.join(', ')}. ` +
358
+ `Drawer utilities (profiler, network, audio, …) open through editor.present({ version: 1, utility: '<id>' }).`,
359
+ );
360
+ }
346
361
  }
347
362
  }
348
363
 
@@ -35,6 +35,7 @@ import type {
35
35
  } from './types.js';
36
36
  import {
37
37
  assertValidWaitForBudget,
38
+ budgetTarget,
38
39
  type HeartbeatState,
39
40
  maybeHeartbeat,
40
41
  runWaitFor,
@@ -793,7 +794,7 @@ export class GameClient {
793
794
  * throwing the same `WaitForTimeoutError` shape so it renders through the
794
795
  * same honest failure block as an ordinary `waitFor`/`waitSimTime` budget
795
796
  * exhaustion. */
796
- async waitSimTime(budget: { simSeconds: number }): Promise<void> {
797
+ async waitSimTime(budget: WaitForBudget): Promise<void> {
797
798
  // A positional budget (`waitSimTime(0.5)`) reads `undefined` here and the
798
799
  // exit comparison below is then false FOREVER — and against a hidden tab
799
800
  // the client drives its own ticks, so the frozen-clock stall guard never
@@ -817,7 +818,11 @@ export class GameClient {
817
818
  let heartbeat: HeartbeatState = { lastEmitWallMs: startWall, lastEmitTick: startTime.tick };
818
819
  for (;;) {
819
820
  const currentTime = await this.readTime();
820
- if (currentTime.simSeconds - startTime.simSeconds >= budget.simSeconds) return;
821
+ const elapsed =
822
+ 'simSeconds' in budget
823
+ ? currentTime.simSeconds - startTime.simSeconds
824
+ : currentTime.tick - startTime.tick;
825
+ if (elapsed >= budgetTarget(budget)) return;
821
826
  stalledPolls = lastTick !== null && currentTime.tick === lastTick ? stalledPolls + 1 : 0;
822
827
  lastTick = currentTime.tick;
823
828
  if (stalledPolls >= WAIT_FOR_STALL_POLL_LIMIT) {