vibedgames 0.9.0 → 0.10.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.
Files changed (88) hide show
  1. package/README.md +3 -2
  2. package/assets/align-framing.py +242 -0
  3. package/assets/render-model.py +406 -0
  4. package/assets/tilemap-editor.html +630 -0
  5. package/dist/THIRD_PARTY_NOTICES.txt +2 -2
  6. package/dist/chunk-2KVQJKIZ.js +6495 -0
  7. package/dist/{chunk-56OY4TEP.js → chunk-2SBBKY5C.js} +1361 -4493
  8. package/dist/{chunk-FC233UKH.js → chunk-2ZKS7V72.js} +16 -16
  9. package/dist/{chunk-BMTHAVMS.js → chunk-3HGBIUM5.js} +22 -19
  10. package/dist/chunk-3UGGMFJJ.js +22 -0
  11. package/dist/{chunk-3HUWAJQH.js → chunk-42K3BJJH.js} +93 -76
  12. package/dist/{chunk-ST5FC2W3.js → chunk-43P4U7CB.js} +20 -11
  13. package/dist/chunk-4FJXCS3K.js +741 -0
  14. package/dist/{chunk-WSRIF6K4.js → chunk-4UU622RK.js} +5 -4
  15. package/dist/chunk-5YPLKGY3.js +87 -0
  16. package/dist/chunk-6KXXZXSO.js +475 -0
  17. package/dist/chunk-7RPLQWR2.js +91 -0
  18. package/dist/{chunk-ZCYWDKYP.js → chunk-A556KALN.js} +14 -13
  19. package/dist/{chunk-UFR6G6BL.js → chunk-ABTUEIRC.js} +554 -254
  20. package/dist/{chunk-PEUP4MZR.js → chunk-AWJNAGPE.js} +6 -3
  21. package/dist/{chunk-HNRVSBRK.js → chunk-BN3Q7UEC.js} +20 -17
  22. package/dist/chunk-BZOMEG3X.js +412 -0
  23. package/dist/{chunk-ZYCSYJWX.js → chunk-COSLGSVO.js} +14 -24
  24. package/dist/{chunk-KZBZNTM4.js → chunk-CTY2WZQK.js} +9 -13
  25. package/dist/chunk-DB7WVFS7.js +80 -0
  26. package/dist/chunk-DOOQUFPG.js +73 -0
  27. package/dist/{chunk-K2U7L4RU.js → chunk-E3FJUPLT.js} +15 -21
  28. package/dist/chunk-E7NDOZ27.js +428 -0
  29. package/dist/{chunk-TBQ5BU3Q.js → chunk-F42QKWBB.js} +18 -18
  30. package/dist/chunk-FXXVXDTW.js +168 -0
  31. package/dist/{chunk-VFFOT7KD.js → chunk-G66HRVDW.js} +1 -1
  32. package/dist/chunk-GLEW7VJQ.js +45 -0
  33. package/dist/{chunk-AXTLPJ2F.js → chunk-H2C4QUTG.js} +8 -7
  34. package/dist/{chunk-H3IPLBXQ.js → chunk-HRKVAXNN.js} +17 -14
  35. package/dist/{chunk-UXCWSWWX.js → chunk-HSMG6U7J.js} +8 -7
  36. package/dist/chunk-HX5Q63UA.js +48 -0
  37. package/dist/chunk-HYOXGNWS.js +53 -0
  38. package/dist/chunk-I5LELJSK.js +22 -0
  39. package/dist/{chunk-7CXMMC5S.js → chunk-JN4WZCR7.js} +5 -4
  40. package/dist/{chunk-7QZSDU52.js → chunk-K36EOII3.js} +5 -4
  41. package/dist/chunk-KAGVI3CE.js +62 -0
  42. package/dist/chunk-KJK5CB6E.js +58 -0
  43. package/dist/chunk-KLFBAFXD.js +25 -0
  44. package/dist/{chunk-355VG7EO.js → chunk-LONQWRTR.js} +107 -77
  45. package/dist/{chunk-Z5TFZQ5U.js → chunk-LORGE2NB.js} +68 -62
  46. package/dist/{chunk-LY2GQ32S.js → chunk-MEAO33XW.js} +22 -20
  47. package/dist/{chunk-OD2MNYXD.js → chunk-MR5KIFI7.js} +23 -22
  48. package/dist/{chunk-2VUUMXAQ.js → chunk-N2UHAQXC.js} +18 -11
  49. package/dist/chunk-NCX6LYNJ.js +117 -0
  50. package/dist/chunk-OGX4DKIS.js +215 -0
  51. package/dist/chunk-OPUCUUID.js +41 -0
  52. package/dist/chunk-Q2QC6KAZ.js +132 -0
  53. package/dist/{chunk-NDHXM4PL.js → chunk-Q3XQPNF6.js} +12 -12
  54. package/dist/{chunk-RXHTGX7C.js → chunk-Q5NZNXJE.js} +6 -10
  55. package/dist/chunk-QLCVLCPM.js +126 -0
  56. package/dist/chunk-R2WVORGD.js +91 -0
  57. package/dist/chunk-RKS7SI5L.js +64 -0
  58. package/dist/{chunk-US6QZICZ.js → chunk-RPJR3S5S.js} +32 -18
  59. package/dist/chunk-RPSUFZAG.js +3307 -0
  60. package/dist/chunk-RRI23NK2.js +40 -0
  61. package/dist/chunk-S7HYWITX.js +57 -0
  62. package/dist/chunk-SBXCK2I2.js +48 -0
  63. package/dist/chunk-SUSX3QIA.js +62 -0
  64. package/dist/{chunk-6EWHKL7Z.js → chunk-SXYQL4GK.js} +7 -6
  65. package/dist/{chunk-ZI6PKVXG.js → chunk-TMPBGXT4.js} +6 -5
  66. package/dist/chunk-TXOE5UY5.js +72 -0
  67. package/dist/chunk-U6DTE5IX.js +124 -0
  68. package/dist/{chunk-UZM6OSW5.js → chunk-UPHB5HWO.js} +15 -13
  69. package/dist/chunk-UQ7VO6B3.js +91 -0
  70. package/dist/chunk-VB4WLJR2.js +47 -0
  71. package/dist/{chunk-25BAMW5X.js → chunk-VIEKOGKG.js} +18 -2
  72. package/dist/{chunk-LXS3NJYD.js → chunk-VZEJ2ZHE.js} +14 -15
  73. package/dist/{chunk-Z4Z24FWO.js → chunk-YNCYMWER.js} +8 -5
  74. package/dist/chunk-ZHLPE6LI.js +71 -0
  75. package/dist/index.js +39 -36
  76. package/package.json +31 -16
  77. package/templates/none/src/main.ts +4 -0
  78. package/templates/none/vite.config.ts +0 -2
  79. package/templates/phaser/src/main.ts +0 -1
  80. package/templates/phaser/src/scenes/game-scene.ts +10 -8
  81. package/templates/phaser/vite.config.ts +0 -2
  82. package/templates/react-r3f/src/app.tsx +3 -1
  83. package/templates/react-r3f/src/main.tsx +1 -0
  84. package/templates/react-r3f/vite.config.ts +0 -2
  85. package/templates/threejs/src/main.ts +10 -1
  86. package/templates/threejs/vite.config.ts +0 -2
  87. package/LICENSE +0 -21
  88. package/dist/chunk-J6PKNPI2.js +0 -26
