ravensight-playtest 0.9.0 → 0.10.1

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 (67) hide show
  1. package/README.md +266 -44
  2. package/addons/ravensight_driver/driver.gd +704 -21
  3. package/docs/ADAPTERS.md +11 -7
  4. package/docs/NATIVE_RUNNER.md +3 -1
  5. package/docs/godot-driver.md +136 -13
  6. package/package.json +8 -6
  7. package/src/api/client.js +4 -3
  8. package/src/cli.js +114 -13
  9. package/src/commands/check.js +30 -4
  10. package/src/commands/fakeCore.js +14 -2
  11. package/src/commands/hosted.js +18 -4
  12. package/src/commands/init.js +17 -1
  13. package/src/commands/run.js +209 -14
  14. package/src/commands/upload.js +6 -2
  15. package/src/commands/validate.js +1 -1
  16. package/src/commands/validateHosted.js +50 -5
  17. package/src/config.js +33 -2
  18. package/src/hosted/archivePreflight.js +7 -7
  19. package/src/hosted/buildUpload.js +89 -8
  20. package/src/hosted/recordedRun.js +40 -1
  21. package/src/run/actionSelector.js +14 -3
  22. package/src/run/aggregate.js +57 -3
  23. package/src/run/anygame/controlbook.js +179 -0
  24. package/src/run/anygame/genre.js +179 -0
  25. package/src/run/anygame/index.js +258 -0
  26. package/src/run/anygame/language.js +336 -0
  27. package/src/run/anygame/memory.js +330 -0
  28. package/src/run/anygame/shared-hashes.json +10 -0
  29. package/src/run/anygame/shared.js +24 -0
  30. package/src/run/anygame/sound.js +342 -0
  31. package/src/run/args.js +75 -8
  32. package/src/run/captureCheck.js +161 -0
  33. package/src/run/choiceCheck.js +312 -0
  34. package/src/run/claimGate.js +236 -0
  35. package/src/run/context.js +254 -13
  36. package/src/run/drivers/godot-observation.js +93 -6
  37. package/src/run/drivers/godot.js +769 -46
  38. package/src/run/drivers/recording.js +24 -4
  39. package/src/run/drivers/web.js +1242 -77
  40. package/src/run/edgePass.js +731 -0
  41. package/src/run/fixLoop.js +5 -4
  42. package/src/run/focus.js +65 -0
  43. package/src/run/gamepad.js +108 -0
  44. package/src/run/godotEdgePass.js +235 -0
  45. package/src/run/godotTesterProbes.js +192 -0
  46. package/src/run/headings.js +21 -0
  47. package/src/run/honesty.js +642 -0
  48. package/src/run/inputs.js +256 -0
  49. package/src/run/marks.js +142 -0
  50. package/src/run/personaLoop.js +1128 -120
  51. package/src/run/phone.js +7 -0
  52. package/src/run/pixels.js +215 -0
  53. package/src/run/playClock.js +162 -0
  54. package/src/run/readiness.js +585 -0
  55. package/src/run/refusal.js +67 -0
  56. package/src/run/regions.js +119 -0
  57. package/src/run/report.js +14 -2
  58. package/src/run/reportChecks.js +487 -0
  59. package/src/run/resume.js +3 -2
  60. package/src/run/screenshots.js +161 -0
  61. package/src/run/strip.js +114 -0
  62. package/src/run/testerLedger.js +312 -0
  63. package/src/run/testerProbes.js +584 -0
  64. package/src/run/thinRun.js +102 -0
  65. package/src/run/timeFreeze.js +79 -0
  66. package/src/run/tools.js +454 -29
  67. package/src/runDefaults.js +1 -0
package/docs/ADAPTERS.md CHANGED
@@ -1,14 +1,16 @@
1
1
  # Connect a game to Ravensight Playtester
2
2
 
3
+ **What can be playtested today:** web builds from any engine (`playwright_web`, on this machine or in the cloud) and Godot projects on this machine (`godot_driver`). Native builds (Unity, Unreal, desktop, iOS, Android) cannot be playtested today: the cloud accepts web builds only, and the native drivers below are experimental. Each needs a separate automation server that you run yourself and that Ravensight does not provide, and none has been tested against a real automation server. For a Unity game, build for the Web platform and playtest that web build.
4
+
3
5
  Run the CLI on the machine that can access your build. Sign in, link the project with `ravensight-playtest init --game <gameId>`, and complete its expectations brief. `run` quotes the existing persona price before registration. Adapters share the same prepaid job, action limits, model budget, cancellation, reports and uploads.
4
6
 
5
7
  | Adapter | Target | Validation |
6
8
  | --- | --- | --- |
7
9
  | `playwright_web` | Browser URL, including canvas/WebGL exports | Automated tests and live Jump Bunny gameplay |
8
10
  | `godot_driver` | Godot project with the playtest addon | Existing addon protocol and runner tests |
9
- | `desktop_driver` | Local W3C/Appium session configuration | Protocol tested; experimental on physical builds |
10
- | `unity_driver`, `unreal_driver` | Desktop exports through that same W3C interface | Engine-neutral screen controls, not editor plugins; experimental |
11
- | `android_driver`, `ios_driver` | Appium device/emulator/simulator configuration | Protocol tested; hardware/build validation still required |
11
+ | `desktop_driver` | Local W3C/Appium session configuration | Experimental. Tested only against a stub; needs your own automation server |
12
+ | `unity_driver`, `unreal_driver` | Desktop exports through that same W3C interface | Experimental. Engine-neutral screen controls, not editor plugins; untested against a real automation server. For Unity, export a web build instead |
13
+ | `android_driver`, `ios_driver` | Appium device/emulator/simulator configuration | Experimental. Tested only against a stub; untested on a real automation server, device or simulator |
12
14
  | `cli_stdio` | Developer-owned JSON-RPC bridge | Real child-process protocol test |
