ravensight-playtest 0.18.0 → 0.19.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 (85) hide show
  1. package/README.md +160 -16
  2. package/addons/desktop/RavensightDesktop.swift +367 -0
  3. package/addons/mobile/UITests/MobileInputTests.swift +67 -1
  4. package/addons/ravensight_driver/driver.gd +557 -4
  5. package/docs/ADAPTERS.md +37 -7
  6. package/docs/DESKTOP.md +117 -0
  7. package/docs/MOBILE.md +30 -3
  8. package/docs/UNITY.md +149 -0
  9. package/docs/UNREAL.md +123 -0
  10. package/docs/godot-driver.md +98 -1
  11. package/package.json +15 -5
  12. package/src/cli.js +26 -10
  13. package/src/commands/build.js +40 -0
  14. package/src/commands/feature.js +1 -1
  15. package/src/commands/hosted.js +78 -9
  16. package/src/commands/run.js +47 -13
  17. package/src/commands/validate.js +1 -1
  18. package/src/hosted/archivePreflight.js +31 -4
  19. package/src/hosted/buildStatus.js +26 -0
  20. package/src/hosted/buildUpload.js +24 -9
  21. package/src/hosted/nativeBuild.js +87 -0
  22. package/src/hosted/recordedRun.js +15 -3
  23. package/src/run/anygame/genre.js +98 -24
  24. package/src/run/anygame/genre2d.js +108 -0
  25. package/src/run/anygame/index.js +7 -4
  26. package/src/run/anygame/scene3d.js +562 -0
  27. package/src/run/anygame/shared-hashes.json +4 -2
  28. package/src/run/anygame/shared.js +3 -3
  29. package/src/run/args.js +15 -4
  30. package/src/run/drivers/desktop/app.js +104 -0
  31. package/src/run/drivers/desktop/common.js +336 -0
  32. package/src/run/drivers/desktop/driver.js +383 -0
  33. package/src/run/drivers/desktop/helper.js +98 -0
  34. package/src/run/drivers/desktop/keys.js +124 -0
  35. package/src/run/drivers/desktop/output.js +107 -0
  36. package/src/run/drivers/desktop/preflight.js +134 -0
  37. package/src/run/drivers/desktop3d.js +106 -0
  38. package/src/run/drivers/desktopSequence.js +72 -0
  39. package/src/run/drivers/godot-3d.js +298 -0
  40. package/src/run/drivers/godot.js +465 -30
  41. package/src/run/drivers/index.js +6 -0
  42. package/src/run/drivers/mobile/adb.js +25 -1
  43. package/src/run/drivers/mobile/frame.js +3 -2
  44. package/src/run/drivers/mobile/gestures.js +76 -0
  45. package/src/run/drivers/mobile/lock.js +51 -11
  46. package/src/run/drivers/mobile/multitouch.js +150 -0
  47. package/src/run/drivers/mobile/native.js +229 -31
  48. package/src/run/drivers/mobile/preflight.js +14 -1
  49. package/src/run/drivers/mobile/target.js +21 -1
  50. package/src/run/drivers/stdio.js +150 -12
  51. package/src/run/drivers/unity/app.js +72 -0
  52. package/src/run/drivers/unity/engine.js +58 -0
  53. package/src/run/drivers/unity/link.js +108 -0
  54. package/src/run/drivers/unity/logs.js +76 -0
  55. package/src/run/drivers/unreal/app.js +40 -0
  56. package/src/run/drivers/unreal/driver.js +686 -0
  57. package/src/run/drivers/unreal/frames.js +243 -0
  58. package/src/run/drivers/unreal/logs.js +276 -0
  59. package/src/run/drivers/unreal/preflight.js +61 -0
  60. package/src/run/drivers/web.js +211 -13
  61. package/src/run/drivers/webdriver.js +79 -12
  62. package/src/run/endScreen.js +88 -0
  63. package/src/run/engineErrors.js +16 -0
  64. package/src/run/featureLoop.js +1 -1
  65. package/src/run/fingers.js +99 -0
  66. package/src/run/focusForKeys.js +54 -0
  67. package/src/run/godotTesterProbes.js +21 -2
  68. package/src/run/honesty.js +11 -1
  69. package/src/run/inputs.js +3 -3
  70. package/src/run/intent.js +12 -0
  71. package/src/run/pauseHook.js +494 -0
  72. package/src/run/personaLoop.js +139 -10
  73. package/src/run/pixels.js +22 -10
  74. package/src/run/planGuard.js +103 -0
  75. package/src/run/replay.js +5 -1
  76. package/src/run/reportChecks.js +17 -4
  77. package/src/run/resume.js +6 -2
  78. package/src/run/sessions.js +170 -0
  79. package/src/run/startFrom.js +415 -0
  80. package/src/run/testerProbes.js +36 -5
  81. package/src/run/tools.js +191 -10
  82. package/src/run/view3dState.js +125 -0
  83. package/src/run/web3d.js +375 -0
  84. package/src/run/world3d.js +164 -0
  85. package/templates/godot-3d/README.md +3 -2
