ravensight-playtest 0.7.2 → 0.8.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,7 +1,7 @@
1
1
  # ravensight-playtest
2
2
 
3
3
  Hosted playtests run your uploaded build on our machines instead of yours. One
4
- persona plays it twice, once with Standard and once with Jev, and the dashboard
4
+ persona plays it twice, once with Geri and once with Freki, and the dashboard
5
5
  gets a report for each and a comparison. They use a separate command from the
6
6
  local `run`:
7
7
 
@@ -41,11 +41,12 @@ is refunded during settlement.
41
41
  To review a quote before paying, save it and confirm it later:
42
42
 
43
43
  ```sh
44
- ravensight-playtest hosted quote --game GAME --build BUILD --profile PROFILE --persona curious-kid --video --output hosted-quote.json
44
+ ravensight-playtest hosted quote --game GAME --build BUILD --persona curious-kid --video --output hosted-quote.json
45
45
  ravensight-playtest hosted run hosted-quote.json
46
46
  ```
47
47
 
48
- The quote names the full Standard then Jev price, prepaid amount, evidence
48
+ `--profile` is needed only when the server advertises more than one build
49
+ profile; the error lists them. The quote names the full Geri then Freki price, prepaid amount, evidence
49
50
  options, expiry and refund rules. It charges nothing. `hosted run` confirms
50
51
  that saved quote before one admission request. Its durable journal blocks an
51
52
  automatic second POST after an uncertain outcome; preserve it for reconciliation.
@@ -54,8 +55,10 @@ A charged-blocked acknowledgement does not prove gameplay or a report. This
54
55
  command does not top up funds, change local run/report files or ask for model
55
56
  proxy permission on the CLI credential.
56
57
 
57
- On a server that advertises it as ready, `hosted quote --standard-provider openai`
58
- selects OpenAI for Standard. Explicit `anthropic` works the same way. The returned
58
+ On a server that advertises it as ready, `hosted quote --geri-provider alternate`
59
+ selects Geri's alternate model provider, and `primary` selects the primary one.
60
+ The [subprocessors page](https://www.ravensight.io/legal/subprocessors/) names
61
+ both. The returned
59
62
  provider and policy hash must match and remain in the saved consent; `hosted run`
60
63
  has no provider override. Omitting the flag keeps the original default request
61
64
  and consent wire. No choice falls back to another provider, and a CLI declaration
@@ -66,14 +69,20 @@ The hosted build command source adds a local check before a paid upload:
66
69
 
67
70
  ```sh
68
71
  ravensight-playtest build preflight ./game.zip --format web --entrypoint index.html
69
- ravensight-playtest build upload ./game.zip --game GAME --profile READY_PROFILE --entrypoint index.html --dry-run
72
+ ravensight-playtest build upload ./game.zip --game GAME --entrypoint index.html --dry-run
73
+ ravensight-playtest build status --game GAME
70
74
  ```
71
75
 
72
76
  `preflight` seeks through bounded ZIP metadata; it does not load a multi-GB
73
77
  archive into memory. A saved server profile can be supplied with `--capacity`
74
- for its declared limits. Upload selects a currently advertised ready profile,
75
- checks metadata and a streamed checksum, then asks for the separate $0.49
76
- validation hold before requesting it. The server’s isolated validator remains
78
+ for its declared limits. Upload uses the server's build profile when it
79
+ advertises exactly one; when it advertises several, name one with `--profile`
80
+ and the error lists them. It checks metadata and a streamed checksum, then
81
+ asks for the separate $0.49 validation hold before requesting it. Without a
82
+ terminal to ask in, pass `--yes`: a piped answer is never taken as consent.
83
+ `build status` shows each build's state and, for a build the server's check
84
+ refused, the reason in one sentence and whether its validation hold is still
85
+ to be returned after cleanup. The server’s isolated validator remains
77
86
  authoritative. A passing local check does not establish engine, GPU or license
78
87
  compatibility.
79
88
 
@@ -468,20 +477,20 @@ splitting the job in two is what gets everything played.
468
477
  | `--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. |
469
478
  | `--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. |
470
479
  | `--concurrency <n>` | Personas at once. Default the number `init` wrote, which is what `check` recommends for this machine. |
471
- | `--controller <name>` | One playthrough using `standard` or an available System One controller. The server must advertise and quote that exact choice. |
472
- | `--compare-with jev` | Separate agent/skill and Jev playthroughs for each chosen persona. Shows their combined quote before purchase. Comparisons run one playthrough at a time. |
480
+ | `--controller <name>` | One playthrough with `geri` or `freki` (CLI 0.8.0 or later). The server must advertise and quote that exact choice. |
481
+ | `--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. |
473
482
  | `--record-video` | Capture the selected web or graphical Godot game locally. Does not upload the video. |
474
483
  | `--upload-video` | Record and explicitly upload `session.webm` or `session.mp4` with the reports. |
475
484
  | `--upload-transcript` | Upload `transcript.jsonl` as well as the reports. |
476
485
  | `--dry-upload` | List every file and byte that would be sent, and send nothing. |
477
486
  | `--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. |
487
+ | `--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`. |
478
488
  | `--headed`, `--headless` | Show or hide the browser. |
479
489
  | `--verbose` | Print each turn. |
480
490
 
481
- Three flags are accepted and reported as not applied by this release, rather
491
+ Two flags are accepted and reported as not applied by this release, rather
482
492
  than silently ignored: `--quality` (the model tier is the server's, enforced at
483
- the proxy), `--offline-upload` (uploads already queue) and `--build-dir` (serve
484
- the build and pass `--build-url`). There is no spending flag: each run's model
493
+ the proxy) and `--offline-upload` (uploads already queue). There is no spending flag: each run's model
485
494
  budget is set by the server from what the job was charged, and `--budget-usd` is
