ravensight-playtest 0.8.2 → 0.9.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.
package/README.md CHANGED
@@ -1,71 +1,100 @@
1
1
  # ravensight-playtest
2
2
 
3
- Hosted playtests run your uploaded build on our machines instead of yours. One
4
- persona plays it twice, once with Geri and once with Freki, and the dashboard
5
- gets a report for each and a comparison. They use a separate command from the
6
- local `run`:
3
+ Cloud playtests run your uploaded build on our machines instead of yours, with
4
+ one playtester per persona: Geri and Freki play your game together, Geri
5
+ thinks and Freki acts. Each persona plays on its own cloud machine at the same
6
+ time, and the dashboard gets a report for each persona and one report that
7
+ covers them all. They use a separate command from the local `run`:
7
8
 
8
9
  ```sh
9
10
  ravensight-playtest hosted run --wait
11
+ ravensight-playtest hosted run --personas speedrunner,completionist --tier small --minutes 10 --focus "beat the first boss"
10
12
  ravensight-playtest hosted status ha_...
11
13
  ravensight-playtest hosted cancel ha_...
12
14
  ```
13
15
 
14
16
  `hosted run` uses the game this directory is linked to (or `--game`), picks the
15
17
  newest build that passed its static archive check on a ready profile (or the one
16
- named by `--build`), asks the server for a quote and prints it: each unit and
17
- its price, the hosted compute for each mode, the total and what is due now from
18
- prepaid funds, the expiry, and the statements you accept with it (the refund
19
- rules for a failed build and for cancellation, no network access for the game,
20
- the separate validation hold). It asks before it charges. `--yes` answers for
21
- you, a run with no terminal and no `--yes` is a no, and `--json` needs `--yes`.
22
- A balance that does not meet the quote's funding requirement stops before the
23
- question, and nothing is charged.
18
+ named by `--build`), asks the server for a quote and prints it: the tier and
19
+ play length, one line per persona with its price, any non-refundable setup fee,
20
+ the total and what is due now from prepaid funds, the expiry, and the
21
+ statements you accept with it (the refund rules for a failed build, for
22
+ cancellation and for a build too large for its tier, and the separate
23
+ validation hold). The whole total is reserved at once. It asks before it
24
+ charges. `--yes` answers for you, a run with no terminal and no `--yes` is a
25
+ no, and `--json` needs `--yes`. A balance that does not meet the quote's
26
+ funding requirement stops before the question, and nothing is charged.
24
27
 
25
28
  | Flag | Effect |
26
29
  |---|---|
27
30
  | `--build <id>` | Use this build instead of the newest ready one. |
28
- | `--persona <slug>` | The persona for both runs. Default `curious-kid`. |
29
- | `--video`, `--transcript` | Save video or transcripts of both sessions in their reports. Priced in the quote. |
30
- | `--wait` | Stay until the run finishes, printing each phase change and the queue place while it waits, then each mode's outcome. Works with a saved quote file too. |
31
+ | `--personas <list>` | More personas to add, comma separated. `fresh-eyes`, a first time player, is always included; each persona adds its own price. `ravensight-playtest personas` lists them. |
32
+ | `--tier <name>` | `jam`, `small`, `medium` or `large`. The default is the tier your build's size needs; a smaller one is refused before any charge. |
33
+ | `--minutes <n>` | Minutes of play per persona, from the tier's own length up to 120. Geri's thinking budget and the action limit grow with it, and so does the price. |
34
+ | `--start <query>` | Open the build with this query or hash, such as `?level=3` or `#boss`. It stays on your build. |
35
+ | `--focus <goal>` | A goal every persona puts first, such as "only test levels 3 to 5". Up to five times. |
36
+ | `--avoid <thing>` | Something every persona stays out of, such as "the settings menu". Up to five times. |
37
+ | `--video` | Save a video of each persona's session in its report. |
38
+ | `--wait` | Stay until the run finishes, printing each phase change and each persona's queue place while it waits, then each persona's outcome. Works with a saved quote file too. |
31
39
  | `--game <id>` | Override the linked game. |
40
+ | `--even-if-unknown` | Buy a run even though an earlier admission for this game has no known outcome yet. Without it, `hosted run` refuses before quoting while such a record exists, because that earlier run may have been charged: ask with `hosted status` first. |
41
+ | `-y, --yes` | Answer the price confirmation with yes. Needed without a terminal and with `--json`. |
42
+
43
+ The tiers, by unpacked build size: Jam (under 50 MB, 5 minutes), Small (under
44
+ 250 MB, 8 minutes), Medium (up to the hosted limit, 15 minutes) and Large (30
45
+ minutes on a bigger machine, with a non-refundable setup fee). The quote states
46
+ every price; the server computes it.
32
47
 
33
48
  `hosted run` prints the hosted run id and job id as soon as the run is admitted.
34
- A run waiting for a hosted machine shows its place, such as "Queued, position 2,
35
- expected to start in about 14 minutes" or "Queued, starting now", and `--wait`
36
- prints it again whenever it moves.
49
+ A persona waiting for a cloud machine shows its place, such as "speedrunner:
50
+ queued, position 2, expected to start in about 14 minutes", and `--wait` prints
51
+ it again whenever it moves.
37
52
 
38
53
  The phases are the dashboard's: queued, provisioning, running, capturing,
39
54
  analyzing, then report ready, failed or canceled. `hosted status <id>` prints