@@ -175,9 +175,12 @@ plus the two optional extras spec 03 lists, `consoleErrors()` and
175
175
  | `click` with a string target | `click{node_path}` (the center of a Control's global rect, or where the active camera draws a Node3D; a Node3D behind the camera is not clickable) |
176
176
  | `click` with coordinates | `click{x,y}` |
177
177
  | `press_action` | `press_action{action, duration_ms}` |
178
+ | `look` (the `hover` tool with `dx`, `dy` or `aim_at`) | `mouse{kind: "look", dx, dy}`, one small move a tick over the look's time, with `with_keys` held from the first move to the last (addon 1.9.0) |
179
+ | `gamepad` | `joypad{buttons, axes}` for the hold, then every button let go and both sticks centred (addon 1.9.0) |
178
180
  | `wait` | the milliseconds on the clock, at most 10 s |
179
181
  | `set_time_scale` | `set_time_scale` |
180
182
  | `quit` | `quit` |
183
+ | a new session (`relaunch()`) | `quit{close_request: true}`, then a new process on the same `user://` |
181
184
 
182
185
  `changed` compares the hash of the scene tree outline before and after the
183
186
  action. Two details make that answer honest:
@@ -252,6 +255,73 @@ and a replay repeats them with a note. Every step answer and `ping` carry
252
255
  call it `desktop_pointer_events`. The mouse speed Godot reports is measured on
253
256
  the wall clock, so it is never exact in lockstep even with no desktop input.
254
257
 
258
+ ## 3D play (addon 1.9.0)
259
+
260
+ A persona can now play the usual kinds of 3D game on this machine, in lockstep
261
+ and with `--realtime`. Each of these was played on a real Godot 4.8 window, with
262
+ a scripted model and no charge, on the fixture at `test/fixtures/godot-3d/`
263
+ (`src/run/drivers/godot-3d.real.test.js`):
264
+
265
+ | Kind of game | How the persona plays it |
266
+ | --- | --- |
267
+ | First person mouse look | `hover` with `dx` and `dy` moves the mouse by that much. The game hears an `InputEventMouseMotion` whose `relative` (and `screen_relative`) is the move, which is what a mouse look reads, so it works when the game has captured and hidden the pointer. `with_keys` walks while the view turns. |
268
+ | Third person orbit camera | `drag` with the right (or middle) button orbits a camera that turns while a button is held; `scroll` moves it in and out; a captured orbit camera turns with `hover` `dx` and `dy`. |
269
+ | 3D platforming with depth | Held keys and `key` with a timed `sequence`: run, then jump at the moment it is due. |
270
+ | Driving | Held keys and chords (`w` with `a`), or the gamepad. |
271
+ | Flight | `hover` `dx` and `dy` steer a plane that reads the mouse; held keys change the throttle. |
272
+ | Aiming at a moving target | `hover` with `aim_at` naming a 3D node: the runner moves the mouse a little, reads from the game how far the view turned, and moves again until the view faces the node, following it when it moves. Nothing about the game's mouse speed is assumed. Then `click` the middle of the screen to fire. |
273
+ | An RTS camera | Held keys pan and turn, a middle button `drag` turns, `scroll` zooms (the mouse wheel). |
274
+ | Moving and turning objects | The 3D view lists what is on screen with the place it is drawn, so `drag` from there carries an object; a `sequence` can hold the mouse button while it presses a key that turns what is held. |
275
+ | Interaction prompts | The 3D view says what the middle of the screen points at and how far away; a prompt drawn in the world (`Label3D`) is in the outline as text, like a HUD label. |
276
+ | HUD and menus over 3D | Controls are read and pressed as in 2D; a 3D node (a sign, a unit) is clicked by its name where the camera draws it, which reaches the game's own physics picking. |
277
+ | A gamepad only game | `gamepad` presses buttons and pushes both sticks by any amount (an analog stick, so half a push walks half as fast). It is offered when the game reads a gamepad: an input action bound to a joypad in `project.godot`, or a script that calls `get_joy_axis` or `is_joy_button_pressed`. |
278
+
279
+ **The 3D view.** `view3d{target}` answers what the game's own state says, read
280
+ without moving anything, so a lockstep digest is the same after it: the
281
+ camera's place and where it faces (degrees round and up), whether it sits inside
282
+ a solid body, what stands between it and the player, what the middle of the
283
+ screen points at and how far, the mouse mode, whether the game is paused, the
284
+ moving bodies (`CharacterBody3D`, `VehicleBody3D`, `RigidBody3D`) with velocity,
285
+ speed and `is_on_floor`, what is on screen with the place it is drawn, and how
286
+ far the level's solid ground reaches. The player is a body in the group
287
+ `player`, else the body the camera rides on, else the first character body or
288
+ vehicle. Every observation of a 3D scene carries these lines and a picture.
289
+
290
+ **What the runner finds from it, with no model call.** After every input the
291
+ runner reads the view and files, as its own findings with the input and the
292
+ numbers the game reported:
293
+
294
+ - a body far below the lowest solid ground and not on a floor: it fell out of the world;
295
+ - movement held twice running while the player moved under 15 cm against a wall, with the game not paused: stuck on the level's geometry;
296
+ - the camera inside a solid body: the camera went inside it;
297
+ - the camera's up direction pointing down: the view turned upside down;
298
+ - six movement inputs in a row, each with the player moving while it was held, all ending within 2.5 m of one place: no progress.
299
+
300
+ An input the game did not answer (a key in a game that only reads a gamepad)
301
+ breaks a run of tries, so it is never read as stuck or as no progress.
302
+
303
+ **A small frame of a 3D scene can look the same after the view moved** (a plain
304
+ floor, a camera that follows the player). When the frames under a picture look
305
+ alike but the game's numbers say the camera, the view or the player moved, the
306
+ result says so, and the input counts as one that changed the screen.
307
+
308
+ **The first input comes after one tick.** A lockstep game is parked before its
309
+ first physics tick, so the physics world had never been stepped when the first
310
+ input landed, and a ray the game cast on it missed bodies that were there. The
311
+ first input of a run now comes after one tick of the game, recorded in the
312
+ trace as a step of its own, so a replay plays it too.
313
+
314
+ **What is not reached.** A game that reads the pointer itself with a viewport's
315
+ `get_mouse_position` (edge scrolling at the side of the screen, say) reads the
316
+ desktop's pointer, which the runner never moves (see the pointer section above);
317
+ pan it with keys or a drag. A game that captures the mouse moves the desktop's
318
+ pointer to the middle of its window once when it captures it (measured on
319
+ macOS); the window never takes focus, so the pointer is not held there. The
320
+ virtual gamepad is device 0 and is heard through input events, so
321
+ `Input.get_connected_joypads()` does not list it; a game that waits for a pad to
322
+ be listed before it reads one is not reached. `--headless` routes no mouse input,
323
+ so a look is refused there.
324
+
255
325
  ## Dropdowns, sliders and tabs
256
326
 
257
327
  `select{node_path, option | index | value}` (addon 1.5.0) chooses an option of
@@ -338,6 +408,32 @@ up and that the files are still there. The second start is only made on a
338
408
  lockstep run, which has a save folder of its own. `--no-edge-pass` turns the
339
409
  checks off.
340
410
 
411
+ ## Starting from a save, and starting again (addon 1.8.0)
412
+
413
+ A run given `--save` gets a `user://` of its own (`config/use_custom_user_dir`
414
+ in the temp copy's `project.godot`, a name under `ravensight-lockstep/`), and
415
+ the saves are written into it before the game's first line runs. The driver
416
+ then holds the folder `ping` reports to the one it wrote; a game that reads
417
+ `user://` somewhere else that is still the run's own gets the saves there and
418
+ is started once more. The developer's own `user://` is never written, and the
419
+ folder is removed at stop.
420
+
421
+ `playtest_start{spec, saves}` calls the game's own
422
+ `_ravensight_playtest_start(spec)` on the first node in the group
423
+ `ravensight_playtest_start` that has it, or else the first autoload that has
424
+ it, once, and answers `{handled, loaded, where}`, or `{handled: false, reason}`
425
+ when the game has no such method. The game also has the spec from its first
426
+ line as `RAVENSIGHT_PLAYTEST_START`. In lockstep the call is made before the
427
+ trace's boot state is read, so a replay that starts the same way boots to the
428
+ same hash.
429
+
430
+ `quit{code, close_request: true}` closes the game the way a player closes its
431
+ window: `NOTIFICATION_WM_CLOSE_REQUEST` goes to every node (the clock runs for
432
+ it, even in lockstep), the game gets ten frames to write its save, and the
433
+ engine quits. `relaunch()` uses it between the sessions of a `--sessions` run
434
+ and starts the game again on the same project copy and the same `user://`;
435
+ the trace ends at the first relaunch, because a replay starts the game once.
436
+
341
437
  ## The game is paused between actions
342
438
 
343
439
  A model takes seconds to decide, and a game with a clock keeps running while it
@@ -551,7 +647,8 @@ deterministic mode the CLI uses for every persona run unless `--realtime` is set
551
647
 
552
648
  - `seed{value}` reseeds the global generator and answers `{ seed, lockstep, tick, ticks_per_second }`.
553
649
  - `step{events, ticks, digest}` applies `events` (`{type: "key", keycode, pressed, unicode}`,
554
- `{type: "action", action, pressed}`, `{type: "click", x, y | node_path, button, double}`),
650
+ `{type: "action", action, pressed}`, `{type: "click", x, y | node_path, button, double}`,
651
+ `{type: "mouse", kind: "look", dx, dy}` and `{type: "joypad", buttons, axes}` from 1.9.0),
555
652
  runs exactly `ticks` ticks (1 to 3600), and answers `{ tick, frame, digest }`. Every event is
556
653
  checked first, so a refused step changes nothing. Outside lockstep it answers `-32030`.
557
654
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ravensight-playtest",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Local AI playtests and seeded game simulations with reports in Ravensight.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://ravensight.io/docs/playtest/",
@@ -42,19 +42,29 @@
42
42
  "!src/run/__helpers__",
43
43
  "!src/run/__fixtures__",
44
44
  "!src/run/__fixtures__",
45
- "docs/MOBILE.md"
45
+ "!src/run/drivers/unity/__fixtures__",
46
+ "docs/MOBILE.md",
47
+ "docs/UNREAL.md",
48
+ "docs/UNITY.md",
49
+ "docs/DESKTOP.md"
46
50
  ],
