ravensight-playtest 0.8.3 → 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 +54 -38
- package/package.json +1 -1
- package/src/cli.js +24 -15
- package/src/commands/fakeCore.js +1 -0
- package/src/commands/hosted.js +26 -11
- package/src/hosted/recordedRun.js +101 -25
- package/src/hosted/status.js +19 -10
- package/src/runDefaults.js +23 -2
package/README.md
CHANGED
|
@@ -1,62 +1,80 @@
|
|
|
1
1
|
# ravensight-playtest
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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:
|
|
17
|
-
|
|
18
|
-
prepaid funds, the expiry, and the
|
|
19
|
-
rules for a failed build
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
| `--
|
|
29
|
-
| `--
|
|
30
|
-
| `--
|
|
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. |
|
|
32
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. |
|
|
33
41
|
| `-y, --yes` | Answer the price confirmation with yes. Needed without a terminal and with `--json`. |
|
|
34
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.
|
|
47
|
+
|
|
35
48
|
`hosted run` prints the hosted run id and job id as soon as the run is admitted.
|
|
36
|
-
A
|
|
37
|
-
expected to start in about 14 minutes"
|
|
38
|
-
|
|
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.
|
|
39
52
|
|
|
40
53
|
The phases are the dashboard's: queued, provisioning, running, capturing,
|
|
41
54
|
analyzing, then report ready, failed or canceled. `hosted status <id>` prints
|
|
42
|
-
the current one (`--wait` to follow it) with each
|
|
43
|
-
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
|
|
44
57
|
canceled one exits 10. `hosted cancel <id>` asks first, then requests
|
|
45
|
-
cancellation: work already done follows the accepted policy and
|
|
46
|
-
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.
|
|
47
66
|
|
|
48
67
|
To review a quote before paying, save it and confirm it later:
|
|
49
68
|
|
|
50
69
|
```sh
|
|
51
|
-
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
|
|
52
71
|
ravensight-playtest hosted run hosted-quote.json --wait
|
|
53
72
|
```
|
|
54
73
|
|
|
55
|
-
`hosted quote`
|
|
56
|
-
says so; `--persona` names another.
|
|
74
|
+
`hosted quote` takes the same personas, tier, length and focus as `hosted run`.
|
|
57
75
|
|
|
58
76
|
`--profile` is needed only when the server advertises more than one build
|
|
59
|
-
profile; the error lists them. The quote names
|
|
77
|
+
profile; the error lists them. The quote names every persona's price, the prepaid amount, evidence
|
|
60
78
|
options, expiry and refund rules. It charges nothing. `hosted run` confirms
|
|
61
79
|
that saved quote before one admission request. Its durable journal blocks an
|
|
62
80
|
automatic second POST after an uncertain outcome; preserve it for reconciliation.
|
|
@@ -180,8 +198,8 @@ In CI, set `RAVENSIGHT_TOKEN` instead and skip `login` entirely.
|
|
|
180
198
|
## Upgrading to 0.3.2
|
|
181
199
|
|
|
182
200
|
- **A plain `run` plays one persona, not two.** The default persona set is now
|
|
183
|
-
`
|
|
184
|
-
`--personas
|
|
201
|
+
`fresh-eyes` alone, so a first run costs one persona run. Name more with
|
|
202
|
+
`--personas fresh-eyes,grumpy-veteran` (or `personas` in
|
|
185
203
|
`.ravensight/config.json`); `ravensight-playtest personas` lists the slugs.
|
|
186
204
|
A script that relied on two personas by default has to name them.
|
|
187
205
|
- **`run` checks the build before it prices anything.** A web build's URL has
|
|
@@ -368,8 +386,8 @@ default marked. A free read. Takes `--game <gameId>` and `--json`.
|
|
|
368
386
|
|
|
369
387
|
Writes the expectations brief: your goals, what success looks like, how the game
|
|
370
388
|
is controlled, where a persona starts. Then prints what the run `run` would
|
|
371
|
-
start costs ("A run of 1 persona (
|
|
372
|
-
$
|
|
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
|
|
373
391
|
warning `run` shows. A brief is required before `run`; the server answers 409
|
|
374
392
|
`brief_required` without one.
|
|
375
393
|
|
|
@@ -380,7 +398,7 @@ warning `run` shows. A brief is required before `run`; the server answers 409
|
|
|
380
398
|
| `--draft` | Save as a draft even when it looks complete. |
|
|
381
399
|
| `--from <file>` | Read the fields from a JSON file instead of asking. |
|
|
382
400
|
| `--game <gameId>` | The game, when this repo is not linked. |
|
|
383
|
-
| `--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 $
|
|
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". |
|
|
384
402
|
|
|
385
403
|
#### The `brief --from` file
|
|
386
404
|
|
|
@@ -447,8 +465,8 @@ run options below.
|
|
|
447
465
|
Registers a job, plays it, writes the reports, uploads them, finishes the job.
|
|
448
466
|
Prints the price and asks before spending. Before any charge, even with
|
|
449
467
|
`--yes`, it prints one bold line with the persona count and the total ("This
|
|
450
|
-
run: 1 persona (
|
|
451
|
-
$
|
|
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
|
|
452
470
|
persona's patience in the pack, lowered by `--max-actions` or the server's
|
|
453
471
|
ceiling) and that sign-up alone can take 8 of those actions. A `test_account`
|
|
454
472
|
in the brief lets the persona sign in instead. An unknown `--personas` slug is
|
|
@@ -496,7 +514,7 @@ splitting the job in two is what gets everything played.
|
|
|
496
514
|
| Flag | Effect |
|
|
497
515
|
|---|---|
|
|
498
516
|
| `--game <gameId>` | The game, when this repo is not linked. |
|
|
499
|
-
| `--personas <list>` | Comma separated persona slugs. Defaults to one, `
|
|
517
|
+
| `--personas <list>` | Comma separated persona slugs. Defaults to one, `fresh-eyes`; `ravensight-playtest personas` lists them. |
|
|
500
518
|
| `--driver <name>` | `playwright_web`, `godot_driver`, `cli_stdio`, or a native driver: `desktop_driver`, `unity_driver`, `unreal_driver`, `android_driver`, `ios_driver`. |
|
|
501
519
|
| `--build-url <url>` | The web build to play. |
|
|
502
520
|
| `--godot-project <dir>` | The Godot project directory. A relative path is read from the repository root. |
|
|
@@ -508,8 +526,6 @@ splitting the job in two is what gets everything played.
|
|
|
508
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. |
|
|
509
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. |
|
|
510
528
|
| `--concurrency <n>` | Personas at once. Default the number `init` wrote, which is what `check` recommends for this machine. |
|
|
511
|
-
| `--controller <name>` | One playthrough with `geri` or `freki` (CLI 0.8.0 or later). The server must advertise and quote that exact choice. |
|
|
512
|
-
| `--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. |
|
|
513
529
|
| `--record-video` | Capture the selected web or graphical Godot game locally. Does not upload the video. |
|
|
514
530
|
| `--upload-video` | Record and explicitly upload `session.webm` or `session.mp4` with the reports. |
|
|
515
531
|
| `--upload-transcript` | Upload `transcript.jsonl` as well as the reports. |
|
|
@@ -750,7 +766,7 @@ open the pull request once you have read the diff.
|
|
|
750
766
|
|
|
751
767
|
A fix attempt is one unit, refunded in full in three cases: the finding turns
|
|
752
768
|
out to be design intent, the attempt changes nothing, or the game did not boot
|
|
753
|
-
for the verify run, in which case the $
|
|
769
|
+
for the verify run, in which case the $18.60 comes back because the fix could
|
|
754
770
|
not be verified. The verify run is included in the price, and the CLI always
|
|
755
771
|
completes the verify run before the fix run so the server can read it.
|
|
756
772
|
|
|
@@ -1151,7 +1167,7 @@ ravensight-playtest run --driver playwright_web --build-url https://your-game.ex
|
|
|
1151
1167
|
|
|
1152
1168
|
The server quotes every persona/playtester run before the CLI asks for payment.
|
|
1153
1169
|
Each keeps its own existing model budget and settlement rules. Two standard runs
|
|
1154
|
-
at the current $
|
|
1170
|
+
at the current $5.60 unit price total $11.20; the displayed server quote is authoritative.
|
|
1155
1171
|
No comparison model call or extra recording fee is added. Use `--upload-video`
|
|
1156
1172
|
instead of `--record-video` only when you want the videos uploaded for private
|
|
1157
1173
|
dashboard playback. Recording is silent and captures only the selected game,
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -52,11 +52,8 @@ 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 (
|
|
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
|
|
@@ -157,12 +154,18 @@ function withoutFirst(values, value) {
|
|
|
157
154
|
export function buildProgram() {
|
|
158
155
|
const program = new Command();
|
|
159
156
|
const slot = { code: ExitCode.OK };
|
|
160
|
-
const hosted = common(program.command('hosted').description('run a
|
|
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'));
|
|
161
158
|
hosted.command('quote')
|
|
162
|
-
.description('save a full
|
|
159
|
+
.description('save a full cloud playtest quote, one line per persona, without charging or admitting a run')
|
|
163
160
|
.requiredOption('--build <id>', 'an existing validated hosted build')
|
|
164
161
|
.option('--profile <version>', 'hosted profile to quote; optional when the server advertises exactly one, otherwise the error lists the choices')
|
|
165
|
-
.option('--
|
|
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], [])
|
|
166
169
|
.requiredOption('--output <file>', 'save the original quote and immutable consent here')
|
|
167
170
|
.option('--game <id>', 'game id, overriding this repo’s configuration')
|
|
168
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'))
|
|
@@ -171,16 +174,22 @@ export function buildProgram() {
|
|
|
171
174
|
.action(capture(slot, async (options, command) => {
|
|
172
175
|
const { hostedQuote } = await import('./commands/hosted.js');
|
|
173
176
|
return hostedQuote(flagsFrom(command.optsWithGlobals(), { build: options.build, profile: options.profile,
|
|
174
|
-
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,
|
|
175
178
|
geriProvider: options.geriProvider, standardProvider: options.standardProvider,
|
|
176
179
|
video: options.video }));
|
|
177
180
|
}));
|
|
178
181
|
common(hosted.command('run [quote-file]'))
|
|
179
|
-
.description('quote the newest ready build (or --build), confirm the price, and start
|
|
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')
|
|
180
183
|
.option('--build <id>', 'a build that passed its static archive check (default: the newest one)')
|
|
181
|
-
.option('--
|
|
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], [])
|
|
182
191
|
.option('--game <id>', 'game id, overriding this repo’s configuration')
|
|
183
|
-
.option('--video', 'save video of
|
|
192
|
+
.option('--video', 'save a video of each persona\'s game session in its report')
|
|
184
193
|
.option('--wait', 'stay until the report is ready, printing each phase change (with or without a saved quote)')
|
|
185
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")')
|
|
186
195
|
// Hidden: the server now queues a funded run instead of refusing it for
|
|
@@ -189,16 +198,16 @@ export function buildProgram() {
|
|
|
189
198
|
.action(capture(slot, async (filename, options, command) => {
|
|
190
199
|
const { hostedRun, hostedRunDirect } = await import('./commands/hosted.js');
|
|
191
200
|
if (filename) {
|
|
192
|
-
const extra = ['build', 'persona', 'game', 'video'].filter(name => options[name] !== undefined);
|
|
193
|
-
if (extra.length) throw new CliError(`A saved quote already fixes its build,
|
|
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.`);
|
|
194
203
|
return hostedRun(filename, flagsFrom(command.optsWithGlobals(), { wait: options.wait, waitForCapacity: options.waitForCapacity,
|
|
195
204
|
evenIfUnknown: options.evenIfUnknown }));
|
|
196
205
|
}
|
|
197
|
-
return hostedRunDirect(flagsFrom(command.optsWithGlobals(), { build: options.build, persona: options.persona, game: options.game,
|
|
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,
|
|
198
207
|
video: options.video, wait: options.wait, waitForCapacity: options.waitForCapacity, evenIfUnknown: options.evenIfUnknown }));
|
|
199
208
|
}));
|
|
200
209
|
common(hosted.command('status [run-id]'))
|
|
201
|
-
.description('show the phase of one hosted run (queued, provisioning, running, capturing, analyzing, report ready, failed or canceled), each
|
|
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')
|
|
202
211
|
.option('--game <id>', 'game id, overriding this repo’s configuration')
|
|
203
212
|
.option('--wait', 'stay until the run finishes, printing each phase change')
|
|
204
213
|
.action(capture(slot, async (runId, options, command) => {
|
package/src/commands/fakeCore.js
CHANGED
|
@@ -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' }
|
package/src/commands/hosted.js
CHANGED
|
@@ -8,22 +8,37 @@ import { quoteHostedRun, runHostedQuote, hostedQuoteLines, prepareHostedRun, adm
|
|
|
8
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 {
|
|
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
|
|
16
|
-
// match
|
|
17
|
-
const
|
|
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
|
-
|
|
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,
|
|
39
|
+
if (flags.json) ui.json({ ...result, personas });
|
|
25
40
|
else {
|
|
26
|
-
if (
|
|
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
|
}
|
|
@@ -116,7 +131,7 @@ function statusView(gameId, apiUrl, { admission, job, runs }, now = Date.now())
|
|
|
116
131
|
failure: status.failure || null,
|
|
117
132
|
elapsedSeconds: status.elapsedSeconds,
|
|
118
133
|
totalPriceCents: Number.isSafeInteger(admission.totalPriceCents) ? admission.totalPriceCents : null,
|
|
119
|
-
modes: modeOutcomes(runs, Array.isArray(admission.controllers) ? admission.controllers : ['standard', 'jev']),
|
|
134
|
+
modes: modeOutcomes(runs, Array.isArray(admission.controllers) ? admission.controllers : ['standard', 'jev'], admission),
|
|
120
135
|
summaryReport: job?.summary_report ?? null,
|
|
121
136
|
reportUrl: admission.jobId ? jobLink(gameId, admission.jobId, apiUrl) : null,
|
|
122
137
|
queue: status.phase === 'queued' ? queueInfo(admission) : null
|
|
@@ -127,7 +142,7 @@ function printOutcome(view, now = Date.now()) {
|
|
|
127
142
|
ui.info(view.queue ? queueLine(view.queue, now) : `${view.label}. ${view.detail}`);
|
|
128
143
|
if (view.failure) ui.info(`Reason: ${view.failure}`);
|
|
129
144
|
if (view.cancelRequested && view.phase !== 'canceled') ui.info('Cancellation was requested.');
|
|
130
|
-
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)));
|
|
131
146
|
if (TERMINAL_PHASES.includes(view.phase) && !view.settled) ui.info('Refunds and cleanup are still settling.');
|
|
132
147
|
if (view.reportUrl) ui.info(`Report: ${view.reportUrl}`);
|
|
133
148
|
}
|
|
@@ -169,7 +184,7 @@ export async function hostedRunDirect(flags = {}, deps = {}) {
|
|
|
169
184
|
const api = context.api, apiUrl = api.apiUrl, gameId = resolveGameId(flags, context.config);
|
|
170
185
|
await assertNoUnknownAdmission({ repoRoot: context.repoRoot, apiUrl, gameId, evenIfUnknown: Boolean(flags.evenIfUnknown) });
|
|
171
186
|
const { offer, build, funding } = await prepareHostedRun({ api, apiUrl, gameId, buildId: flags.build,
|
|
172
|
-
|
|
187
|
+
personas: personasFrom(flags), ...scopeFrom(flags), includeVideo: Boolean(flags.video), now });
|
|
173
188
|
if (!flags.json) {
|
|
174
189
|
ui.info(`Build ${build.buildId}${build.entrypoint ? ` (${build.entrypoint})` : ''}${flags.build ? '' : ', the newest ready build'}.`);
|
|
175
190
|
hostedQuoteLines(offer).forEach(line => ui.info(line));
|
|
@@ -189,7 +204,7 @@ export async function hostedRunDirect(flags = {}, deps = {}) {
|
|
|
189
204
|
const { offer: admittedOffer, ...admitted } = await admitter(flags, deps, maxWaitMs)({ offer, api, apiUrl, repoRoot: context.repoRoot, now });
|
|
190
205
|
const reportUrl = jobLink(gameId, admitted.jobId, apiUrl);
|
|
191
206
|
const result = { state: admitted.state, admissionId: admitted.admissionId, jobId: admitted.jobId, gameId, buildId: build.buildId,
|
|
192
|
-
|
|
207
|
+
personas: offer.request.personas, totalPriceCents: admitted.totalPriceCents, dueNowCents: admittedOffer.quote.dueNowCents,
|
|
193
208
|
journal: admitted.journal, reportUrl, queue: admitted.queue || null };
|
|
194
209
|
if (!flags.json) {
|
|
195
210
|
ui.ok(`Paid ${dollars(admittedOffer.quote.dueNowCents)}. Hosted run ${admitted.admissionId}, job ${admitted.jobId}.`);
|
|
@@ -8,10 +8,19 @@ import { printable } from '../ui/index.js';
|
|
|
8
8
|
import { chooseProfile } from './buildUpload.js';
|
|
9
9
|
import { displayName } from '../run/controllers.js';
|
|
10
10
|
import { queueInfo } from './status.js';
|
|
11
|
+
import { ALWAYS_INCLUDED_PERSONA, MAX_HOSTED_PERSONAS, hostedPersonas } from '../runDefaults.js';
|
|
11
12
|
|
|
12
13
|
const MAX_QUOTE_BYTES = 1024 * 1024;
|
|
13
14
|
const CONSENT_KEYS = ['quoteId', 'planHash', 'profileVersion', 'controllers', 'includeVideo', 'includeTranscript',
|
|
14
15
|
'totalPriceCents', 'dueNowCents', 'priceVersion', 'policyVersion'];
|
|
16
|
+
// The cloud playtest customers buy: one playtester per persona, Geri planning
|
|
17
|
+
// and Freki acting in the same run (the server's wire id `combined`). The
|
|
18
|
+
// separate Geri then Freki comparison stays readable for saved quotes and
|
|
19
|
+
// evaluation, but nothing in the CLI offers it any more.
|
|
20
|
+
export const COMBINED = Object.freeze(['combined']);
|
|
21
|
+
export const COMPARISON = Object.freeze(['standard', 'jev']);
|
|
22
|
+
const isCombined = controllers => same(controllers, COMBINED);
|
|
23
|
+
const slug = value => typeof value === 'string' && value.length <= 48 && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value);
|
|
15
24
|
const PROVIDERS = ['anthropic', 'openai'];
|
|
16
25
|
// Customers choose Geri's model provider by role, never by vendor name. The
|
|
17
26
|
// server's wire values stay; ravensight.io/legal/subprocessors names both.
|
|
@@ -62,22 +71,47 @@ export async function readHostedQuote(filename) {
|
|
|
62
71
|
} finally { await handle.close(); }
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
74
|
+
/**
|
|
75
|
+
* The quote request. A combined playtest names fresh-eyes first and each
|
|
76
|
+
* other persona once; a comparison (saved by an older CLI) names one persona.
|
|
77
|
+
*/
|
|
78
|
+
export const TIERS = Object.freeze(['jam', 'small', 'medium', 'large']);
|
|
79
|
+
const plainLine = value => typeof value === 'string' && value.trim().length > 0 && value.length <= 200 && !/[\u0000-\u001f\u007f]/.test(value);
|
|
80
|
+
/** The focus block: a start query or hash, and up to five focus and avoid lines. */
|
|
81
|
+
export function focusFor({ start, focus = [], avoid = [] } = {}) {
|
|
82
|
+
if (start !== undefined && start !== null && start !== '' && (typeof start !== 'string' || !/^[?#][^\s\\]{0,199}$/.test(start))) fail('Choose --start as a query or hash on the build, such as ?level=3 or #boss.');
|
|
83
|
+
for (const [name, list] of [['--focus', focus], ['--avoid', avoid]]) {
|
|
84
|
+
if (!Array.isArray(list) || list.length > 5 || !list.every(plainLine)) fail(`Give ${name} at most five times, each plain text of at most 200 characters.`);
|
|
85
|
+
}
|
|
86
|
+
return { ...(start ? { start } : {}), focus: focus.map(x => x.trim()), avoid: avoid.map(x => x.trim()) };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function requestFor({ buildId, profileVersion, personas, controllers = COMBINED, standardProvider, includeVideo = false, includeTranscript = false, tier, minutes, focus }, profile) {
|
|
90
|
+
const combined = isCombined(controllers);
|
|
91
|
+
if (!combined && !same(controllers, COMPARISON)) fail('Choose a cloud playtest the server sells.');
|
|
92
|
+
const list = combined ? hostedPersonas(personas) : personas;
|
|
93
|
+
if (!id(buildId) || !id(profileVersion) || !Array.isArray(list) || !list.length || !list.every(slug)
|
|
94
|
+
|| new Set(list).size !== list.length) fail('Choose a validated build, a ready profile and persona slugs such as fresh-eyes.');
|
|
95
|
+
if (combined && (list[0] !== ALWAYS_INCLUDED_PERSONA || list.length > MAX_HOSTED_PERSONAS)) fail(`Choose at most ${MAX_HOSTED_PERSONAS} personas, ${ALWAYS_INCLUDED_PERSONA} included.`);
|
|
96
|
+
if (!combined && list.length !== 1) fail('A saved comparison names one persona.');
|
|
68
97
|
if (standardProvider !== undefined && !PROVIDERS.includes(standardProvider)) fail('Choose primary or alternate for the Geri model provider.');
|
|
69
98
|
if (typeof includeVideo !== 'boolean' || typeof includeTranscript !== 'boolean') fail('Choose explicit video and transcript options.');
|
|
70
|
-
|
|
99
|
+
if (tier !== undefined && (!combined || !TIERS.includes(tier))) fail(`Choose --tier from ${TIERS.join(', ')}.`);
|
|
100
|
+
if (minutes !== undefined && (!combined || !Number.isSafeInteger(minutes) || minutes < 1 || minutes > 120)) fail('Choose --minutes as whole minutes, from the tier minimum up to 120.');
|
|
101
|
+
return { kind: 'recorded_graphical', buildId, personas: [...list], controllers: [...controllers],
|
|
71
102
|
driver: profile.driver, runLength: 'standard', profileVersion, includeVideo, includeTranscript,
|
|
72
|
-
...(standardProvider === undefined ? {} : { standardProvider })
|
|
103
|
+
...(standardProvider === undefined ? {} : { standardProvider }),
|
|
104
|
+
...(combined && tier !== undefined ? { tier } : {}), ...(combined && minutes !== undefined ? { minutes } : {}),
|
|
105
|
+
...(combined && focus !== undefined ? { focus } : {}) };
|
|
73
106
|
}
|
|
74
107
|
|
|
75
|
-
async function available(api, gameId, profileVersion, standardProvider) {
|
|
108
|
+
async function available(api, gameId, profileVersion, standardProvider, controllers = COMBINED) {
|
|
76
109
|
const answer = await api.request('GET', `${base(gameId)}/run-capabilities`, { idempotent: true });
|
|
77
110
|
const caps = answer.body, recorded = caps?.recorded;
|
|
78
111
|
if (!recorded?.available || recorded.intakeEnabled !== true || !Array.isArray(recorded.profiles)
|
|
79
|
-
|| !Array.isArray(recorded.controllers) || !
|
|
80
|
-
fail('This server does not currently
|
|
112
|
+
|| !Array.isArray(recorded.controllers) || !controllers.every(value => recorded.controllers.includes(value))) {
|
|
113
|
+
fail(isCombined(controllers) ? 'This server does not currently sell cloud playtests where Geri and Freki play together. Nothing was charged.'
|
|
114
|
+
: 'This server does not currently advertise ready hosted Geri and Freki runs. Nothing was charged.');
|
|
81
115
|
}
|
|
82
116
|
// The same rule as "build upload": the one named, or the only one
|
|
83
117
|
// advertised; with several and none named, the error lists them.
|
|
@@ -98,9 +132,11 @@ function sum(rows, value) {
|
|
|
98
132
|
}
|
|
99
133
|
|
|
100
134
|
export function hostedConsent(quote, request, now = Date.now()) {
|
|
135
|
+
const combined = isCombined(request.controllers);
|
|
101
136
|
if (!quote || quote.kind !== 'recorded_graphical' || !/^hq_[a-f0-9-]{36}$/.test(quote.quoteId || '') || !hex(quote.planHash)
|
|
102
137
|
|| quote.buildId !== request.buildId || quote.profileVersion !== request.profileVersion || quote.driver !== request.driver
|
|
103
|
-
|| !same(quote.controllers,
|
|
138
|
+
|| !same(quote.controllers, request.controllers) || (combined && !same(quote.personas, request.personas))
|
|
139
|
+
|| quote.includeVideo !== request.includeVideo || quote.includeTranscript !== request.includeTranscript
|
|
104
140
|
|| quote.currency !== 'USD' || !Number.isSafeInteger(quote.expiresAt) || quote.expiresAt <= now
|
|
105
141
|
|| !['localPriceCents', 'computePriceCents', 'totalPriceCents', 'dueNowCents', 'alreadyReservedCents'].every(key => cents(quote[key]))
|
|
106
142
|
|| quote.totalPriceCents < 1 || BigInt(quote.localPriceCents) + BigInt(quote.computePriceCents) !== BigInt(quote.totalPriceCents)
|
|
@@ -109,21 +145,39 @@ export function hostedConsent(quote, request, now = Date.now()) {
|
|
|
109
145
|
|| !['refund', 'retain'].includes(quote.cancelAfterStart)) fail('The server quote changed or expired. Nothing was charged; request a fresh quote.');
|
|
110
146
|
if (!Array.isArray(quote.localBreakdown) || !quote.localBreakdown.length || !quote.localBreakdown.every(row => id(row.unit) && cents(row.unitCents) && Number.isSafeInteger(row.count) && row.count > 0)
|
|
111
147
|
|| sum(quote.localBreakdown, row => BigInt(row.count) * BigInt(row.unitCents)) !== quote.localPriceCents
|
|
112
|
-
|| !Array.isArray(quote.computeBreakdown) || quote.computeBreakdown.length !== 2
|
|
113
|
-
|| !quote.computeBreakdown.every((row, index) => row.controller === request.
|
|
114
|
-
|
|
148
|
+
|| !Array.isArray(quote.computeBreakdown) || quote.computeBreakdown.length !== (combined ? request.personas.length : 2)
|
|
149
|
+
|| !quote.computeBreakdown.every((row, index) => (combined ? row.controller === 'combined' && row.persona === request.personas[index] : row.controller === request.controllers[index])
|
|
150
|
+
&& row.profileVersion === request.profileVersion && cents(row.priceCents))
|
|
151
|
+
|| sum(quote.computeBreakdown, row => BigInt(row.priceCents)) !== quote.computePriceCents) fail(combined ? 'The server did not quote a price for every persona. Nothing was charged.' : 'The server did not quote every Geri and Freki price. Nothing was charged.');
|
|
152
|
+
if (combined && (quote.localBreakdown.length !== 1 || quote.localBreakdown[0].count !== request.personas.length
|
|
153
|
+
|| !Array.isArray(quote.personaPrices) || quote.personaPrices.length !== request.personas.length
|
|
154
|
+
|| !quote.personaPrices.every((row, i) => row.persona === request.personas[i] && cents(row.priceCents))
|
|
155
|
+
|| sum(quote.personaPrices, row => BigInt(row.priceCents)) !== quote.totalPriceCents
|
|
156
|
+
|| !TIERS.includes(quote.tier) || (request.tier !== undefined && quote.tier !== request.tier)
|
|
157
|
+
|| !Number.isSafeInteger(quote.minutes) || (request.minutes !== undefined && quote.minutes !== request.minutes)
|
|
158
|
+
|| !cents(quote.setupFeeCents) || !cents(quote.underScopeFeeCents) || !quote.focus || typeof quote.focus !== 'object')) fail('The server did not quote a price for every persona. Nothing was charged.');
|
|
115
159
|
const explicit = request.standardProvider !== undefined;
|
|
116
160
|
if (explicit ? quote.standardProvider !== request.standardProvider || !hex(quote.standardProviderPolicyHash)
|
|
117
161
|
: Object.hasOwn(quote, 'standardProvider') || Object.hasOwn(quote, 'standardProviderPolicyHash')) {
|
|
118
162
|
fail('The quoted Geri provider policy does not match the requested choice. Nothing was charged.');
|
|
119
163
|
}
|
|
120
|
-
return Object.fromEntries([...CONSENT_KEYS, ...(explicit ? ['standardProvider', 'standardProviderPolicyHash'] : [])].map(key => [key, quote[key]]));
|
|
164
|
+
return Object.fromEntries([...CONSENT_KEYS, ...(combined ? ['personas', 'tier', 'minutes', 'focus', 'setupFeeCents', 'underScopeFeeCents'] : []), ...(explicit ? ['standardProvider', 'standardProviderPolicyHash'] : [])].map(key => [key, quote[key]]));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* What each persona costs in a combined quote: its play unit plus its own
|
|
169
|
+
* machine's compute, the two charges the server makes per persona.
|
|
170
|
+
* @returns {Array<{persona: string, priceCents: number}>}
|
|
171
|
+
*/
|
|
172
|
+
export function personaPrices(quote, request) {
|
|
173
|
+
if (!isCombined(request.controllers)) return [];
|
|
174
|
+
return quote.personaPrices.map(row => ({ persona: row.persona, priceCents: row.priceCents }));
|
|
121
175
|
}
|
|
122
176
|
|
|
123
177
|
export function validateHostedOffer(offer, apiUrl, now = Date.now()) {
|
|
124
178
|
if (offer?.schema !== 'ravensight-hosted-recorded-quote/v1' || !offer.request || !offer.quote || !id(offer.gameId) || offer.apiUrl !== origin(apiUrl)
|
|
125
179
|
|| offer.integrity !== digest({ apiUrl: offer.apiUrl, gameId: offer.gameId, request: offer.request, quote: offer.quote, consent: offer.consent })) fail('The saved quote does not match this API or its original contents. Nothing was charged.');
|
|
126
|
-
const request = requestFor({ ...offer.request
|
|
180
|
+
const request = requestFor({ ...offer.request }, { driver: offer.request.driver });
|
|
127
181
|
if (!same(request, offer.request) || !same(hostedConsent(offer.quote, request, now), offer.consent)) fail('The saved quote request or consent changed. Nothing was charged.');
|
|
128
182
|
return offer;
|
|
129
183
|
}
|
|
@@ -133,7 +187,7 @@ export async function quoteHostedRun({ api, apiUrl, gameId, output, now = Date.n
|
|
|
133
187
|
try { await access(output); fail('That saved quote already exists. Choose a new output path; the original was preserved.'); }
|
|
134
188
|
catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
135
189
|
const { profile } = await available(api, gameId, options.profileVersion, options.standardProvider);
|
|
136
|
-
const request = requestFor({ ...options, profileVersion: profile.profileVersion }, profile);
|
|
190
|
+
const request = requestFor({ ...options, controllers: COMBINED, profileVersion: profile.profileVersion }, profile);
|
|
137
191
|
const response = await api.request('POST', `${base(gameId)}/quotes`, { body: request, idempotent: false });
|
|
138
192
|
if (response.status !== 200) fail('The server did not return a hosted quote. No admission was requested.');
|
|
139
193
|
const quote = response.body, consent = hostedConsent(quote, request, now());
|
|
@@ -145,6 +199,23 @@ export async function quoteHostedRun({ api, apiUrl, gameId, output, now = Date.n
|
|
|
145
199
|
|
|
146
200
|
export function hostedQuoteLines(offer) {
|
|
147
201
|
const { quote: q, request: r } = offer;
|
|
202
|
+
if (isCombined(r.controllers)) {
|
|
203
|
+
const focus = q.focus || {};
|
|
204
|
+
return [`Game ${offer.gameId}; build ${r.buildId}; profile ${r.profileVersion}.`,
|
|
205
|
+
'One playtester per persona: Geri and Freki play your game together, Geri thinks and Freki acts. Each persona plays on its own cloud machine, at the same time as the others, and one report covers them all.',
|
|
206
|
+
`Tier ${q.tier}, ${q.minutes} minutes of play per persona.`,
|
|
207
|
+
...(focus.start ? [`Start: ${printable(focus.start)}`] : []),
|
|
208
|
+
...(focus.focus?.length ? [`Focus: ${focus.focus.map(printable).join('; ')}`] : []),
|
|
209
|
+
...(focus.avoid?.length ? [`Avoid: ${focus.avoid.map(printable).join('; ')}`] : []),
|
|
210
|
+
...(r.standardProvider ? [`Geri's model provider: ${providerLabel(r.standardProvider)}; policy ${q.standardProviderPolicyHash}.`] : []),
|
|
211
|
+
...personaPrices(q, r).map(row => `${row.persona}${row.persona === ALWAYS_INCLUDED_PERSONA ? ' (always included)' : ''}: ${money(row.priceCents)}.`),
|
|
212
|
+
...(q.setupFeeCents ? [`Includes a non-refundable setup fee: ${money(q.setupFeeCents)} (${money(q.setupFeeCents / r.personas.length)} a persona). It is kept even when a persona is refunded, unless it never got a machine.`] : []),
|
|
213
|
+
`Total ${money(q.totalPriceCents)} for ${r.personas.length} persona${r.personas.length === 1 ? '' : 's'}; already reserved ${money(q.alreadyReservedCents)}; due now ${money(q.dueNowCents)} from prepaid funds. No top-up is performed.`,
|
|
214
|
+
`Video: ${r.includeVideo ? 'included' : 'off'}. Cloud playtests save no transcript.`,
|
|
215
|
+
`If a persona fails or is canceled, the per run refund policy applies to that persona: customer failure ${q.customerFailure}, cancellation after start ${q.cancelAfterStart}. Price ${q.priceVersion}; refund policy ${q.policyVersion}.`,
|
|
216
|
+
`If the build is too large for this tier, that persona stops early and keeps the machine time and model spend it used plus a ${money(q.underScopeFeeCents)} fee; the rest of its price is refunded and the report names the tier to choose.`,
|
|
217
|
+
`Quote expires ${new Date(q.expiresAt).toISOString()}.`];
|
|
218
|
+
}
|
|
148
219
|
return [`Game ${offer.gameId}; build ${r.buildId}; persona ${r.personas[0]}; profile ${r.profileVersion}.`,
|
|
149
220
|
`Two separate playthroughs: Geri (${r.standardProvider ? providerLabel(r.standardProvider) : 'server default model provider'}) then Freki.`,
|
|
150
221
|
...(r.standardProvider ? [`Geri provider policy: ${q.standardProviderPolicyHash}.`] : []),
|
|
@@ -190,7 +261,7 @@ export async function runHostedQuote({ filename, api, apiUrl, repoRoot, confirm,
|
|
|
190
261
|
}
|
|
191
262
|
if (prior) fail(`This quote's earlier admission has no known outcome yet (${journal}). Ask the server what happened with: ravensight-playtest hosted status. No request was repeated.`);
|
|
192
263
|
await assertNoUnknownAdmission({ repoRoot, apiUrl, gameId: offer.gameId, evenIfUnknown });
|
|
193
|
-
const { profile, funding } = await available(api, offer.gameId, offer.request.profileVersion, offer.request.standardProvider);
|
|
264
|
+
const { profile, funding } = await available(api, offer.gameId, offer.request.profileVersion, offer.request.standardProvider, offer.request.controllers);
|
|
194
265
|
if (profile.driver !== offer.request.driver || funding?.eligible === false || offer.quote.funding?.eligible === false) fail('The server no longer advertises this profile or sufficient prepaid funding. Nothing was charged.');
|
|
195
266
|
await onPrepared(offer);
|
|
196
267
|
if (typeof confirm !== 'function') fail('The full hosted quote must be confirmed before admission.');
|
|
@@ -198,7 +269,9 @@ export async function runHostedQuote({ filename, api, apiUrl, repoRoot, confirm,
|
|
|
198
269
|
return admit({ offer, api, apiUrl, repoRoot, now });
|
|
199
270
|
}
|
|
200
271
|
|
|
201
|
-
export const confirmQuestion = offer =>
|
|
272
|
+
export const confirmQuestion = offer => isCombined(offer.request.controllers)
|
|
273
|
+
? `Pay ${money(offer.quote.dueNowCents)} now (${money(offer.quote.totalPriceCents)} total) for ${offer.request.personas.length} persona${offer.request.personas.length === 1 ? '' : 's'}, one playtester each, and the evidence options shown?`
|
|
274
|
+
: `Pay ${money(offer.quote.dueNowCents)} now (${money(offer.quote.totalPriceCents)} total) for the quoted Geri then Freki runs and the evidence options shown?`;
|
|
202
275
|
|
|
203
276
|
// Refusals the server makes with its own code that prove nothing was admitted
|
|
204
277
|
// under this key. Each one is thrown only before the server records an
|
|
@@ -466,7 +539,7 @@ export async function assertNoUnknownAdmission({ repoRoot, apiUrl, gameId, evenI
|
|
|
466
539
|
|
|
467
540
|
// The terms a person accepted. A fresh quote taken while waiting for capacity
|
|
468
541
|
// must match them exactly, or nothing is admitted without asking again.
|
|
469
|
-
const TERMS = ['buildId', 'profileVersion', 'driver', 'controllers', 'includeVideo', 'includeTranscript', 'currency',
|
|
542
|
+
const TERMS = ['buildId', 'profileVersion', 'driver', 'controllers', 'personas', 'tier', 'minutes', 'focus', 'setupFeeCents', 'underScopeFeeCents', 'personaPrices', 'includeVideo', 'includeTranscript', 'currency',
|
|
470
543
|
'localPriceCents', 'computePriceCents', 'totalPriceCents', 'dueNowCents', 'alreadyReservedCents', 'localBreakdown',
|
|
471
544
|
'computeBreakdown', 'priceVersion', 'policyVersion', 'customerFailure', 'cancelAfterStart', 'standardProvider',
|
|
472
545
|
'standardProviderPolicyHash'];
|
|
@@ -474,7 +547,7 @@ const sameTerms = (a, b) => TERMS.every(key => same(a[key] ?? null, b[key] ?? nu
|
|
|
474
547
|
|
|
475
548
|
/** A fresh quote for exactly the request of an accepted offer. Charges nothing. */
|
|
476
549
|
export async function requoteOffer({ api, apiUrl, offer, now = Date.now }) {
|
|
477
|
-
const { profile, funding } = await available(api, offer.gameId, offer.request.profileVersion, offer.request.standardProvider);
|
|
550
|
+
const { profile, funding } = await available(api, offer.gameId, offer.request.profileVersion, offer.request.standardProvider, offer.request.controllers);
|
|
478
551
|
if (profile.driver !== offer.request.driver) fail('The server no longer advertises this build profile. No run was started and nothing was charged.');
|
|
479
552
|
const response = await api.request('POST', `${base(offer.gameId)}/quotes`, { body: offer.request, idempotent: false });
|
|
480
553
|
if (response.status !== 200) fail('The server did not return a hosted quote. No run was started and nothing was charged.');
|
|
@@ -545,11 +618,12 @@ export function eligibleHostedBuilds(builds, profiles, now = Date.now()) {
|
|
|
545
618
|
}
|
|
546
619
|
|
|
547
620
|
/**
|
|
548
|
-
* Quote a
|
|
549
|
-
*
|
|
550
|
-
* hand back the same offer shape `hosted quote`
|
|
621
|
+
* Quote a cloud playtest without a saved quote file: pick the build (the
|
|
622
|
+
* newest eligible one unless named), ask for a quote for fresh-eyes plus the
|
|
623
|
+
* named personas, check it, and hand back the same offer shape `hosted quote`
|
|
624
|
+
* saves. Charges nothing.
|
|
551
625
|
*/
|
|
552
|
-
export async function prepareHostedRun({ api, apiUrl, gameId, buildId,
|
|
626
|
+
export async function prepareHostedRun({ api, apiUrl, gameId, buildId, personas = [], tier, minutes, focus, includeVideo = false, includeTranscript = false, standardProvider, now = Date.now }) {
|
|
553
627
|
if (!id(gameId)) fail('Choose a game. Nothing was charged.');
|
|
554
628
|
const answer = await api.request('GET', `${base(gameId)}/run-capabilities`, { idempotent: true });
|
|
555
629
|
const recorded = answer.body?.recorded;
|
|
@@ -569,7 +643,7 @@ export async function prepareHostedRun({ api, apiUrl, gameId, buildId, persona,
|
|
|
569
643
|
if (!build) fail('No build is ready for a hosted run. Upload one with "build upload" and wait for its static archive check. Nothing was charged.');
|
|
570
644
|
}
|
|
571
645
|
const { profile, funding } = await available(api, gameId, build.profileVersion, standardProvider);
|
|
572
|
-
const request = requestFor({ buildId: build.buildId, profileVersion: build.profileVersion,
|
|
646
|
+
const request = requestFor({ buildId: build.buildId, profileVersion: build.profileVersion, personas, controllers: COMBINED, standardProvider, includeVideo, includeTranscript, tier, minutes, focus }, profile);
|
|
573
647
|
const response = await api.request('POST', `${base(gameId)}/quotes`, { body: request, idempotent: false });
|
|
574
648
|
if (response.status !== 200) fail('The server did not return a hosted quote. Nothing was charged.');
|
|
575
649
|
const quote = response.body, consent = hostedConsent(quote, request, now());
|
|
@@ -589,7 +663,9 @@ export function fundingShortfall(quote, funding) {
|
|
|
589
663
|
export function hostedConsentLines(offer) {
|
|
590
664
|
const q = offer.quote;
|
|
591
665
|
return [
|
|
592
|
-
|
|
666
|
+
isCombined(offer.request.controllers)
|
|
667
|
+
? 'Each persona is one AI playtester, Geri and Freki together, on its own isolated cloud machine. These are AI playtests, not human feedback. The whole total is reserved now; a persona that never starts is refunded.'
|
|
668
|
+
: 'One persona plays the same build twice, once with Geri and once with Freki, on isolated hosted machines. These are AI playtests, not human feedback.',
|
|
593
669
|
'The game runs without network access. Shared capacity, daily limits and the quoted runtime bounds still apply; funding does not guarantee an immediate start.',
|
|
594
670
|
`If the build fails, hosted compute is ${q.customerFailure === 'refund' ? 'refunded' : 'kept'}. Canceling after a confirmed start ${q.cancelAfterStart === 'refund' ? 'refunds' : 'keeps'} that run's compute charge. Unstarted work is refunded during settlement.`,
|
|
595
671
|
'The build\'s validation hold is separate and is returned after safe cleanup. It does not reduce this price.',
|
package/src/hosted/status.js
CHANGED
|
@@ -40,7 +40,7 @@ export function hostedPlaytestStatus(admission, job = null, runs = [], now = Dat
|
|
|
40
40
|
} else if (job?.summary_report === 'ready' || admissionState === 'recorded_closed') {
|
|
41
41
|
phase = 'report-ready'; label = 'Report ready'; detail = 'The hosted run and report are complete.';
|
|
42
42
|
} else if (['aggregating', 'uploading'].includes(jobState) || ['reporting', 'uploading'].includes(aggregate?.state)) {
|
|
43
|
-
phase = 'analyzing'; label = 'Analyzing'; detail = 'Combining the completed playtests into
|
|
43
|
+
phase = 'analyzing'; label = 'Analyzing'; detail = 'Combining the completed playtests into one report.';
|
|
44
44
|
} else if (plays.some(row => ['reporting', 'uploading'].includes(row.state))) {
|
|
45
45
|
phase = 'capturing'; label = 'Capturing results'; detail = 'Saving the playtest report, evidence and requested media.';
|
|
46
46
|
} else if (plays.some(row => row.state === 'playing') || jobState === 'running') {
|
|
@@ -74,19 +74,27 @@ export function hostedPlaytestStatus(admission, job = null, runs = [], now = Dat
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
|
-
* One row per
|
|
78
|
-
*
|
|
77
|
+
* One row per playtester, from the job's persona runs. A combined cloud
|
|
78
|
+
* playtest has one row per persona (each its own Geri and Freki run, named by
|
|
79
|
+
* the persona); an older comparison has one row per mode (Geri, Freki). A row
|
|
80
|
+
* whose run the server has not created yet reads as not started, and a row
|
|
81
|
+
* still waiting for a cloud machine carries its own queue place.
|
|
79
82
|
* @param {Array<object>} runs
|
|
80
83
|
* @param {Array<string>} [controllers]
|
|
84
|
+
* @param {{personas?: Array<string>, personaRuns?: Array<object>}} [admission]
|
|
81
85
|
*/
|
|
82
|
-
export function modeOutcomes(runs = [], controllers = ['standard', 'jev']) {
|
|
86
|
+
export function modeOutcomes(runs = [], controllers = ['standard', 'jev'], admission = {}) {
|
|
83
87
|
const plays = (Array.isArray(runs) ? runs : []).filter(row => row.module !== 'aggregate_report');
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
const combined = Array.isArray(controllers) && controllers.length === 1 && controllers[0] === 'combined';
|
|
89
|
+
const keys = combined ? (Array.isArray(admission?.personas) ? admission.personas : [...new Set(plays.map(row => row.persona))]) : controllers;
|
|
90
|
+
return keys.map(key => {
|
|
91
|
+
const run = (combined ? plays.find(row => row.persona === key) : plays.find(row => row.controller === key)) || null;
|
|
86
92
|
const report = run?.report || null;
|
|
93
|
+
const waiting = combined && Array.isArray(admission?.personaRuns) ? queueInfo(admission.personaRuns.find(row => row?.persona === key)) : null;
|
|
87
94
|
return {
|
|
88
|
-
mode:
|
|
89
|
-
name: DISPLAY_NAMES[
|
|
95
|
+
mode: combined ? 'combined' : key,
|
|
96
|
+
name: combined ? key : DISPLAY_NAMES[key] || 'Playtester',
|
|
97
|
+
...(combined ? { persona: key, queue: waiting } : {}),
|
|
90
98
|
runId: run?.run_id || null,
|
|
91
99
|
state: run?.state || 'not_started',
|
|
92
100
|
reason: run?.state_reason ? boundedReason(run.state_reason) : null,
|
|
@@ -98,8 +106,9 @@ export function modeOutcomes(runs = [], controllers = ['standard', 'jev']) {
|
|
|
98
106
|
});
|
|
99
107
|
}
|
|
100
108
|
|
|
101
|
-
/** "Geri: completed, 4 findings, video saved." */
|
|
102
|
-
export function modeLine(row) {
|
|
109
|
+
/** "Geri: completed, 4 findings, video saved." or "speedrunner: queued, position 2, ..." */
|
|
110
|
+
export function modeLine(row, now = Date.now()) {
|
|
111
|
+
if (row.queue && row.state === 'queued') return `${row.name}: ${queueLine(row.queue, now).replace(/^Queued/, 'queued')}`;
|
|
103
112
|
const parts = [row.state.replace(/_/g, ' ')];
|
|
104
113
|
if (row.findings !== null) parts.push(`${row.findings} finding${row.findings === 1 ? '' : 's'}`);
|
|
105
114
|
if (row.wouldContinue !== null) parts.push(row.wouldContinue ? 'would keep playing' : 'would stop playing');
|
package/src/runDefaults.js
CHANGED
|
@@ -8,9 +8,30 @@
|
|
|
8
8
|
* Personas used when the developer names none. One since 0.3.2: a first run
|
|
9
9
|
* should cost one persona run, and a second persona is one `--personas` away.
|
|
10
10
|
* Spec 17 defaulted to two, which made the default run cost twice what most
|
|
11
|
-
* customers expected to pay for a first look.
|
|
11
|
+
* customers expected to pay for a first look. Since 0.9.0 the one is
|
|
12
|
+
* fresh-eyes, the general first time player, the same persona a cloud
|
|
13
|
+
* playtest always includes.
|
|
12
14
|
*/
|
|
13
|
-
export const DEFAULT_PERSONAS = Object.freeze(['
|
|
15
|
+
export const DEFAULT_PERSONAS = Object.freeze(['fresh-eyes']);
|
|
16
|
+
|
|
17
|
+
/** The persona every cloud playtest includes; the customer adds others. */
|
|
18
|
+
export const ALWAYS_INCLUDED_PERSONA = 'fresh-eyes';
|
|
19
|
+
|
|
20
|
+
/** The most personas one cloud playtest may name, fresh-eyes included (the server's own limit). */
|
|
21
|
+
export const MAX_HOSTED_PERSONAS = 10;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The persona list a cloud playtest asks for: fresh-eyes first, then each
|
|
25
|
+
* persona named once, in the order given.
|
|
26
|
+
*
|
|
27
|
+
* @param {Array<string>|string} [extra]
|
|
28
|
+
* @returns {Array<string>}
|
|
29
|
+
*/
|
|
30
|
+
export function hostedPersonas(extra = []) {
|
|
31
|
+
const named = (Array.isArray(extra) ? extra : String(extra || '').split(','))
|
|
32
|
+
.map(slug => String(slug).trim()).filter(Boolean);
|
|
33
|
+
return [...new Set([ALWAYS_INCLUDED_PERSONA, ...named])];
|
|
34
|
+
}
|
|
14
35
|
|
|
15
36
|
/** The modules `run` registers. `aggregate_report` is free and buys the aggregate's steps. */
|
|
16
37
|
export const RUN_MODULES = Object.freeze(['persona_playtest', 'aggregate_report']);
|