13
15
 
14
16
  No adapter promises every game is autonomously solvable. Fast action games, unusual controls, anti-cheat, hardware access and protected platforms may require a game-specific bridge. Console tooling and authorization remain the developer's responsibility. The runner cannot bypass platform access restrictions.
@@ -20,13 +22,15 @@ ravensight-playtest run --driver playwright_web --build-url https://your-game.ex
20
22
  ravensight-playtest run --driver godot_driver --godot-project ./your-game
21
23
  ```
22
24
 
23
- `--controller freki` plays with Freki, the selecting playtester, when the server supports it. Screen interpretation proposes up to three actions and a separate selector chooses one. `--controller geri` plays with Geri, which chooses every action itself. Uncertain decisions stop for review. Provider credentials stay on Ravensight. A completed playtest report is evidence for human review, not proof that a game is bug-free.
25
+ `--controller freki` plays with Freki, the selecting playtester, when the server supports it. Screen interpretation proposes up to three actions and a separate selector chooses one. `--controller geri` plays with Geri, which chooses every action itself. When Freki is unsure, its most likely candidate (or the first action proposed for that screen) is played and the run goes on. Provider credentials stay on Ravensight. A completed playtest report is evidence for human review, not proof that a game is bug-free.
26
+
27
+ ## Desktop and mobile (experimental)
24
28
 
25
- ## Desktop and mobile
29
+ These drivers are not a supported way to playtest today. This section is the technical reference for anyone trying one; expect to adapt it, and tell us what you had to change.
26
30
 
27
- Before anything else, `ravensight-playtest check --driver <name> --driver-config <file>` probes the automation server for free (status, a session with your capabilities, the app answering, the session closed), and `run` repeats that probe before it registers a paid native job. [NATIVE_RUNNER.md](NATIVE_RUNNER.md) is a step by step iOS simulator starter with the expected `check` rows.
31
+ Before anything else, `ravensight-playtest check --driver <name> --driver-config <file>` probes the automation server for free (status, a session with your capabilities, the app answering, the session closed), and `run` repeats that probe before it registers a paid native job. [NATIVE_RUNNER.md](NATIVE_RUNNER.md) is an untested, step by step iOS simulator starter with the expected `check` rows.
28
32
 
29
- Install and configure an Appium-compatible driver for your platform. Start its server locally. Supply `ravensight-driver.json` with a loopback endpoint and capabilities appropriate to the installed driver:
33
+ Ravensight does not provide, install or start the automation server. Install and configure an Appium-compatible driver for your platform yourself and start its server locally. Supply `ravensight-driver.json` with a loopback endpoint and capabilities appropriate to the installed driver:
30
34
 
31
35
  ```json
