@vgai/cli 0.5.23 → 0.5.25

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.
Files changed (2) hide show
  1. package/dist/index.js +233 -116
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -1977,6 +1977,34 @@ var init_client2 = __esm({
1977
1977
  };
1978
1978
  }
1979
1979
  }
1980
+ /** THE MODULE LANE under a real Playwright host: the step's source is
1981
+ * evaluated INSIDE the editor page via the same in-page handler the relay
1982
+ * op uses (`window.__vgaiGameEval`), because `modules()` only means
1983
+ * anything in the page's own module space — a Node-side call could never
1984
+ * hand back the running mount's instances. Same serialization contract
1985
+ * as the relay leg. */
1986
+ async runGameScript(src, _step, instance) {
1987
+ try {
1988
+ const result = await this.page.evaluate(
1989
+ async (args2) => {
1990
+ const hook = window["__vgaiGameEval"];
1991
+ if (typeof hook !== "function") {
1992
+ throw new Error(
1993
+ "game-eval: this page has no __vgaiGameEval hook \u2014 is the editor page loaded?"
1994
+ );
1995
+ }
1996
+ return hook(args2.src, args2.instance);
1997
+ },
1998
+ { src, ...instance === void 0 ? {} : { instance } }
1999
+ );
2000
+ return { ok: true, result };
2001
+ } catch (err2) {
2002
+ return {
2003
+ ok: false,
2004
+ error: { code: void 0, message: err2 instanceof Error ? err2.message : String(err2) }
2005
+ };
2006
+ }
2007
+ }
1980
2008
  /** Playwright's own reload already waits for the new document's `load`
1981
2009
  * event, which is exactly the completion signal this method's contract
1982
2010
  * asks for — nothing to reconstruct on this leg. */