40
- the current one (`--wait` to follow it) with each mode's state and findings and
41
- the dashboard link to the report. With `--wait`, a failed run exits 1 and a
55
+ the current one (`--wait` to follow it) with each persona's state and findings
56
+ and the dashboard link to the report. With `--wait`, a failed run exits 1 and a
42
57
  canceled one exits 10. `hosted cancel <id>` asks first, then requests
43
- cancellation: work already done follows the accepted policy and unstarted work
44
- is refunded during settlement.
58
+ cancellation: work already done follows the accepted policy and each persona
59
+ that has not started is refunded during settlement.
60
+
61
+ If a persona's build is too large for the tier (it runs out of memory, the
62
+ browser crashes under memory pressure, or the frame rate stays too low to
63
+ play), that persona stops early. It keeps the machine time and model spend it
64
+ used plus the quote's under-scope fee, the rest of its price is refunded, and
65
+ the report names the tier to choose.
45
66
 
46
67
  To review a quote before paying, save it and confirm it later:
47
68
 
48
69
  ```sh
49
- ravensight-playtest hosted quote --game GAME --build BUILD --video --output hosted-quote.json
70
+ ravensight-playtest hosted quote --game GAME --build BUILD --personas speedrunner --video --output hosted-quote.json
50
71
  ravensight-playtest hosted run hosted-quote.json --wait
51
72
  ```
52
73
 
53
- `hosted quote` uses the same default persona as `hosted run`, `curious-kid`, and
54
- says so; `--persona` names another.
74
+ `hosted quote` takes the same personas, tier, length and focus as `hosted run`.
55
75
 
56
76
  `--profile` is needed only when the server advertises more than one build
57
- profile; the error lists them. The quote names the full Geri then Freki price, prepaid amount, evidence
77
+ profile; the error lists them. The quote names every persona's price, the prepaid amount, evidence
58
78
  options, expiry and refund rules. It charges nothing. `hosted run` confirms
59
79
  that saved quote before one admission request. Its durable journal blocks an
60
80
  automatic second POST after an uncertain outcome; preserve it for reconciliation.
61
81
  Both forms of `hosted run` keep that journal under `.ravensight/hosted-runs/`.
62
- When the server refuses the run with its own reason (busy capacity, funding,
63
- an expired quote), no run was started, nothing was charged and the journal is
64
- cleared, so the same command can be run again; it sends the same idempotency
65
- key, so the server can never admit it twice. Only an answer that never arrived
66
- leaves the outcome unknown. Then `hosted status`, with no run id, asks the
67
- server what happened once the quote has expired (so asking cannot start the
68
- run), records the run if it was admitted, and clears the journal if it was not.
82
+ When the server refuses the run with a reason of its own that proves nothing
83
+ was admitted (busy capacity, funding, the daily allowance, an expired quote),
84
+ no run was started, nothing was charged and the journal is cleared. Whether the
85
+ same saved quote can be run again depends on when the server refused it. A
86
+ refusal before the server records the attempt leaves the key free, so the same
87
+ command can run again under the same idempotency key and the server can still
88
+ never admit it twice. A refusal from inside the admission is kept by the server
89
+ under that key, so the same saved quote is refused from then on, and the
90
+ message asks for a new quote; `hosted run` without a quote file always quotes
91
+ afresh. A 404, 403 or 409 can also come back for an attempt the server
92
+ already holds, possibly admitted and charged, so it leaves the outcome unknown, like an answer that never arrived. Then
93
+ `hosted status`, with no run id, asks the server what happened once the quote
94
+ has expired (so asking cannot start the run), records the run if it was
95
+ admitted, and clears the journal only when the server says for certain that it
96
+ was not. While any outcome for the game is unknown, `hosted run` refuses to buy
97
+ another run unless `--even-if-unknown` is passed.
69
98
  A charged-blocked acknowledgement does not prove gameplay or a report. This
70
99
  command does not top up funds, change local run/report files or ask for model
71
100
  proxy permission on the CLI credential.
@@ -169,8 +198,8 @@ In CI, set `RAVENSIGHT_TOKEN` instead and skip `login` entirely.
169
198
  ## Upgrading to 0.3.2
170
199
 
171
200
  - **A plain `run` plays one persona, not two.** The default persona set is now