47
51
  "exports": {
48
52
  ".": "./src/api/index.js",
49
53
  "./api": "./src/api/index.js"
50
54
  },
51
55
  "scripts": {
52
- "test": "node --test --test-reporter=spec 'src/**/!(godot-real|godot-draw.real|godot-inputs.real|godot-menus.real|godot-replay.real|godot-tester.real|web.e2e|web.containment.e2e|web.inputs.e2e|web.honesty.e2e|web.followups.e2e|web.replay.e2e|web.anygame.e2e|web.languages.e2e|web.events.e2e|web.tester.e2e|web.livesite.e2e|web.network.e2e|web.moving.e2e|web.urlrun.e2e|scaffold.godot|template3d.godot).test.js'",
53
- "test:godot": "node scripts/gated-test.mjs RAVENSIGHT_RECORDING_E2E some -- --test --test-concurrency=1 --test-reporter=spec src/run/drivers/godot-real.test.js src/run/drivers/godot-draw.real.test.js src/run/drivers/godot-inputs.real.test.js src/run/drivers/godot-menus.real.test.js src/run/drivers/godot-replay.real.test.js src/run/drivers/godot-tester.real.test.js src/create/scaffold.godot.test.js src/create/template3d.godot.test.js",
54
- "test:e2e": "node scripts/gated-test.mjs RAVENSIGHT_E2E all -- --test --test-reporter=spec src/run/drivers/web.e2e.test.js src/run/drivers/web.containment.e2e.test.js src/run/drivers/web.inputs.e2e.test.js src/run/drivers/web.honesty.e2e.test.js src/run/drivers/web.followups.e2e.test.js src/run/drivers/web.tester.e2e.test.js src/run/drivers/web.replay.e2e.test.js src/run/drivers/web.anygame.e2e.test.js src/run/drivers/web.languages.e2e.test.js src/run/drivers/web.events.e2e.test.js src/run/drivers/web.livesite.e2e.test.js src/run/drivers/web.network.e2e.test.js src/run/drivers/web.moving.e2e.test.js src/commands/run.urlrun.e2e.test.js",
56
+ "test": "node --test --test-reporter=spec 'src/**/!(godot-real|godot-draw.real|godot-inputs.real|godot-menus.real|godot-replay.real|godot-tester.real|godot-start.real|godot-3d.real|godot-2d.real|godot-touch.real|web.e2e|web.containment.e2e|web.inputs.e2e|web.honesty.e2e|web.followups.e2e|web.replay.e2e|web.anygame.e2e|web.languages.e2e|web.events.e2e|web.tester.e2e|web.livesite.e2e|web.network.e2e|web.moving.e2e|web.genre2d.e2e|web.world3d.e2e|web.engine3d.e2e|web.urlrun.e2e|scaffold.godot|template3d.godot|run.unreal.real|run.unity.real|run.desktop.real|web.engines.e2e).test.js'",
57
+ "test:godot": "node scripts/gated-test.mjs RAVENSIGHT_RECORDING_E2E some -- --test --test-concurrency=1 --test-reporter=spec src/run/drivers/godot-real.test.js src/run/drivers/godot-draw.real.test.js src/run/drivers/godot-inputs.real.test.js src/run/drivers/godot-menus.real.test.js src/run/drivers/godot-replay.real.test.js src/run/drivers/godot-tester.real.test.js src/run/drivers/godot-start.real.test.js src/run/drivers/godot-3d.real.test.js src/run/drivers/godot-2d.real.test.js src/run/drivers/godot-touch.real.test.js src/create/scaffold.godot.test.js src/create/template3d.godot.test.js",
58
+ "test:e2e": "node scripts/gated-test.mjs RAVENSIGHT_E2E all -- --test --test-reporter=spec src/run/drivers/web.e2e.test.js src/run/drivers/web.containment.e2e.test.js src/run/drivers/web.inputs.e2e.test.js src/run/drivers/web.honesty.e2e.test.js src/run/drivers/web.followups.e2e.test.js src/run/drivers/web.tester.e2e.test.js src/run/drivers/web.replay.e2e.test.js src/run/drivers/web.anygame.e2e.test.js src/run/drivers/web.languages.e2e.test.js src/run/drivers/web.events.e2e.test.js src/run/drivers/web.livesite.e2e.test.js src/run/drivers/web.network.e2e.test.js src/run/drivers/web.moving.e2e.test.js src/run/drivers/web.genre2d.e2e.test.js src/run/drivers/web.world3d.e2e.test.js src/run/drivers/web.engine3d.e2e.test.js src/commands/run.urlrun.e2e.test.js src/run/drivers/web.engines.e2e.test.js",
55
59
  "lint": "node scripts/no-dashes.mjs",
56
60
  "audit:honesty": "node --test --test-reporter=spec src/run/honestyCorpus.test.js",
57
61
  "test:android": "node scripts/gated-test.mjs RAVENSIGHT_ANDROID_E2E all -- --test --test-timeout=240000 --test-concurrency=1 src/run/drivers/mobile/native-real.test.js",
62
+ "test:mobile:concepts": "node scripts/gated-test.mjs RAVENSIGHT_MOBILE_CONCEPTS all -- --test --test-timeout=900000 --test-concurrency=1 --test-reporter=spec src/run/drivers/mobile/concepts-real.test.js",
63
+ "test:android:touch": "node scripts/gated-test.mjs RAVENSIGHT_ANDROID_REAL some -- --test --test-timeout=600000 --test-concurrency=1 --test-reporter=spec src/run/drivers/mobile/twofinger-real.test.js",
64
+ "test:ios:touch": "node scripts/gated-test.mjs RAVENSIGHT_IOS_REAL some -- --test --test-timeout=600000 --test-concurrency=1 --test-reporter=spec src/run/drivers/mobile/twofinger-real.test.js",
65
+ "test:unreal": "node scripts/gated-test.mjs RAVENSIGHT_UNREAL_E2E all -- --test --test-timeout=600000 --test-concurrency=1 src/commands/run.unreal.real.test.js",
66
+ "test:unity": "node scripts/gated-test.mjs RAVENSIGHT_UNITY_E2E all -- --test --test-timeout=900000 --test-concurrency=1 src/commands/run.unity.real.test.js",
67
+ "test:desktop": "node scripts/gated-test.mjs RAVENSIGHT_DESKTOP_E2E all -- --test --test-timeout=900000 --test-concurrency=1 src/commands/run.desktop.real.test.js",
58
68
  "test:ios": "node scripts/gated-test.mjs RAVENSIGHT_IOS_E2E all -- --test --test-timeout=240000 --test-concurrency=1 src/run/drivers/mobile/native-real.test.js",
59
69
  "hooks:install": "git config core.hooksPath .githooks",
60
70
  "prepare": "node -e \"try{require('child_process').execFileSync('git',['config','core.hooksPath','.githooks'],{stdio:'ignore'})}catch(e){}\""
package/src/cli.js CHANGED
@@ -53,10 +53,15 @@ async function loadRunner(name, exportName) {
53
53
  export const RUNNER_HELP = `
54
54
  Run options (parsed by the runner, see src/run/args.js):
55
55
  --personas <list> comma separated persona slugs, default one (fresh-eyes); "personas" lists them
56
- --driver <name> playwright_web, godot_driver, cli_stdio, android_driver or ios_driver.
57
- android_driver and ios_driver play a local Android emulator or iOS Simulator
58
- build given with --native-build and --device (see docs/MOBILE.md). desktop_driver,
59
- unity_driver and unreal_driver remain experimental and need --driver-config
56
+ --driver <name> playwright_web, godot_driver, cli_stdio, android_driver, ios_driver,
57
+ unreal_driver, unity_driver or desktop_driver. android_driver and ios_driver play
58
+ a local Android emulator or iOS Simulator build given with --native-build and
59
+ --device (see docs/MOBILE.md). unreal_driver plays a packaged Unreal Mac app and
60
+ unity_driver a Unity Mac player given with --native-build, in a window on this Mac
61
+ (see docs/UNREAL.md and docs/UNITY.md). desktop_driver plays any other desktop
62
+ game given with --native-build (a Mac app, an executable, or a LÖVE folder or
63
+ .love file) in a window on this Mac (see docs/DESKTOP.md); with --driver-config
64
+ desktop_driver remains the experimental automation server route
60
65
  --no-record-video do not keep a video. A playwright_web or godot_driver run records one on this
61
66
  machine by default (session.webm or session.mp4 in the run folder; Godot needs
62
67
  ffmpeg); nothing is uploaded unless --upload-video is passed
@@ -99,7 +104,9 @@ Run options (parsed by the runner, see src/run/args.js):
99
104
  .html page, with wasm, Brotli and gzip engine files and threaded builds served right
100
105
  --build-entry <file> the page to open inside --build-dir, when it has more than one .html file
101
106
  --godot-project <dir> the Godot project directory
102
- --native-build <path> Android APK or iOS simulator APP; uses the local native driver
107
+ --native-build <path> Android APK, iOS simulator APP, packaged Unreal Mac app, Unity Mac player, or any
108
+ desktop game (Mac app, executable, LÖVE folder or .love file); uses the local
109
+ native driver
103
110
  --device <id> exact emulator serial/AVD or simulator UDID/name
104
111
  --package <id> Android package override, checked against the APK
105
112
  --bundle-id <id> iOS bundle override, checked against the APP
@@ -258,6 +265,7 @@ export function buildProgram() {
258
265
  common(hosted.command('run [quote-file]'))
259
266
  .description('quote the newest ready build (or --build), confirm the price, and start a cloud playtest: fresh-eyes plus any --personas, each on its own machine at once; with a saved quote file, confirm that quote instead. Never retries an unknown outcome')
260
267
  .option('--build <id>', 'a build that passed its static archive check (default: the newest one)')
268
+ .option('--native-build <path>', 'upload this Android APK and playtest it on an Android device in the cloud, with the device\'s network off; a signed APK with a launcher activity, not an .aab; not with --build, --start, --save, --focus or --avoid; not yet available for most studios')
261
269
  .option('--personas <list>', 'more personas to add, comma separated; fresh-eyes is always included and each persona adds its own price')
262
270
  .addOption(new Option('--persona <slug>').hideHelp())
263
271
  .addOption(new Option('--tier <name>', 'cloud tier: jam, small, medium or large (default: the one your build size needs; a smaller one is refused before any charge)').choices(['jam', 'small', 'medium', 'large']))
@@ -280,12 +288,12 @@ export function buildProgram() {
280
288
  const { hostedRun, hostedRunDirect, HOSTED_URL_REFUSAL } = await import('./commands/hosted.js');
281
289
  if (options.url !== undefined || options.buildUrl !== undefined) throw new CliError(HOSTED_URL_REFUSAL, ExitCode.ENVIRONMENT);
282
290
  if (filename) {
283
- const extra = ['build', 'persona', 'personas', 'tier', 'minutes', 'start', 'save', 'saveTarget', 'game', 'video'].filter(name => options[name] !== undefined).concat(['focus', 'avoid'].filter(name => options[name]?.length));
284
- if (extra.length) throw new CliError(`A saved quote already fixes its build, personas and options. Drop --${extra.join(', --')}, or run "hosted run" without a quote file.`);
291
+ const extra = ['build', 'nativeBuild', 'persona', 'personas', 'tier', 'minutes', 'start', 'save', 'saveTarget', 'game', 'video'].filter(name => options[name] !== undefined).concat(['focus', 'avoid'].filter(name => options[name]?.length));
292
+ if (extra.length) throw new CliError(`A saved quote already fixes its build, personas and options. Drop --${extra.map(name => name.replace(/[A-Z]/g, c => `-${c.toLowerCase()}`)).join(', --')}, or run "hosted run" without a quote file.`);
285
293
  return hostedRun(filename, flagsFrom(command.optsWithGlobals(), { wait: options.wait, waitForCapacity: options.waitForCapacity,
286
294
  evenIfUnknown: options.evenIfUnknown }));
287
295
  }
288
- return hostedRunDirect(flagsFrom(command.optsWithGlobals(), { build: options.build, persona: options.persona, personas: options.personas, tier: options.tier, minutes: options.minutes, start: options.start, focus: options.focus, avoid: options.avoid, save: options.save, saveTarget: options.saveTarget, game: options.game,
296
+ return hostedRunDirect(flagsFrom(command.optsWithGlobals(), { build: options.build, nativeBuild: options.nativeBuild, persona: options.persona, personas: options.personas, tier: options.tier, minutes: options.minutes, start: options.start, focus: options.focus, avoid: options.avoid, save: options.save, saveTarget: options.saveTarget, game: options.game,
289
297
  video: options.video, wait: options.wait, waitForCapacity: options.waitForCapacity, evenIfUnknown: options.evenIfUnknown }));
290
298
  }));
291
299
  common(hosted.command('status [run-id]'))
@@ -303,7 +311,7 @@ export function buildProgram() {
303
311
  const { hostedCancel } = await import('./commands/hosted.js');
304
312
  return hostedCancel(runId, flagsFrom(command.optsWithGlobals(), { game: options.game }));
305
313
  }));
306
- const build = common(program.command('build').description('check or upload a self-contained hosted game archive'));
314
+ const build = common(program.command('build').description('check, upload, list or delete a self-contained hosted game archive'));
307
315
  build.command('preflight <archive>')
308
316
  .description('check bounded ZIP metadata locally before any paid upload')
309
317
  .option('--entrypoint <path>', 'entry file inside the ZIP (default: index.html at the root, or the only HTML file; several are listed to choose from)')
@@ -320,6 +328,14 @@ export function buildProgram() {
320
328
  const { buildStatus } = await import('./commands/build.js');
321
329
  return buildStatus(buildId, flagsFrom(command.optsWithGlobals(), { game: options.game }));
322
330
  }));
331
+ build.command('delete <build-id>')
332
+ .description('delete one private hosted build; its validation hold comes back after cleanup')
333
+ .option('--game <id>', 'game id, overriding this repo’s configuration')
334
+ .addHelpText('after', '\nAsks first at a terminal. Without one, pass --yes; --json needs --yes.\nThe build can no longer be quoted or played. Its validation hold comes back\nafter cleanup finishes. See where it stands with: ravensight-playtest build status')
335
+ .action(capture(slot, async (buildId, options, command) => {
336
+ const { buildDelete } = await import('./commands/build.js');
337
+ return buildDelete(buildId, flagsFrom(command.optsWithGlobals(), { game: options.game }));
338
+ }));
323
339
  build.command('upload <archive>')
324
340
  .description('preflight and stream one private build upload after validation-hold consent')
325
341
  .option('--profile <version>', 'server build profile to upload under; optional when the server advertises exactly one, otherwise the error lists the choices')
@@ -378,7 +394,7 @@ export function buildProgram() {
378
394
  .option('--web', 'check the browser even when this repo is not linked to a web build')
379
395
  .option('--driver <name>', 'check the setup for this driver instead of the configured one')
380
396
  .option('--driver-config <file>', 'the experimental native driver config to probe instead of the configured one')
381
- .option('--native-build <path>', 'Android APK or iOS simulator APP to inspect')
397
+ .option('--native-build <path>', 'Android APK, iOS simulator APP, packaged Unreal Mac app, Unity Mac player or desktop game to inspect')
382
398
  .option('--device <id>', 'exact native emulator or simulator')
383
399
  .option('--package <id>', 'expected Android package')
384
400
  .option('--bundle-id <id>', 'expected iOS bundle identifier')
@@ -6,6 +6,7 @@ import { preflightBuildArchive, limitsFromProfile, entrypointChoiceLine } from '
6
6
  import { uploadHostedBuild } from '../hosted/buildUpload.js';
7
7
  import { buildStatusLines, readHostedBuilds } from '../hosted/buildStatus.js';
8
8
  import { CliError, ExitCode } from '../errors.js';
9
+ import { ApiError } from '../api/errors.js';
9
10
  import { ui } from '../ui/index.js';
10
11
 
11
12
  // TTY animation stays live while I/O awaits. Piped logs receive at most one
@@ -103,3 +104,42 @@ export async function buildStatus(buildId, flags = {}, deps = {}) {
103
104
  return ExitCode.OK;
104
105
  });
105
106
  }
107
+
108
+ // Delete one private hosted build. The server answers 202 and removes it in
109
+ // the background; the validation hold comes back once that cleanup finishes,
110
+ // so the command says so and points at build status rather than claiming the
111
+ // money is already back.
112
+ export async function buildDelete(buildId, flags = {}, deps = {}) {
113
+ if (flags.json && !flags.yes && !deps.confirm) throw new CliError('Use --yes with --json to delete a build. Nothing was deleted.');
114
+ const context = deps.context || await createContext({ apiUrl: flags.apiUrl, repoRoot: flags.repoRoot, requireAuth: true });
115
+ return withAuthHandling(context, async () => {
116
+ const api = context.api, gameId = resolveGameId(flags, context.config);
117
+ const statusHint = `See where it stands with: ravensight-playtest build status ${buildId}`;
118
+ const missing = () => new CliError(`No hosted build ${buildId} for this game. Nothing was deleted. See your builds with: ravensight-playtest build status`);
119
+ const [build] = await readHostedBuilds({ api, gameId, buildId });
120
+ if (!build) throw missing();
121
+ if (build.state === 'deleting') {
122
+ if (flags.json) ui.json({ buildId, state: 'deleting' });
123
+ else { ui.info(`Build ${buildId} is already being removed. Its validation hold comes back after cleanup.`); ui.info(statusHint); }
124
+ return ExitCode.OK;
125
+ }
126
+ const confirm = deps.confirm || (question => ui.confirm(question, { yes: Boolean(flags.yes),
127
+ noTerminalMessage: 'No terminal to confirm in: pass --yes to delete this build.' }));
128
+ if (!await confirm(`Delete hosted build ${buildId}? It can no longer be quoted or played. Its validation hold comes back after cleanup.`)) {
129
+ if (flags.json) ui.json({ buildId, state: 'kept' });
130
+ else ui.info('Nothing was deleted.');
131
+ return ExitCode.CANCELED;
132
+ }
133
+ let result;
134
+ try { result = await api.hosted.deleteBuild(gameId, buildId); }
135
+ catch (error) { if (error instanceof ApiError && error.status === 404) throw missing(); throw error; }
136
+ const state = typeof result?.state === 'string' ? result.state : 'deleting';
137
+ if (flags.json) ui.json({ buildId, state });
138
+ else {
139
+ ui.ok(`Build ${buildId} is being removed.`);
140
+ ui.info('Its validation hold comes back after cleanup finishes, usually within minutes.');
141
+ ui.info(statusHint);
142
+ }
143
+ return ExitCode.OK;
144
+ });
145
+ }
@@ -67,7 +67,7 @@ export const MAX_REPAIRS = 2;
67
67
  export const REPAIR_MAX_ACTIONS = 30;
68
68
  const SPEC_ID = /^[a-f0-9]{24}$/i;
69
69
  export const DESIGN_ID = /^[a-f0-9]{24}$/i;
70
- const ALPHA_3D_LINE = '3D Alpha: a proof of concept on one template. It is priced as any feature is, a real model on 3D is unmeasured, and a persona plays with keys and input actions, never mouse look.';
70
+ const ALPHA_3D_LINE = '3D Alpha: a proof of concept on one template. It is priced as any feature is, a real model on 3D is unmeasured, and a persona plays with keys, input actions, mouse look and a gamepad.';
71
71
  const LABS_OFF = 'Build a feature is part of Ravensight Labs (beta), and it is not on for this game. Turn Labs on from the Labs page in the dashboard. Nothing was charged.';
72
72
 
73
73
  /**
@@ -9,7 +9,11 @@ import { quoteHostedRun, runHostedQuote, hostedQuoteLines, prepareHostedRun, con
9
9
  import { hostedPlaytestStatus, modeOutcomes, modeLine, TERMINAL_PHASES, queueInfo, queueLine } from '../hosted/status.js';
10
10
  import { jobLink } from '../dashboard.js';
11
11
  import { ALWAYS_INCLUDED_PERSONA, hostedPersonas } from '../runDefaults.js';
12
- import { focusFor, providerRoles, uploadSave } from '../hosted/recordedRun.js';
12
+ import { focusFor, providerRoles, uploadSave, ANDROID_FOCUS_REFUSAL } from '../hosted/recordedRun.js';
13
+ import { ApiError } from '../api/errors.js';
14
+ import { uploadHostedBuild } from '../hosted/buildUpload.js';
15
+ import { waitForBuildValidation, readHostedBuilds, VALIDATED_STATE } from '../hosted/buildStatus.js';
16
+ import { ANDROID_FORMAT, ANDROID_UNAVAILABLE, ANDROID_UNAVAILABLE_CODE, androidProfiles, androidRefusalText, preflightApk } from '../hosted/nativeBuild.js';
13
17
 
14
18
  /** Machine output names a Geri provider by its role, never by the server's wire id. */
15
19
  const printJson = value => ui.json(providerRoles(value));
@@ -54,13 +58,64 @@ export function assertHostedBuildId(build) {
54
58
  if (typeof build !== 'string' || !/^pt_build_[A-Za-z0-9-]{1,100}$/.test(build)) throw new CliError(HOSTED_URL_REFUSAL, ExitCode.ENVIRONMENT);
55
59
  }
56
60
 
61
+ /** The server's refusal of an Android cloud playtest (503, nothing charged), printed in its own words. */
62
+ function androidRefusal(error) {
63
+ if (error instanceof ApiError && error.code === ANDROID_UNAVAILABLE_CODE) return new CliError(androidRefusalText(error), ExitCode.ENVIRONMENT);
64
+ return error;
65
+ }
66
+ const passAndroidRefusal = async fn => { try { return await fn(); } catch (error) { throw androidRefusal(error); } };
67
+
68
+ /**
69
+ * `hosted run --native-build game.apk`: the flags that cannot go with it,
70
+ * refused before any network call. An Android build is a new upload (not
71
+ * --build), plays offline with no web address (no --start, --save or
72
+ * --save-target) and takes no goals yet (no --focus or --avoid).
73
+ */
74
+ export function assertNativeRunFlags(flags = {}) {
75
+ if (!flags.nativeBuild) return;
76
+ if (flags.build !== undefined) throw new CliError('--native-build uploads an Android build as a new build, and --build names one already uploaded. Use one of them. Nothing was uploaded or charged.', ExitCode.ENVIRONMENT);
77
+ if (flags.start !== undefined || flags.save !== undefined || flags.saveTarget !== undefined) {
78
+ throw new CliError(ANDROID_FOCUS_REFUSAL, ExitCode.ENVIRONMENT);
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Upload an APK for a cloud playtest and wait for its archive check. Refused
84
+ * before any upload or hold when the server offers this studio no Android
85
+ * profile. Answers the checked build's id, or null when the hold was declined.
86
+ */
87
+ async function uploadAndroidBuild({ api, apiUrl, gameId, repoRoot, flags, deps, confirm, sleep, now, sha256 }) {
88
+ const caps = (await api.request('GET', `/api/v1/games/${encodeURIComponent(gameId)}/playtest/hosted/run-capabilities`, { idempotent: true })).body;
89
+ if (!caps?.recorded?.available || !androidProfiles(caps.recorded.profiles).length) throw new CliError(ANDROID_UNAVAILABLE, ExitCode.ENVIRONMENT);
90
+ // The same APK uploaded before and still checked or being checked is used again: no second upload or hold.
91
+ const earlier = (await readHostedBuilds({ api, gameId })).find(row => row.sha256 === sha256 && row.format === ANDROID_FORMAT
92
+ && [VALIDATED_STATE, 'awaiting_validation'].includes(row.state) && !row.rejection && !(Date.parse(row.expiresAt) <= now()));
93
+ if (earlier) {
94
+ if (!flags.json) ui.info(`Build ${earlier.buildId} is this same APK, uploaded before. Using it; nothing new is uploaded or held.`);
95
+ const build = earlier.state === VALIDATED_STATE ? earlier : await waitForBuildValidation({ api, gameId, buildId: earlier.buildId, sleep: deps.validationSleep || sleep, now });
96
+ return build.buildId;
97
+ }
98
+ const upload = await (deps.uploadBuild || uploadHostedBuild)({ filename: flags.nativeBuild, gameId, format: ANDROID_FORMAT, repoRoot, api, apiUrl,
99
+ fetchImpl: deps.fetch, confirm,
100
+ onPrepared: prepared => {
101
+ if (flags.json) return;
102
+ ui.info(`Android build ${flags.nativeBuild}: ${ui.bytes(prepared.archiveBytes)}, ${prepared.entries} entries, with an AndroidManifest.xml. The server checks its signature and launcher activity.`);
103
+ ui.info('Static validation hold: $0.49 from prepaid funds, returned after safe cleanup. The playtest is quoted separately once the build passes its check.');
104
+ } });
105
+ if (upload.state === 'declined') return null;
106
+ if (!flags.json) ui.info(`Uploaded ${upload.buildId}. Waiting for its archive check, which usually takes about a minute.`);
107
+ const build = await waitForBuildValidation({ api, gameId, buildId: upload.buildId, sleep: deps.validationSleep || sleep, now });
108
+ if (!flags.json) ui.ok(`Build ${build.buildId} passed its archive check.`);
109
+ return build.buildId;
110
+ }
111
+
57
112
  export async function hostedQuote(flags = {}, deps = {}) {
58
113
  assertHostedBuildId(flags.build);
59
114
  const context = deps.context || await createContext({ apiUrl: flags.apiUrl, repoRoot: flags.repoRoot, requireAuth: true });
60
115
  // The same personas as "hosted run", so a quote and a run of the same build
61
116
  // match: fresh-eyes always, plus any named.
62
117
  const personas = personasFrom(flags);
63
- return withAuthHandling(context, async () => {
118
+ return withAuthHandling(context, () => passAndroidRefusal(async () => {
64
119
  const gameId = resolveGameId(flags, context.config);
65
120
  const result = await quoteHostedRun({ api: context.api, apiUrl: context.api.apiUrl,
66
121
  gameId, buildId: flags.build, profileVersion: flags.profile,
@@ -74,7 +129,7 @@ export async function hostedQuote(flags = {}, deps = {}) {
74
129
  ui.ok(`Saved ${result.quoteFile}. No admission or charge was requested.`);
75
130
  }
76
131
  return ExitCode.OK;
77
- });
132
+ }));
78
133
  }
79
134
 
80
135
  export async function hostedRun(filename, flags = {}, deps = {}) {
@@ -212,17 +267,32 @@ function admittedLines(admitted, now) {
212
267
  */
213
268
  export async function hostedRunDirect(flags = {}, deps = {}) {
214
269
  assertHostedBuildId(flags.build);
270
+ assertNativeRunFlags(flags);
215
271
  if (flags.json && !flags.yes && !deps.confirm) throw new CliError('A hosted run charges prepaid funds. Use --yes with --json. Nothing was charged.');
216
272
  const maxWaitMs = capacityWaitMs(flags.waitForCapacity);
273
+ // The APK's own checks come first: nothing is sent for a file that cannot be an installable APK.
274
+ const apk = flags.nativeBuild ? await preflightApk(flags.nativeBuild) : null;
217
275
  const context = deps.context || await createContext({ apiUrl: flags.apiUrl, repoRoot: flags.repoRoot, requireAuth: true });
218
276
  const now = deps.now || Date.now, sleep = poller(deps);
219
- return withAuthHandling(context, async () => {
277
+ return withAuthHandling(context, () => passAndroidRefusal(async () => {
220
278
  const api = context.api, apiUrl = api.apiUrl, gameId = resolveGameId(flags, context.config);
221
279
  await assertNoUnknownAdmission({ repoRoot: context.repoRoot, apiUrl, gameId, evenIfUnknown: Boolean(flags.evenIfUnknown) });
222
- const { offer, build, funding } = await prepareHostedRun({ api, apiUrl, gameId, buildId: flags.build,
223
- personas: personasFrom(flags), ...await scopeWithSave(flags, { api, gameId, upload: deps.uploadSave }), includeVideo: Boolean(flags.video), now });
280
+ const confirm = deps.confirm || (question => ui.confirm(question, { yes: Boolean(flags.yes) }));
281
+ let buildId = flags.build;
282
+ if (flags.nativeBuild) {
283
+ buildId = await uploadAndroidBuild({ api, apiUrl, gameId, repoRoot: context.repoRoot, flags, deps, confirm, sleep, now, sha256: apk.sha256 });
284
+ if (!buildId) {
285
+ if (flags.json) printJson({ state: 'declined', gameId, walletMutationRequested: false });
286
+ else ui.info('Upload declined. Nothing was uploaded or charged.');
287
+ return ExitCode.CANCELED;
288
+ }
289
+ }
290
+ // An Android build takes no start, save or goals (refused above), so its scope is the tier and minutes only.
291
+ const scope = flags.nativeBuild ? scopeFrom({ tier: flags.tier, minutes: flags.minutes }) : await scopeWithSave(flags, { api, gameId, upload: deps.uploadSave });
292
+ const { offer, build, funding } = await prepareHostedRun({ api, apiUrl, gameId, buildId,
293
+ personas: personasFrom(flags), ...scope, includeVideo: Boolean(flags.video), now });
224
294
  if (!flags.json) {
225
- ui.info(`Build ${build.buildId}${build.entrypoint ? ` (${build.entrypoint})` : ''}${flags.build ? '' : ', the newest ready build'}.`);
295
+ ui.info(`Build ${build.buildId}${build.entrypoint ? ` (${build.entrypoint})` : ''}${buildId ? '' : ', the newest ready build'}.`);
226
296
  hostedQuoteLines(offer).forEach(line => ui.info(line));
227
297
  hostedConsentLines(offer).forEach(line => ui.info(line));
228
298
  }
@@ -231,7 +301,6 @@ export async function hostedRunDirect(flags = {}, deps = {}) {
231
301
  const topUp = short.requiredTopUpCents ? ` Add at least ${dollars(short.requiredTopUpCents)} of prepaid funds, then run this again.` : ' Add prepaid funds, then run this again.';
232
302
  throw new CliError(`The balance does not meet this hosted run's funding requirement. Nothing was charged.${topUp}`, ExitCode.ENVIRONMENT);
233
303
  }
234
- const confirm = deps.confirm || (question => ui.confirm(question, { yes: Boolean(flags.yes) }));
235
304
  if (!await confirm(confirmQuestion(offer))) {
236
305
  if (flags.json) printJson({ state: 'declined', gameId, buildId: build.buildId, walletMutationRequested: false });
237
306
  else ui.info('Declined. Nothing was charged.');
@@ -256,7 +325,7 @@ export async function hostedRunDirect(flags = {}, deps = {}) {
256
325
  if (flags.json) printJson({ ...result, status: view });
257
326
  else printOutcome(view);
258
327
  return exitFor(view);
259
- });
328
+ }));
260
329
  }
261
330
 
262
331
  export async function hostedStatus(admissionId, flags = {}, deps = {}) {