486
495
  an unknown option (the refusal says where the budget comes from).
487
496
 
@@ -1066,30 +1075,35 @@ import { createClient, packs, uploadRunDir } from 'ravensight-playtest';
1066
1075
 
1067
1076
  MIT. Copyright Reality Software Entertainment.
1068
1077
 
1069
- ## Ravensight Playtester action selection
1078
+ ## Geri and Freki
1070
1079
 
1071
- The optional `--controller jev` mode uses the existing persona run. A screenshot
1072
- observer proposes actions, Ravensight selects one on the server, and the local
1073
- driver executes only that choice. Ambiguous controls stop the run for review.
1080
+ Two AI playtesters can play a persona run, at the same price per run:
1081
+
1082
+ - **Geri**, the reasoning playtester, studies each screen and chooses every
1083
+ action itself. It is the default.
1084
+ - **Freki**, the selecting playtester, picks each action from a short list. A
1085
+ screenshot observer proposes up to three actions, Ravensight selects one on
1086
+ the server, and the local driver executes only that choice. Ambiguous
1087
+ controls stop the run for review.
1088
+
1089
+ The optional `--controller freki` mode uses the existing persona run.
1074
1090
  Reports, screenshots and findings use the normal upload and review flow.
1075
1091
 
1076
1092
  ```sh
1077
- ravensight-playtest run --driver playwright_web --controller jev --build-url https://your-game.example/ --max-actions 12 --headed
1093
+ ravensight-playtest run --driver playwright_web --controller freki --build-url https://your-game.example/ --max-actions 12 --headed
1078
1094
  ```
1079
1095
 
1080
1096
  Sign in, initialize the project and save its expectations brief first. The server
1081
- must advertise this controller in its content pack; otherwise the command stops
1097
+ must advertise this playtester in its content pack; otherwise the command stops
1082
1098
  before registering a paid job. No provider key belongs in the CLI. Selection costs
1083
1099
  share the existing persona-run budget and do not create another wallet charge.
1084
- Resume preserves the controller recorded in the job journal.
1100
+ Resume preserves the playtester recorded in the job journal.
1085
1101
 
1086
1102
  ### Recorded playthroughs and comparisons
1087
1103
 
1088
1104
  The `0.5.0` candidate adds local recording and explicit comparisons. It requires a
1089
- matching server release for controller plans; an older server is refused before
1090
- purchase. Rune is recognized as a future controller but is unavailable until
1091
- provider access, pricing and acceptance are complete. These commands do not
1092
- activate graphical AWS hosting.
1105
+ matching server release for playtester plans; an older server is refused before
1106
+ purchase. These commands do not activate graphical AWS hosting.
1093
1107
 
1094
1108
  To keep one playthrough's video on your computer:
1095
1109
 
@@ -1097,20 +1111,28 @@ To keep one playthrough's video on your computer:
1097
1111
  ravensight-playtest run --driver playwright_web --build-url https://your-game.example/ --record-video
1098
1112
  ```
1099
1113
 
1100
- To request two reports, one from the agent/skill controller and one from Jev:
1114
+ To request two reports, one from Geri and one from Freki:
1101
1115
 
1102
1116
  ```sh
1103
- ravensight-playtest run --driver playwright_web --build-url https://your-game.example/ --personas curious-kid --compare-with jev --record-video
1117
+ ravensight-playtest run --driver playwright_web --build-url https://your-game.example/ --personas curious-kid --compare-with freki --record-video
1104
1118
  ```
1105
1119
 
1106
- The server quotes every persona/controller run before the CLI asks for payment.
1120
+ The server quotes every persona/playtester run before the CLI asks for payment.
1107
1121
  Each keeps its own existing model budget and settlement rules. Two standard runs
1108
1122
  at the current $1 unit price total $2; the displayed server quote is authoritative.
1109
1123
  No comparison model call or extra recording fee is added. Use `--upload-video`
1110
1124
  instead of `--record-video` only when you want the videos uploaded for private
1111
1125
  dashboard playback. Recording is silent and captures only the selected game,
1112
- not your desktop. Browser popups and navigation to another origin are blocked
1113
- while recording.
1126
+ not your desktop.
1127
+
1128
+ A web persona stays on the build, recording or not. A clicked link, a form, a
1129
+ script or a server redirect to another site, or to another port on your
1130
+ machine, is stopped (a redirect is undone), and a new window is closed. The
1131
+ persona is told "Refused: that link leaves the build under test (host). Stay
1132
+ on this page and use its controls." and the step counts as one that changed
1133
+ nothing. Each attempt is a network note in the report. `localhost`,
1134
+ `127.0.0.1` and `[::1]` on the build's own port are the build. Assets and API
1135
+ calls the page loads from elsewhere are not affected.
1114
1136
 
1115
1137
  Web recording produces WebM. Graphical Godot recording needs an existing FFmpeg
1116
1138
  installation and produces MP4; a headless Godot run or missing encoder is reported
@@ -1128,7 +1150,7 @@ Older recordings and later byte-only uploads can show status as unreported.
1128
1150
  Malformed local status is omitted so it cannot prevent an existing report from
1129
1151
  being completed.
1130
1152
 
1131
- Each controller starts a separate game session and produces its own report.
1153
+ Each playtester starts a separate game session and produces its own report.
1132
1154
  Saved progress and random events may still differ; this is not a guaranteed
1133
1155
  identical-state benchmark. The aggregate compares evidence-bearing findings and
1134
1156
  marks missing, failed or partial playthroughs as inconclusive. Agreement between
package/docs/ADAPTERS.md CHANGED
@@ -20,7 +20,7 @@ ravensight-playtest run --driver playwright_web --build-url https://your-game.ex
20
20
  ravensight-playtest run --driver godot_driver --godot-project ./your-game
21
21
  ```