@@ -0,0 +1,25 @@
1
+ import { createRequire as __createRequire } from "node:module";
2
+ import { dirname as __pathDirname } from "node:path";
3
+ import { fileURLToPath as __fileURLToPath } from "node:url";
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+
8
+ // src/checks/project-playwright.ts
9
+ import { createRequire } from "node:module";
10
+ import path from "node:path";
11
+ import { pathToFileURL } from "node:url";
12
+ var hasChromium = (module) => typeof module === "object" && module !== null && "chromium" in module;
13
+ var loadProjectChromium = async () => {
14
+ try {
15
+ const resolved = createRequire(path.join(process.cwd(), "package.json")).resolve("playwright");
16
+ const module = await import(pathToFileURL(resolved).href);
17
+ return hasChromium(module) ? module.chromium : null;
18
+ } catch {
19
+ return null;
20
+ }
21
+ };
22
+
23
+ export {
24
+ loadProjectChromium
25
+ };
@@ -8,39 +8,41 @@ import {
8
8
  ensureAgentBrowser,
9
9
  projectSessionId,
10
10
  resolveGameUrl
11
- } from "./chunk-US6QZICZ.js";
12
- import "./chunk-2VUUMXAQ.js";
13
- import "./chunk-7CXMMC5S.js";
11
+ } from "./chunk-RPJR3S5S.js";
12
+ import "./chunk-N2UHAQXC.js";
13
+ import "./chunk-TMPBGXT4.js";
14
+ import {
15
+ assertKnownFlags
16
+ } from "./chunk-RZ4DIJQW.js";
17
+ import "./chunk-JN4WZCR7.js";
14
18
  import {
15
19
  authErrorCode,
16
20
  createClient
17
- } from "./chunk-KZBZNTM4.js";
18
- import "./chunk-K2U7L4RU.js";
19
- import "./chunk-Z4Z24FWO.js";
20
- import "./chunk-PEUP4MZR.js";
21
+ } from "./chunk-CTY2WZQK.js";
22
+ import "./chunk-E3FJUPLT.js";
21
23
  import {
22
24
  getBaseUrl,
23
25
  getToken
24
- } from "./chunk-RXHTGX7C.js";
25
- import "./chunk-5535KDYI.js";
26
- import "./chunk-ZI6PKVXG.js";
26
+ } from "./chunk-Q5NZNXJE.js";
27
27
  import {
28
28
  outputArgs,
29
29
  writeStructured
30
- } from "./chunk-ZYCSYJWX.js";
30
+ } from "./chunk-COSLGSVO.js";
31
31
  import {
32
- assertKnownFlags
33
- } from "./chunk-RZ4DIJQW.js";
32
+ defineCommand
33
+ } from "./chunk-MBXCVCC4.js";
34
+ import "./chunk-5535KDYI.js";
34
35
  import {
35
36
  consola
36
37
  } from "./chunk-D2RF35HJ.js";