32
36
  {
@@ -1,6 +1,8 @@
1
1
  # Native runner starter: an iOS simulator app
2
2
 
3
- The smallest setup that lets a persona play a native or engine-exported iOS
3
+ > **Experimental, not a supported path:** native builds cannot be playtested today. The cloud accepts web builds only, `ios_driver` needs an automation server you run yourself (Ravensight does not provide one), and it has not been tested against a real one. What works today: web builds from any engine (`playwright_web`) and Godot projects locally (`godot_driver`).
4
+
5
+ The smallest setup that should let a persona play a native or engine-exported iOS
4
6
  game on a simulator through `ios_driver`. Each step ends with the
5
7
  `ravensight-playtest check` rows you should see before moving on. `check` never
6
8
  reserves units or starts a job, so you can run it as often as you like.
@@ -201,10 +201,78 @@ A tap is one frame, which in a game that moves a character by `speed * delta`
201
201
  is a pixel or two. Holds and waits are timed on the clock, divided by the game's
202
202
  time scale, not counted in frames: a frame count depends on the display, and on
203
203
  a 120 Hz Mac 120 frames was one game second. The persona's `key` tool therefore takes `hold_ms` (up to
204
- 5000) and `with_keys` (up to two more keys held at the same time, for a
205
- diagonal). Every key that went down is released, in reverse order, even when a
206
- later key was refused, so nothing stays held for the rest of the run. A driver
207
- that cannot hold keys refuses a hold as a driver error rather than tapping.
204
+ 5000) and `with_keys` (up to five more keys held at the same time: a diagonal,
205
+ or move, sprint and jump together). Every key that went down is released, in
206
+ reverse order, even when a later key was refused, so nothing stays held for the
207
+ rest of the run. A driver that cannot hold keys refuses a hold as a driver error
208
+ rather than tapping.
209
+
210
+ A key held past half a second echoes, as a keyboard's does: the addon sends it
211
+ again about thirty times a second with `echo` set (`key { repeat: true }`), on
212
+ ticks in lockstep and on the clock otherwise. A chord such as `Shift+Tab` is its
213
+ keys held together, and every key event says which modifiers are down. Key
214
+ names are the usual ones however they are capitalised: `F1` to `F24`, `Delete`,
215
+ `Home`, `End`, `PageUp`, `PageDown`, `numpad 4`, punctuation by name or as the
216
+ character.
217
+
218
+ ## The pointer
219
+
220
+ `mouse { kind, x, y | node_path, button, double, dx, dy }` is one pointer event
221
+ (addon 1.4.0): `move`, `down`, `up` or `wheel`. A move carries the buttons that
222
+ are held, so the persona's tools are made of them:
223
+
224
+ | Tool | What the game receives |
225
+ | --- | --- |
226
+ | `click` with `button`, `double`, `hold_ms` | a right or middle click, a double click, or a press held for game time |
227
+ | `drag` (and `swipe`) | a press, moves across the screen in steps, a release: `_get_drag_data` drops, a hand drawn drag and a slider handle all work |
228
+ | `hover` | a move with no button, so `mouse_entered` and tooltips fire |
229
+ | `scroll` | one wheel button press and release per notch at the pointer, with Control, Shift or Alt when asked |
230
+ | `key` with `sequence` | presses and releases on the tick each `at_ms` falls on, overlapping holds included |
231
+
232
+ A named end (`from: "Army"`) is resolved against the last outline like a click
233
+ target and sent as the centre the outline prints. In lockstep every event is a
234
+ `step` event of type `mouse`, so a trace replays a drag move for move. There is
235
+ no `select`: a dropdown is opened and picked with clicks, a slider is dragged,
236
+ and the refusal is recorded as a limit of the runner.
237
+
238
+ ## Dropdowns, sliders and tabs
239
+
240
+ `select{node_path, option | index | value}` (addon 1.5.0) chooses an option of
241
+ an `OptionButton`, an `ItemList`, a `TabBar` or a `TabContainer` by the text a
242
+ player reads (or its place), or sets a `Slider` or a `SpinBox` to a value
243
+ inside its range. The control shows the choice and sends the signal a pick or
244
+ a drag would (`item_selected`, `value_changed`, `drag_ended`). In lockstep it
245
+ is a step event (`{type: "select", ...}`), so it is in the trace and a replay
246
+ makes the same choice. An option the control does not have is refused with
247
+ the ones it has. The outline prints what is chosen and offered
248
+ (`selected="Normal" options=[Easy | Normal | Hard]`) and where a slider stands
249
+ (`value=50 (from 0 to 100)`). The persona's `select` tool is offered on
250
+ `godot_driver` when the project's addon is 1.5.0 or newer.
251
+
252
+ ## The frame strip
253
+
254
+ While a held key, a held press or a timed sequence plays, the addon takes up
255
+ to four small frames (a quarter of the window each way): a lockstep `step`
256
+ takes `strip_at`, the ticks of the step they are due on, and `strip_new` to
257
+ start a new strip; a run on the wall clock calls `strip_begin` and
258
+ `strip_frame`. `strip_status` says how many were taken and whether the game
259
+ moved in them, and `screenshot{strip: true}` draws them in a row under the
260
+ picture, in one image, and forgets them. The frames read the screen and are no
261
+ part of the trace. When nothing moved no strip is drawn and the result says so.
262
+
263
+ ## Edge behaviour checks
264
+
265
+ After play the runner makes the checks `playwright_web` makes, through the
266
+ addon (1.5.0), with no model call: `edge_focus{focused}` tells every node its
267
+ window lost focus or has it back (the desktop's real focus is left alone),
268
+ `window_size{width, height}` resizes the window and `edge_layout` lists the
269
+ controls a player presses that then lie outside it, the keys the session used
270
+ are pressed as fast as the game ticks, the game is left alone for five seconds
271
+ of game time, and when `user_files` shows the game wrote under `user://` it is
272
+ started a second time on that folder, without a window, to see that it comes
273
+ up and that the files are still there. The second start is only made on a
274
+ lockstep run, which has a save folder of its own. `--no-edge-pass` turns the
275
+ checks off.
208
276
 
209
277
  ## The game is paused between actions
210
278
 
@@ -217,6 +285,15 @@ that sets its own `time_scale` keeps it: the scale read back when the clock is
217
285
  frozen is the one restored next. `run --realtime` turns this off for a game
218
286
  that has to keep running in real time.
219
287
 
288
+ A screenshot, a frame of the video and a frame of the strip are always the
289
+ frame the game is on. A window the desktop has minimized, covered or moved to
290
+ another space stops drawing, and reading it gave the last frame it drew, from
291
+ many inputs before (addon 1.5.0 and earlier). Since addon 1.5.1 the driver
292
+ draws the frame itself when the window cannot, rendering without presenting
293
+ and without running any game code or game time, so a lockstep run stays where
294
+ it was. `ping` and every `screenshot` answer carry `forced_draws`, how many
295
+ frames the driver has drawn that way.
296
+
220
297
  `time_scale` 0 stops what reads `delta` or a timer. A game that moves on wall
221
298
  clock time (`Time.get_ticks_msec()`) is not paused by it.
222
299
 
@@ -237,7 +314,8 @@ After `ping`, the driver lets the game run ten frames, then reads its output.
237
314
  A `Parse Error:`, a `Failed to load script ... with error`, a main scene that
238
315
  failed to load, or no current scene at all fails the launch with an error that
239
316
  starts `game_boot_failed:`. The run is completed as `failed` with that reason,
240
- so it is refunded as a failed run, and a fix verify whose game did not boot is
317
+ so it settles as a failed run by the server's rules (with no AI time used, it
318
+ comes back in full), and a fix verify whose game did not boot is
241
319
  reported "not verified, the game did not boot", never fixed. An ordinary
242
320
  runtime `ERROR:` line does not fail the boot.
243
321
 
@@ -256,8 +334,8 @@ scripts: res://ravensight_stub.gd, res://main.gd
256
334
  Window root