22
22
 
23
- `--controller jev` enables structured action selection when the server supports it. Screen interpretation proposes controls and the selector chooses a supplied action. Uncertain decisions stop for review. Provider credentials stay on Ravensight. A completed playtest report is evidence for human review, not proof that a game is bug-free.
23
+ `--controller freki` plays with Freki, the selecting playtester, when the server supports it. Screen interpretation proposes up to three actions and a separate selector chooses one. `--controller geri` plays with Geri, which chooses every action itself. Uncertain decisions stop for review. Provider credentials stay on Ravensight. A completed playtest report is evidence for human review, not proof that a game is bug-free.
24
24
 
25
25
  ## Desktop and mobile
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ravensight-playtest",
3
- "version": "0.7.2",
3
+ "version": "0.8.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",
@@ -46,9 +46,9 @@
46
46
  "./api": "./src/api/index.js"
47
47
  },
48
48
  "scripts": {
49
- "test": "node --test --test-reporter=spec 'src/**/!(godot-real|web.e2e|scaffold.godot|template3d.godot).test.js'",
49
+ "test": "node --test --test-reporter=spec 'src/**/!(godot-real|web.e2e|web.containment.e2e|scaffold.godot|template3d.godot).test.js'",
50
50
  "test:godot": "node --test --test-reporter=spec src/run/drivers/godot-real.test.js src/create/scaffold.godot.test.js src/create/template3d.godot.test.js",
51
- "test:e2e": "node --test --test-reporter=spec src/run/drivers/web.e2e.test.js",
51
+ "test:e2e": "node --test --test-reporter=spec src/run/drivers/web.e2e.test.js src/run/drivers/web.containment.e2e.test.js",
52
52
  "lint": "node scripts/no-dashes.mjs"
53
53
  },