172
- `curious-kid` alone, so a first run costs one persona run. Name more with
173
- `--personas curious-kid,grumpy-veteran` (or `personas` in
201
+ `fresh-eyes` alone, so a first run costs one persona run. Name more with
202
+ `--personas fresh-eyes,grumpy-veteran` (or `personas` in
174
203
  `.ravensight/config.json`); `ravensight-playtest personas` lists the slugs.
175
204
  A script that relied on two personas by default has to name them.
176
205
  - **`run` checks the build before it prices anything.** A web build's URL has
@@ -357,8 +386,8 @@ default marked. A free read. Takes `--game <gameId>` and `--json`.
357
386
 
358
387
  Writes the expectations brief: your goals, what success looks like, how the game
359
388
  is controlled, where a persona starts. Then prints what the run `run` would
360
- start costs ("A run of 1 persona (curious-kid) would cost $1.00: a persona run
361
- $1.00 each"; the game profile is a separate job), whether your balance covers it, and, past 8 personas, the same wall-clock
389
+ start costs ("A run of 1 persona (fresh-eyes) would cost $5.60: a persona run
390
+ $5.60 each"; the game profile is a separate job), whether your balance covers it, and, past 8 personas, the same wall-clock
362
391
  warning `run` shows. A brief is required before `run`; the server answers 409
363
392
  `brief_required` without one.
364
393
 
@@ -369,7 +398,7 @@ warning `run` shows. A brief is required before `run`; the server answers 409
369
398
  | `--draft` | Save as a draft even when it looks complete. |
370
399
  | `--from <file>` | Read the fields from a JSON file instead of asking. |
371
400
  | `--game <gameId>` | The game, when this repo is not linked. |
372
- | `--modules <list>`, `--personas <list>` | Price this module and persona list in the estimate it prints. Every unit is named with its own price, such as "profile job $4.00, a persona run $1.00 each". |
401
+ | `--modules <list>`, `--personas <list>` | Price this module and persona list in the estimate it prints. Every unit is named with its own price, such as "profile job $8.40, a persona run $5.60 each". |
373
402
 
374
403
  #### The `brief --from` file
375
404
 
@@ -436,8 +465,8 @@ run options below.
436
465
  Registers a job, plays it, writes the reports, uploads them, finishes the job.
437
466
  Prints the price and asks before spending. Before any charge, even with
438
467
  `--yes`, it prints one bold line with the persona count and the total ("This
439
- run: 1 persona (curious-kid) on playwright_web, $1.00 in total: a persona run
440
- $1.00 each"), the balance, and what a persona run buys: the action budget (the
468
+ run: 1 persona (fresh-eyes) on playwright_web, $5.60 in total: a persona run
469
+ $5.60 each"), the balance, and what a persona run buys: the action budget (the
441
470
  persona's patience in the pack, lowered by `--max-actions` or the server's
442
471
  ceiling) and that sign-up alone can take 8 of those actions. A `test_account`
443
472
  in the brief lets the persona sign in instead. An unknown `--personas` slug is
@@ -485,7 +514,7 @@ splitting the job in two is what gets everything played.
485
514
  | Flag | Effect |
486
515
  |---|---|
487
516
  | `--game <gameId>` | The game, when this repo is not linked. |
488
- | `--personas <list>` | Comma separated persona slugs. Defaults to one, `curious-kid`; `ravensight-playtest personas` lists them. |
517
+ | `--personas <list>` | Comma separated persona slugs. Defaults to one, `fresh-eyes`; `ravensight-playtest personas` lists them. |
489
518
  | `--driver <name>` | `playwright_web`, `godot_driver`, `cli_stdio`, or a native driver: `desktop_driver`, `unity_driver`, `unreal_driver`, `android_driver`, `ios_driver`. |
490
519
  | `--build-url <url>` | The web build to play. |
491
520
  | `--godot-project <dir>` | The Godot project directory. A relative path is read from the repository root. |
@@ -497,14 +526,13 @@ splitting the job in two is what gets everything played.
497
526
  | `--max-actions <n>` | Lower the actions one persona may take. It can only lower the persona's own patience (and the server's per run ceiling), never raise it. |
498
527
  | `--long` | A long persona run: twice the actions, model budget and wall time of a standard run, at twice the price. The price is read from the estimate and confirmed before any charge. |
499
528
  | `--concurrency <n>` | Personas at once. Default the number `init` wrote, which is what `check` recommends for this machine. |
500
- | `--controller <name>` | One playthrough with `geri` or `freki` (CLI 0.8.0 or later). The server must advertise and quote that exact choice. |
501
- | `--compare-with freki` | Separate Geri and Freki playthroughs for each chosen persona. Shows their combined quote before purchase. Comparisons run one playthrough at a time. |
502
529
  | `--record-video` | Capture the selected web or graphical Godot game locally. Does not upload the video. |
503
530
  | `--upload-video` | Record and explicitly upload `session.webm` or `session.mp4` with the reports. |
504
531
  | `--upload-transcript` | Upload `transcript.jsonl` as well as the reports. |
505
532
  | `--dry-upload` | List every file and byte that would be sent, and send nothing. |
506
533
  | `--key-modifier <meta\|control>` | The modifier the browser driver uses for editing shortcuts such as select all. Defaults to this machine's own (Command on macOS, Control elsewhere); set it when the browser's platform is not this machine's. `RAVENSIGHT_KEY_MODIFIER` does the same. |
507
- | `--build-dir <dir>` | Serve an exported web build folder from this machine and play it: `index.html`, or the folder's one `.html` page (a Godot export named after the project). The local server sends `application/wasm`, Content-Encoding for Unity's Brotli and gzip files (`.br`, `.gz`), and cross-origin isolation, so threaded Godot, love.js and Emscripten builds get SharedArrayBuffer. `resume` serves the same folder again. Not with `--build-url`. |
534
+ | `--build-dir <dir>` | Serve an exported web build folder from this machine and play it: `index.html`, or the folder's one `.html` page (a Godot export named after the project). The local server sends `application/wasm`, Content-Encoding for Unity's Brotli and gzip files (`.br`, `.gz`), and cross-origin isolation, so threaded Godot, love.js and Emscripten builds get SharedArrayBuffer. `resume` serves the same folder again. Not with `--build-url`. The server answers only `127.0.0.1` or `localhost` on its own port and never serves dotfiles. |
535
+ | `--build-entry <file>` | The page to open inside `--build-dir` when the folder has more than one `.html` file, relative to it, such as `play.html`. |
508
536
  | `--headed`, `--headless` | Show or hide the browser. |
509
537
  | `--verbose` | Print each turn. |
510
538
 
@@ -738,7 +766,7 @@ open the pull request once you have read the diff.
738
766
 
739
767
  A fix attempt is one unit, refunded in full in three cases: the finding turns
740
768
  out to be design intent, the attempt changes nothing, or the game did not boot
741
- for the verify run, in which case the $5.00 comes back because the fix could
769
+ for the verify run, in which case the $18.60 comes back because the fix could
742
770
  not be verified. The verify run is included in the price, and the CLI always
743
771
  completes the verify run before the fix run so the server can read it.
744
772
 
@@ -1139,7 +1167,7 @@ ravensight-playtest run --driver playwright_web --build-url https://your-game.ex
1139
1167
 
1140
1168
  The server quotes every persona/playtester run before the CLI asks for payment.
1141
1169
  Each keeps its own existing model budget and settlement rules. Two standard runs
1142
- at the current $1 unit price total $2; the displayed server quote is authoritative.
1170
+ at the current $5.60 unit price total $11.20; the displayed server quote is authoritative.
1143
1171
  No comparison model call or extra recording fee is added. Use `--upload-video`
1144
1172
  instead of `--record-video` only when you want the videos uploaded for private
1145
1173
  dashboard playback. Recording is silent and captures only the selected game,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ravensight-playtest",
3
- "version": "0.8.2",
3
+ "version": "0.9.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",
package/src/cli.js CHANGED
@@ -52,15 +52,13 @@ async function loadRunner(name, exportName) {
52
52
  */
53
53
  export const RUNNER_HELP = `
54
54
  Run options (parsed by the runner, see src/run/args.js):
55
- --personas <list> comma separated persona slugs, default one (curious-kid); "personas" lists them
55
+ --personas <list> comma separated persona slugs, default one (fresh-eyes); "personas" lists them
56
56
  --driver <name> playwright_web, godot_driver, desktop_driver, unity_driver, unreal_driver, android_driver, ios_driver or cli_stdio
57
- --controller <name> one playtester: geri (studies each screen and chooses every action itself)
58
- or freki (picks each action from a short list of choices), if enabled
59
- --compare-with freki separate Geri and Freki playthroughs; quotes every run
60
57
  --record-video record this game locally; --upload-video also uploads it
61
58
  --build-url <url> the web build to play
62
59
  --build-dir <dir> a web export folder to serve from this machine and play: index.html or its one
63
60
  .html page, with wasm, Brotli and gzip engine files and threaded builds served right
61
+ --build-entry <file> the page to open inside --build-dir, when it has more than one .html file
64
62
  --godot-project <dir> the Godot project directory
65
63
  --driver-config <file> local WebDriver or JSON-RPC bridge configuration
66
64
  --max-actions <n> lower the actions one persona may take; it can only lower the persona's own patience, never raise it
@@ -156,12 +154,18 @@ function withoutFirst(values, value) {
156
154
  export function buildProgram() {
157
155
  const program = new Command();
158
156
  const slot = { code: ExitCode.OK };
159
- const hosted = common(program.command('hosted').description('run a server-hosted Geri and Freki playtest: quote, run, status and cancel'));
157
+ const hosted = common(program.command('hosted').description('run a cloud playtest, one playtester per persona (Geri and Freki play your game together): quote, run, status and cancel'));
160
158
  hosted.command('quote')
161
- .description('save a full hosted quote without charging or admitting a run')
159
+ .description('save a full cloud playtest quote, one line per persona, without charging or admitting a run')
162
160
  .requiredOption('--build <id>', 'an existing validated hosted build')
163
161
  .option('--profile <version>', 'hosted profile to quote; optional when the server advertises exactly one, otherwise the error lists the choices')
164
- .option('--persona <slug>', 'the persona that plays both runs (default: curious-kid, the same as hosted run)')
162
+ .option('--personas <list>', 'more personas to add, comma separated; fresh-eyes is always included and each persona adds its own price ("personas" lists them)')
163
+ .addOption(new Option('--persona <slug>').hideHelp())
164
+ .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']))
165
+ .option('--minutes <n>', 'minutes of play per persona, from the tier minimum up to 120; the price scales with it')
166
+ .option('--start <query>', 'open the build with this query or hash, such as ?level=3 or #boss')
167
+ .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
+ .option('--avoid <thing>', 'something every persona stays out of, such as "the settings menu"; up to five times', (v, list) => [...list, v], [])
165
169
  .requiredOption('--output <file>', 'save the original quote and immutable consent here')
166
170
  .option('--game <id>', 'game id, overriding this repo’s configuration')
167
171
  .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'))
@@ -170,32 +174,40 @@ export function buildProgram() {
170
174
  .action(capture(slot, async (options, command) => {
171
175
  const { hostedQuote } = await import('./commands/hosted.js');
172
176
  return hostedQuote(flagsFrom(command.optsWithGlobals(), { build: options.build, profile: options.profile,
173
- persona: options.persona, output: options.output, game: options.game,
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,
174
178
  geriProvider: options.geriProvider, standardProvider: options.standardProvider,
175
179
  video: options.video }));
176
180
  }));
177
181
  common(hosted.command('run [quote-file]'))
178
- .description('quote the newest ready build (or --build), confirm the price, and start one hosted Geri and Freki run; with a saved quote file, confirm that quote instead. Never retries an unknown outcome')
182
+ .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')
179
183
  .option('--build <id>', 'a build that passed its static archive check (default: the newest one)')
180
- .option('--persona <slug>', 'the persona that plays both runs (default: curious-kid)')
184
+ .option('--personas <list>', 'more personas to add, comma separated; fresh-eyes is always included and each persona adds its own price')
185
+ .addOption(new Option('--persona <slug>').hideHelp())
186
+ .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']))
187
+ .option('--minutes <n>', 'minutes of play per persona, from the tier minimum up to 120; the price scales with it')
188
+ .option('--start <query>', 'open the build with this query or hash, such as ?level=3 or #boss')
189
+ .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
+ .option('--avoid <thing>', 'something every persona stays out of, such as "the settings menu"; up to five times', (v, list) => [...list, v], [])
181
191
  .option('--game <id>', 'game id, overriding this repo’s configuration')
182
- .option('--video', 'save video of both game sessions in their reports')
192
+ .option('--video', 'save a video of each persona\'s game session in its report')
183
193
  .option('--wait', 'stay until the report is ready, printing each phase change (with or without a saved quote)')
194
+ .option('--even-if-unknown', 'buy a run even though an earlier admission for this game has no known outcome yet (it may have been charged; check it first with "hosted status")')
184
195
  // Hidden: the server now queues a funded run instead of refusing it for
185
196
  // capacity. Kept so an older server's busy answer can still be waited out.
186
197
  .addOption(new Option('--wait-for-capacity [minutes]', 'when hosted capacity is busy, ask again about once a minute and start when there is room, for up to this many minutes (default 60)').hideHelp())
187
198
  .action(capture(slot, async (filename, options, command) => {
188
199
  const { hostedRun, hostedRunDirect } = await import('./commands/hosted.js');
189
200
  if (filename) {
190
- const extra = ['build', 'persona', 'game', 'video'].filter(name => options[name] !== undefined);
191
- if (extra.length) throw new CliError(`A saved quote already fixes its build, persona and options. Drop --${extra.join(', --')}, or run "hosted run" without a quote file.`);
192
- return hostedRun(filename, flagsFrom(command.optsWithGlobals(), { wait: options.wait, waitForCapacity: options.waitForCapacity }));
201
+ const extra = ['build', 'persona', 'personas', 'tier', 'minutes', 'start', 'game', 'video'].filter(name => options[name] !== undefined).concat(['focus', 'avoid'].filter(name => options[name]?.length));
202
+ 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
+ return hostedRun(filename, flagsFrom(command.optsWithGlobals(), { wait: options.wait, waitForCapacity: options.waitForCapacity,
204
+ evenIfUnknown: options.evenIfUnknown }));
193
205
  }
194
- return hostedRunDirect(flagsFrom(command.optsWithGlobals(), { build: options.build, persona: options.persona, game: options.game,
195
- video: options.video, wait: options.wait, waitForCapacity: options.waitForCapacity }));
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,
207
+ video: options.video, wait: options.wait, waitForCapacity: options.waitForCapacity, evenIfUnknown: options.evenIfUnknown }));
196
208
  }));
197
209
  common(hosted.command('status [run-id]'))
198
- .description('show the phase of one hosted run (queued, provisioning, running, capturing, analyzing, report ready, failed or canceled), each mode and the report link; with no run id, ask the server about any admission whose outcome is not known yet')
210
+ .description('show the phase of one hosted run (queued, provisioning, running, capturing, analyzing, report ready, failed or canceled), each persona (with its queue place while it waits for a machine) and the report link; with no run id, ask the server about any admission whose outcome is not known yet')
199
211
  .option('--game <id>', 'game id, overriding this repo’s configuration')
200
212
  .option('--wait', 'stay until the run finishes, printing each phase change')
201
213
  .action(capture(slot, async (runId, options, command) => {
@@ -108,6 +108,7 @@ export function fakePack(overrides = {}) {
108
108
  return {
109
109
  pack_version: '1.0.0',
110
110
  personas: [
111
+ { slug: 'fresh-eyes', name: 'Fresh Eyes', patience_actions: 25, model_tier_hint: 'tier_fast', body: 'a first time player' },
111
112
  { slug: 'curious-kid', name: 'Curious Kid', patience_actions: 25, model_tier_hint: 'tier_fast', body: 'clicks everything' },
112
113
  { slug: 'grumpy-veteran', name: 'Grumpy Veteran', patience_actions: 30, model_tier_hint: 'tier_frontier', body: 'has seen it all' },
113
114
  { slug: 'speedrunner', name: 'Speedrunner', patience_actions: 40, model_tier_hint: 'tier_standard', body: 'goes fast' }
@@ -5,25 +5,40 @@ import { CliError, ExitCode } from '../errors.js';
5
5
  import { ui } from '../ui/index.js';
6
6
  import { quoteHostedRun, runHostedQuote, hostedQuoteLines, prepareHostedRun, admitHostedOffer, confirmQuestion,
7
7
  hostedConsentLines, fundingShortfall, readHostedRun, cancelHostedRun, GERI_PROVIDERS, admitWithCapacityWait,
8
- resolveHostedIntents } from '../hosted/recordedRun.js';
8
+ resolveHostedIntents, assertNoUnknownAdmission } from '../hosted/recordedRun.js';
9
9
  import { hostedPlaytestStatus, modeOutcomes, modeLine, TERMINAL_PHASES, queueInfo, queueLine } from '../hosted/status.js';
10
10
  import { jobLink } from '../dashboard.js';
11
- import { DEFAULT_PERSONAS } from '../runDefaults.js';
11
+ import { ALWAYS_INCLUDED_PERSONA, hostedPersonas } from '../runDefaults.js';
12
+ import { focusFor } from '../hosted/recordedRun.js';
13
+
14
+ /** --tier, --minutes, --start, --focus and --avoid as the quote request takes them. */
15
+ export function scopeFrom(flags = {}) {
16
+ const minutes = flags.minutes === undefined ? undefined : Number(flags.minutes);
17
+ const named = flags.start !== undefined || (flags.focus || []).length || (flags.avoid || []).length;
18
+ return { ...(flags.tier ? { tier: flags.tier } : {}), ...(minutes !== undefined ? { minutes } : {}),
19
+ ...(named ? { focus: focusFor({ start: flags.start, focus: flags.focus || [], avoid: flags.avoid || [] }) } : {}) };
20
+ }
21
+
22
+ /** The personas a cloud playtest asks for: fresh-eyes plus --personas (and the older --persona). */
23
+ export function personasFrom(flags = {}) {
24
+ const named = [flags.personas, flags.persona].filter(Boolean).join(',');
25
+ return hostedPersonas(named);
26
+ }
12
27
 
13
28
  export async function hostedQuote(flags = {}, deps = {}) {
14
29
  const context = deps.context || await createContext({ apiUrl: flags.apiUrl, repoRoot: flags.repoRoot, requireAuth: true });
15
- // The same default as "hosted run", so a quote and a run of the same build
16
- // match unless a persona is named.
17
- const persona = flags.persona || DEFAULT_PERSONAS[0];
30
+ // The same personas as "hosted run", so a quote and a run of the same build
31
+ // match: fresh-eyes always, plus any named.
32
+ const personas = personasFrom(flags);
18
33
  return withAuthHandling(context, async () => {
19
34
  const result = await quoteHostedRun({ api: context.api, apiUrl: context.api.apiUrl,
20
35
  gameId: resolveGameId(flags, context.config), buildId: flags.build, profileVersion: flags.profile,
21
- persona,
36
+ personas, ...scopeFrom(flags),
22
37
  standardProvider: flags.geriProvider ? GERI_PROVIDERS[flags.geriProvider] : flags.standardProvider, includeVideo: Boolean(flags.video),
23
38
  output: flags.output });
24
- if (flags.json) ui.json({ ...result, persona, personaDefaulted: !flags.persona });
39
+ if (flags.json) ui.json({ ...result, personas });
25
40
  else {
26
- if (!flags.persona) ui.info(`Persona: ${persona}, the default. Choose another with --persona.`);
41
+ if (personas.length === 1) ui.info(`Persona: ${ALWAYS_INCLUDED_PERSONA}, always included. Add others with --personas a,b.`);
27
42
  hostedQuoteLines(result).forEach(line => ui.info(line));
28
43
  ui.ok(`Saved ${result.quoteFile}. No admission or charge was requested.`);
29
44
  }
@@ -35,10 +50,10 @@ export async function hostedRun(filename, flags = {}, deps = {}) {
35
50
  if (flags.json && !flags.yes && !deps.confirm) throw new CliError('Inspect the saved quote, then use --yes with --json. No admission was requested.');
36
51
  const maxWaitMs = capacityWaitMs(flags.waitForCapacity);
37
52
  const context = deps.context || await createContext({ apiUrl: flags.apiUrl, repoRoot: flags.repoRoot, requireAuth: true });
38
- const now = deps.now || Date.now, sleep = deps.sleep || (() => sleepFor(POLL_MS));
53
+ const now = deps.now || Date.now, sleep = poller(deps);
39
54
  return withAuthHandling(context, async () => {
40
55
  const api = context.api, apiUrl = api.apiUrl;
41
- const result = await runHostedQuote({ filename, api, apiUrl, repoRoot: context.repoRoot, now,
56
+ const result = await runHostedQuote({ filename, api, apiUrl, repoRoot: context.repoRoot, now, evenIfUnknown: Boolean(flags.evenIfUnknown),
42
57
  confirm: deps.confirm || (question => ui.confirm(question, { yes: Boolean(flags.yes) })),
43
58
  onPrepared: offer => { if (!flags.json) hostedQuoteLines(offer).forEach(line => ui.info(line)); },
44
59
  admit: admitter(flags, deps, maxWaitMs) });
@@ -94,7 +109,10 @@ function admitter(flags, deps, maxWaitMs) {
94
109
 
95
110
  const POLL_MS = 15000;
96
111
  const dollars = cents => `$${(cents / 100).toFixed(2)}`;
97
- const sleepFor = ms => new Promise(resolve => { const timer = setTimeout(resolve, ms); if (timer.unref) timer.unref(); });
112
+ // Not unref'd: while --wait polls, this timer is the only thing keeping the
113
+ // process alive, and an unref'd one let it exit 0 after the first poll.
114
+ const sleepFor = ms => new Promise(resolve => setTimeout(resolve, ms));
115
+ const poller = deps => deps.sleep || (() => sleepFor(Number.isSafeInteger(deps.pollMs) && deps.pollMs > 0 ? deps.pollMs : POLL_MS));
98
116
 
99
117
  /** One status object for --json and for the printed lines. */
100
118
  function statusView(gameId, apiUrl, { admission, job, runs }, now = Date.now()) {
@@ -113,7 +131,7 @@ function statusView(gameId, apiUrl, { admission, job, runs }, now = Date.now())
113
131
  failure: status.failure || null,
114
132
  elapsedSeconds: status.elapsedSeconds,
115
133
  totalPriceCents: Number.isSafeInteger(admission.totalPriceCents) ? admission.totalPriceCents : null,
116
- modes: modeOutcomes(runs, Array.isArray(admission.controllers) ? admission.controllers : ['standard', 'jev']),
134
+ modes: modeOutcomes(runs, Array.isArray(admission.controllers) ? admission.controllers : ['standard', 'jev'], admission),
117
135
  summaryReport: job?.summary_report ?? null,
118
136
  reportUrl: admission.jobId ? jobLink(gameId, admission.jobId, apiUrl) : null,
119
137
  queue: status.phase === 'queued' ? queueInfo(admission) : null
@@ -124,7 +142,7 @@ function printOutcome(view, now = Date.now()) {
124
142
  ui.info(view.queue ? queueLine(view.queue, now) : `${view.label}. ${view.detail}`);
125
143
  if (view.failure) ui.info(`Reason: ${view.failure}`);
126
144
  if (view.cancelRequested && view.phase !== 'canceled') ui.info('Cancellation was requested.');
127
- if (TERMINAL_PHASES.includes(view.phase) || view.modes.some(row => row.state !== 'not_started')) view.modes.forEach(row => ui.info(modeLine(row)));
145
+ if (TERMINAL_PHASES.includes(view.phase) || view.modes.some(row => row.state !== 'not_started')) view.modes.forEach(row => ui.info(modeLine(row, now)));
128
146
  if (TERMINAL_PHASES.includes(view.phase) && !view.settled) ui.info('Refunds and cleanup are still settling.');
129
147
  if (view.reportUrl) ui.info(`Report: ${view.reportUrl}`);
130
148
  }
@@ -161,11 +179,12 @@ export async function hostedRunDirect(flags = {}, deps = {}) {
161
179
  if (flags.json && !flags.yes && !deps.confirm) throw new CliError('A hosted run charges prepaid funds. Use --yes with --json. Nothing was charged.');
162
180
  const maxWaitMs = capacityWaitMs(flags.waitForCapacity);
163
181
  const context = deps.context || await createContext({ apiUrl: flags.apiUrl, repoRoot: flags.repoRoot, requireAuth: true });
164
- const now = deps.now || Date.now, sleep = deps.sleep || (() => sleepFor(POLL_MS));
182
+ const now = deps.now || Date.now, sleep = poller(deps);
165
183
  return withAuthHandling(context, async () => {
166
184
  const api = context.api, apiUrl = api.apiUrl, gameId = resolveGameId(flags, context.config);
185
+ await assertNoUnknownAdmission({ repoRoot: context.repoRoot, apiUrl, gameId, evenIfUnknown: Boolean(flags.evenIfUnknown) });
167
186
  const { offer, build, funding } = await prepareHostedRun({ api, apiUrl, gameId, buildId: flags.build,
168
- persona: flags.persona || DEFAULT_PERSONAS[0], includeVideo: Boolean(flags.video), now });
187
+ personas: personasFrom(flags), ...scopeFrom(flags), includeVideo: Boolean(flags.video), now });
169
188
  if (!flags.json) {
170
189
  ui.info(`Build ${build.buildId}${build.entrypoint ? ` (${build.entrypoint})` : ''}${flags.build ? '' : ', the newest ready build'}.`);
171
190
  hostedQuoteLines(offer).forEach(line => ui.info(line));
@@ -185,7 +204,7 @@ export async function hostedRunDirect(flags = {}, deps = {}) {
185
204
  const { offer: admittedOffer, ...admitted } = await admitter(flags, deps, maxWaitMs)({ offer, api, apiUrl, repoRoot: context.repoRoot, now });
186
205
  const reportUrl = jobLink(gameId, admitted.jobId, apiUrl);
187
206
  const result = { state: admitted.state, admissionId: admitted.admissionId, jobId: admitted.jobId, gameId, buildId: build.buildId,
188
- persona: offer.request.personas[0], totalPriceCents: admitted.totalPriceCents, dueNowCents: admittedOffer.quote.dueNowCents,
207
+ personas: offer.request.personas, totalPriceCents: admitted.totalPriceCents, dueNowCents: admittedOffer.quote.dueNowCents,
189
208
  journal: admitted.journal, reportUrl, queue: admitted.queue || null };
190
209
  if (!flags.json) {
191
210
  ui.ok(`Paid ${dollars(admittedOffer.quote.dueNowCents)}. Hosted run ${admitted.admissionId}, job ${admitted.jobId}.`);
@@ -206,7 +225,7 @@ export async function hostedRunDirect(flags = {}, deps = {}) {
206
225
 
207
226
  export async function hostedStatus(admissionId, flags = {}, deps = {}) {
208
227
  const context = deps.context || await createContext({ apiUrl: flags.apiUrl, repoRoot: flags.repoRoot, requireAuth: true });
209
- const now = deps.now || Date.now, sleep = deps.sleep || (() => sleepFor(POLL_MS));
228
+ const now = deps.now || Date.now, sleep = poller(deps);
210
229
  if (!admissionId) {
211
230
  if (flags.wait) throw new CliError('Name the hosted run to wait for: hosted status <run-id> --wait.');
212
231
  return withAuthHandling(context, () => resolvePending(context, flags, now));
@@ -226,13 +245,41 @@ async function resolvePending(context, flags, now) {
226
245
  const results = await resolveHostedIntents({ api: context.api, apiUrl: context.api.apiUrl, repoRoot: context.repoRoot, now });
227
246
  if (flags.json) { ui.json({ intents: results.map(({ message, ...row }) => row) }); }
228
247
  else if (!results.length) ui.info('No hosted admission is waiting for an answer. Name a run to see it: ravensight-playtest hosted status <run-id>');
229
- else for (const row of results) {
230
- ui.info(row.message);
231
- if (row.state === 'admitted') ui.info(`Check on it with: ravensight-playtest hosted status ${row.admissionId}`);
232
- }
248
+ else pendingLines(results).forEach(line => ui.info(line));
233
249
  return results.some(row => ['unknown', 'unreadable', 'wait', 'other_api'].includes(row.state)) ? ExitCode.ENVIRONMENT : ExitCode.OK;
234
250
  }
235
251
 
252
+ const LISTED_QUOTES = 3;
253
+
254
+ /**
255
+ * The lines "hosted status" prints for resolved intents, in the resolver's
256
+ * order (admitted first, newest first). Several earlier attempts the server
257
+ * refused for one game collapse into one count line, because each charged
258
+ * nothing and a list of them beside a charged run reads as alarming.
259
+ */
260
+ export function pendingLines(results) {
261
+ const lines = [], refused = new Map();
262
+ for (const row of results) {
263
+ if (row.state === 'not_admitted') {
264
+ const key = row.gameId;
265
+ if (!refused.has(key)) refused.set(key, []);
266
+ refused.get(key).push(row);
267
+ continue;
268
+ }
269
+ lines.push(row.message);
270
+ if (row.state === 'admitted') lines.push(`Check on it with: ravensight-playtest hosted status ${row.admissionId}`);
271
+ }
272
+ for (const [gameId, rows] of refused) {
273
+ if (rows.length === 1) { lines.push(rows[0].message); continue; }
274
+ const times = rows.map(row => row.createdAt).filter(Boolean).sort();
275
+ const quotes = rows.map(row => row.quoteId).filter(Boolean);
276
+ const named = quotes.slice(0, LISTED_QUOTES).join(', ') + (quotes.length > LISTED_QUOTES ? `, and ${quotes.length - LISTED_QUOTES} more` : '');
277
+ const span = times.length ? `, saved from ${times[0]} to ${times.at(-1)},` : '';
278
+ lines.push(`Game ${gameId}: ${rows.length} earlier attempts${span} were refused by the server before admission${named ? ` (quotes ${named})` : ''}. Those attempts started no run and charged nothing; they say nothing about any other run. Their records are cleared.`);
279
+ }
280
+ return lines;
281
+ }
282
+
236
283
  export async function hostedCancel(admissionId, flags = {}, deps = {}) {
237
284
  if (flags.json && !flags.yes && !deps.confirm) throw new CliError('Use --yes with --json to cancel a hosted run. Nothing was canceled.');
238
285
  const context = deps.context || await createContext({ apiUrl: flags.apiUrl, repoRoot: flags.repoRoot, requireAuth: true });
@@ -313,7 +313,7 @@ async function run(flags, injected, deps, log) {
313
313
  modules,
314
314
  driver: driverName,
315
315
  target,
316
- ...(served ? { buildDir: served.root } : {}),
316
+ ...(served ? { buildDir: served.root, ...(options.buildEntry !== undefined ? { buildEntry: served.entry } : {}) } : {}),
317
317
  priceCents: registered.price && registered.price.price_cents,
318
318
  options: {
319
319
  maxActions: options.maxActions ?? null,
@@ -487,7 +487,13 @@ export function unusedFlagWarnings(options) {
487
487
  * @returns {Promise<{url: string, root: string, entry: string}|null|false>}
488
488
  */
489
489
  export async function serveBuildDirOption({ options, driverName, log, serve = serveBuildDir }) {
490
- if (options.buildDir === undefined) return null;
490
+ if (options.buildDir === undefined) {
491
+ if (options.buildEntry !== undefined) {
492
+ log('--build-entry names the page inside --build-dir. Pass --build-dir too. Nothing was registered or charged.');
493
+ return false;
494
+ }
495
+ return null;
496
+ }
491
497
  if (driverName !== 'playwright_web') {
492
498
  log(`--build-dir serves a web build, and this run uses ${driverName}. Nothing was registered or charged.`);
493
499
  return false;
@@ -497,7 +503,7 @@ export async function serveBuildDirOption({ options, driverName, log, serve = se
497
503
  return false;
498
504
  }
499
505
  try {
500
- const served = await serve(options.buildDir);
506
+ const served = await serve(options.buildDir, options.buildEntry === undefined ? {} : { entry: options.buildEntry });
501
507
  options.buildUrl = served.url;
502
508
  log(`Serving ${served.root} at ${served.url} (wasm, compressed engine files and cross-origin isolation for threaded builds).`);
503
509
  return served;
@@ -312,10 +312,18 @@ const MAX_LISTED = 10;
312
312
  * person can choose: nothing is guessed.
313
313
  * @returns {Promise<{entrypoint: string, reason: 'root'|'only-top-level'|'wrapped-folder'|'only-one'}>}
314
314
  */
315
+ // What macOS Finder adds to a ZIP it makes: the __MACOSX/ resource-fork tree,
316
+ // AppleDouble ._ files beside each file, and .DS_Store. None is ever the entry,
317
+ // and counting them would hide the one folder that holds the build.
318
+ const finderMetadata = name => {
319
+ const parts = name.split('/'), last = parts.at(-1);
320
+ return parts[0] === '__MACOSX' || last.startsWith('._') || last === '.DS_Store';
321
+ };
322
+
315
323
  export async function chooseEntrypoint(archive, { limits: supplied, format } = {}) {
316
324
  const kind = ENTRY_KINDS[format];
317
325
  if (!kind) throw new CliError('Choose the entry file inside the ZIP with --entrypoint. No upload reservation was requested.');
318
- const names = await archiveFileNames(archive, buildLimits(supplied));
326
+ const names = (await archiveFileNames(archive, buildLimits(supplied))).filter(name => !finderMetadata(name));
319
327
  const tops = new Set(names.map(name => name.split('/')[0]));
320
328
  const wrapped = names.length > 0 && names.every(name => name.includes('/')) && tops.size === 1;
321
329
  const base = wrapped ? `${[...tops][0]}/` : '';