38
+ import "./chunk-YNCYMWER.js";
39
+ import "./chunk-AWJNAGPE.js";
37
40
  import {
38
41
  isJsonObject,
39
- isJsonString
40
- } from "./chunk-J6PKNPI2.js";
41
- import {
42
- defineCommand
43
- } from "./chunk-MBXCVCC4.js";
42
+ isJsonString,
43
+ parseJson
44
+ } from "./chunk-RPSUFZAG.js";
45
+ import "./chunk-2SBBKY5C.js";
44
46
  import "./chunk-GKDUYJ7R.js";
45
47
 
46
48
  // src/lib/playtest/browser.ts
@@ -95,7 +97,7 @@ var GameBrowser = class {
95
97
  }
96
98
  let parsed;
97
99
  try {
98
- parsed = JSON.parse(text);
100
+ parsed = parseJson(text);
99
101
  } catch {
100
102
  throw new HarnessError(`\`${args[0]} --json\` did not return JSON: ${text.slice(0, 200)}`);
101
103
  }
@@ -116,12 +118,6 @@ var GameBrowser = class {
116
118
  evaluate(expression) {
117
119
  return this.payload(["eval", expression], "result");
118
120
  }
119
- /**
120
- * Navigate and wait for the diagnostics contract. Logs are cleared BEFORE
121
- * navigating so boot errors belong to this run. Waits for the CONTRACT,
122
- * not for frames: most games boot into a menu where the loop hasn't
123
- * started, so frames only advance once setState('active-play') has run.
124
- */
125
121
  boot(url, headed, whenAbsent) {
126
122
  this.run(["console", "--clear"]);
127
123
  this.run(["errors", "--clear"]);
@@ -133,12 +129,6 @@ var GameBrowser = class {
133
129
  throw new HarnessError(whenAbsent);
134
130
  }
135
131
  }
136
- /**
137
- * Two ways a game can honour a seed: a `seed()` hook that restarts the run,
138
- * or a `?seed=` boot param for games whose scene is single-start. Calling
139
- * an absent hook would leave the run unseeded while the report still
140
- * claimed the seed, so detect which one this game implements.
141
- */
142
132
  applySeed(seed, headed) {
143
133
  const probe = this.evaluate(
144
134
  "({ hasSeedHook: typeof window.__GAME_TEST_HOOKS__?.seed === 'function', href: location.href })"
@@ -363,11 +353,11 @@ var shiftedKey = (code, key) => {
363
353
  };
364
354
  var keyFields = (code) => {
365
355
  const letter = /^Key(?<letter>[A-Z])$/u.exec(code)?.groups?.letter;
366
- if (letter) {
356
+ if (letter !== void 0 && letter !== "") {
367
357
  return [letter.codePointAt(0) ?? 0, letter.toLowerCase()];
368
358
  }
369
359
  const digit = /^Digit(?<digit>[0-9])$/u.exec(code)?.groups?.digit;
370
- if (digit) {
360
+ if (digit !== void 0 && digit !== "") {
371
361
  return [48 + Number(digit), digit];
372
362
  }
373
363
  const keyCode = NAMED_KEYS.get(code);
@@ -551,7 +541,7 @@ var parseControls = (raw, source) => {
551
541
  moves[label] = readMoveOption(option, `${source} move.${label}`);
552
542
  }
553
543
  if (!Object.values(moves).some(
554
- (option) => option.keys.length > 0 || option.pointer || option.reflex
544
+ (option) => option.keys.length > 0 || option.pointer !== null || option.reflex
555
545
  )) {
556
546
  fail(`${source}: no \`move\` option holds any input, so the playtester could never move.`);
557
547
  }
@@ -593,7 +583,7 @@ var readControlsArg = (value) => {
593
583
  }
594
584
  let raw;
595
585
  try {
596
- raw = JSON.parse(text);
586
+ raw = parseJson(text);
597
587
  } catch (error) {
598
588
  fail(
599
589
  `--controls ${value} isn't valid JSON: ${error instanceof Error ? error.message : String(error)}`
@@ -627,15 +617,35 @@ var browserEnv = () => {
627
617
  return type === "pointerdown" ? "mousedown" : "mouseup";
628
618
  };
629
619
  let lastPointer = null;
620
+ const isJson = (value) => {
621
+ if (value === null || Number.isFinite(value)) {
622
+ return true;
623
+ }
624
+ if (Array.isArray(value)) {
625
+ return value.every((item) => isJson(item));
626
+ }
627
+ const tag = Object.prototype.toString.call(value);
628
+ return tag === "[object String]" || tag === "[object Boolean]" || tag === "[object Object]" && value instanceof Object && Object.values(value).every((item) => isJson(item));
629
+ };
630
+ const readJson = (text) => {
631
+ const value = JSON.parse(text);
632
+ if (!isJson(value)) {
633
+ throw new TypeError("not JSON");
634
+ }
635
+ return value;
636
+ };
630
637
  const isFunction = (value) => Object.prototype.toString.call(value) === "[object Function]";
631
638
  return {
632
- caf: (id) => window.cancelAnimationFrame(id),
633
- delay: (ms) => (
634
- // oxlint-disable-next-line promise/avoid-new -- the page has no timers/promises; wrapping setTimeout is the only way to await a delay there
635
- new Promise((resolve) => {
636
- window.setTimeout(resolve, ms);
637
- })
638
- ),
639
+ caf: (id) => {
640
+ window.cancelAnimationFrame(id);
641
+ },
642
+ delay: async (ms) => {
643
+ const { promise, resolve } = Promise.withResolvers();
644
+ window.setTimeout(() => {
645
+ resolve(ms);
646
+ }, ms);
647
+ await promise;
648
+ },
639
649
  dispatchKey: (type, init) => {
640
650
  const target = document.activeElement ?? document.body ?? window;
641
651
  target.dispatchEvent(new KeyboardEvent(type, init));
@@ -670,7 +680,7 @@ var browserEnv = () => {
670
680
  target.dispatchEvent(new PointerEvent(type, init));
671
681
  target.dispatchEvent(new MouseEvent(mouseType(type), init));
672
682
  },
673
- fetch: (url, init) => window.fetch(url, init),
683
+ fetch: async (url, init) => await window.fetch(url, init),
674
684
  live: () => window.__GAME_DIAGNOSTICS__ ?? null,
675
685
  now: () => Date.now(),
676
686
  publish: (result) => {
@@ -684,7 +694,7 @@ var browserEnv = () => {
684
694
  },
685
695
  snapshot: () => {
686
696
  try {
687
- return JSON.parse(JSON.stringify(window.__GAME_DIAGNOSTICS__ ?? null));
697
+ return readJson(JSON.stringify(window.__GAME_DIAGNOSTICS__ ?? null));
688
698
  } catch {
689
699
  return null;
690
700
  }
@@ -693,6 +703,24 @@ var browserEnv = () => {
693
703
  };
694
704
  var inPageAgent = (config, env) => {
695
705
  const isObject = (value) => Object(value) === value && !Array.isArray(value);
706
+ const isText = (value) => Object.prototype.toString.call(value) === "[object String]";
707
+ const isJson = (value) => {
708
+ if (value === null || Number.isFinite(value)) {
709
+ return true;
710
+ }
711
+ if (Array.isArray(value)) {
712
+ return value.every((item) => isJson(item));
713
+ }
714
+ const tag = Object.prototype.toString.call(value);
715
+ return tag === "[object String]" || tag === "[object Boolean]" || tag === "[object Object]" && value instanceof Object && Object.values(value).every((item) => isJson(item));
716
+ };
717
+ const readJson = (text) => {
718
+ const value = JSON.parse(text);
719
+ if (!isJson(value)) {
720
+ throw new TypeError("not JSON");
721
+ }
722
+ return value;
723
+ };
696
724
  const round2 = (value) => Number(value.toFixed(2));
697
725
  const started = env.now();
698
726
  const usage = {
@@ -847,7 +875,7 @@ var inPageAgent = (config, env) => {
847
875
  const parseDecision = (text, offered) => {
848
876
  let body;
849
877
  try {
850
- body = JSON.parse(text);
878
+ body = readJson(text);
851
879
  } catch {
852
880
  throw new Error(`decision response was not JSON: ${text.slice(0, 200)}`);
853
881
  }
@@ -856,7 +884,7 @@ var inPageAgent = (config, env) => {
856
884
  throw new Error(`decision response had no answers: ${text.slice(0, 200)}`);
857
885
  }
858
886
  const move2 = answerFor(answers, "move");
859
- const choice = String(move2.choice ?? "");
887
+ const choice = isText(move2.choice) ? move2.choice : "";
860
888
  if (!Object.hasOwn(offered, choice)) {
861
889
  throw new Error(`decision model answered \`move\` outside the offered options: ${choice}`);
862
890
  }
@@ -905,7 +933,7 @@ var inPageAgent = (config, env) => {
905
933
  }
906
934
  const offered = offeredMoves(state.tick.index);
907
935
  const body = JSON.stringify({ model: config.model, questions: questions(offered), state });
908
- for (let attempt = 0; ; attempt += 1) {
936
+ const ask = async (attempt) => {
909
937
  let response = null;
910
938
  let failure = "";
911
939
  try {
@@ -923,7 +951,7 @@ var inPageAgent = (config, env) => {
923
951
  } catch (error) {
924
952
  failure = error instanceof Error ? error.message : String(error);
925
953
  }
926
- if (response?.ok) {
954
+ if (response?.ok === true) {
927
955
  const text = await response.text();
928
956
  return parseDecision(text, offered);
929
957
  }
@@ -936,14 +964,15 @@ var inPageAgent = (config, env) => {
936
964
  throw new Error(`decision failed after ${attempt + 1} attempts: ${reason}`);
937
965
  }
938
966
  await env.delay(500 * 2 ** attempt);
939
- }
967
+ return await ask(attempt + 1);
968
+ };
969
+ return await ask(0);
940
970
  };
941
971
  const pointerFrom = (input) => {
942
972
  if (!input) {
943
973
  return null;
944
974
  }
945
- const x = Number(input.x);
946
- const y = Number(input.y);
975
+ const { x, y } = input;
947
976
  if (!Number.isFinite(x) || !Number.isFinite(y)) {
948
977
  return null;
949
978
  }
@@ -1080,17 +1109,16 @@ var inPageAgent = (config, env) => {
1080
1109
  };
1081
1110
  const run = async () => {
1082
1111
  rafId = env.raf(frame);
1083
- let game = env.snapshot();
1084
- for (let tick = 0; tick < config.ticks; tick += 1) {
1085
- if (stopped) {
1086
- break;
1112
+ const play = async (tick, game) => {
1113
+ if (tick >= config.ticks || stopped) {
1114
+ return;
1087
1115
  }
1088
1116
  const t0 = env.now();
1089
1117
  const decision = await decide(stateFor(game, tick));
1090
1118
  const decisionMs = env.now() - t0;
1091
1119
  record(decision, decisionMs);
1092
1120
  if (stopped) {
1093
- break;
1121
+ return;
1094
1122
  }
1095
1123
  if (pending) {
1096
1124
  const remaining = config.tickMs - (env.now() - pending.appliedAt);
@@ -1116,13 +1144,14 @@ var inPageAgent = (config, env) => {
1116
1144
  reflexStuck: false,
1117
1145
  tick
1118
1146
  };
1119
- game = env.snapshot();
1120
1147
  if (measured.complete) {
1121
1148
  result.completedAtTick = Math.max(0, tick - 1);
1122
1149
  pending = null;
1123
- break;
1150
+ return;
1124
1151
  }
1125
- }
1152
+ await play(tick + 1, env.snapshot());
1153
+ };
1154
+ await play(0, env.snapshot());
1126
1155
  if (pending && !stopped) {
1127
1156
  await env.delay(Math.max(config.tickMs, config.finalHoldMs));
1128
1157
  const measured = flush();
@@ -1358,13 +1387,13 @@ var resultFromAgent = (published, epsilon = THRESHOLDS.displacement * THRESHOLDS
1358
1387
  var runInPage = async (browser, opts, session) => {
1359
1388
  browser.inject(agentSource(agentConfig(opts, session)));
1360
1389
  const deadline = Date.now() + budgetMs(opts);
1361
- for (; ; ) {
1390
+ const waitForAgent = async () => {
1362
1391
  const status = browser.agentStatus();
1363
1392
  if (!status) {
1364
1393
  throw new HarnessError("the page lost the agent; it probably navigated mid-run.");
1365
1394
  }
1366
1395
  if (status.done) {
1367
- break;
1396
+ return;
1368
1397
  }
1369
1398
  if (Date.now() > deadline) {
1370
1399
  browser.stopAgent();
@@ -1373,11 +1402,16 @@ var runInPage = async (browser, opts, session) => {
1373
1402
  );
1374
1403
  }
1375
1404
  await delay(POLL_MS);
1376
- }
1405
+ await waitForAgent();
1406
+ };
1407
+ await waitForAgent();
1377
1408
  return resultFromAgent(browser.agentResult(), motionEpsilon(opts.controls));
1378
1409
  };
1379
1410
  var summarizeProgress = (timeline) => {
1380
- const scored = timeline.map((entry) => entry.progress).filter((p) => p !== null);
1411
+ const scored = timeline.flatMap((entry) => {
1412
+ const p = entry.progress;
1413
+ return p === null ? [] : [p];
1414
+ });
1381
1415
  const [first] = scored;
1382
1416
  const last = scored.at(-1);
1383
1417
  if (first === void 0 || last === void 0) {
@@ -1434,12 +1468,9 @@ var buildReport = (opts, input) => {
1434
1468
  distanceTravelled: round(run.metrics.distance),
1435
1469
  framesAdvanced: (last ? last.frame : before.frame) - before.frame,
1436
1470
  goal: opts.controls.goal,
1437
- // Which GPU rasterized the run. Under software rendering the functional
1438
- // checks still hold; any frame-rate read from the run does not.
1439
1471
  gpu: input.gpu,
1440
1472
  longestStuckRun: run.metrics.longestStuckRun,
1441
1473
  maxTickDisplacement: round(run.metrics.maxTickDisplacement),
1442
- // The gate `maxTickDisplacement` was held to, so the number reads in context.
1443
1474
  minDisplacement: displacementGate(opts.controls),
1444
1475
  model: {
1445
1476
  calls: run.usage.calls,
@@ -1453,8 +1484,6 @@ var buildReport = (opts, input) => {
1453
1484
  scoreAfter: last ? last.score : before.score,
1454
1485
  scoreBefore: before.score,
1455
1486
  seed: input.seed,
1456
- // How the seed actually landed, so a reader can tell a real seeded run
1457
- // from one where the hook quietly did nothing.
1458
1487
  seedApplied: input.seedApplied,
1459
1488
  stuckTicks: run.metrics.stuckTicks,
1460
1489
  target: input.target,
@@ -1585,13 +1614,17 @@ var numberArg = (raw, flag, check, hint) => {
1585
1614
  }
1586
1615
  return value;
1587
1616
  };
1588
- var settingsFrom = (args) => {
1589
- if (!args.url && !args.game) {
1617
+ var isFilled = (value) => value !== void 0 && value !== "";
1618
+ var assertOneTarget = (args) => {
1619
+ if (!isFilled(args.url) && !isFilled(args.game)) {
1590
1620
  throw new HarnessError("Pass --url <url> or --game <slug>.");
1591
1621
  }
1592
- if (args.url && args.game) {
1622
+ if (isFilled(args.url) && isFilled(args.game)) {
1593
1623
  throw new HarnessError("Pass either --url or --game, not both.");
1594
1624
  }
1625
+ };
1626
+ var settingsFrom = (args) => {
1627
+ assertOneTarget(args);
1595
1628
  if (args.goal !== void 0 && args.goal.trim() === "") {
1596
1629
  throw new HarnessError("`--goal` must not be empty.");
1597
1630
  }
@@ -1613,7 +1646,7 @@ var settingsFrom = (args) => {
1613
1646
  model: args.model,
1614
1647
  pinMove: args.pinMove ?? null,
1615
1648
  seed: numberArg(args.seed, "--seed", Number.isFinite, "a finite number"),
1616
- target: args.game ? `game:${args.game}` : args.url ?? "",
1649
+ target: isFilled(args.game) ? `game:${args.game ?? ""}` : args.url ?? "",
1617
1650
  tickMs: numberArg(
1618
1651
  args.tickMs,
1619
1652
  "--tick-ms",
@@ -1630,10 +1663,7 @@ var settingsFrom = (args) => {
1630
1663
  };
1631
1664
  };
1632
1665
  var chooseControls = (settings, manifest) => {
1633
- let controls = settings.explicitControls;
1634
- if (!controls) {
1635
- controls = manifest === null ? PRESETS.get(DEFAULT_PRESET) : parseControls(manifest, "window.__GAME_PLAYTEST__");
1636
- }
1666
+ const controls = settings.explicitControls ?? (manifest === null ? PRESETS.get(DEFAULT_PRESET) : parseControls(manifest, "window.__GAME_PLAYTEST__"));
1637
1667
  if (!controls) {
1638
1668
  throw new HarnessError("no control scheme available.");
1639
1669
  }
@@ -1708,7 +1738,7 @@ var playtestRunCommand = defineCommand({
1708
1738
  consola.error(error instanceof Error ? error.message : String(error));
1709
1739
  process.exit(HARNESS_FAILURE);
1710
1740
  }
1711
- if (!getToken()) {
1741
+ if ((getToken() ?? "") === "") {
1712
1742
  consola.warn("Not logged in. Run `vg login` to authenticate.");
1713
1743
  process.exit(1);
1714
1744
  }