257
335
  Node2D Main @(0,0) [groups=ravensight_state] {res://main.tscn} <res://main.gd>
258
336
  CanvasLayer HUD
259
- Label TrustLabel "Trust: 4" @(24,16)
260
- Button BeginButton "Begin" @(600,400) [focus]
337
+ Label TrustLabel "Trust: 4" 120x24 centre(84,28)
338
+ Button BeginButton "Begin" 120x40 centre(660,420) [focus]
261
339
 
262
340
  game state:
263
341
  /root/Main: {"phase":"HEALING","trust":4}
@@ -267,9 +345,44 @@ That is what lets a finding say which scene and which script to open. The
267
345
  driver's own autoload is filtered out of the snapshot, so its script path never
268
346
  appears in that list.
269
347
 
270
- Subtrees with nothing a player could see or press are dropped, the outline is
271
- capped at 12k characters, and `needsVision()` asks for a screenshot when the
272
- remaining outline is under 200 characters, which is the canvas drawn or 3D case.
348
+ Subtrees with nothing a player could see or press are dropped and the outline is
349
+ capped at 12k characters.
350
+
351
+ The tree is read twelve levels deep (`DEFAULT_TREE_DEPTH`). Six cut a card grid
352
+ off at its container, so the cards and the labels inside them never reached the
353
+ persona. A branch the cut still leaves out is read on its own with
354
+ `get_state { root }` (up to `MAX_CUT_EXPANSIONS` per snapshot); past that the
355
+ line says `+N more`, as before.
356
+
357
+ Every Control with a size prints `WxH centre(x,y)`: its size, and the point a
358
+ click on it lands on, in the window pixels `click` takes (the addon's `center`,
359
+ which follows a stretched window; an older addon sends only `rect`, whose middle
360
+ is used). A container that holds one thing and nothing a player could read is
361
+ folded into the next line as a path, so a card twelve containers down costs one
362
+ line and its path can still be read off:
363
+
364
+ ```
365
+ GridContainer UI/Screens/Picker/Margin/Column/Grid 1208x590 centre(640,389)
366
+ Button Card1 290x287 centre(487,238)
367
+ VBoxContainer Pad/Body/Header/Lines 270x76 centre(487,256)
368
+ Label Name "Duchy of Normandy" 270x22 centre(487,261)
369
+ ```
370
+
371
+ A click target is a node path from `/root`, or, looked up in the last outline, a
372
+ node name, the end of a path, or the text a node shows when only one node has
373
+ it. Text on a label inside a card clicks the card: the nearest pressable node
374
+ above it. A target that names two nodes or none is refused before anything
375
+ reaches the game, as a driver error, so nothing downstream reads it as a broken
376
+ game.
377
+
378
+ `needsVision()` asks for a picture when the remaining outline is under 200
379
+ characters (the canvas drawn or 3D case), or when it holds something pressable
380
+ with no text on it or under it (an icon button, a map region). The picture a
381
+ model is shown is a JPEG (`screenshot { format: "jpeg", quality }`), because the
382
+ model proxy reserves a request by its bytes; saved evidence stays PNG. On a
383
+ screen played from the picture, `changed` also compares two small frames as
384
+ pixels, so a canvas drawn game is not read as stuck and a blinking cursor is not
385
+ read as a change.
273
386
 
274
387
  Spec 07's `extensions/navigation.gd` (`nav_sample`, `nav_path`, `teleport`,
275
388
  `raycast`) is **not** part of this addon: those methods exist for spec 06 level
@@ -278,6 +391,13 @@ probing, not for a persona run, and they can be added later through
278
391
  extension method implemented here, because a persona that gets `-32012` needs to
279
392
  know what it may press instead.
280
393
 
394
+ A Control with no text of its own carries a `label` when its author gave it a
395
+ `tooltip_text`, or an `accessibility_name` on an engine that has one (addon
396
+ 1.4.0). It is sent apart from `text`, which is only ever what the screen shows.
397
+ The outline prints it as `label="Rouen"`, it counts as text for
398
+ `silentPressables()` (so a labelled map region no longer asks for a picture on
399
+ every turn), and a click target that names it resolves like visible text.
400
+
281
401
  The author hook is unchanged from the spec: a node in the `ravensight_state`
282
402
  group with a `_ravensight_state() -> Dictionary` method. Vectors become arrays,
283
403
  recursion stops at 8 levels, each result is capped at 64 KB, and a hook that
@@ -296,9 +416,12 @@ So `--headless` is only useful for a game driven entirely by InputMap actions
296
416
  that manages its own focus. `launch()` pushes a console entry saying so when it
297
417
  detects a headless run, and the local CLI default stays windowed.
298
418
 
299
- `--record-video` opts into local capture of this game's viewport; it does not
300
- consent to upload. `--upload-video` still enables both recording and optional
301
- video upload. Audio capture is off. Godot samples up to ten frames per second,
419
+ A run records this game's viewport by default when a window and FFmpeg are
420
+ there, and says in its summary where `session.mp4` is or why there is none;
421
+ `--no-record-video` turns it off. Recording is never consent to upload:
422
+ `--upload-video` is still what sends the video. Frames are JPEG, and a frame the
423
+ same as the last one (the game stands still while a persona thinks) is not
424
+ written again, so the frame budget covers a whole run. Audio capture is off. Godot samples up to ten frames per second,
302
425
  records their actual timestamps, and uses optional local FFmpeg to create
303
426
  `session.mp4`. Set `RAVENSIGHT_FFMPEG` to an existing executable when it is not
304
427
  on PATH. No package or encoder is downloaded automatically.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ravensight-playtest",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
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",
@@ -37,18 +37,20 @@
37
37
  "LICENSE",
38
38
  "!src/**/*.test.js",
39
39
  "!src/test-helpers",
40
- "!src/run/__helpers__",
41
40
  "!src/run/drivers/testing",
42
- "!test"
41
+ "!test",
42
+ "!src/run/__helpers__",
43
+ "!src/run/__fixtures__",
44
+ "!src/run/__fixtures__"
43
45
  ],
44
46
  "exports": {
45
47
  ".": "./src/api/index.js",
46
48
  "./api": "./src/api/index.js"
47
49
  },
48
50
  "scripts": {
49
- "test": "node --test --test-reporter=spec 'src/**/!(godot-real|web.e2e|web.containment.e2e|scaffold.godot|template3d.godot).test.js'",
50
- "test:godot": "node --test --test-reporter=spec src/run/drivers/godot-real.test.js src/create/scaffold.godot.test.js src/create/template3d.godot.test.js",
51
- "test:e2e": "node --test --test-reporter=spec src/run/drivers/web.e2e.test.js src/run/drivers/web.containment.e2e.test.js",
51
+ "test": "node --test --test-reporter=spec 'src/**/!(godot-real|godot-draw.real|godot-inputs.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.tester.e2e|scaffold.godot|template3d.godot).test.js'",
52
+ "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-replay.real.test.js src/run/drivers/godot-tester.real.test.js src/create/scaffold.godot.test.js src/create/template3d.godot.test.js",
53
+ "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",
52
54
  "lint": "node scripts/no-dashes.mjs"
53
55
  },