@@ -2221,6 +2249,9 @@ var init_client2 = __esm({
2221
2249
  /** Per-test tick-rate samples, fed by every `snapshot()` read (a poll the
2222
2250
  * client was making anyway — zero extra page.evaluate round trips). */
2223
2251
  #tps = new TpsAccumulator();
2252
+ /** True after the settled run-ticks door proved absent on this page (an older exported
2253
+ * game's engine) — see `fastForward`'s `runTicksBatch`. */
2254
+ #legacyRunTicksDoor = false;
2224
2255
  /** Hidden-tab recovery (hollowstone field lesson: the engine hard-stops
2225
2256
  * while `document.hidden`). Client-lifetime state so `bringToFront()`
2226
2257
  * fires at most once per test, across ALL waitFor/waitSimTime loops. */
@@ -2292,7 +2323,28 @@ var init_client2 = __esm({
2292
2323
  async fastForward(budget, opts) {
2293
2324
  assertValidWaitForBudget(budget, "fastForward");
2294
2325
  const clock = {
2295
- runTicksBatch: (n, render2) => this.callBridgeVoid("runTicks", n, { render: render2 }),
2326
+ // The SETTLED door (`runTicksSettled`, an async bridge method): ticks never race a scene
2327
+ // remount's async commit, so which tick first runs a freshly reloaded world is
2328
+ // deterministic (see engine/runtime/run-ticks-settled.ts — measured: without it, one
2329
+ // drive script produced 7 or 8 post-respawn walked ticks depending on wall timing).
2330
+ // Falls back ONCE to the plain sync door for a page whose engine predates the method
2331
+ // (an older exported game), and remembers the verdict for the rest of the burst.
2332
+ runTicksBatch: async (n, render2) => {
2333
+ if (this.#legacyRunTicksDoor) {
2334
+ await this.callBridgeVoid("runTicks", n, { render: render2 });
2335
+ return;
2336
+ }
2337
+ try {
2338
+ await this.callBridgeAsync("runTicksSettled", n, { render: render2 });
2339
+ } catch (error48) {
2340
+ const code = error48.code;
2341
+ const message = error48 instanceof Error ? error48.message : String(error48);
2342
+ const doorAbsent = code === "UNKNOWN_BRIDGE_METHOD" || /is not a function|undefined/i.test(message);
2343
+ if (!doorAbsent) throw error48;
2344
+ this.#legacyRunTicksDoor = true;
2345
+ await this.callBridgeVoid("runTicks", n, { render: render2 });
2346
+ }
2347
+ },
2296
2348
  readTime: async () => {
2297
2349
  const snap = await this.callBridge("snapshot");
2298
2350
  return { tick: snap.time.tick, simSeconds: snap.time.simSeconds };
@@ -2444,6 +2496,29 @@ var init_client2 = __esm({
2444
2496
  const outcome = await this.#transport.runPageScript(step.toString(), erased);
2445
2497
  return this.unwrap(outcome);
2446
2498
  }
2499
+ /**
2500
+ * THE MODULE LANE — run literal JS INSIDE the game's page, with the
2501
+ * running mount's modules in reach:
2502
+ *
2503
+ * ```js
2504
+ * await game.run(async ({ modules }) => {
2505
+ * const { simHost } = await modules('src/sim/host.ts');
2506
+ * return simHost().state.day;
2507
+ * })
2508
+ * ```
2509
+ *
2510
+ * `scope` is `{ page, modules, instanceId }`. Serialization contract as
2511
+ * `game.page()`: the step travels as source (no closures), and the return
2512
+ * value must be plain data. `modules(path)` resolves through the ACTIVE
2513
+ * mount's own url space, so what you touch IS the running game — never a
2514
+ * phantom second copy. Dev-server sessions only; a shipped build's curated
2515
+ * surface is its adapter exports.
2516
+ */
2517
+ async run(step, opts) {
2518
+ const erased = (arg) => step(arg);
2519
+ const outcome = await this.#transport.runGameScript(step.toString(), erased, opts?.instance);
2520
+ return this.unwrap(outcome);
2521
+ }
2447
2522
  /**
2448
2523
  * Reload the document showing the game, resolving only once it is back and
2449
2524
  * answering commands (see `bridge-transport.ts`'s `reloadPage`).
@@ -2750,6 +2825,24 @@ var init_relay_transport = __esm({
2750
2825
  };
2751
2826
  }
2752
2827
  }
2828
+ /** THE MODULE LANE over the relay — same wire shape as `page-script`. */
2829
+ async runGameScript(src, _step, instance) {
2830
+ try {
2831
+ const body = await this.postCommand(
2832
+ { type: "game-eval", src, ...instance === void 0 ? {} : { instance } },
2833
+ PAGE_SCRIPT_TIMEOUT_MS
2834
+ );
2835
+ return this.toBridgeOutcome(body);
2836
+ } catch (err2) {
2837
+ return {
2838
+ ok: false,
2839
+ error: {
2840
+ code: "RELAY_UNREACHABLE",
2841
+ message: `vgai: could not reach the editor dev server relay at ${this.baseUrl} \u2014 ${err2 instanceof Error ? err2.message : String(err2)}`
2842
+ }
2843
+ };
2844
+ }
2845
+ }
2753
2846
  /**
2754
2847
  * P20 — order the tab to reload, then wait for EVIDENCE that it came back.
2755
2848
  *
@@ -78094,9 +78187,9 @@ var require_browser = __commonJS({
78094
78187
  }
78095
78188
  });
78096
78189
 
78097
- // ../../../vgai-engine/node_modules/has-flag/index.js
78190
+ // ../../../../node_modules/has-flag/index.js
78098
78191
  var require_has_flag = __commonJS({
78099
- "../../../vgai-engine/node_modules/has-flag/index.js"(exports, module) {
78192
+ "../../../../node_modules/has-flag/index.js"(exports, module) {
78100
78193
  "use strict";
78101
78194
  module.exports = (flag, argv = process.argv) => {
78102
78195
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
@@ -78107,9 +78200,9 @@ var require_has_flag = __commonJS({
78107
78200
  }
78108
78201
  });
78109
78202
 
78110
- // ../../../vgai-engine/node_modules/supports-color/index.js
78203
+ // ../../../../node_modules/supports-color/index.js
78111
78204
  var require_supports_color = __commonJS({
78112
- "../../../vgai-engine/node_modules/supports-color/index.js"(exports, module) {
78205
+ "../../../../node_modules/supports-color/index.js"(exports, module) {
78113
78206
  "use strict";
78114
78207
  var os3 = __require("os");
78115
78208
  var tty3 = __require("tty");
@@ -80126,13 +80219,26 @@ var require_theme = __commonJS({
80126
80219
  }
80127
80220
  });
80128
80221
 
80222
+ // ../../../vgai-engine/node_modules/has-flag/index.js
80223
+ var require_has_flag2 = __commonJS({
80224
+ "../../../vgai-engine/node_modules/has-flag/index.js"(exports, module) {
80225
+ "use strict";
80226
+ module.exports = (flag, argv = process.argv) => {
80227
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
80228
+ const position = argv.indexOf(prefix + flag);
80229
+ const terminatorPosition = argv.indexOf("--");
80230
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
80231
+ };
80232
+ }
80233
+ });
80234
+
80129
80235
  // ../../../vgai-engine/node_modules/@oclif/core/node_modules/supports-color/index.js
80130
80236
  var require_supports_color2 = __commonJS({
80131
80237
  "../../../vgai-engine/node_modules/@oclif/core/node_modules/supports-color/index.js"(exports, module) {
80132
80238
  "use strict";
80133
80239
  var os3 = __require("os");
80134
80240
  var tty3 = __require("tty");
80135
- var hasFlag2 = require_has_flag();
80241
+ var hasFlag2 = require_has_flag2();
80136
80242
  var { env: env3 } = process;
80137
80243
  var flagForceColor2;
80138
80244
  if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
@@ -80604,9 +80710,9 @@ var require_warn = __commonJS({
80604
80710
  }
80605
80711
  });
80606
80712
 
80607
- // ../../../vgai-engine/node_modules/source-map/lib/base64.js
80713
+ // ../../../../node_modules/source-map/lib/base64.js
80608
80714
  var require_base64 = __commonJS({
80609
- "../../../vgai-engine/node_modules/source-map/lib/base64.js"(exports) {
80715
+ "../../../../node_modules/source-map/lib/base64.js"(exports) {
80610
80716
  var intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
80611
80717
  exports.encode = function(number4) {
80612
80718
  if (0 <= number4 && number4 < intToCharMap.length) {
@@ -80645,9 +80751,9 @@ var require_base64 = __commonJS({
80645
80751
  }
80646
80752
  });
80647
80753
 
80648
- // ../../../vgai-engine/node_modules/source-map/lib/base64-vlq.js
80754
+ // ../../../../node_modules/source-map/lib/base64-vlq.js
80649
80755
  var require_base64_vlq = __commonJS({
80650
- "../../../vgai-engine/node_modules/source-map/lib/base64-vlq.js"(exports) {
80756
+ "../../../../node_modules/source-map/lib/base64-vlq.js"(exports) {
80651
80757
  var base643 = require_base64();
80652
80758
  var VLQ_BASE_SHIFT = 5;
80653
80759
  var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
@@ -80699,9 +80805,9 @@ var require_base64_vlq = __commonJS({
80699
80805
  }
80700
80806
  });
80701
80807
 
80702
- // ../../../vgai-engine/node_modules/source-map/lib/util.js
80808
+ // ../../../../node_modules/source-map/lib/util.js
80703
80809
  var require_util4 = __commonJS({
80704
- "../../../vgai-engine/node_modules/source-map/lib/util.js"(exports) {
80810
+ "../../../../node_modules/source-map/lib/util.js"(exports) {
80705
80811
  function getArg(aArgs, aName, aDefaultValue) {
80706
80812
  if (aName in aArgs) {
80707
80813
  return aArgs[aName];
@@ -81000,9 +81106,9 @@ var require_util4 = __commonJS({
81000
81106
  }
81001
81107
  });
81002
81108
 
81003
- // ../../../vgai-engine/node_modules/source-map/lib/array-set.js
81109
+ // ../../../../node_modules/source-map/lib/array-set.js
81004
81110
  var require_array_set = __commonJS({
81005
- "../../../vgai-engine/node_modules/source-map/lib/array-set.js"(exports) {
81111
+ "../../../../node_modules/source-map/lib/array-set.js"(exports) {
81006
81112
  var util2 = require_util4();
81007
81113
  var has = Object.prototype.hasOwnProperty;
81008
81114
  var hasNativeMap = typeof Map !== "undefined";
@@ -81070,9 +81176,9 @@ var require_array_set = __commonJS({
81070
81176
  }
81071
81177
  });
81072
81178
 
81073
- // ../../../vgai-engine/node_modules/source-map/lib/mapping-list.js
81179
+ // ../../../../node_modules/source-map/lib/mapping-list.js
81074
81180
  var require_mapping_list = __commonJS({
81075
- "../../../vgai-engine/node_modules/source-map/lib/mapping-list.js"(exports) {
81181
+ "../../../../node_modules/source-map/lib/mapping-list.js"(exports) {
81076
81182
  var util2 = require_util4();
81077
81183
  function generatedPositionAfter(mappingA, mappingB) {
81078
81184
  var lineA = mappingA.generatedLine;
@@ -81109,9 +81215,9 @@ var require_mapping_list = __commonJS({
81109
81215
  }
81110
81216
  });
81111
81217
 
81112
- // ../../../vgai-engine/node_modules/source-map/lib/source-map-generator.js
81218
+ // ../../../../node_modules/source-map/lib/source-map-generator.js
81113
81219
  var require_source_map_generator = __commonJS({
81114
- "../../../vgai-engine/node_modules/source-map/lib/source-map-generator.js"(exports) {
81220
+ "../../../../node_modules/source-map/lib/source-map-generator.js"(exports) {
81115
81221
  var base64VLQ = require_base64_vlq();
81116
81222
  var util2 = require_util4();
81117
81223
  var ArraySet = require_array_set().ArraySet;
@@ -81385,9 +81491,9 @@ var require_source_map_generator = __commonJS({
81385
81491
  }
81386
81492
  });
81387
81493
 
81388
- // ../../../vgai-engine/node_modules/source-map/lib/binary-search.js
81494
+ // ../../../../node_modules/source-map/lib/binary-search.js
81389
81495
  var require_binary_search = __commonJS({
81390
- "../../../vgai-engine/node_modules/source-map/lib/binary-search.js"(exports) {
81496
+ "../../../../node_modules/source-map/lib/binary-search.js"(exports) {
81391
81497
  exports.GREATEST_LOWER_BOUND = 1;
81392
81498
  exports.LEAST_UPPER_BOUND = 2;
81393
81499
  function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
@@ -81441,9 +81547,9 @@ var require_binary_search = __commonJS({
81441
81547
  }
81442
81548
  });
81443
81549
 
81444
- // ../../../vgai-engine/node_modules/source-map/lib/quick-sort.js
81550
+ // ../../../../node_modules/source-map/lib/quick-sort.js
81445
81551
  var require_quick_sort = __commonJS({
81446
- "../../../vgai-engine/node_modules/source-map/lib/quick-sort.js"(exports) {
81552
+ "../../../../node_modules/source-map/lib/quick-sort.js"(exports) {
81447
81553
  function swap(ary, x, y) {
81448
81554
  var temp = ary[x];
81449
81555
  ary[x] = ary[y];
@@ -81476,9 +81582,9 @@ var require_quick_sort = __commonJS({
81476
81582
  }
81477
81583
  });
81478
81584
 
81479
- // ../../../vgai-engine/node_modules/source-map/lib/source-map-consumer.js
81585
+ // ../../../../node_modules/source-map/lib/source-map-consumer.js
81480
81586
  var require_source_map_consumer = __commonJS({
81481
- "../../../vgai-engine/node_modules/source-map/lib/source-map-consumer.js"(exports) {
81587
+ "../../../../node_modules/source-map/lib/source-map-consumer.js"(exports) {
81482
81588
  var util2 = require_util4();
81483
81589
  var binarySearch = require_binary_search();
81484
81590
  var ArraySet = require_array_set().ArraySet;
@@ -82077,9 +82183,9 @@ var require_source_map_consumer = __commonJS({
82077
82183
  }
82078
82184
  });
82079
82185
 
82080
- // ../../../vgai-engine/node_modules/source-map/lib/source-node.js
82186
+ // ../../../../node_modules/source-map/lib/source-node.js
82081
82187
  var require_source_node = __commonJS({
82082
- "../../../vgai-engine/node_modules/source-map/lib/source-node.js"(exports) {
82188
+ "../../../../node_modules/source-map/lib/source-node.js"(exports) {
82083
82189
  var SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
82084
82190
  var util2 = require_util4();
82085
82191
  var REGEX_NEWLINE = /(\r?\n)/;
@@ -82342,18 +82448,18 @@ var require_source_node = __commonJS({
82342
82448
  }
82343
82449
  });
82344
82450
 
82345
- // ../../../vgai-engine/node_modules/source-map/source-map.js
82451
+ // ../../../../node_modules/source-map/source-map.js
82346
82452
  var require_source_map = __commonJS({
82347
- "../../../vgai-engine/node_modules/source-map/source-map.js"(exports) {
82453
+ "../../../../node_modules/source-map/source-map.js"(exports) {
82348
82454
  exports.SourceMapGenerator = require_source_map_generator().SourceMapGenerator;
82349
82455
  exports.SourceMapConsumer = require_source_map_consumer().SourceMapConsumer;
82350
82456
  exports.SourceNode = require_source_node().SourceNode;
82351
82457
  }
82352
82458
  });
82353
82459
 
82354
- // ../../../vgai-engine/node_modules/buffer-from/index.js
82460
+ // ../../../../node_modules/buffer-from/index.js
82355
82461
  var require_buffer_from = __commonJS({
82356
- "../../../vgai-engine/node_modules/buffer-from/index.js"(exports, module) {
82462
+ "../../../../node_modules/buffer-from/index.js"(exports, module) {
82357
82463
  var toString = Object.prototype.toString;
82358
82464
  var isModern = typeof Buffer !== "undefined" && typeof Buffer.alloc === "function" && typeof Buffer.allocUnsafe === "function" && typeof Buffer.from === "function";
82359
82465
  function isArrayBuffer(input) {
@@ -82400,9 +82506,9 @@ var require_buffer_from = __commonJS({
82400
82506
  }
82401
82507
  });
82402
82508
 
82403
- // ../../../vgai-engine/node_modules/source-map-support/source-map-support.js
82509
+ // ../../../../node_modules/source-map-support/source-map-support.js
82404
82510
  var require_source_map_support = __commonJS({
82405
- "../../../vgai-engine/node_modules/source-map-support/source-map-support.js"(exports, module) {
82511
+ "../../../../node_modules/source-map-support/source-map-support.js"(exports) {
82406
82512
  var SourceMapConsumer = require_source_map().SourceMapConsumer;
82407
82513
  var path = __require("path");
82408
82514
  var fs3;
@@ -82414,9 +82520,6 @@ var require_source_map_support = __commonJS({
82414
82520
  } catch (err2) {
82415
82521
  }
82416
82522
  var bufferFrom = require_buffer_from();
82417
- function dynamicRequire(mod, request) {
82418
- return mod.require(request);
82419
- }
82420
82523
  var errorFormatterInstalled = false;
82421
82524
  var uncaughtShimInstalled = false;
82422
82525
  var emptyCacheBetweenOperations = false;
@@ -82436,23 +82539,6 @@ var require_source_map_support = __commonJS({
82436
82539
  function hasGlobalProcessEventEmitter() {
82437
82540
  return typeof process === "object" && process !== null && typeof process.on === "function";
82438
82541
  }
82439
- function globalProcessVersion() {
82440
- if (typeof process === "object" && process !== null) {
82441
- return process.version;
82442
- } else {
82443
- return "";
82444
- }
82445
- }
82446
- function globalProcessStderr() {
82447
- if (typeof process === "object" && process !== null) {
82448
- return process.stderr;
82449
- }
82450
- }
82451
- function globalProcessExit(code) {
82452
- if (typeof process === "object" && process !== null && typeof process.exit === "function") {
82453
- return process.exit(code);
82454
- }
82455
- }
82456
82542
  function handlerExec(list) {
82457
82543
  return function(arg) {
82458
82544
  for (var i = 0; i < list.length; i++) {
@@ -82677,20 +82763,15 @@ var require_source_map_support = __commonJS({
82677
82763
  object3.toString = CallSiteToString;
82678
82764
  return object3;
82679
82765
  }
82680
- function wrapCallSite(frame, state) {
82681
- if (state === void 0) {
82682
- state = { nextPosition: null, curPosition: null };
82683
- }
82766
+ function wrapCallSite(frame) {
82684
82767
  if (frame.isNative()) {
82685
- state.curPosition = null;
82686
82768
  return frame;
82687
82769
  }
82688
82770
  var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
82689
82771
  if (source) {
82690
82772
  var line = frame.getLineNumber();
82691
82773
  var column = frame.getColumnNumber() - 1;
82692
- var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
82693
- var headerLength = noHeader.test(globalProcessVersion()) ? 0 : 62;
82774
+ var headerLength = 62;
82694
82775
  if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
82695
82776
  column -= headerLength;
82696
82777
  }
@@ -82699,14 +82780,10 @@ var require_source_map_support = __commonJS({
82699
82780
  line,
82700
82781
  column
82701
82782
  });
82702
- state.curPosition = position;
82703
82783
  frame = cloneCallSite(frame);
82704
82784
  var originalFunctionName = frame.getFunctionName;
82705
82785
  frame.getFunctionName = function() {
82706
- if (state.nextPosition == null) {
82707
- return originalFunctionName();
82708
- }
82709
- return state.nextPosition.name || originalFunctionName();
82786
+ return position.name || originalFunctionName();
82710
82787
  };
82711
82788
  frame.getFileName = function() {
82712
82789
  return position.source;
@@ -82741,14 +82818,9 @@ var require_source_map_support = __commonJS({
82741
82818
  var name = error48.name || "Error";
82742
82819
  var message = error48.message || "";
82743
82820
  var errorString = name + ": " + message;
82744
- var state = { nextPosition: null, curPosition: null };
82745
- var processedStack = [];
82746
- for (var i = stack.length - 1; i >= 0; i--) {
82747
- processedStack.push("\n at " + wrapCallSite(stack[i], state));
82748
- state.nextPosition = state.curPosition;
82749
- }
82750
- state.curPosition = state.nextPosition = null;
82751
- return errorString + processedStack.reverse().join("");
82821
+ return errorString + stack.map(function(frame) {
82822
+ return "\n at " + wrapCallSite(frame);
82823
+ }).join("");
82752
82824
  }
82753
82825
  function getErrorSource(error48) {
82754
82826
  var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error48.stack);
@@ -82775,16 +82847,15 @@ var require_source_map_support = __commonJS({
82775
82847
  }
82776
82848
  function printErrorAndExit(error48) {
82777
82849
  var source = getErrorSource(error48);
82778
- var stderr = globalProcessStderr();
82779
- if (stderr && stderr._handle && stderr._handle.setBlocking) {
82780
- stderr._handle.setBlocking(true);
82850
+ if (process.stderr._handle && process.stderr._handle.setBlocking) {
82851
+ process.stderr._handle.setBlocking(true);
82781
82852
  }
82782
82853
  if (source) {
82783
82854
  console.error();
82784
82855
  console.error(source);
82785
82856
  }
82786
82857
  console.error(error48.stack);
82787
- globalProcessExit(1);
82858
+ process.exit(1);
82788
82859
  }
82789
82860
  function shimEmitUncaughtException() {
82790
82861
  var origEmit = process.emit;
@@ -82826,7 +82897,11 @@ var require_source_map_support = __commonJS({
82826
82897
  retrieveMapHandlers.unshift(options.retrieveSourceMap);
82827
82898
  }
82828
82899
  if (options.hookRequire && !isInBrowser()) {
82829
- var Module = dynamicRequire(module, "module");
82900
+ var Module;
82901
+ try {
82902
+ Module = __require("module");
82903
+ } catch (err2) {
82904
+ }
82830
82905
  var $compile = Module.prototype._compile;
82831
82906
  if (!$compile.__sourceMapSupport) {
82832
82907
  Module.prototype._compile = function(content, filename) {
@@ -82846,13 +82921,6 @@ var require_source_map_support = __commonJS({
82846
82921
  }
82847
82922
  if (!uncaughtShimInstalled) {
82848
82923
  var installHandler = "handleUncaughtExceptions" in options ? options.handleUncaughtExceptions : true;
82849
- try {
82850
- var worker_threads = dynamicRequire(module, "worker_threads");
82851
- if (worker_threads.isMainThread === false) {
82852
- installHandler = false;
82853
- }
82854
- } catch (e) {
82855
- }
82856
82924
  if (installHandler && hasGlobalProcessEventEmitter()) {
82857
82925
  uncaughtShimInstalled = true;
82858
82926
  shimEmitUncaughtException();
@@ -309821,9 +309889,11 @@ import { dirname as dirname11, isAbsolute as isAbsolute8, join as join18, relati
309821
309889
  // ../../../vgai-engine/node_modules/fflate/esm/index.mjs
309822
309890
  import { createRequire } from "module";
309823
309891
  var require2 = createRequire("/");
309892
+ var _a2;
309824
309893
  var Worker;
309894
+ var isMarkedAsUntransferable;
309825
309895
  try {
309826
- Worker = require2("worker_threads").Worker;
309896
+ _a2 = require2("worker_threads"), Worker = _a2.Worker, isMarkedAsUntransferable = _a2.isMarkedAsUntransferable;
309827
309897
  } catch (e) {
309828
309898
  }
309829
309899
  var u8 = Uint8Array;
@@ -310021,6 +310091,7 @@ var ec = [
310021
310091
  "stream finished",
310022
310092
  "no stream handler",
310023
310093
  ,
310094
+ // determined by compression function
310024
310095
  "no callback",
310025
310096
  "invalid UTF-8 data",
310026
310097
  "extra field too long",
@@ -310551,7 +310622,7 @@ var fltn = function(d, p, t, o) {
310551
310622
  var val = d[k], n = p + k, op = o;
310552
310623
  if (Array.isArray(val))
310553
310624
  op = mrg(o, val[1]), val = val[0];
310554
- if (val instanceof u8)
310625
+ if (ArrayBuffer.isView(val))
310555
310626
  t[n] = [val, op];
310556
310627
  else {
310557
310628
  t[n += "/"] = [new u8(0), op];
@@ -310635,14 +310706,28 @@ var slzh = function(d, b) {
310635
310706
  return b + 30 + b2(d, b + 26) + b2(d, b + 28);
310636
310707
  };
310637
310708
  var zh = function(d, b, z2) {
310638
- var fnl = b2(d, b + 28), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl, bs = b4(d, b + 20);
310639
- var _a3 = z2 && bs == 4294967295 ? z64e(d, es) : [bs, b4(d, b + 24), b4(d, b + 42)], sc = _a3[0], su = _a3[1], off = _a3[2];
310640
- return [b2(d, b + 10), sc, su, fn, es + b2(d, b + 30) + b2(d, b + 32), off];
310709
+ var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;
310710
+ var _a3 = z64hs(d, es, efl, z2, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a3[0], su = _a3[1], off = _a3[2];
310711
+ return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];
310641
310712
  };
310642
- var z64e = function(d, b) {
310643
- for (; b2(d, b) != 1; b += 4 + b2(d, b + 2))
310644
- ;
310645
- return [b8(d, b + 12), b8(d, b + 4), b8(d, b + 20)];
310713
+ var z64hs = function(d, b, l, z2, sc, su, off) {
310714
+ var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;
310715
+ var nf = nsc + nsu + noff;
310716
+ if (z2 && nf) {
310717
+ for (; b + 4 < e; b += 4 + b2(d, b + 2)) {
310718
+ if (b2(d, b) == 1) {
310719
+ return [
310720
+ nsc ? b8(d, b + 4 + 8 * nsu) : sc,
310721
+ nsu ? b8(d, b + 4) : su,
310722
+ noff ? b8(d, b + 4 + 8 * (nsu + nsc)) : off,
310723
+ 1
310724
+ ];
310725
+ }
310726
+ }
310727
+ if (z2 < 2)
310728
+ err(13);
310729
+ }
310730
+ return [sc, su, off, 0];
310646
310731
  };
310647
310732
  var exfl = function(ex) {
310648
310733
  var le = 0;
@@ -310757,7 +310842,7 @@ function unzipSync(data, opts) {
310757
310842
  if (!c)
310758
310843
  return {};
310759
310844
  var o = b4(data, e + 16);
310760
- var z2 = o == 4294967295 || c == 65535;
310845
+ var z2 = b4(data, e - 20) == 117853008;
310761
310846
  if (z2) {
310762
310847
  var ze = b4(data, e - 12);
310763
310848
  z2 = b4(data, ze) == 101075792;
@@ -311794,6 +311879,8 @@ var RELAY_COMMANDS = {
311794
311879
  "bridge-recording-start": { timeoutMs: 15e3 },
311795
311880
  "bridge-recording-stop": { timeoutMs: 6e4 },
311796
311881
  "page-script": { timeoutMs: 6e4 },
311882
+ // THE MODULE LANE: an in-page step over { page, modules, instanceId }.
311883
+ "game-eval": { timeoutMs: 6e4 },
311797
311884
  "page-reload": { timeoutMs: DEFAULT_RELAY_COMMAND_TIMEOUT_MS }
311798
311885
  };
311799
311886
  var RELAY_COMMAND_TYPES = Object.keys(RELAY_COMMANDS);
@@ -316371,7 +316458,7 @@ var src_default = Yoga;
316371
316458
  // ../../../vgai-engine/node_modules/ink/node_modules/ansi-regex/index.js
316372
316459
  function ansiRegex({ onlyFirst = false } = {}) {
316373
316460
  const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
316374
- const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
316461
+ const osc = `(?:\\u001B\\][^\\u0007\\u001B\\u009C]*${ST})`;
316375
316462
  const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
316376
316463
  const pattern = `${osc}|${csi}`;
316377
316464
  return new RegExp(pattern, onlyFirst ? void 0 : "g");
@@ -323661,6 +323748,34 @@ function shouldMountInk(input) {
323661
323748
  }
323662
323749
 
323663
323750
  // src/instrumentation-signal.ts
323751
+ import { spawnSync as spawnSync8 } from "node:child_process";
323752
+ function git2(cwd2, args2) {
323753
+ const result = spawnSync8("git", args2, { cwd: cwd2, encoding: "utf-8" });
323754
+ if (result.error || result.status !== 0) return null;
323755
+ return (result.stdout ?? "").trim();
323756
+ }
323757
+ var REAL_HISTORY_COMMITS = 5;
323758
+ var UNPUSHED_THRESHOLD = 10;
323759
+ function remoteLine(projectRoot) {
323760
+ if (!projectRoot) return null;
323761
+ if (git2(projectRoot, ["rev-parse", "--is-inside-work-tree"]) !== "true") return null;
323762
+ const commitsRaw = git2(projectRoot, ["rev-list", "--count", "HEAD"]);
323763
+ const commits = commitsRaw === null ? 0 : Number.parseInt(commitsRaw, 10);
323764
+ if (!Number.isFinite(commits) || commits < REAL_HISTORY_COMMITS) return null;
323765
+ const remotes = git2(projectRoot, ["remote"]);
323766
+ if (remotes === null || remotes === "") {
323767
+ return `remote: NONE \u2014 ${commits} commit(s) of history exist only on this machine (create one: \`gh repo create <owner>/<name> --private --source . --push\`)`;
323768
+ }
323769
+ const ahead = git2(projectRoot, ["rev-list", "--count", "@{upstream}..HEAD"]);
323770
+ if (ahead === null) {
323771
+ return `remote: ${remotes.split("\n")[0]} exists but this branch has NO UPSTREAM \u2014 push with -u`;
323772
+ }
323773
+ const aheadCount = Number.parseInt(ahead, 10);
323774
+ if (Number.isFinite(aheadCount) && aheadCount >= UNPUSHED_THRESHOLD) {
323775
+ return `remote: ${aheadCount} commit(s) unpushed \u2014 this machine is the only copy of recent work`;
323776
+ }
323777
+ return null;
323778
+ }
323664
323779
  function livePlaneLine(shape) {
323665
323780
  if (!shape) {
323666
323781
  return "live plane: idle \u2014 commands/providers enumerate while playing (`vgai play`)";
@@ -324104,7 +324219,7 @@ function runIntegrationsCommand(argv, io = {}) {
324104
324219
  }
324105
324220
 
324106
324221
  // src/isolated-worktree.ts
324107
- import { execFileSync as execFileSync5, spawnSync as spawnSync8 } from "node:child_process";
324222
+ import { execFileSync as execFileSync5, spawnSync as spawnSync9 } from "node:child_process";
324108
324223
  import { createHash as createHash7, randomUUID } from "node:crypto";
324109
324224
  import {
324110
324225
  chmodSync,
@@ -324140,7 +324255,7 @@ function canonical(path) {
324140
324255
  return resolve13(path);
324141
324256
  }
324142
324257
  }
324143
- function git2(cwd2, args2) {
324258
+ function git3(cwd2, args2) {
324144
324259
  try {
324145
324260
  const output = execFileSync4("git", ["-C", cwd2, ...args2], {
324146
324261
  encoding: "utf8",
@@ -324157,7 +324272,7 @@ function resolveGitPath(worktreeRoot, rawPath) {
324157
324272
  }
324158
324273
  function defaultBaseCommit(worktreeRoot, headCommit) {
324159
324274
  if (!headCommit) return null;
324160
- const originHead = git2(worktreeRoot, ["symbolic-ref", "--quiet", "refs/remotes/origin/HEAD"]);
324275
+ const originHead = git3(worktreeRoot, ["symbolic-ref", "--quiet", "refs/remotes/origin/HEAD"]);
324161
324276
  const candidates = [
324162
324277
  originHead,
324163
324278
  "refs/remotes/origin/main",
@@ -324166,14 +324281,14 @@ function defaultBaseCommit(worktreeRoot, headCommit) {
324166
324281
  ];
324167
324282
  for (const candidate of candidates) {
324168
324283
  if (!candidate) continue;
324169
- const base = git2(worktreeRoot, ["merge-base", "HEAD", candidate]);
324284
+ const base = git3(worktreeRoot, ["merge-base", "HEAD", candidate]);
324170
324285
  if (base) return base;
324171
324286
  }
324172
324287
  return headCommit;
324173
324288
  }
324174
324289
  function resolveWorktreeIdentity(projectRoot) {
324175
324290
  const project = canonical(projectRoot);
324176
- const discoveredRoot = git2(project, ["rev-parse", "--show-toplevel"]);
324291
+ const discoveredRoot = git3(project, ["rev-parse", "--show-toplevel"]);
324177
324292
  if (!discoveredRoot) {
324178
324293
  const repositoryId2 = `local-${hash2(project)}`;
324179
324294
  return {
@@ -324189,13 +324304,13 @@ function resolveWorktreeIdentity(projectRoot) {
324189
324304
  const worktreeRoot = canonical(discoveredRoot);
324190
324305
  const commonDir = resolveGitPath(
324191
324306
  worktreeRoot,
324192
- git2(worktreeRoot, ["rev-parse", "--git-common-dir"])
324307
+ git3(worktreeRoot, ["rev-parse", "--git-common-dir"])
324193
324308
  );
324194
- const remote = git2(worktreeRoot, ["config", "--get", "remote.origin.url"]);
324309
+ const remote = git3(worktreeRoot, ["config", "--get", "remote.origin.url"]);
324195
324310
  const repositoryKey = remote ?? commonDir ?? worktreeRoot;
324196
324311
  const repositoryId = `repository-${hash2(repositoryKey)}`;
324197
- const branch = git2(worktreeRoot, ["symbolic-ref", "--quiet", "--short", "HEAD"]);
324198
- const headCommit = git2(worktreeRoot, ["rev-parse", "--verify", "HEAD"]);
324312
+ const branch = git3(worktreeRoot, ["symbolic-ref", "--quiet", "--short", "HEAD"]);
324313
+ const headCommit = git3(worktreeRoot, ["rev-parse", "--verify", "HEAD"]);
324199
324314
  const projectRelativePath = relative8(worktreeRoot, project) || ".";
324200
324315
  if (projectRelativePath === ".." || projectRelativePath.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`)) {
324201
324316
  throw new Error(`Project ${project} is outside its reported Git worktree ${worktreeRoot}.`);
@@ -324245,7 +324360,7 @@ var systemRunner = {
324245
324360
  runToFile(command2, args2, destination) {
324246
324361
  const output = openSync2(destination, "wx", 384);
324247
324362
  try {
324248
- const result = spawnSync8(command2, [...args2], {
324363
+ const result = spawnSync9(command2, [...args2], {
324249
324364
  encoding: "utf8",
324250
324365
  stdio: ["ignore", output, "pipe"]
324251
324366
  });
@@ -324715,7 +324830,7 @@ function stopIsolatedWorktree(id, discard, runner = systemRunner) {
324715
324830
  }
324716
324831
  function attachIsolatedAgent(id, harness) {
324717
324832
  const record2 = readRecord(id);
324718
- const result = spawnSync8(
324833
+ const result = spawnSync9(
324719
324834
  "docker",
324720
324835
  [
324721
324836
  "exec",
@@ -327047,7 +327162,7 @@ function applyPorcelainField(record2, key, value) {
327047
327162
  else if (key === "bare") record2.bare = true;
327048
327163
  else if (key === "detached") record2.detached = true;
327049
327164
  }
327050
- function git3(cwd2, args2) {
327165
+ function git4(cwd2, args2) {
327051
327166
  try {
327052
327167
  return execFileSync6("git", ["-C", cwd2, ...args2], {
327053
327168
  encoding: "utf8",
@@ -327121,7 +327236,7 @@ async function listRepositoryWorktrees(projectRoot, sessions2 = []) {
327121
327236
  throw new Error(`${projectRoot} is not inside a Git repository.`);
327122
327237
  }
327123
327238
  const records = parseWorktreePorcelain(
327124
- git3(currentIdentity.worktreeRoot, ["worktree", "list", "--porcelain"])
327239
+ git4(currentIdentity.worktreeRoot, ["worktree", "list", "--porcelain"])
327125
327240
  );
327126
327241
  return Promise.all(
327127
327242
  records.map(async (record2) => {
@@ -327147,10 +327262,10 @@ function createRepositoryWorktree(projectRoot, options) {
327147
327262
  const identity = resolveWorktreeIdentity(projectRoot);
327148
327263
  if (identity.headCommit === null)
327149
327264
  throw new Error(`${projectRoot} is not inside a Git repository.`);
327150
- git3(identity.worktreeRoot, ["check-ref-format", "--branch", options.branch]);
327265
+ git4(identity.worktreeRoot, ["check-ref-format", "--branch", options.branch]);
327151
327266
  const branchExists = (() => {
327152
327267
  try {
327153
- git3(identity.worktreeRoot, ["show-ref", "--verify", `refs/heads/${options.branch}`]);
327268
+ git4(identity.worktreeRoot, ["show-ref", "--verify", `refs/heads/${options.branch}`]);
327154
327269
  return true;
327155
327270
  } catch {
327156
327271
  return false;
@@ -327165,7 +327280,7 @@ function createRepositoryWorktree(projectRoot, options) {
327165
327280
  const args2 = ["worktree", "add"];
327166
327281
  if (!branchExists) args2.push("-b", options.branch);
327167
327282
  args2.push(destination, branchExists ? options.branch : options.from ?? "HEAD");
327168
- git3(identity.worktreeRoot, args2);
327283
+ git4(identity.worktreeRoot, args2);
327169
327284
  const root = realpathSync6(destination);
327170
327285
  const project = join36(root, identity.projectRelativePath);
327171
327286
  return {
@@ -327211,12 +327326,12 @@ function archiveRepositoryWorktree(projectRoot, targetRoot, sessions2) {
327211
327326
  if (sessions2.some((session) => session.worktreeId === target.worktreeId)) {
327212
327327
  throw new Error(`Stop the live session for ${target.worktreeRoot} before archiving it.`);
327213
327328
  }
327214
- if (git3(target.worktreeRoot, ["status", "--porcelain"]) !== "") {
327329
+ if (git4(target.worktreeRoot, ["status", "--porcelain"]) !== "") {
327215
327330
  throw new Error(
327216
327331
  `Worktree ${target.worktreeRoot} is dirty; checkpoint or clean it before archiving.`
327217
327332
  );
327218
327333
  }
327219
- git3(current.worktreeRoot, ["worktree", "remove", target.worktreeRoot]);
327334
+ git4(current.worktreeRoot, ["worktree", "remove", target.worktreeRoot]);
327220
327335
  }
327221
327336
 
327222
327337
  // src/index.ts
@@ -327233,8 +327348,8 @@ function catalogDistributionDir() {
327233
327348
  );
327234
327349
  }
327235
327350
  function cliVersion() {
327236
- if ("0.5.23") {
327237
- return "0.5.23";
327351
+ if ("0.5.25") {
327352
+ return "0.5.25";
327238
327353
  }
327239
327354
  try {
327240
327355
  const pkg = JSON.parse(readFileSync31(join37(__dirname4, "..", "package.json"), "utf8"));
@@ -327253,7 +327368,7 @@ function bakedTargetVersions() {
327253
327368
  if (false)
327254
327369
  return void 0;
327255
327370
  try {
327256
- return JSON.parse('{"@vgai/engine":"0.5.23","@vgai/editor":"0.5.23","@vgai/p2p-colyseus":"0.5.23","@vgai/live":"0.5.23","@vgai/sdk":"0.5.23","@vgai/editor-sdk":"0.5.23","@vgai/cli":"0.5.23"}');
327371
+ return JSON.parse('{"@vgai/engine":"0.5.25","@vgai/editor":"0.5.25","@vgai/p2p-colyseus":"0.5.25","@vgai/live":"0.5.25","@vgai/sdk":"0.5.25","@vgai/editor-sdk":"0.5.25","@vgai/cli":"0.5.25"}');
327257
327372
  } catch {
327258
327373
  return void 0;
327259
327374
  }
@@ -328203,6 +328318,8 @@ async function instrumentationSignalLines(state) {
328203
328318
  const shape = state.playState === "playing" ? await readDebugPlaneShape(Number(new URL(resolveEditorTargetUrl()).port)) : null;
328204
328319
  lines.push(livePlaneLine(shape));
328205
328320
  }
328321
+ const remote = remoteLine(findProjectRootFrom2(process.cwd()));
328322
+ if (remote) lines.push(remote);
328206
328323
  return lines;
328207
328324
  }
328208
328325
  function playFailureReport(evidence) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vgai/cli",
3
3
  "author": "Volter AI, Inc.",
4
4
  "license": "Apache-2.0",
5
- "version": "0.5.23",
5
+ "version": "0.5.25",
6
6
  "description": "Create, open, control, validate, and playtest VGAI game projects.",
7
7
  "keywords": [
8
8
  "game-engine",
@@ -39,12 +39,12 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@oclif/core": "^4.11.14",
42
- "@vgai/editor": "0.5.23",
43
- "@vgai/editor-sdk": "0.5.23",
44
- "@vgai/engine": "0.5.23",
45
- "@vgai/live": "0.5.23",
46
- "@vgai/p2p-colyseus": "0.5.23",
47
- "@vgai/sdk": "0.5.23",
42
+ "@vgai/editor": "0.5.25",
43
+ "@vgai/editor-sdk": "0.5.25",
44
+ "@vgai/engine": "0.5.25",
45
+ "@vgai/live": "0.5.25",
46
+ "@vgai/p2p-colyseus": "0.5.25",
47
+ "@vgai/sdk": "0.5.25",
48
48
  "ink": "^7.1.0",
49
49
  "playwright": "^1.58.2",
50
50
  "react": "^19.2.4",