54
54
  "dependencies": {
package/src/cli.js CHANGED
@@ -54,10 +54,13 @@ export const RUNNER_HELP = `
54
54
  Run options (parsed by the runner, see src/run/args.js):
55
55
  --personas <list> comma separated persona slugs, default one (curious-kid); "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 controller: standard, jev or rune (if enabled)
58
- --compare-with <names> separate standard + jev and/or rune playthroughs; quotes every run
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
59
60
  --record-video record this game locally; --upload-video also uploads it
60
61
  --build-url <url> the web build to play
62
+ --build-dir <dir> a web export folder to serve from this machine and play: index.html or its one
63
+ .html page, with wasm, Brotli and gzip engine files and threaded builds served right
61
64
  --godot-project <dir> the Godot project directory
62
65
  --driver-config <file> local WebDriver or JSON-RPC bridge configuration
63
66
  --max-actions <n> lower the actions one persona may take; it can only lower the persona's own patience, never raise it
@@ -77,7 +80,7 @@ Run options (parsed by the runner, see src/run/args.js):
77
80
  charged even if the build or the server turns out to be down
78
81
 
79
82
  Accepted and reported as not applied by this release:
80
- --quality, --offline-upload, --build-dir
83
+ --quality, --offline-upload
81
84
 
82
85
  There is no spending flag: each run's model budget is set by the server from
83
86
  what the job was charged.
@@ -153,24 +156,26 @@ function withoutFirst(values, value) {
153
156
  export function buildProgram() {
154
157
  const program = new Command();
155
158
  const slot = { code: ExitCode.OK };
156
- const hosted = common(program.command('hosted').description('run a server-hosted Standard and Jev playtest: quote, run, status and cancel'));
159
+ const hosted = common(program.command('hosted').description('run a server-hosted Geri and Freki playtest: quote, run, status and cancel'));
157
160
  hosted.command('quote')
158
161
  .description('save a full hosted quote without charging or admitting a run')
159
162
  .requiredOption('--build <id>', 'an existing validated hosted build')
160
- .requiredOption('--profile <version>', 'one currently advertised ready hosted profile')
163
+ .option('--profile <version>', 'hosted profile to quote; optional when the server advertises exactly one, otherwise the error lists the choices')
161
164
  .requiredOption('--persona <slug>', 'one available persona for both separate playthroughs')
162
165
  .requiredOption('--output <file>', 'save the original quote and immutable consent here')
163
166
  .option('--game <id>', 'game id, overriding this repo’s configuration')
164
- .addOption(new Option('--standard-provider <name>', 'explicit Standard provider; unavailable choices are refused').choices(['anthropic', 'openai']))
167
+ .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'))
168
+ .addOption(new Option('--standard-provider <name>').choices(['anthropic', 'openai']).hideHelp())
165
169
  .option('--video', 'include hosted gameplay video in this quote')
166
170
  .action(capture(slot, async (options, command) => {
167
171
  const { hostedQuote } = await import('./commands/hosted.js');
168
172
  return hostedQuote(flagsFrom(command.optsWithGlobals(), { build: options.build, profile: options.profile,
169
- persona: options.persona, output: options.output, game: options.game, standardProvider: options.standardProvider,
173
+ persona: options.persona, output: options.output, game: options.game,
174
+ geriProvider: options.geriProvider, standardProvider: options.standardProvider,
170
175
  video: options.video }));
171
176
  }));
172
177
  common(hosted.command('run [quote-file]'))
173
- .description('quote the newest ready build (or --build), confirm the price, and start one hosted Standard and Jev run; with a saved quote file, confirm that quote instead. Never retries an unknown outcome')
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')
174
179
  .option('--build <id>', 'a build that passed its static archive check (default: the newest one)')
175
180
  .option('--persona <slug>', 'the persona that plays both runs (default: curious-kid)')
176
181
  .option('--game <id>', 'game id, overriding this repo’s configuration')
@@ -211,13 +216,21 @@ export function buildProgram() {
211
216
  const { buildPreflight } = await import('./commands/build.js');
212
217
  return buildPreflight(archive, flagsFrom(command.optsWithGlobals(), { entrypoint: options.entrypoint, format: options.format, capacity: options.capacity }));
213
218
  }));
219
+ build.command('status [build-id]')
220
+ .description('show each private hosted build, why a refused one was refused, and whether its hold is still to be returned')
221
+ .option('--game <id>', 'game id, overriding this repo’s configuration')
222
+ .action(capture(slot, async (buildId, options, command) => {
223
+ const { buildStatus } = await import('./commands/build.js');
224
+ return buildStatus(buildId, flagsFrom(command.optsWithGlobals(), { game: options.game }));
225
+ }));
214
226
  build.command('upload <archive>')
215
227
  .description('preflight and stream one private build upload after validation-hold consent')
216
- .requiredOption('--profile <version>', 'one currently advertised ready server profile')
228
+ .option('--profile <version>', 'server build profile to upload under; optional when the server advertises exactly one, otherwise the error lists the choices')
217
229
  .requiredOption('--entrypoint <path>', 'entry file inside the ZIP')
218
230
  .option('--game <id>', 'game id, overriding this repo’s configuration')
219
231
  .option('--journal <file>', 'preserve this original upload intent at the specified path')
220
232
  .option('--dry-run', 'inspect and hash the archive without requesting a reservation')
233
+ .addHelpText('after', '\nThe $0.49 validation hold is asked for at a terminal. Without one, pass --yes\nto accept it; piped input is never taken as consent. See the result with: ravensight-playtest build status')
221
234
  .action(capture(slot, async (archive, options, command) => {
222
235
  const { buildUpload } = await import('./commands/build.js');
223
236
  return buildUpload(archive, flagsFrom(command.optsWithGlobals(), { entrypoint: options.entrypoint, profile: options.profile, game: options.game, journal: options.journal, dryRun: options.dryRun }));
@@ -273,7 +273,7 @@ async function editBrief(context, flags, deps) {
273
273
  parentVersion,
274
274
  onStale: async version => {
275
275
  ui.warn(`The brief moved to version ${version} while you were editing.`);
276
- return ui.confirm('Save on top of that version?', { yes: flags.yes });
276
+ return ui.confirm('Save on top of that version?', { yes: flags.yes, noTerminalMessage: 'No terminal to confirm in: pass --yes to save on top of the newer version.' });
277
277
  }
278
278
  });
279
279
 
@@ -4,6 +4,7 @@ import { resolveGameId } from '../config.js';
4
4
  import { withAuthHandling } from '../auth/session.js';
5
5
  import { preflightBuildArchive, limitsFromProfile } from '../hosted/archivePreflight.js';
6
6
  import { uploadHostedBuild } from '../hosted/buildUpload.js';
7
+ import { buildStatusLines, readHostedBuilds } from '../hosted/buildStatus.js';
7
8
  import { CliError, ExitCode } from '../errors.js';
8
9
  import { ui } from '../ui/index.js';
9
10
 
@@ -61,6 +62,7 @@ export async function buildUpload(filename, flags = {}, deps = {}) {
61
62
  onPrepared: prepared => {
62
63
  progress.stop();
63
64
  if (flags.json) return;
65
+ ui.info(`Build profile: ${prepared.profileVersion}${flags.profile ? '' : ', the only one the server advertises'}.`);
64
66
  ui.info(`ZIP metadata checked: ${prepared.entries} entries; ${ui.bytes(prepared.archiveBytes)} archive, ${ui.bytes(prepared.expandedBytes)} expanded.`);
65
67
  const limit = prepared.limits;
66
68
  ui.info(`Selected limits: archive ${ui.bytes(limit.archiveBytes)}, expanded ${ui.bytes(limit.expandedBytes)}, file ${ui.bytes(limit.fileBytes)}, ${limit.files} entries, depth ${limit.depth}, ratio ${limit.ratio}:1.`);
@@ -73,9 +75,29 @@ export async function buildUpload(filename, flags = {}, deps = {}) {
73
75
  });
74
76
  progress.stop();
75
77
  if (flags.json) ui.json(result);
76
- else if (result.state === 'awaiting_validation') ui.ok(`Uploaded ${result.buildId}; awaiting server validation. Journal: ${result.journal}`);
78
+ else if (result.state === 'awaiting_validation') {
79
+ ui.ok(`Uploaded ${result.buildId}; awaiting server validation. Journal: ${result.journal}`);
80
+ ui.info(`See the result, and the reason if it is not accepted: ravensight-playtest build status ${result.buildId}`);
81
+ }
77
82
  else ui.info(result.state === 'declined' ? 'Upload declined; no reservation requested.' : 'Preflight finished; no reservation requested.');
78
83
  return result.state === 'declined' ? ExitCode.CANCELED : ExitCode.OK;
79
84
  } finally { progress.stop(); }
80
85
  });
81
86
  }
87
+
88
+ // State of the game's private hosted builds, with the reason a refused build
89
+ // was refused and whether its validation hold is still to be returned.
90
+ export async function buildStatus(buildId, flags = {}, deps = {}) {
91
+ const context = deps.context || await createContext({ apiUrl: flags.apiUrl, repoRoot: flags.repoRoot, requireAuth: true });
92
+ return withAuthHandling(context, async () => {
93
+ const builds = await readHostedBuilds({ api: context.api, gameId: resolveGameId(flags, context.config), buildId });
94
+ if (flags.json) { ui.json({ builds }); return ExitCode.OK; }
95
+ if (!builds.length) {
96
+ if (buildId) throw new CliError(`No hosted build ${buildId} for this game. A refused build is listed until its cleanup finishes.`);
97
+ ui.info('No private hosted builds for this game.');
98
+ return ExitCode.OK;
99
+ }
100
+ for (const build of builds) buildStatusLines(build).forEach(text => ui.info(text));
101
+ return ExitCode.OK;
102
+ });
103
+ }
@@ -4,7 +4,7 @@ import { withAuthHandling } from '../auth/session.js';
4
4
  import { CliError, ExitCode } from '../errors.js';
5
5
  import { ui } from '../ui/index.js';
6
6
  import { quoteHostedRun, runHostedQuote, hostedQuoteLines, prepareHostedRun, admitHostedOffer, confirmQuestion,
7
- hostedConsentLines, fundingShortfall, readHostedRun, cancelHostedRun } from '../hosted/recordedRun.js';
7
+ hostedConsentLines, fundingShortfall, readHostedRun, cancelHostedRun, GERI_PROVIDERS } from '../hosted/recordedRun.js';
8
8
  import { hostedPlaytestStatus, modeOutcomes, modeLine, TERMINAL_PHASES } from '../hosted/status.js';
9
9
  import { jobLink } from '../dashboard.js';
10
10
  import { DEFAULT_PERSONAS } from '../runDefaults.js';
@@ -14,7 +14,8 @@ export async function hostedQuote(flags = {}, deps = {}) {
14
14
  return withAuthHandling(context, async () => {
15
15
  const result = await quoteHostedRun({ api: context.api, apiUrl: context.api.apiUrl,
16
16
  gameId: resolveGameId(flags, context.config), buildId: flags.build, profileVersion: flags.profile,
17
- persona: flags.persona, standardProvider: flags.standardProvider, includeVideo: Boolean(flags.video),
17
+ persona: flags.persona,
18
+ standardProvider: flags.geriProvider ? GERI_PROVIDERS[flags.geriProvider] : flags.standardProvider, includeVideo: Boolean(flags.video),
18
19
  output: flags.output });
19
20
  if (flags.json) ui.json(result);
20
21
  else {
@@ -162,7 +163,8 @@ export async function hostedCancel(admissionId, flags = {}, deps = {}) {
162
163
  const now = deps.now || Date.now;
163
164
  return withAuthHandling(context, async () => {
164
165
  const api = context.api, apiUrl = api.apiUrl, gameId = resolveGameId(flags, context.config);
165
- const confirm = deps.confirm || (question => ui.confirm(question, { yes: Boolean(flags.yes) }));
166
+ const confirm = deps.confirm || (question => ui.confirm(question, { yes: Boolean(flags.yes),
167
+ noTerminalMessage: 'No terminal to confirm in: pass --yes to cancel this run.' }));
166
168
  if (!await confirm(`Cancel hosted run ${admissionId}? Work already completed follows the accepted policy; unstarted work is refunded during settlement.`)) {
167
169
  if (flags.json) ui.json({ state: 'kept', admissionId });
168
170
  else ui.info('Nothing was canceled.');
@@ -7,7 +7,7 @@ import { reportPrOutcomes } from '../run/labsOutcome.js';
7
7
  import { finishJob } from '../run/settle.js';
8
8
  import { driverStartReason, failureReason } from '../run/failureReason.js';
9
9
  import { optionsFrom, unknownOptionNotes } from '../run/args.js';
10
- import { controllerPlan, quoteMatchesPlan, runsMatchPlan } from '../run/controllers.js';
10
+ import { controllerPlan, displayName, quoteMatchesPlan, runsMatchPlan, wireId } from '../run/controllers.js';
11
11
  import { getDeps } from '../run/deps.js';
12
12
  import { createDriver } from '../run/drivers/index.js';
13
13
  import EXIT from '../run/exit.js';
@@ -32,6 +32,7 @@ import { bold } from '../ui/index.js';
32
32
  import { reconcileDroppedFindings } from '../run/dropped.js';
33
33
  import * as stateFile from '../run/state.js';
34
34
  import { emitRunEvents } from '../run/synthetic.js';
35
+ import { serveBuildDir } from '../run/serveBuild.js';
35
36
 
36
37
  /**
37
38
  * `ravensight-playtest run`: register a job, play it, upload it, finish it.
@@ -114,13 +115,16 @@ async function run(flags, injected, deps, log) {
114
115
  let controllers;
115
116
  try { controllers = controllerPlan(options); } catch (error) { log(error.message); return EXIT.ENVIRONMENT; }
116
117
  options.controllers = controllers;
118
+ if (options.controller) options.controller = wireId(options.controller);
117
119
  const keyModifier = resolveKeyModifier(options.keyModifier);
118
120
  if (keyModifier.error) { log(keyModifier.error); return EXIT.ENVIRONMENT; }
119
121
  const driverName = options.driver || (context.config && context.config.driver) || 'playwright_web';
120
122
  if (controllers?.length > 1 && !['playwright_web', 'godot_driver'].includes(driverName)) { log('Comparisons currently require a web or Godot build. Nothing was charged.'); return EXIT.ENVIRONMENT; }
123
+ const served = await serveBuildDirOption({ options, driverName, log, serve: injected.serveBuildDir });
124
+ if (served === false) return EXIT.ENVIRONMENT;
121
125
  const target = resolveTarget(options, context.config, driverName, repoRoot);
122
126
  if (!target) {
123
- log('Point the run at a build: --build-url for a web build, --godot-project for Godot, or --driver-config for a native or text bridge.');
127
+ log('Point the run at a build: --build-url or --build-dir for a web build, --godot-project for Godot, or --driver-config for a native or text bridge.');
124
128
  return EXIT.ENVIRONMENT;
125
129
  }
126
130
 
@@ -173,7 +177,7 @@ async function run(flags, injected, deps, log) {
173
177
  }
174
178
  const modules = [...RUN_MODULES];
175
179
  const pack = await deps.packs.get({ api, gameId, modules });
176
- if (controllers && (!pack.routing?.controller_plans || controllers.some(controller => !pack.routing?.action_controllers?.includes(controller)))) { log('This server does not currently support the requested controller plan. No job was registered or charged.'); return EXIT.ENVIRONMENT; }
180
+ if (controllers && (!pack.routing?.controller_plans || controllers.some(controller => !pack.routing?.action_controllers?.includes(controller)))) { log('This server does not currently support the requested playtesters. No job was registered or charged.'); return EXIT.ENVIRONMENT; }
177
181
  const personaSlugs = resolvePersonas(options, context.config, pack);
178
182
  const unknownSlugs = unknownPersonas(personaSlugs, pack.personas || []);
179
183
  if (unknownSlugs.length > 0) {
@@ -226,9 +230,9 @@ async function run(flags, injected, deps, log) {
226
230
  }
227
231
  throw error;
228
232
  }
229
- if (!quoteMatchesPlan(estimate, controllers, personaSlugs)) { log('The server did not quote every requested controller run. Nothing was registered or charged.'); return EXIT.ENVIRONMENT; }
230
- if (controllers) log(`Controllers: ${controllers.join(' + ')}. ${personas.length * controllers.length} independent playthrough(s); each run is included in the total quote.`);
231
- if (controllers?.length > 1) log('Each controller gets a fresh game process or browser session. Server-side game progress and randomness may differ; comparison is evidence, not proof of identical starting state.');
233
+ if (!quoteMatchesPlan(estimate, controllers, personaSlugs)) { log('The server did not quote every requested playtester run. Nothing was registered or charged.'); return EXIT.ENVIRONMENT; }
234
+ if (controllers) log(`Playtesters: ${controllers.map(displayName).join(' + ')}. ${personas.length * controllers.length} independent playthrough(s); each run is included in the total quote.`);
235
+ if (controllers?.length > 1) log('Each playtester gets a fresh game process or browser session. Server-side game progress and randomness may differ; comparison is evidence, not proof of identical starting state.');
232
236
  // A long run is its own unit on the server. An older server that ignores
233
237
  // run_length prices a standard run, and confirming that would buy a run
234
238
  // the CLI then plays as long.
@@ -309,6 +313,7 @@ async function run(flags, injected, deps, log) {
309
313
  modules,
310
314
  driver: driverName,
311
315
  target,
316
+ ...(served ? { buildDir: served.root } : {}),
312
317
  priceCents: registered.price && registered.price.price_cents,
313
318
  options: {
314
319
  maxActions: options.maxActions ?? null,
@@ -329,7 +334,7 @@ async function run(flags, injected, deps, log) {
329
334
  }
330
335
  await stateFile.save(repoRoot, journal);
331
336
  if (!runsMatchPlan(registered.runs || [], controllers, personaSlugs)) {
332
- log(`The registered controller plan does not match the quote. Job ${jobId} is saved for reconciliation; no playthrough or model call was started.`);
337
+ log(`The registered playtester plan does not match the quote. Job ${jobId} is saved for reconciliation; no playthrough or model call was started.`);
333
338
  return EXIT.FAILED;
334
339
  }
335
340
  log(`job ${jobId}${registered.replayed ? ' (replayed)' : ''}: ${formatCents(registered.price && registered.price.price_cents)} charged. ${directory}`);
@@ -469,12 +474,39 @@ export function unusedFlagWarnings(options) {
469
474
  if (options.offlineUpload !== undefined) {
470
475
  warnings.push('--offline-upload is not applied by this release: uploads already queue and can be drained later with "ravensight-playtest upload <job>".');
471
476
  }
472
- if (options.buildDir !== undefined) {
473
- warnings.push('--build-dir is not applied by this release: serve the build and pass --build-url instead.');
474
- }
475
477
  return warnings;
476
478
  }
477
479
 
480
+ /**
481
+ * `--build-dir`: serve an exported web build from this machine and point the
482
+ * run at it, with the headers engines' web exports need (see
483
+ * ../run/serveBuild.js). Answers the served build, null when the flag is not
484
+ * given, or false after saying why it cannot be used; nothing is registered
485
+ * or charged either way.
486
+ *
487
+ * @returns {Promise<{url: string, root: string, entry: string}|null|false>}
488
+ */
489
+ export async function serveBuildDirOption({ options, driverName, log, serve = serveBuildDir }) {
490
+ if (options.buildDir === undefined) return null;
491
+ if (driverName !== 'playwright_web') {
492
+ log(`--build-dir serves a web build, and this run uses ${driverName}. Nothing was registered or charged.`);
493
+ return false;
494
+ }
495
+ if (options.buildUrl) {
496
+ log('Pass --build-dir or --build-url, not both. Nothing was registered or charged.');
497
+ return false;
498
+ }
499
+ try {
500
+ const served = await serve(options.buildDir);
501
+ options.buildUrl = served.url;
502
+ log(`Serving ${served.root} at ${served.url} (wasm, compressed engine files and cross-origin isolation for threaded builds).`);
503
+ return served;
504
+ } catch (error) {
505
+ log(`${error.message} Nothing was registered or charged.`);
506
+ return false;
507
+ }
508
+ }
509
+
478
510
  /**
479
511
  * Play every unfinished run of a registered job, aggregate, finish.
480
512
  *
@@ -182,14 +182,58 @@ async function nativeHeader(archive, file, format, requirements) {
182
182
  return { os, architecture, binaryFormat, runtimeCompatibilityProven: false };
183
183
  }
184
184
 
185
+ // What a build that is not a web build is, by file names alone, and what to
186
+ // do instead. Asked only once a web upload has already failed (no entry page,
187
+ // or an entry file that is not a page), so it never refuses a web build.
188
+ const NATIVE_ADVICE = Object.freeze({
189
+ unity: 'this is a Unity desktop or mobile build. Cloud playtests play web builds: build for the Web platform and upload that output, or run a local playtest with --driver unity_driver',
190
+ unreal: 'this is an Unreal Engine build, and Unreal has no supported web export, so a cloud playtest cannot play it. Run a local playtest with --driver unreal_driver',
191
+ godot: 'this is a Godot desktop export. Cloud playtests play web builds: export with the Web preset and upload that folder, or run a local playtest with --driver godot_driver',
192
+ love: 'this is a LÖVE game file. Cloud playtests play web builds: package it with love.js and upload that folder, or run a local playtest with --driver desktop_driver',
193
+ android: 'this is an Android app. Android builds play only in a local playtest: --driver android_driver on your own device or emulator',
194
+ ios: 'this is an iOS app. iOS builds play only in a local playtest: --driver ios_driver on your own device or simulator',
195
+ desktop: 'this is a desktop program, not a web build. Cloud playtests play web builds only (HTML and WebAssembly): build for the web, or run a local playtest with --driver desktop_driver'
196
+ });
197
+ const any = (paths, pattern) => paths.some(name => pattern.test(name));
198
+
199
+ /**
200
+ * The engine or platform a non-web build came from, or null.
201
+ * @param {string[]} names archive file names
202
+ * @returns {keyof NATIVE_ADVICE|null}
203
+ */
204
+ export function nativeBuildKind(names) {
205
+ const paths = names.map(name => name.toLowerCase());
206
+ if (any(paths, /\.(?:apk|aab)$/)) return 'android';
207
+ if (any(paths, /\.ipa$|(?:^|\/)payload\/[^/]+\.app\//)) return 'ios';
208
+ if (any(paths, /\.uproject$|(?:^|\/)engine\/binaries\/|(?:^|\/)content\/paks\/[^/]+\.(?:pak|utoc|ucas)$/)) return 'unreal';
209
+ if (any(paths, /(?:^|\/)(?:unityplayer|gameassembly)\.(?:dll|so|dylib)$|(?:^|\/)[^/]+_data\/(?:globalgamemanagers|data\.unity3d|managed\/|il2cpp_data\/)|\.app\/contents\/resources\/data\/(?:globalgamemanagers|data\.unity3d)$/)) return 'unity';
210
+ if (any(paths, /\.love$/)) return 'love';
211
+ if (any(paths, /\.pck$/) && !any(paths, /\.wasm$/) && any(paths, /\.(?:exe|x86_64|x86_32|arm64|arm32)$|\.app\/contents\/macos\//)) return 'godot';
212
+ if (any(paths, /\.(?:exe|dll|so|dylib|x86_64|x86_32|appimage|msi)$|\.app\/contents\/macos\//)) return 'desktop';
213
+ return null;
214
+ }
215
+
216
+ /** The entry-file kind of a web upload that names a program or package. */
217
+ function nativeEntryKind(entrypoint) {
218
+ const name = String(entrypoint || '').toLowerCase();
219
+ if (/\.(?:apk|aab)$/.test(name)) return 'android';
220
+ if (/\.ipa$/.test(name)) return 'ios';
221
+ if (/\.uproject$/.test(name)) return 'unreal';
222
+ if (/(?:^|\/)project\.godot$|\.pck$/.test(name)) return 'godot';
223
+ if (/\.love$/.test(name)) return 'love';
224
+ if (/\.(?:exe|x86_64|x86_32|arm64|app|appimage|dll|so|dylib)$/.test(name)) return 'desktop';
225
+ return null;
226
+ }
227
+
185
228
  export async function inspectBuildArchive(archive, { limits: supplied, format, entrypoint, requirements } = {}) {
186
229
  const limits = buildLimits(supplied);
187
230
  if (!['web', 'godot-project', 'linux-executable', 'windows-executable'].includes(format)) reject('the selected runtime format is unsupported');
231
+ if (format === 'web' && typeof entrypoint === 'string' && !/\.html?$/i.test(entrypoint) && nativeEntryKind(entrypoint)) reject(NATIVE_ADVICE[nativeEntryKind(entrypoint)]);
188
232
  if (typeof entrypoint !== 'string' || entrypoint.length > 240 || !/^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*$/.test(entrypoint)) reject('the entrypoint does not match the current server path policy');
189
233
  const wanted = safePath(entrypoint, limits.depth);
190
234
  if (format === 'web' && !wanted.endsWith('.html') || format === 'godot-project' && wanted.split('/').at(-1) !== 'project.godot'
191
235
  || format === 'windows-executable' && !wanted.toLowerCase().endsWith('.exe')) reject('the entrypoint does not match the selected format');
192
- const dir = await directory(archive, limits), paths = new Map(), explicit = new Set(), ranges = [];
236
+ const dir = await directory(archive, limits), paths = new Map(), explicit = new Set(), ranges = [], fileNames = [];
193
237
  let cursor = dir.offset, expandedBytes = 0, files = 0, found = false, pathBytes = 0, nativeFile;
194
238
  for (let index = 0; index < dir.count; index++) {
195
239
  const h = await archive.read(cursor, 46);
@@ -221,10 +265,11 @@ export async function inspectBuildArchive(archive, { limits: supplied, format, e
221
265
  const dataEnd = size.offset + 30 + nameBytes + local.readUInt16LE(28) + size.compressed;
222
266
  if (!Number.isSafeInteger(dataEnd) || dataEnd > dir.offset) reject('file data overlaps the ZIP directory');
223
267
  ranges.push([size.offset, dataEnd]);
224
- if (!isDirectory) { files++; if (name === wanted) { if (!size.expanded) reject('the entrypoint is empty'); found = true;
268
+ if (!isDirectory) { files++; if (fileNames.length < 5000) fileNames.push(name); if (name === wanted) { if (!size.expanded) reject('the entrypoint is empty'); found = true;
225
269
  nativeFile = { ...size, method, dataOffset: size.offset + 30 + nameBytes + local.readUInt16LE(28), dataEnd }; } }
226
270
  cursor += 46 + nameBytes + extraBytes + commentBytes;
227
271
  }
272
+ if (!found && format === 'web' && nativeBuildKind(fileNames)) reject(NATIVE_ADVICE[nativeBuildKind(fileNames)]);
228
273
  if (cursor !== dir.offset + dir.size || !found) reject('the declared entrypoint is absent or the directory is inconsistent');
229
274
  ranges.sort((a, b) => a[0] - b[0]);
230
275
  for (let i = 1; i < ranges.length; i++) if (ranges[i][0] < ranges[i - 1][1]) reject('ZIP file data overlaps');
@@ -0,0 +1,37 @@
1
+ import { printable } from '../ui/index.js';
2
+
3
+ const base = game => `/api/v1/games/${encodeURIComponent(game)}/playtest/hosted`;
4
+
5
+ const LABELS = {
6
+ uploading: 'uploading',
7
+ awaiting_validation: 'waiting for its archive check',
8
+ ready: 'ready',
9
+ graphical_static_validated: 'archive check passed',
10
+ rejected: 'not accepted',
11
+ deleting: 'being removed'
12
+ };
13
+
14
+ // Server text is one fixed sentence; still print it as one plain line.
15
+ const line = text => printable(String(text || '')).replace(/\s+/g, ' ').trim().slice(0, 300);
16
+
17
+ /** The plain lines that describe one build: its state, why it was refused, and the hold. */
18
+ export function buildStatusLines(build) {
19
+ const state = build?.state === 'deleting' && build.rejection ? 'not accepted, being removed' : (LABELS[build?.state] || line(build?.state) || 'unknown');
20
+ const lines = [`${line(build?.buildId)}${build?.entrypoint ? ` (${line(build.entrypoint)})` : ''}: ${state}.`];
21
+ if (build?.rejection?.message) lines.push(` Why: ${line(build.rejection.message)}`);
22
+ // Waiting for the daily build check limit to reset: the server says when.
23
+ else if (build?.state === 'awaiting_validation' && build.waiting?.message) lines.push(` Waiting: ${line(build.waiting.message)}`);
24
+ else if (build?.state === 'awaiting_validation') lines.push(' Validation is required before a run. Check again in a minute.');
25
+ if (build?.holdReturn?.message) lines.push(` ${line(build.holdReturn.message)}`);
26
+ if (build?.safetyHold) lines.push(' A run of this build was stopped by the safety check, so it cannot be quoted until that hold is cleared.');
27
+ return lines;
28
+ }
29
+
30
+ /** The game's private hosted builds, newest first, optionally one of them. */
31
+ export async function readHostedBuilds({ api, gameId, buildId }) {
32
+ const answer = await api.request('GET', `${base(gameId)}/builds`, { idempotent: true });
33
+ const builds = (Array.isArray(answer.body?.builds) ? answer.body.builds : [])
34
+ .filter(build => build && typeof build.buildId === 'string')
35
+ .sort((a, b) => (Date.parse(b.createdAt) || 0) - (Date.parse(a.createdAt) || 0));
36
+ return buildId ? builds.filter(build => build.buildId === buildId) : builds;
37
+ }