54
56
  "dependencies": {
package/src/api/client.js CHANGED
@@ -201,12 +201,13 @@ export function createClient(options = {}) {
201
201
  const jobs = {
202
202
  /**
203
203
  * Price a job without charging. `runLength: 'long'` asks for the long
204
- * persona run's price; anything else leaves `run_length` out, which the
205
- * server reads as a standard run.
204
+ * persona run's price and a tier length (`tier:<tier>:<minutes>`) for a
205
+ * run on a cloud tier's allowance; `standard` or nothing leaves
206
+ * `run_length` out, which the server reads as a standard run.
206
207
  */
207
208
  estimate: (gameId, { modules = [], personas = [], runLength = null, simulation, controllers, driver, validate, feature, acceptance } = {}) =>
208
209
  request('POST', `${gameBase(gameId)}/estimate`, {
209
- body: { modules, personas, ...(controllers ? { controllers, driver } : {}), ...(runLength === 'long' ? { run_length: 'long' } : {}), ...(simulation ? { simulation } : {}), ...(validate ? { validate } : {}), ...(feature ? { feature } : {}), ...(acceptance ? { acceptance: true } : {}) }
210
+ body: { modules, personas, ...(controllers ? { controllers, driver } : {}), ...(typeof runLength === 'string' && runLength !== 'standard' ? { run_length: runLength } : {}), ...(simulation ? { simulation } : {}), ...(validate ? { validate } : {}), ...(feature ? { feature } : {}), ...(acceptance ? { acceptance: true } : {}) }
210
211
  }).then(answer => answer.body),
211
212
 
212
213
  /**
package/src/cli.js CHANGED
@@ -53,26 +53,63 @@ 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, desktop_driver, unity_driver, unreal_driver, android_driver, ios_driver or cli_stdio
57
- --record-video record this game locally; --upload-video also uploads it
56
+ --driver <name> playwright_web, godot_driver or cli_stdio. Experimental, untested against a real
57
+ automation server and needing one you run yourself: desktop_driver, unity_driver,
58
+ unreal_driver, android_driver, ios_driver. Native builds cannot be playtested today
59
+ --no-record-video do not keep a video. A playwright_web or godot_driver run records one on this
60
+ machine by default (session.webm or session.mp4 in the run folder; Godot needs
61
+ ffmpeg); nothing is uploaded unless --upload-video is passed
62
+ --record-video record with the upload limits (15 minutes, 200 MB); --upload-video implies it
63
+ --no-edge-pass skip the edge behaviour checks a playwright_web or godot_driver run makes
64
+ after play (focus loss and return, window resize, rapid input, a short idle,
65
+ a reload or a second start on the save) and the tester probes (fast clicks,
66
+ untried buttons, odd text, opposite keys); they ask no model and cost nothing
67
+ --phone playwright_web only: play on a phone sized screen (390 by 844) with touch and no
68
+ mouse: a click is a tap, a drag is a finger swipe, and pinch is two fingers.
69
+ For a game made for touch; the report says when a game wanted touch and the
70
+ run was played with a mouse
58
71
  --build-url <url> the web build to play
59
72
  --build-dir <dir> a web export folder to serve from this machine and play: index.html or its one
60
73
  .html page, with wasm, Brotli and gzip engine files and threaded builds served right
61
74
  --build-entry <file> the page to open inside --build-dir, when it has more than one .html file
62
75
  --godot-project <dir> the Godot project directory
63
- --driver-config <file> local WebDriver or JSON-RPC bridge configuration
76
+ --driver-config <file> JSON-RPC bridge configuration, or an experimental native driver's WebDriver configuration
77
+ --cli <command> the command that starts a text build (cli_stdio)
78
+ --controller <name> geri (the default, chooses every action itself) or freki (picks each action from a short list)
79
+ --compare-with <name> also play every persona with this playtester, for two reports side by side
64
80
  --max-actions <n> lower the actions one persona may take; it can only lower the persona's own patience, never raise it
65
- --long a long persona run: twice the actions, model budget and wall time of a standard
66
- run, for a game whose screens are heavy or whose goal is far in. It costs twice
67
- a standard run; the price is read from the estimate and confirmed before any charge
81
+ --long a long persona run: twice the actions and wall time of a standard run and a larger
82
+ model budget, for a game whose screens are heavy or whose goal is far in. It costs
83
+ more than a standard run; the price is read from the estimate and confirmed before any charge
84
+ --tier <name> play on a cloud tier's allowance from this machine: jam, small, medium or large.
85
+ Each has its own play length, model budget and action count; the price is
86
+ read from the estimate and confirmed before any charge
87
+ --minutes <n> with --tier, minutes of play per persona, from the tier's own length (jam 5,
88
+ small 8, medium 15, large 30) up to 240; the price scales with it
89
+ --focus <goal> a goal for every persona, such as "beat the first boss"; up to five times
90
+ --avoid <thing> something every persona stays out of, such as "the settings menu"; up to five times
91
+ --start <query> open a web build with this query or hash, such as ?level=3 or #boss
68
92
  --concurrency <n> personas at once, default 2
69
93
  --upload-video upload session.webm as well as the reports
70
- --upload-transcript upload transcript.jsonl as well as the reports
94
+ --no-upload-step-log keep the step log (transcript.jsonl) on this machine. By default it uploads with the reports,
95
+ because the evidence report in the dashboard is built from it: the inputs sent, what each
96
+ observation read, your persona's notes and the checks on its findings, with the local brief's
97
+ secrets already scrubbed. Nothing else is added to it, and it expires after 90 days.
98
+ "uploads": { "step_log": false } in the project config does the same. The default applies
99
+ to projects set up before 0.10.0 too; an older "uploads": { "transcript": false } is not
100
+ an opt out. Without the step log the dashboard shows the written report only
101
+ --upload-step-log upload the step log for this run even when the config sets "step_log": false
102
+ (older name: --upload-transcript)
103
+ --no-replay do not play the findings' recorded inputs again after the report. A replay makes no model
104
+ call and costs nothing; it opens the game again for a few seconds (a second browser for a
105
+ web build, a second Godot for a lockstep run)
71
106
  --dry-upload list every file and byte that would be sent, send nothing
72
107
  --key-modifier <name> meta or control: the modifier for editing shortcuts in the browser, default the platform's own
73
108
  --headed show the browser
74
109
  --headless hide it
75
110
  --verbose print each turn
111
+ --realtime let the game run between actions; by default a Godot game and a canvas game in the
112
+ browser stand still while the persona decides
76
113
  --skip-preflight register without the free checks first: the build health check (any driver)
77
114
  and the automation server probe (native drivers); the job is registered and
78
115
  charged even if the build or the server turns out to be down
@@ -166,6 +203,8 @@ export function buildProgram() {
166
203
  .option('--start <query>', 'open the build with this query or hash, such as ?level=3 or #boss')
167
204
  .option('--focus <goal>', 'a goal for every persona, such as "beat the first boss"; give it up to five times', (v, list) => [...list, v], [])
168
205
  .option('--avoid <thing>', 'something every persona stays out of, such as "the settings menu"; up to five times', (v, list) => [...list, v], [])
206
+ .option('--save <file>', 'a save file every persona starts from, at most 1 MiB; uploaded before the quote, free')
207
+ .option('--save-target <where>', 'where the game reads the save: localstorage:<key>, godot:user://<path>, idbfs:/<mount>/<path>, or hook (the default: the game reads it through window.RavensightPlaytest.save)')
169
208
  .requiredOption('--output <file>', 'save the original quote and immutable consent here')
170
209
  .option('--game <id>', 'game id, overriding this repo’s configuration')
171
210
  .addOption(new Option('--geri-provider <name>', "Geri's model provider: primary or alternate (ravensight.io/legal/subprocessors names both); unavailable choices are refused").choices(['primary', 'alternate']).conflicts('standardProvider'))
@@ -174,7 +213,7 @@ export function buildProgram() {
174
213
  .action(capture(slot, async (options, command) => {
175
214
  const { hostedQuote } = await import('./commands/hosted.js');
176
215
  return hostedQuote(flagsFrom(command.optsWithGlobals(), { build: options.build, profile: options.profile,
177
- persona: options.persona, personas: options.personas, tier: options.tier, minutes: options.minutes, start: options.start, focus: options.focus, avoid: options.avoid, output: options.output, game: options.game,
216
+ 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, output: options.output, game: options.game,
178
217
  geriProvider: options.geriProvider, standardProvider: options.standardProvider,
179
218
  video: options.video }));
180
219
  }));
@@ -188,6 +227,8 @@ export function buildProgram() {
188
227
  .option('--start <query>', 'open the build with this query or hash, such as ?level=3 or #boss')
189
228
  .option('--focus <goal>', 'a goal for every persona, such as "beat the first boss"; give it up to five times', (v, list) => [...list, v], [])
190
229
  .option('--avoid <thing>', 'something every persona stays out of, such as "the settings menu"; up to five times', (v, list) => [...list, v], [])
230
+ .option('--save <file>', 'a save file every persona starts from, at most 1 MiB; uploaded before the quote, free')
231
+ .option('--save-target <where>', 'where the game reads the save: localstorage:<key>, godot:user://<path>, idbfs:/<mount>/<path>, or hook (the default: the game reads it through window.RavensightPlaytest.save)')
191
232
  .option('--game <id>', 'game id, overriding this repo’s configuration')
192
233
  .option('--video', 'save a video of each persona\'s game session in its report')
193
234
  .option('--wait', 'stay until the report is ready, printing each phase change (with or without a saved quote)')
@@ -198,12 +239,12 @@ export function buildProgram() {
198
239
  .action(capture(slot, async (filename, options, command) => {
199
240
  const { hostedRun, hostedRunDirect } = await import('./commands/hosted.js');
200
241
  if (filename) {
201
- const extra = ['build', 'persona', 'personas', 'tier', 'minutes', 'start', 'game', 'video'].filter(name => options[name] !== undefined).concat(['focus', 'avoid'].filter(name => options[name]?.length));
242
+ 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));
202
243
  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.`);
203
244
  return hostedRun(filename, flagsFrom(command.optsWithGlobals(), { wait: options.wait, waitForCapacity: options.waitForCapacity,
204
245
  evenIfUnknown: options.evenIfUnknown }));
205
246
  }
206
- 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, game: options.game,
247
+ 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,
207
248
  video: options.video, wait: options.wait, waitForCapacity: options.waitForCapacity, evenIfUnknown: options.evenIfUnknown }));
208
249
  }));
209
250
  common(hosted.command('status [run-id]'))
@@ -278,7 +319,11 @@ export function buildProgram() {
278
319
  .option('--godot-path <path>', 'where Godot is, if it is not on the PATH')
279
320
  .option('--web', 'check the browser even when this repo is not linked to a web build')
280
321
  .option('--driver <name>', 'check the setup for this driver instead of the configured one')
281
- .option('--driver-config <file>', 'the native driver config to probe instead of the configured one')
322
+ .option('--driver-config <file>', 'the experimental native driver config to probe instead of the configured one')
323
+ .option('--godot-project <dir>', 'the Godot project a godot_driver run would play, read for controls with no text, fonts and a game state hook')
324
+ .option('--record-video', 'the run will pass --record-video, so the video row passes')
325
+ .option('--no-record-video', 'the run will pass --no-record-video, so the video row warns')
326
+ .option('--upload-video', 'the run will pass --upload-video, so the video row passes')
282
327
  .action(capture(slot, async options => {
283
328
  const { check } = await import('./commands/check.js');
284
329
  return check(flagsFrom(options, {
@@ -288,6 +333,10 @@ export function buildProgram() {
288
333
  modules: options.modules,
289
334
  personas: options.personas,
290
335
  godotPath: options.godotPath,
336
+ godotProject: options.godotProject,
337
+ recordVideo: options.recordVideo === true,
338
+ noRecordVideo: options.recordVideo === false,
339
+ uploadVideo: Boolean(options.uploadVideo),
291
340
  web: Boolean(options.web)
292
341
  }));
293
342
  }));
@@ -333,14 +382,15 @@ export function buildProgram() {
333
382
  .option('--game <gameId>', 'the game, when the job journal is missing')
334
383
  .option('--dry-upload', 'list what would be sent and send nothing')
335
384
  .option('--video', 'include the session video')
336
- .option('--transcript', 'include the transcript')
385
+ .option('--transcript', 'include the step log (transcript.jsonl); without a flag a job sends what its run decided, or, with no journal, sends it unless uploads.step_log is false')
386
+ .option('--no-step-log', 'leave the step log (transcript.jsonl) on this machine')
337
387
  .action(capture(slot, async (jobId, options) => {
338
388
  const { upload } = await import('./commands/upload.js');
339
389
  return upload(jobId, flagsFrom(options, {
340
390
  game: options.game,
341
391
  dryRun: Boolean(options.dryUpload),
342
392
  video: options.video,
343
- transcript: options.transcript
393
+ transcript: options.stepLog === false ? false : options.transcript
344
394
  }));
345
395
  }));
346
396
 
@@ -682,6 +732,15 @@ export function buildProgram() {
682
732
  */
683
733
  export async function main(argv = process.argv, options = {}) {
684
734
  const program = buildProgram();
735
+ // `<group> <sub> --help`, `help <group> <sub>` and `<group> help <sub>`
736
+ // print that subcommand's own help. Commander alone answered some of these
737
+ // with a parent's page (a paid proof run's "hosted run --help" printed the
738
+ // root help in 0.10.0), so the command asked about is found here first.
739
+ const asked = helpTarget(program, argv.slice(2));
740
+ if (asked) {
741
+ (options.write || (text => process.stdout.write(text)))(asked.helpInformation());
742
+ return ExitCode.OK;
743
+ }
685
744
  program.exitOverride();
686
745
  // Commander writes its own help and usage errors straight to the process
687
746
  // streams. Routing them through `options.write` lets a test drive the whole
@@ -704,6 +763,48 @@ export async function main(argv = process.argv, options = {}) {
704
763
  }
705
764
  }
706
765
 
766
+ /**
767
+ * The subcommand a help request is about, or null to leave the request (and
768
+ * every other command line) to commander. Walks the words in order: a
769
+ * subcommand's name goes one level down, an option is skipped with its value,
770
+ * and `--help`, `-h` or a bare `help` asks for help on where the walk stands.
771
+ * The root and a single command keep commander's own help.
772
+ *
773
+ * @param {import('commander').Command} program
774
+ * @param {Array<string>} args the words after the program name
775
+ * @returns {import('commander').Command|null}
776
+ */
777
+ export function helpTarget(program, args = []) {
778
+ let current = program;
779
+ let asked = false;
780
+ let depth = 0;
781
+ const optionsOf = command => {
782
+ const all = [];
783
+ for (let at = command; at; at = at.parent) all.push(...at.options);
784
+ return all;
785
+ };
786
+ for (let i = 0; i < args.length; i += 1) {
787
+ const word = String(args[i]);
788
+ if (word === '--') break;
789
+ if (word === '--help' || word === '-h') { asked = true; continue; }
790
+ if (word.startsWith('-')) {
791
+ const flag = word.split('=')[0];
792
+ const option = optionsOf(current).find(candidate => candidate.long === flag || candidate.short === flag);
793
+ const next = args[i + 1];
794
+ const isCommand = next !== undefined && current.commands.some(command => command.name() === String(next));
795
+ // A value follows an option that takes one; after an option this command does not know, a word that names no subcommand is taken as its value.
796
+ if (!word.includes('=') && next !== undefined && !String(next).startsWith('-') && (option ? option.required || (option.optional && !isCommand) : !isCommand)) i += 1;
797
+ continue;
798
+ }
799
+ const sub = current.commands.find(command => command.name() === word || command.aliases().includes(word));
800
+ if (sub) { current = sub; depth += 1; continue; }
801
+ if (word === 'help') { asked = true; continue; }
802
+ // A positional argument: the walk stands where it is.
803
+ break;
804
+ }
805
+ return asked && depth >= 2 ? current : null;
806
+ }
807
+
707
808
  /**
708
809
  * Turn a thrown thing into a printed message and an exit code.
709
810
  * @param {unknown} error
@@ -16,6 +16,7 @@ import { RUN_MODULES, defaultPersonasFor, describeBreakdown, personaCount, unkno
16
16
  import { WEBDRIVER_NAMES } from '../run/drivers/webdriver.js';
17
17
  import { inspectNativeBuild, probeAutomation, platformWords } from '../run/drivers/webdriver-probe.js';
18
18
  import { CHECK_PLAYTEST_IDENTITY, DEFAULT_VIEWPORT, WEB_OBSERVATION_MAX_CHARS, injectPlaytestIdentity, measureSnapshot, readSnapshot } from '../run/drivers/web.js';
19
+ import { inspectReadiness } from '../run/readiness.js';
19
20
  import path from 'node:path';
20
21
 
21
22
  export const NODE_MIN_MAJOR = 22;
@@ -316,7 +317,8 @@ export async function runChecks(flags = {}, deps = {}) {
316
317
  project: { game: null, environment: null, in_scope: null },
317
318
  brief: { present: null, complete: null, missing: [] },
318
319
  build: { driver: null, ref: null },
319
- automation: null
320
+ automation: null,
321
+ readiness: null
320
322
  };
321
323
 
322
324
  /* ------------------------------------------------------------- runtime */
@@ -453,6 +455,8 @@ export async function runChecks(flags = {}, deps = {}) {
453
455
  : flags.config;
454
456
  const gameId = flags.game || (config && config.game_id) || null;
455
457
  let inScope = null;
458
+ /** The brief's fields once read, for the full run rows. */
459
+ let briefFields = null;
456
460
  if (!gameId) {
457
461
  rows.push(row(
458
462
  'project binding',
@@ -495,6 +499,7 @@ export async function runChecks(flags = {}, deps = {}) {
495
499
  facts.brief = { present: false, complete: false, missing: [] };
496
500
  rows.push(row('brief', 'fail', 'this game has no expectations brief, and a persona run needs one', 'ravensight-playtest brief'));
497
501
  } else {
502
+ briefFields = current.fields || {};
498
503
  const completeness = completenessFor(current.fields || {});
499
504
  // The server's status is what `run` and `POST /jobs` act on. The local
500
505
  // field check only explains a draft, or flags a brief marked complete
@@ -699,6 +704,24 @@ export async function runChecks(flags = {}, deps = {}) {
699
704
  ));
700
705
  }
701
706
 
707
+ /* ------------------------------------------------- what makes a run thin */
708
+
709
+ // Read from this machine only, and warnings at most: a run that would come
710
+ // back thin is still a run the developer may want, so nothing here fails.
711
+ const godotProject = plan.driverName === 'godot_driver' && plan.target
712
+ ? path.resolve(repoRoot, plan.target)
713
+ : godot.isProject ? repoRoot : null;
714
+ const uploads = (config && config.uploads) || {};
715
+ const readiness = await (deps.inspectReadiness || inspectReadiness)({
716
+ fields: flags.briefFields || briefFields,
717
+ driverName: plan.driverName,
718
+ godotProject,
719
+ // A run keeps a video by default; only --no-record-video leaves it out.
720
+ video: Boolean(flags.recordVideo || flags.uploadVideo || uploads.video) || flags.noRecordVideo !== true
721
+ });
722
+ rows.push(...readiness.rows);
723
+ facts.readiness = readiness.facts;
724
+
702
725
  return { rows, ok: rows.every(entry => entry.status !== 'fail'), ...facts };
703
726
  }
704
727
 
@@ -722,7 +745,7 @@ export async function firstScreenRow(measure, url, { authed, gameId, priced }) {
722
745
  if (reasons.length === 0) {
723
746
  return row('first screen', 'pass', `${count(measure.fullChars)} characters, within the ${count(WEB_OBSERVATION_MAX_CHARS)} a persona reads per step`);
724
747
  }
725
- let prices = 'a long run costs twice a standard run; run shows the price before any charge';
748
+ let prices = 'a long run costs more than a standard run; run shows the price before any charge';
726
749
  if (priced && priced.modules.includes('persona_playtest') && authed && gameId) {
727
750
  try {
728
751
  // A read like the standard estimate above: it prices, it charges nothing.
@@ -735,7 +758,7 @@ export async function firstScreenRow(measure, url, { authed, gameId, priced }) {
735
758
  return row(
736
759
  'first screen',
737
760
  'warn',
738
- `${reasons.join('; ')}. Consider --long: twice the actions, model budget and wall time per persona (${prices})`,
761
+ `${reasons.join('; ')}. Consider --long: twice the actions and wall time and a larger model budget per persona (${prices})`,
739
762
  'ravensight-playtest run --long'
740
763
  );
741
764
  }
@@ -751,7 +774,7 @@ export const MAX_GAMES_LISTED = 5;
751
774
 
752
775
  export async function check(flags = {}, deps = {}) {
753
776
  const progress = flags.json ? {} : { onProgress: line => ui.info(line) };
754
- const { rows, ok, cli, login, project, brief, build, automation } = await runChecks(flags, { ...progress, ...deps });
777
+ const { rows, ok, cli, login, project, brief, build, automation, readiness } = await runChecks(flags, { ...progress, ...deps });
755
778
 
756
779
  if (flags.json) {
757
780
  ui.json({
@@ -764,6 +787,7 @@ export async function check(flags = {}, deps = {}) {
764
787
  brief,
765
788
  build,
766
789
  automation,
790
+ readiness,
767
791
  checks: rows
768
792
  });
769
793
  return ok ? ExitCode.OK : ExitCode.ENVIRONMENT;
@@ -780,6 +804,8 @@ export async function check(flags = {}, deps = {}) {
780
804
  }
781
805
  ui.blank();
782
806
  ui.info(NO_CHARGE_NOTE);
807
+ const thin = rows.filter(entry => entry.name.startsWith('full run:') && entry.status === 'warn').length;
808
+ if (ok && thin > 0) ui.info(`${thin} of the "full run" rows above ${thin === 1 ? 'is a warning' : 'are warnings'}: the run will start, and is likely to cover less than it could. Each row names its fix.`);
783
809
  if (ok) ui.ok('Ready.');
784
810
  else ui.error('Some checks failed. Fix the ones above and run check again.');
785
811
  return ok ? ExitCode.OK : ExitCode.ENVIRONMENT;