ravensight-playtest 0.11.0 → 0.12.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 +89 -21
- package/addons/mobile/Host/AppDelegate.swift +11 -0
- package/addons/mobile/RavensightMobile.xcodeproj/project.pbxproj +398 -0
- package/addons/mobile/RavensightMobile.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/addons/mobile/RavensightMobile.xcodeproj/xcshareddata/xcschemes/RavensightMobile.xcscheme +116 -0
- package/addons/mobile/UITests/MobileInputTests.swift +152 -0
- package/addons/mobile/project.yml +45 -0
- package/docs/ADAPTERS.md +5 -4
- package/docs/MOBILE.md +107 -0
- package/docs/NATIVE_RUNNER.md +7 -3
- package/docs/godot-driver.md +1 -1
- package/package.json +7 -5
- package/src/api/README.md +3 -3
- package/src/cli.js +36 -6
- package/src/commands/check.js +17 -3
- package/src/commands/device.js +64 -0
- package/src/commands/fakeCore.js +1 -1
- package/src/commands/hosted.js +16 -13
- package/src/commands/login.js +1 -1
- package/src/commands/run.js +39 -11
- package/src/dashboard.js +2 -3
- package/src/detect.js +17 -0
- package/src/fsutil.js +1 -1
- package/src/hosted/archivePreflight.js +3 -3
- package/src/hosted/buildUpload.js +8 -7
- package/src/hosted/recordedRun.js +19 -3
- package/src/run/anygame/index.js +9 -3
- package/src/run/args.js +6 -0
- package/src/run/budgetReserve.js +29 -9
- package/src/run/claimProtocol.js +27 -0
- package/src/run/completion.js +86 -0
- package/src/run/context.js +2 -2
- package/src/run/drivers/android.js +3 -0
- package/src/run/drivers/godot.js +1 -1
- package/src/run/drivers/index.js +4 -0
- package/src/run/drivers/ios.js +3 -0
- package/src/run/drivers/mobile/adb.js +91 -0
- package/src/run/drivers/mobile/attempt.js +18 -0
- package/src/run/drivers/mobile/crash.js +115 -0
- package/src/run/drivers/mobile/frame.js +64 -0
- package/src/run/drivers/mobile/ios-helper.js +102 -0
- package/src/run/drivers/mobile/lock.js +32 -0
- package/src/run/drivers/mobile/native.js +227 -0
- package/src/run/drivers/mobile/preflight.js +80 -0
- package/src/run/drivers/mobile/process.js +57 -0
- package/src/run/drivers/mobile/recording.js +88 -0
- package/src/run/drivers/mobile/screenshot.js +34 -0
- package/src/run/drivers/mobile/simctl.js +60 -0
- package/src/run/drivers/mobile/target.js +53 -0
- package/src/run/honesty.js +66 -26
- package/src/run/inputMeasurement.js +49 -0
- package/src/run/model.js +24 -31
- package/src/run/paths.js +1 -1
- package/src/run/personaLoop.js +282 -74
- package/src/run/proxyClient.js +173 -0
- package/src/run/repoTools.js +1 -1
- package/src/run/report.js +19 -0
- package/src/run/resume.js +33 -4
- package/src/run/screenshots.js +3 -1
- package/src/run/tools.js +31 -5
- package/src/run/usage.js +2 -2
- package/src/upload/allowlist.js +2 -2
- package/src/upload/index.js +9 -9
package/src/commands/check.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { nativeTarget } from '../run/drivers/mobile/target.js';
|
|
2
|
+
import { nativeChecks } from '../run/drivers/mobile/preflight.js';
|
|
1
3
|
import { createClient } from '../api/client.js';
|
|
2
4
|
import { ApiError } from '../api/errors.js';
|
|
3
5
|
import { resolveApiUrl, paths } from '../paths.js';
|
|
@@ -226,7 +228,7 @@ export async function probeBrowser(importer, { url = null, timeoutMs } = {}) {
|
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
/** Said by `check` every time, in both outputs, because a customer asked. */
|
|
229
|
-
export const NO_CHARGE_NOTE = 'check reserves no units and starts no job:
|
|
231
|
+
export const NO_CHARGE_NOTE = 'check reserves no units and starts no job: API requests are free reads or estimates, and probes use your own local browser, native device or automation server. A native check installs and opens the selected test build.';
|
|
230
232
|
|
|
231
233
|
/** `Jump Bunny (g1)`, or just the id when the game has no name. */
|
|
232
234
|
const gameLabel = game => (game.name ? `${game.name} (${game.gameId})` : game.gameId);
|
|
@@ -242,6 +244,8 @@ const gameLabel = game => (game.name ? `${game.name} (${game.gameId})` : game.ga
|
|
|
242
244
|
export function plannedRun(flags = {}, config = null) {
|
|
243
245
|
const driverName = flags.driver || (config && config.driver) || 'playwright_web';
|
|
244
246
|
const build = (config && config.build) || {};
|
|
247
|
+
const mobile = nativeTarget(flags, config, driverName, flags.repoRoot || process.cwd());
|
|
248
|
+
if (mobile) return { driverName, native: false, target: mobile.build, nativePlan: mobile };
|
|
245
249
|
let target = null;
|
|
246
250
|
if (WEBDRIVER_NAMES.includes(driverName) || driverName === 'cli_stdio') {
|
|
247
251
|
target = flags.driverConfig || (build.kind === 'driver_config' ? build.ref : null) || null;
|
|
@@ -571,9 +575,19 @@ export async function runChecks(flags = {}, deps = {}) {
|
|
|
571
575
|
|
|
572
576
|
/* ---------------------------------------------- build and automation */
|
|
573
577
|
|
|
574
|
-
|
|
578
|
+
let plan;
|
|
579
|
+
try { plan = plannedRun(flags, config); }
|
|
580
|
+
catch (error) {
|
|
581
|
+
rows.push(row('native configuration', 'fail', error.message));
|
|
582
|
+
plan = { driverName: flags.driver || config?.driver || 'playwright_web', native: false, target: null, invalid: true };
|
|
583
|
+
}
|
|
575
584
|
facts.build.driver = plan.driverName;
|
|
576
|
-
if (plan.
|
|
585
|
+
if (plan.invalid) {
|
|
586
|
+
facts.build.ref = null;
|
|
587
|
+
} else if (plan.nativePlan) {
|
|
588
|
+
const checked = await (deps.nativeChecks || nativeChecks)(plan.nativePlan, { ...deps.nativeDeps, smoke: true, recordVideo: !flags.noRecordVideo });
|
|
589
|
+
rows.push(...checked.rows); facts.build.ref = plan.nativePlan.build; facts.native = checked.plan;
|
|
590
|
+
} else if (plan.native) {
|
|
577
591
|
const native = await automationChecks({ ...plan, repoRoot }, deps);
|
|
578
592
|
rows.push(...native.rows);
|
|
579
593
|
facts.build.ref = native.build.ref;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { createAdb } from '../run/drivers/mobile/adb.js';
|
|
3
|
+
import { createSimctl } from '../run/drivers/mobile/simctl.js';
|
|
4
|
+
import { sdkTool } from '../run/drivers/mobile/process.js';
|
|
5
|
+
import { buildIosHelper } from '../run/drivers/mobile/ios-helper.js';
|
|
6
|
+
import { lockDevice } from '../run/drivers/mobile/lock.js';
|
|
7
|
+
import { ui } from '../ui/index.js';
|
|
8
|
+
|
|
9
|
+
export async function listDevices({ adb = createAdb(), simctl = createSimctl(), platform = process.platform } = {}) {
|
|
10
|
+
const result = { android: [], avds: [], ios: [], errors: [] };
|
|
11
|
+
for (const [key, read] of [['android', () => adb.list()], ['avds', () => adb.avds()], ...(platform === 'darwin' ? [['ios', () => simctl.list()]] : [])]) {
|
|
12
|
+
try { result[key] = await read(); } catch (error) { result.errors.push({ platform: key, error: error.message }); }
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
export function androidImage({ platform = process.platform, arch = process.arch } = {}) {
|
|
17
|
+
return `system-images;android-35;google_apis;${platform === 'darwin' && arch === 'arm64' ? 'arm64-v8a' : 'x86_64'}`;
|
|
18
|
+
}
|
|
19
|
+
async function withInput(binary, args, input, timeout = 300000) {
|
|
20
|
+
const child = spawn(binary, args, { stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
21
|
+
let text = '';
|
|
22
|
+
child.stdout.on('data', b => { text = (text + b).slice(-4000); }); child.stderr.on('data', b => { text = (text + b).slice(-4000); });
|
|
23
|
+
const timer = setTimeout(() => child.kill('SIGKILL'), timeout);
|
|
24
|
+
try { await new Promise((resolve, reject) => { child.on('error', reject); child.on('close', code => code === 0 ? resolve() : reject(new Error(text || 'Android setup failed or timed out.'))); child.stdin.end(input); }); }
|
|
25
|
+
finally { clearTimeout(timer); }
|
|
26
|
+
}
|
|
27
|
+
export async function deviceCommand(action, value, flags = {}, deps = {}) {
|
|
28
|
+
const adb = deps.adb || createAdb(), simctl = deps.simctl || createSimctl(), log = deps.log || ui.info;
|
|
29
|
+
if (action === 'list') {
|
|
30
|
+
const result = await listDevices({ adb, simctl });
|
|
31
|
+
if (flags.json) ui.json(result);
|
|
32
|
+
else {
|
|
33
|
+
for (const d of [...result.android, ...result.ios]) log(`${d.platform} ${d.id} ${d.name} ${d.state}${d.avd ? ` (${d.avd})` : ''}`);
|
|
34
|
+
for (const name of result.avds) log(`Android AVD: ${name}`);
|
|
35
|
+
for (const error of result.errors) log(`${error.platform}: ${error.error}`);
|
|
36
|
+
}
|
|
37
|
+
return result.errors.length && !result.android.length && !result.ios.length && !result.avds.length ? 3 : 0;
|
|
38
|
+
}
|
|
39
|
+
if (action === 'setup') {
|
|
40
|
+
if (value === 'ios') { log('Building the local XCTest input helper. Xcode and an installed iOS Simulator runtime are required.'); await (deps.buildIosHelper || buildIosHelper)(); log('The iOS input helper is built. Run device list and boot a simulator.'); return 0; }
|
|
41
|
+
if (value !== 'android') throw new Error('Choose device setup android or device setup ios.');
|
|
42
|
+
const image = androidImage();
|
|
43
|
+
const confirm = deps.confirm || ui.confirm;
|
|
44
|
+
if (!flags.yes && !await confirm(`Install Android SDK components and ${image} (about 1 to 2 GB), then create a dedicated Ravensight_Playtest_API35 emulator?`)) { log('No SDK components were installed.'); return 0; }
|
|
45
|
+
// The SDK's license terms are the user's to read and accept, never ours:
|
|
46
|
+
// nothing is typed into a license prompt, so an unaccepted one fails here.
|
|
47
|
+
log('This installs only components whose Android SDK licenses you have already accepted. To read and accept them, run sdkmanager --licenses first.');
|
|
48
|
+
const licenseHint = error => new Error(`${error.message}\nIf sdkmanager asked about a license, read and accept it with sdkmanager --licenses, then run device setup android again.`);
|
|
49
|
+
await (deps.withInput || withInput)(await sdkTool('sdkmanager'), ['--install', 'platform-tools', 'emulator', 'build-tools;35.0.0', image], '').catch(error => { throw licenseHint(error); });
|
|
50
|
+
if (!(await adb.avds()).includes('Ravensight_Playtest_API35')) await (deps.withInput || withInput)(await sdkTool('avdmanager'), ['create', 'avd', '-n', 'Ravensight_Playtest_API35', '-k', image, '-d', 'pixel_6'], 'no\n').catch(error => { throw licenseHint(error); });
|
|
51
|
+
log('Android setup is ready. Run device boot Ravensight_Playtest_API35 --platform android.'); return 0;
|
|
52
|
+
}
|
|
53
|
+
if (!['android', 'ios'].includes(flags.platform)) throw new Error('Pass --platform android or --platform ios for device boot or shutdown.');
|
|
54
|
+
if (!value) throw new Error('Name the exact device to boot or shut down.');
|
|
55
|
+
const tool = flags.platform === 'android' ? adb : simctl;
|
|
56
|
+
if (action === 'boot') { const device = await tool.boot(value); log(`${flags.platform} ${device.id} is ready.`); return 0; }
|
|
57
|
+
if (action === 'shutdown') {
|
|
58
|
+
const device = await tool.select(value);
|
|
59
|
+
const unlock = await (deps.lock || lockDevice)(`${flags.platform}:${device.id}`);
|
|
60
|
+
try { await tool.shutdown(device.id); } finally { await unlock(); }
|
|
61
|
+
log(`${flags.platform} ${device.id} stopped.`); return 0;
|
|
62
|
+
}
|
|
63
|
+
throw new Error(`Unknown device action ${action}.`);
|
|
64
|
+
}
|
package/src/commands/fakeCore.js
CHANGED
|
@@ -327,7 +327,7 @@ export function fakeCore({
|
|
|
327
327
|
},
|
|
328
328
|
async uploads(gameId, jobId, body) {
|
|
329
329
|
record('uploads', { jobId, body });
|
|
330
|
-
return { urls: body.files.map(file => ({ path: file.path, put_url: 'https://
|
|
330
|
+
return { urls: body.files.map(file => ({ path: file.path, put_url: 'https://storage.test/x', tagging: null })) };
|
|
331
331
|
},
|
|
332
332
|
async findings(gameId, query) {
|
|
333
333
|
record('findings', { gameId, query });
|
package/src/commands/hosted.js
CHANGED
|
@@ -9,7 +9,10 @@ import { quoteHostedRun, runHostedQuote, hostedQuoteLines, prepareHostedRun, con
|
|
|
9
9
|
import { hostedPlaytestStatus, modeOutcomes, modeLine, TERMINAL_PHASES, queueInfo, queueLine } from '../hosted/status.js';
|
|
10
10
|
import { jobLink } from '../dashboard.js';
|
|
11
11
|
import { ALWAYS_INCLUDED_PERSONA, hostedPersonas } from '../runDefaults.js';
|
|
12
|
-
import { focusFor, uploadSave } from '../hosted/recordedRun.js';
|
|
12
|
+
import { focusFor, providerRoles, uploadSave } from '../hosted/recordedRun.js';
|
|
13
|
+
|
|
14
|
+
/** Machine output names a Geri provider by its role, never by the server's wire id. */
|
|
15
|
+
const printJson = value => ui.json(providerRoles(value));
|
|
13
16
|
|
|
14
17
|
/** --tier, --minutes, --start, --focus and --avoid as the quote request takes them. */
|
|
15
18
|
export function scopeFrom(flags = {}) {
|
|
@@ -48,9 +51,9 @@ export async function hostedQuote(flags = {}, deps = {}) {
|
|
|
48
51
|
const result = await quoteHostedRun({ api: context.api, apiUrl: context.api.apiUrl,
|
|
49
52
|
gameId, buildId: flags.build, profileVersion: flags.profile,
|
|
50
53
|
personas, ...await scopeWithSave(flags, { api: context.api, gameId, upload: deps.uploadSave }),
|
|
51
|
-
standardProvider: flags.geriProvider ? GERI_PROVIDERS[flags.geriProvider] :
|
|
54
|
+
standardProvider: flags.geriProvider ? GERI_PROVIDERS[flags.geriProvider] : undefined, includeVideo: Boolean(flags.video),
|
|
52
55
|
output: flags.output });
|
|
53
|
-
if (flags.json)
|
|
56
|
+
if (flags.json) printJson({ ...result, personas });
|
|
54
57
|
else {
|
|
55
58
|
if (personas.length === 1) ui.info(`Persona: ${ALWAYS_INCLUDED_PERSONA}, always included. Add others with --personas a,b.`);
|
|
56
59
|
hostedQuoteLines(result).forEach(line => ui.info(line));
|
|
@@ -72,7 +75,7 @@ export async function hostedRun(filename, flags = {}, deps = {}) {
|
|
|
72
75
|
onPrepared: offer => { if (!flags.json) hostedQuoteLines(offer).forEach(line => ui.info(line)); },
|
|
73
76
|
admit: admitter(flags, deps, maxWaitMs) });
|
|
74
77
|
if (result.state === 'declined') {
|
|
75
|
-
if (flags.json)
|
|
78
|
+
if (flags.json) printJson(result); else ui.info('Hosted quote declined. No admission was requested.');
|
|
76
79
|
return ExitCode.CANCELED;
|
|
77
80
|
}
|
|
78
81
|
const { offer: admittedOffer, ...admitted } = result, gameId = admittedOffer.gameId;
|
|
@@ -82,12 +85,12 @@ export async function hostedRun(filename, flags = {}, deps = {}) {
|
|
|
82
85
|
ui.info(`Check on it with: ravensight-playtest hosted status ${admitted.admissionId}`);
|
|
83
86
|
}
|
|
84
87
|
if (!flags.wait) {
|
|
85
|
-
if (flags.json)
|
|
88
|
+
if (flags.json) printJson(admitted);
|
|
86
89
|
else ui.info(`The server acknowledged the paid admission (${admitted.state}). This does not prove a worker started or produced gameplay or reports.`);
|
|
87
90
|
return ExitCode.OK;
|
|
88
91
|
}
|
|
89
92
|
const view = await waitForRun({ api, gameId, admissionId: admitted.admissionId, apiUrl, sleep, now, onPhase: phaseLine(flags) });
|
|
90
|
-
if (flags.json)
|
|
93
|
+
if (flags.json) printJson({ ...admitted, gameId, status: view });
|
|
91
94
|
else printOutcome(view);
|
|
92
95
|
return exitFor(view);
|
|
93
96
|
});
|
|
@@ -215,7 +218,7 @@ export async function hostedRunDirect(flags = {}, deps = {}) {
|
|
|
215
218
|
}
|
|
216
219
|
const confirm = deps.confirm || (question => ui.confirm(question, { yes: Boolean(flags.yes) }));
|
|
217
220
|
if (!await confirm(confirmQuestion(offer))) {
|
|
218
|
-
if (flags.json)
|
|
221
|
+
if (flags.json) printJson({ state: 'declined', gameId, buildId: build.buildId, walletMutationRequested: false });
|
|
219
222
|
else ui.info('Declined. Nothing was charged.');
|
|
220
223
|
return ExitCode.CANCELED;
|
|
221
224
|
}
|
|
@@ -230,12 +233,12 @@ export async function hostedRunDirect(flags = {}, deps = {}) {
|
|
|
230
233
|
ui.info(`Check on it with: ravensight-playtest hosted status ${admitted.admissionId}`);
|
|
231
234
|
}
|
|
232
235
|
if (!flags.wait) {
|
|
233
|
-
if (flags.json)
|
|
236
|
+
if (flags.json) printJson(result);
|
|
234
237
|
else ui.info(`Report: ${reportUrl}`);
|
|
235
238
|
return ExitCode.OK;
|
|
236
239
|
}
|
|
237
240
|
const view = await waitForRun({ api, gameId, admissionId: admitted.admissionId, apiUrl, sleep, now, onPhase: phaseLine(flags) });
|
|
238
|
-
if (flags.json)
|
|
241
|
+
if (flags.json) printJson({ ...result, status: view });
|
|
239
242
|
else printOutcome(view);
|
|
240
243
|
return exitFor(view);
|
|
241
244
|
});
|
|
@@ -253,7 +256,7 @@ export async function hostedStatus(admissionId, flags = {}, deps = {}) {
|
|
|
253
256
|
const view = flags.wait
|
|
254
257
|
? await waitForRun({ api, gameId, admissionId, apiUrl, sleep, now, onPhase: phaseLine(flags) })
|
|
255
258
|
: statusView(gameId, apiUrl, await readHostedRun({ api, gameId, admissionId }), now());
|
|
256
|
-
if (flags.json)
|
|
259
|
+
if (flags.json) printJson(view); else printOutcome(view, now());
|
|
257
260
|
return flags.wait ? exitFor(view) : ExitCode.OK;
|
|
258
261
|
});
|
|
259
262
|
}
|
|
@@ -261,7 +264,7 @@ export async function hostedStatus(admissionId, flags = {}, deps = {}) {
|
|
|
261
264
|
/** "hosted status" with no run id: ask the server about every admission whose outcome is not known locally. */
|
|
262
265
|
async function resolvePending(context, flags, now) {
|
|
263
266
|
const results = await resolveHostedIntents({ api: context.api, apiUrl: context.api.apiUrl, repoRoot: context.repoRoot, now });
|
|
264
|
-
if (flags.json) {
|
|
267
|
+
if (flags.json) { printJson({ intents: results.map(({ message, ...row }) => row) }); }
|
|
265
268
|
else if (!results.length) ui.info('No hosted admission is waiting for an answer. Name a run to see it: ravensight-playtest hosted status <run-id>');
|
|
266
269
|
else pendingLines(results).forEach(line => ui.info(line));
|
|
267
270
|
return results.some(row => ['unknown', 'unreadable', 'wait', 'other_api'].includes(row.state)) ? ExitCode.ENVIRONMENT : ExitCode.OK;
|
|
@@ -307,13 +310,13 @@ export async function hostedCancel(admissionId, flags = {}, deps = {}) {
|
|
|
307
310
|
const confirm = deps.confirm || (question => ui.confirm(question, { yes: Boolean(flags.yes),
|
|
308
311
|
noTerminalMessage: 'No terminal to confirm in: pass --yes to cancel this run.' }));
|
|
309
312
|
if (!await confirm(`Cancel hosted run ${admissionId}? Work already completed follows the accepted policy; unstarted work is refunded during settlement.`)) {
|
|
310
|
-
if (flags.json)
|
|
313
|
+
if (flags.json) printJson({ state: 'kept', admissionId });
|
|
311
314
|
else ui.info('Nothing was canceled.');
|
|
312
315
|
return ExitCode.CANCELED;
|
|
313
316
|
}
|
|
314
317
|
await cancelHostedRun({ api, gameId, admissionId });
|
|
315
318
|
const view = statusView(gameId, apiUrl, await readHostedRun({ api, gameId, admissionId }), now());
|
|
316
|
-
if (flags.json)
|
|
319
|
+
if (flags.json) printJson(view);
|
|
317
320
|
else {
|
|
318
321
|
ui.ok(view.phase === 'canceled' ? `Hosted run ${admissionId} is canceled.` : `Cancellation requested for hosted run ${admissionId}.`);
|
|
319
322
|
printOutcome(view);
|
package/src/commands/login.js
CHANGED
|
@@ -13,7 +13,7 @@ import { ExitCode } from '../errors.js';
|
|
|
13
13
|
* The device code flow, whole: start one, show the user code, wait for the
|
|
14
14
|
* approval, store the token.
|
|
15
15
|
*
|
|
16
|
-
* No
|
|
16
|
+
* No model provider key is involved at any point, and none is ever stored: model
|
|
17
17
|
* calls go through the Ravensight proxy under this same token, so the developer
|
|
18
18
|
* machine holds one credential and it is revocable from the dashboard.
|
|
19
19
|
*
|
package/src/commands/run.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { nativeTarget, MOBILE_DRIVERS } from '../run/drivers/mobile/target.js';
|
|
2
|
+
import { nativeChecks } from '../run/drivers/mobile/preflight.js';
|
|
1
3
|
import { buildIdentity, readRunNotes } from '../run/gameMemory.js';
|
|
2
4
|
import { recordingForCompletion, recordingCompletionBody } from '../upload/recording.js';
|
|
3
5
|
import { playClockFor } from '../run/playClock.js';
|
|
@@ -79,6 +81,7 @@ export const DEFAULT_CONCURRENCY = 2;
|
|
|
79
81
|
* @returns {Promise<number>} process exit code
|
|
80
82
|
*/
|
|
81
83
|
export async function runCommand(flags = {}, injected = {}) {
|
|
84
|
+
injected = { ...injected };
|
|
82
85
|
const deps = injected.deps || (await getDeps());
|
|
83
86
|
const log = injected.log || logger(deps);
|
|
84
87
|
try {
|
|
@@ -91,6 +94,8 @@ export async function runCommand(flags = {}, injected = {}) {
|
|
|
91
94
|
if (code === EXIT.FAILED) throw error;
|
|
92
95
|
log(String(error && error.message ? error.message : error));
|
|
93
96
|
return code;
|
|
97
|
+
} finally {
|
|
98
|
+
await injected.nativeLease?.release();
|
|
94
99
|
}
|
|
95
100
|
}
|
|
96
101
|
|
|
@@ -176,6 +181,12 @@ async function run(flags, injected, deps, log) {
|
|
|
176
181
|
const keyModifier = resolveKeyModifier(options.keyModifier);
|
|
177
182
|
if (keyModifier.error) { log(keyModifier.error); return EXIT.ENVIRONMENT; }
|
|
178
183
|
const driverName = options.driver || (context.config && context.config.driver) || 'playwright_web';
|
|
184
|
+
try { options.nativePlan = nativeTarget(options, context.config, driverName, repoRoot); }
|
|
185
|
+
catch (error) { log(error.message); return EXIT.ENVIRONMENT; }
|
|
186
|
+
options.driverMode = options.nativePlan ? 'native' : 'webdriver';
|
|
187
|
+
if (options.nativePlan && controllers?.some(controller => controller !== 'standard')) {
|
|
188
|
+
log('Native mobile play currently supports Geri only. Use --controller geri. Nothing was registered or charged.'); return EXIT.ENVIRONMENT;
|
|
189
|
+
}
|
|
179
190
|
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; }
|
|
180
191
|
const served = await serveBuildDirOption({ options, driverName, log, serve: injected.serveBuildDir });
|
|
181
192
|
if (served === false) return EXIT.ENVIRONMENT;
|
|
@@ -189,7 +200,7 @@ async function run(flags, injected, deps, log) {
|
|
|
189
200
|
// --start opens a web build at a query or hash on its own address.
|
|
190
201
|
const target = withStart(resolveTarget(options, context.config, driverName, repoRoot), driverName === 'playwright_web' ? options.start : undefined);
|
|
191
202
|
if (!target) {
|
|
192
|
-
log('Point the run at a build: --build-url or --build-dir for
|
|
203
|
+
log('Point the run at a build: --build-url or --build-dir for web, --godot-project for Godot, --native-build for an APK or simulator APP, or --driver-config for a bridge.');
|
|
193
204
|
return EXIT.ENVIRONMENT;
|
|
194
205
|
}
|
|
195
206
|
|
|
@@ -208,14 +219,21 @@ async function run(flags, injected, deps, log) {
|
|
|
208
219
|
// `aggregate.*` steps are spendable from, and it is free (the price list has
|
|
209
220
|
// no unit for it), so asking costs nothing and not asking costs the judged
|
|
210
221
|
// dedup and success-criteria passes.
|
|
211
|
-
if (WEBDRIVER_NAMES.includes(driverName)) await readDriverConfig(target);
|
|
222
|
+
if (WEBDRIVER_NAMES.includes(driverName) && !options.nativePlan) await readDriverConfig(target);
|
|
223
|
+
if (options.nativePlan) {
|
|
224
|
+
const checked = await (injected.nativeChecks || nativeChecks)(options.nativePlan, { ...injected.nativeDeps, smoke: !options.skipPreflight, boot: true, reserve: true, recordVideo: recordingMode(options, driverName) !== false });
|
|
225
|
+
injected.nativeLease = checked.lease;
|
|
226
|
+
for (const row of checked.rows) log(`${row.status} ${row.name}: ${row.detail}${row.fix ? ` (${row.fix})` : ''}`);
|
|
227
|
+
if (!checked.ok) { log('Native preflight failed. No job was registered or charged.'); return EXIT.ENVIRONMENT; }
|
|
228
|
+
options.nativePlan = checked.plan;
|
|
229
|
+
}
|
|
212
230
|
if (driverName === "cli_stdio") await readBridgeConfig(target);
|
|
213
231
|
|
|
214
232
|
// The free capability probe. A native run depends on the developer's own
|
|
215
233
|
// automation server, which no amount of SDK or token setup proves, so the
|
|
216
234
|
// automation rows of `check` run first and a failure stops the run before
|
|
217
235
|
// the estimate, the confirmation and the register: no job, no reservation.
|
|
218
|
-
if (WEBDRIVER_NAMES.includes(driverName) && !options.skipPreflight) {
|
|
236
|
+
if (WEBDRIVER_NAMES.includes(driverName) && !options.nativePlan && !options.skipPreflight) {
|
|
219
237
|
// Each row is printed as it completes, and the slow step says so before
|
|
220
238
|
// it starts, so a first session on a fresh simulator does not look hung.
|
|
221
239
|
const preflight = await (injected.preflight || automationChecks)(
|
|
@@ -368,7 +386,7 @@ async function run(flags, injected, deps, log) {
|
|
|
368
386
|
cli_version: cliVersion,
|
|
369
387
|
confirm_price_cents: estimate.estimate_cents,
|
|
370
388
|
brief_version: brief.version ?? null,
|
|
371
|
-
build: { kind: driverName === 'playwright_web' ? 'url' : (WEBDRIVER_NAMES.includes(driverName) || driverName === 'cli_stdio') ? 'driver_config' : 'godot_project', ref: target },
|
|
389
|
+
build: { kind: options.nativePlan ? 'native_build' : driverName === 'playwright_web' ? 'url' : (WEBDRIVER_NAMES.includes(driverName) || driverName === 'cli_stdio') ? 'driver_config' : 'godot_project', ref: target },
|
|
372
390
|
repo: { commit: (context.config && context.config.commit) || '', dirty: Boolean(context.config && context.config.dirty) },
|
|
373
391
|
max_actions: Number.isInteger(options.maxActions) ? options.maxActions : null,
|
|
374
392
|
...(runLength !== 'standard' ? { run_length: runLength } : {}),
|
|
@@ -403,6 +421,9 @@ async function run(flags, injected, deps, log) {
|
|
|
403
421
|
...(options.focus?.length ? { focus: options.focus } : {}), ...(options.avoid?.length ? { avoid: options.avoid } : {}),
|
|
404
422
|
controller: options.controller || 'standard',
|
|
405
423
|
...(controllers ? { controllers } : {}),
|
|
424
|
+
driverMode: options.driverMode,
|
|
425
|
+
...(options.nativePlan ? { nativePlan: options.nativePlan } : {}),
|
|
426
|
+
realtime: Boolean(options.realtime), phone: Boolean(options.phone),
|
|
406
427
|
recordVideo: recordingMode(options, driverName),
|
|
407
428
|
concurrency: options.concurrency ?? DEFAULT_CONCURRENCY,
|
|
408
429
|
uploadVideo: Boolean(options.uploadVideo),
|
|
@@ -687,6 +708,7 @@ export async function playJob({
|
|
|
687
708
|
journal,
|
|
688
709
|
inFlight,
|
|
689
710
|
makeDriver,
|
|
711
|
+
nativeLock: injected.nativeLease?.lock,
|
|
690
712
|
brief,
|
|
691
713
|
localBrief,
|
|
692
714
|
// A run that plays its own checkout, or a feature scenario's own brief, is not the game's ordinary build.
|
|
@@ -815,6 +837,7 @@ export async function playPersonaRun({
|
|
|
815
837
|
journal,
|
|
816
838
|
inFlight = null,
|
|
817
839
|
makeDriver,
|
|
840
|
+
nativeLock,
|
|
818
841
|
brief = null,
|
|
819
842
|
localBrief = {},
|
|
820
843
|
memory = null,
|
|
@@ -834,7 +857,7 @@ export async function playPersonaRun({
|
|
|
834
857
|
const runTarget = entry.target || target;
|
|
835
858
|
let driver;
|
|
836
859
|
try {
|
|
837
|
-
driver = await makeDriver(driverName, driverOptions({ headless, driverName, target: runTarget, directory, entry, jobId, keyModifier: options.keyModifier, godotPath: options.godotPath, realtime: options.realtime, phone: options.phone }));
|
|
860
|
+
driver = await makeDriver(driverName, driverOptions({ headless, driverName, target: runTarget, directory, entry, jobId, keyModifier: options.keyModifier, godotPath: options.godotPath, realtime: options.realtime, phone: options.phone, native: options.nativePlan, mode: options.driverMode, nativeLock }));
|
|
838
861
|
} catch (error) {
|
|
839
862
|
// A driver that cannot even be built (the browser package missing, say) is
|
|
840
863
|
// what a new machine hits first. The run is completed as failed now, with
|
|
@@ -894,6 +917,7 @@ export async function playPersonaRun({
|
|
|
894
917
|
client,
|
|
895
918
|
api,
|
|
896
919
|
modelBudgetUsd: runModelBudgetUsd(entry),
|
|
920
|
+
inputMeasurement: pack.routing?.input_measurement,
|
|
897
921
|
gameId,
|
|
898
922
|
jobId,
|
|
899
923
|
runId,
|
|
@@ -919,7 +943,7 @@ export async function playPersonaRun({
|
|
|
919
943
|
edgePass: options.noEdgePass !== true,
|
|
920
944
|
replayFindings: options.noReplay !== true,
|
|
921
945
|
// A web run's findings are replayed in a second browser of the same kind, on the same target, with no recording.
|
|
922
|
-
...(driverName === 'playwright_web' ? { replayDriver: () => makeDriver(driverName, driverOptions({ headless, driverName, target: runTarget, directory, entry, jobId, keyModifier: options.keyModifier, godotPath: options.godotPath, realtime: options.realtime, phone: options.phone })) } : {}),
|
|
946
|
+
...(driverName === 'playwright_web' ? { replayDriver: () => makeDriver(driverName, driverOptions({ headless, driverName, target: runTarget, directory, entry, jobId, keyModifier: options.keyModifier, godotPath: options.godotPath, realtime: options.realtime, phone: options.phone, native: options.nativePlan, mode: options.driverMode, nativeLock })) } : {}),
|
|
923
947
|
// A run sold by the minute stops on the clock (../run/playClock.js).
|
|
924
948
|
playClock: playClockFor(options, entry),
|
|
925
949
|
...(options.phone === true && driverName === 'playwright_web' ? { viewport: PHONE_VIEWPORT } : {}),
|
|
@@ -1695,7 +1719,7 @@ export async function resolveSetup(deps, options, log) {
|
|
|
1695
1719
|
*
|
|
1696
1720
|
* @returns {Object}
|
|
1697
1721
|
*/
|
|
1698
|
-
export function driverOptions({ headless, driverName, target, directory, entry, jobId, keyModifier, godotPath, realtime, phone = false }) {
|
|
1722
|
+
export function driverOptions({ headless, driverName, target, directory, entry, jobId, keyModifier, godotPath, realtime, phone = false, native = null, mode = 'webdriver', nativeLock }) {
|
|
1699
1723
|
// Only the browser driver sends key chords with a modifier.
|
|
1700
1724
|
const modifier = driverName === 'playwright_web' ? resolveKeyModifier(keyModifier).modifier : null;
|
|
1701
1725
|
const godot = driverName === 'godot_driver'
|
|
@@ -1704,6 +1728,7 @@ export function driverOptions({ headless, driverName, target, directory, entry,
|
|
|
1704
1728
|
? { pauseBetweenActions: realtime !== true, lockstep: realtime !== true, ...(Number.isInteger(entry.seed) ? { seed: entry.seed } : {}), ...(entry.trace_header ? { traceHeader: entry.trace_header } : {}), ...(godotPath ? { godotPath } : {}) }
|
|
1705
1729
|
: {};
|
|
1706
1730
|
return {
|
|
1731
|
+
...(MOBILE_DRIVERS.includes(driverName) ? { native, mode, ...(nativeLock ? { lock: nativeLock } : {}) } : {}),
|
|
1707
1732
|
headless,
|
|
1708
1733
|
...(modifier ? { modifier } : {}),
|
|
1709
1734
|
// A canvas game in the browser is parked between actions too, unless the
|
|
@@ -1901,11 +1926,12 @@ const RECORDING_DRIVERS = Object.freeze(['playwright_web', 'godot_driver']);
|
|
|
1901
1926
|
* @returns {boolean|'auto'}
|
|
1902
1927
|
*/
|
|
1903
1928
|
export function recordingMode(options = {}, driverName = '') {
|
|
1929
|
+
const native = MOBILE_DRIVERS.includes(driverName) && options.driverMode === 'native';
|
|
1904
1930
|
if (options.recordVideo === true || options.uploadVideo === true) return true;
|
|
1905
1931
|
// A resumed job keeps what its journal says.
|
|
1906
|
-
if (options.recordVideo === 'auto') return RECORDING_DRIVERS.includes(driverName) ? 'auto' : false;
|
|
1932
|
+
if (options.recordVideo === 'auto') return (native || RECORDING_DRIVERS.includes(driverName)) ? 'auto' : false;
|
|
1907
1933
|
if (options.noRecordVideo === true || options.recordVideo === false) return false;
|
|
1908
|
-
return RECORDING_DRIVERS.includes(driverName) ? 'auto' : false;
|
|
1934
|
+
return (native || RECORDING_DRIVERS.includes(driverName)) ? 'auto' : false;
|
|
1909
1935
|
}
|
|
1910
1936
|
|
|
1911
1937
|
/**
|
|
@@ -1918,7 +1944,7 @@ export function recordingMode(options = {}, driverName = '') {
|
|
|
1918
1944
|
export function videoPlanLines(options = {}, driverName = '') {
|
|
1919
1945
|
if (driverName === 'cli_stdio') return [];
|
|
1920
1946
|
const mode = recordingMode(options, driverName);
|
|
1921
|
-
if (mode === false) return [RECORDING_DRIVERS.includes(driverName) ? NO_VIDEO_LINE : `No video will be recorded: ${driverName} cannot record what it plays.`];
|
|
1947
|
+
if (mode === false) return [(RECORDING_DRIVERS.includes(driverName) || (MOBILE_DRIVERS.includes(driverName) && options.driverMode === 'native')) ? NO_VIDEO_LINE : `No video will be recorded: ${driverName} cannot record what it plays.`];
|
|
1922
1948
|
if (options.uploadVideo === true) return ['A video of each run is recorded and uploaded with the reports (--upload-video).'];
|
|
1923
1949
|
if (mode === true) return ['A video of each run is kept on this machine, in its run folder. It is not uploaded.'];
|
|
1924
1950
|
return [`A video of each run is kept on this machine, in its run folder${driverName === 'godot_driver' ? ' (Godot needs ffmpeg for it)' : ''}. It is not uploaded; --upload-video sends it, --no-record-video turns it off.`];
|
|
@@ -1947,7 +1973,7 @@ export async function videoSummaryLine({ directory, persona = '', options = {},
|
|
|
1947
1973
|
}
|
|
1948
1974
|
}
|
|
1949
1975
|
if (recordingMode(options, driverName) === false) {
|
|
1950
|
-
return `No video${who}: ${RECORDING_DRIVERS.includes(driverName) ? 'turned off with --no-record-video' : `${driverName || 'this driver'} cannot record what it plays`}.`;
|
|
1976
|
+
return `No video${who}: ${(RECORDING_DRIVERS.includes(driverName) || (MOBILE_DRIVERS.includes(driverName) && options.driverMode === 'native')) ? 'turned off with --no-record-video' : `${driverName || 'this driver'} cannot record what it plays`}.`;
|
|
1951
1977
|
}
|
|
1952
1978
|
const meta = await readFile(path.join(directory, 'recording.json'), 'utf8').then(JSON.parse).catch(() => null);
|
|
1953
1979
|
const why = meta ? (meta.detail || meta.failure || meta.reason || 'the recording did not finish') : 'the run ended before a recording was made';
|
|
@@ -2090,6 +2116,8 @@ export function resolveMaxActions(options, persona, pack, run = null) {
|
|
|
2090
2116
|
}
|
|
2091
2117
|
|
|
2092
2118
|
export function resolveTarget(options, config, driverName, repoRoot = null) {
|
|
2119
|
+
const native = nativeTarget(options, config, driverName, repoRoot || process.cwd());
|
|
2120
|
+
if (native) return native.build;
|
|
2093
2121
|
if (WEBDRIVER_NAMES.includes(driverName) || driverName === 'cli_stdio') return options.driverConfig || (config?.build?.kind === 'driver_config' ? config.build.ref : null);
|
|
2094
2122
|
const build = (config && config.build) || {};
|
|
2095
2123
|
if (driverName === 'playwright_web') return options.buildUrl || (build.kind === 'url' ? build.ref : null) || null;
|
package/src/dashboard.js
CHANGED
|
@@ -4,9 +4,8 @@ import { resolveApiUrl } from './paths.js';
|
|
|
4
4
|
* Where the dashboard is, given where the API is.
|
|
5
5
|
*
|
|
6
6
|
* There is no endpoint that says, so this is a derivation with an override.
|
|
7
|
-
* `api.ravensight.io` pairs with `app.ravensight.io
|
|
8
|
-
*
|
|
9
|
-
* pairs with the Vite dev server's port. Anything else keeps the same host,
|
|
7
|
+
* `api.ravensight.io` pairs with `app.ravensight.io`. A localhost API
|
|
8
|
+
* pairs with the local dashboard dev server's port. Anything else keeps the same host,
|
|
10
9
|
* which is the least surprising guess for a single host deployment.
|
|
11
10
|
*
|
|
12
11
|
* `RAVENSIGHT_DASHBOARD_URL` overrides all of it, and the device code flow does
|
package/src/detect.js
CHANGED
|
@@ -75,3 +75,20 @@ export function recommendConcurrency(machine = {}) {
|
|
|
75
75
|
const recommended = Math.max(1, Math.min(4, byMem > 0 ? Math.min(byCpu, byMem) : 1));
|
|
76
76
|
return { cpus, freeMemGb: Number(freeMemGb.toFixed(1)), recommended };
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
/** Native device diagnostics; missing tools are observations, never exceptions. */
|
|
80
|
+
export async function detectAdb() {
|
|
81
|
+
const { sdkTool } = await import('./run/drivers/mobile/process.js');
|
|
82
|
+
const binary = await sdkTool('adb'); const version = await probe(binary, ['version']);
|
|
83
|
+
return { path: version === null ? null : binary, version };
|
|
84
|
+
}
|
|
85
|
+
export async function detectEmulator() {
|
|
86
|
+
const { sdkTool } = await import('./run/drivers/mobile/process.js');
|
|
87
|
+
const binary = await sdkTool('emulator'); const version = await probe(binary, ['-version']);
|
|
88
|
+
return { path: version === null ? null : binary, version };
|
|
89
|
+
}
|
|
90
|
+
export async function detectXcrun() {
|
|
91
|
+
if (process.platform !== 'darwin') return { path: null, version: null };
|
|
92
|
+
const binary = process.env.RAVENSIGHT_XCRUN || 'xcrun'; const version = await probe(binary, ['simctl', 'help']);
|
|
93
|
+
return { path: version === null ? null : binary, version };
|
|
94
|
+
}
|
package/src/fsutil.js
CHANGED
|
@@ -53,7 +53,7 @@ export async function writeJson(file, value, options = {}) {
|
|
|
53
53
|
/**
|
|
54
54
|
* The sha256 of a file, hex, streamed so a 200 MB video does not go through
|
|
55
55
|
* memory. Hex because that is what the presign route wants; it converts to the
|
|
56
|
-
* base64
|
|
56
|
+
* base64 storage needs on its own side.
|
|
57
57
|
* @param {string} file
|
|
58
58
|
* @returns {Promise<string>}
|
|
59
59
|
*/
|
|
@@ -186,12 +186,12 @@ async function nativeHeader(archive, file, format, requirements) {
|
|
|
186
186
|
// do instead. Asked only once a web upload has already failed (no entry page,
|
|
187
187
|
// or an entry file that is not a page), so it never refuses a web build.
|
|
188
188
|
const NATIVE_ADVICE = Object.freeze({
|
|
189
|
-
unity: 'this is a Unity desktop or mobile build
|
|
189
|
+
unity: 'this is a Unity desktop or mobile build. Cloud playtests play web builds: build for the Web platform in Unity and upload that output; the export settings are at ravensight.io/docs/playtest/#playtest-unity. A Unity Android emulator or iOS Simulator build can be playtested on this machine with --driver android_driver or ios_driver; a Unity desktop build cannot be playtested today',
|
|
190
190
|
unreal: 'this is an Unreal Engine build. Native builds cannot be playtested today and Unreal has no supported web export, so no playtest can play it. Cloud and local playtests play web builds',
|
|
191
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 of the Godot project itself with --driver godot_driver',
|
|
192
192
|
love: 'this is a LÖVE game file. Cloud playtests play web builds: package it with love.js and upload that folder. A native LÖVE build cannot be playtested today',
|
|
193
|
-
android: 'this is an Android app
|
|
194
|
-
ios: 'this is an iOS app
|
|
193
|
+
android: 'this is an Android app. Cloud playtests play web builds only: build your game for the web and upload that output. To playtest the APK itself, play it on this machine in an Android emulator with ravensight-playtest run --driver android_driver --native-build game.apk --device <emulator>',
|
|
194
|
+
ios: 'this is an iOS app. Cloud playtests play web builds only: build your game for the web and upload that output. An App Store or device build (.ipa) cannot be playtested; a simulator build of the game (.app) can be played on a Mac in the iOS Simulator with ravensight-playtest run --driver ios_driver --native-build Game.app --device <simulator>',
|
|
195
195
|
desktop: 'this is a desktop program, not a web build, and native desktop builds cannot be playtested today. Cloud and local playtests play web builds (HTML and WebAssembly): build for the web and upload that output'
|
|
196
196
|
});
|
|
197
197
|
const any = (paths, pattern) => paths.some(name => pattern.test(name));
|
|
@@ -12,11 +12,13 @@ const fail = message => { throw new CliError(message); };
|
|
|
12
12
|
const base = game => `/api/v1/games/${encodeURIComponent(game)}/playtest/hosted`;
|
|
13
13
|
const body = answer => answer.body;
|
|
14
14
|
const money = cents => `$${(cents / 100).toFixed(2)}`;
|
|
15
|
+
// The storage host the API signs uploads for; moves to files.ravensight.io.
|
|
16
|
+
const STORAGE_HOST = /^[a-z0-9.-]+\.s3\.[a-z0-9-]+\.amazonaws\.com$/;
|
|
15
17
|
|
|
16
18
|
export function singlePut(upload, { size, sha256, uploadExpiresAt }, now = Date.now()) {
|
|
17
19
|
const url = new URL(upload?.url), headers = upload?.headers;
|
|
18
|
-
if (upload.method !== 'PUT' || url.protocol !== 'https:' || url.username || url.password || url.hash
|
|
19
|
-
||
|
|
20
|
+
if (upload.method !== 'PUT' || url.protocol !== 'https:' || url.port || url.username || url.password || url.hash
|
|
21
|
+
|| !STORAGE_HOST.test(url.hostname)) fail('The server did not return a supported private upload destination. Preserve the original upload journal.');
|
|
20
22
|
const expected = { 'content-type': 'application/zip', 'if-none-match': '*', 'x-amz-checksum-sha256': Buffer.from(sha256, 'hex').toString('base64'), 'x-amz-server-side-encryption': 'AES256' };
|
|
21
23
|
if (!headers || Object.keys(headers).sort().join(',') !== Object.keys(expected).sort().join(',')
|
|
22
24
|
|| Object.entries(expected).some(([key, value]) => headers[key] !== value)) fail('The upload headers do not match the inspected archive. Preserve the original upload journal.');
|
|
@@ -43,17 +45,16 @@ export async function putArchive(archive, transfer, { fetchImpl = globalThis.fet
|
|
|
43
45
|
} finally { stream.destroy(); }
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
const S3_HOST = /^[a-z0-9.-]+\.s3\.[a-z0-9-]+\.amazonaws\.com$/;
|
|
47
48
|
// A part is tried a few times; a URL the storage refuses (it expired with the
|
|
48
49
|
// credentials that signed it) is signed again once per part.
|
|
49
50
|
export const PART_TRIES = 4;
|
|
50
51
|
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
51
52
|
|
|
52
|
-
/** One part of a multipart upload as the server signed it: its number, exact length and private
|
|
53
|
+
/** One part of a multipart upload as the server signed it: its number, exact length and private upload URL. */
|
|
53
54
|
function signedPart(part, { number, bytes, uploadId }) {
|
|
54
55
|
let url;
|
|
55
|
-
try { url = new URL(part?.url); } catch { fail('The server did not return a supported private
|
|
56
|
-
if (part.partNumber !== number || part.bytes !== bytes || url.protocol !== 'https:' || url.username || url.password || url.hash || !
|
|
56
|
+
try { url = new URL(part?.url); } catch { fail('The server did not return a supported private upload destination. Preserve the original upload journal.'); }
|
|
57
|
+
if (part.partNumber !== number || part.bytes !== bytes || url.protocol !== 'https:' || url.port || url.username || url.password || url.hash || !STORAGE_HOST.test(url.hostname)
|
|
57
58
|
|| url.searchParams.get('partNumber') !== String(number) || url.searchParams.get('uploadId') !== uploadId
|
|
58
59
|
|| !/^\d{8}T\d{6}Z$/.test(url.searchParams.get('X-Amz-Date') || '')) fail('The upload parts do not match the inspected archive. Preserve the original upload journal.');
|
|
59
60
|
return { number, bytes, url: url.href };
|
|
@@ -79,7 +80,7 @@ export function multipartPlan(upload, { size, uploadExpiresAt }, now = Date.now(
|
|
|
79
80
|
/**
|
|
80
81
|
* Send every part in order and answer `[{ partNumber, etag }]` for the
|
|
81
82
|
* completion. Each part streams from the archive with its exact length. A part
|
|
82
|
-
* that fails is sent again (the same bytes;
|
|
83
|
+
* that fails is sent again (the same bytes; storage keeps the last), and a part
|
|
83
84
|
* whose URL storage refuses is signed again by `resign(partNumber)`, once.
|
|
84
85
|
*/
|
|
85
86
|
export async function putParts(archive, plan, { fetchImpl = globalThis.fetch, signal, onProgress, resign, sleepImpl = sleep } = {}) {
|
|
@@ -21,11 +21,27 @@ export const COMBINED = Object.freeze(['combined']);
|
|
|
21
21
|
export const COMPARISON = Object.freeze(['standard', 'jev']);
|
|
22
22
|
const isCombined = controllers => same(controllers, COMBINED);
|
|
23
23
|
const slug = value => typeof value === 'string' && value.length <= 48 && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value);
|
|
24
|
-
const PROVIDERS = ['anthropic', 'openai'];
|
|
25
24
|
// Customers choose Geri's model provider by role, never by vendor name. The
|
|
26
|
-
// server's wire values stay
|
|
25
|
+
// server's wire values stay internal to this file: nothing printed (help,
|
|
26
|
+
// errors, logs or --json) names them; ravensight.io/legal/subprocessors does.
|
|
27
27
|
export const GERI_PROVIDERS = Object.freeze({ primary: 'anthropic', alternate: 'openai' });
|
|
28
|
-
const
|
|
28
|
+
const PROVIDERS = Object.values(GERI_PROVIDERS);
|
|
29
|
+
const roleOf = wire => Object.keys(GERI_PROVIDERS).find(role => GERI_PROVIDERS[role] === wire) || 'other';
|
|
30
|
+
const providerLabel = wire => (roleOf(wire) === 'other' ? 'model provider' : `${roleOf(wire)} model provider`);
|
|
31
|
+
const PROVIDER_KEYS = new Set(['standardProvider', 'standardProviders', 'defaultStandardProvider']);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A copy of a quote, offer or admission for printing: every provider wire id
|
|
35
|
+
* becomes its role (primary, alternate). The saved quote file keeps the wire
|
|
36
|
+
* values, because consent is checked against them.
|
|
37
|
+
*/
|
|
38
|
+
export function providerRoles(value) {
|
|
39
|
+
if (Array.isArray(value)) return value.map(providerRoles);
|
|
40
|
+
if (!value || typeof value !== 'object') return value;
|
|
41
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, PROVIDER_KEYS.has(key)
|
|
42
|
+
? (Array.isArray(entry) ? entry.map(item => (typeof item === 'string' ? roleOf(item) : item)) : typeof entry === 'string' ? roleOf(entry) : entry)
|
|
43
|
+
: providerRoles(entry)]));
|
|
44
|
+
}
|
|
29
45
|
const base = game => `/api/v1/games/${encodeURIComponent(game)}/playtest/hosted`;
|
|
30
46
|
const digest = value => createHash('sha256').update(stableStringify(value)).digest('hex');
|
|
31
47
|
const fail = message => { throw new CliError(message); };
|
package/src/run/anygame/index.js
CHANGED
|
@@ -97,7 +97,7 @@ export function actionOf(tool, input = {}) {
|
|
|
97
97
|
* it; `controls` the studio's own words about its controls, when the brief
|
|
98
98
|
* has them; `touch` whether the run is played with a finger (--phone).
|
|
99
99
|
*/
|
|
100
|
-
export function createLocalAnyGame({ briefText = '', controls = null, touch = false, reportLanguageHint = null, driverName = '' } = {}) {
|
|
100
|
+
export function createLocalAnyGame({ briefText = '', controls = null, touch = false, continuousTime = false, reportLanguageHint = null, driverName = '' } = {}) {
|
|
101
101
|
const memory = createMemory();
|
|
102
102
|
const book = createControlBook({ touch, given: controls });
|
|
103
103
|
const genre = createGenre();
|
|
@@ -116,6 +116,7 @@ export function createLocalAnyGame({ briefText = '', controls = null, touch = fa
|
|
|
116
116
|
? '- Controls: the brief gives the controls. In your first actions inside the game itself, try each of them once, saying what you expect, so the runner has measured them; write a note only if one does not do what the brief says.'
|
|
117
117
|
: `- Controls: you do not yet know this game's controls. Read any control prompt or tutorial on screen and keep it with a "tutorial:" note. In your first actions inside the game itself, try the likely inputs one at a time, saying what you expect of each (${touch ? 'a tap, a swipe each way, a long press, a pinch' : 'the arrows, W A S D, Space, Enter, a click, a drag'}). The runner measures what each did and gives it back to you in the notebook. On a menu, or once the notebook shows the controls, just play.`);
|
|
118
118
|
lines.push(`- When the game itself is on screen, write one reaction note "kind: <one of ${KIND_IDS.join(', ')}>" (${KIND_IDS.filter(k => k !== 'unknown').map(k => `${k}: ${KINDS[k].examples}`).join('; ')}). The runner answers once with how that kind of game is best played.`);
|
|
119
|
+
if (continuousTime) lines.push('- Timing: this native driver does not pause the game between inputs or while you think. A genre label never establishes that time is stopped. Watch visible countdowns and respond promptly to timed choices; an untimed menu or turn can still be considered at your own pace.');
|
|
119
120
|
lines.push('- The game may be written in any language. Read its text as written and act on what it says. When the brief names something to pick, find the option on screen that means the same in the game\'s language, and say in a "choice:" note which on-screen label you took for which words of the brief.');
|
|
120
121
|
if (report.code !== 'en') lines.push(`- The brief is written in ${report.name}. Write your notes, your expectations and the prose of the report in ${report.name}, because ${report.why}. Keep the report's required section headings and its JSON keys exactly as they are given.`);
|
|
121
122
|
return lines.join('\n');
|
|
@@ -180,7 +181,12 @@ export function createLocalAnyGame({ briefText = '', controls = null, touch = fa
|
|
|
180
181
|
*/
|
|
181
182
|
function aside({ actions = actionsSeen, dropped = 0 } = {}) {
|
|
182
183
|
const parts = [];
|
|
183
|
-
if (genre.settled && !styleSaid) {
|
|
184
|
+
if (genre.settled && !styleSaid) {
|
|
185
|
+
styleSaid = true;
|
|
186
|
+
if (continuousTime) {
|
|
187
|
+
parts.push(`You classified the game as ${genre.style().label}. Timing comes from the current screen, not that label: this native session keeps running while you think. A visible countdown requires a prompt response. Do not assume the board or clock waits for your next input; plan only inputs whose results you can predict, and wait only while the game is plainly busy. For untimed choices, take the time needed to read them. Progress is what the current screen actually shows.`);
|
|
188
|
+
} else parts.push(...genre.lines());
|
|
189
|
+
}
|
|
184
190
|
const due = dropped > droppedSeen || actions - shownAt >= NOTES_EVERY;
|
|
185
191
|
if (due) {
|
|
186
192
|
const text = notebook();
|
|
@@ -249,7 +255,7 @@ export function createLocalAnyGame({ briefText = '', controls = null, touch = fa
|
|
|
249
255
|
}
|
|
250
256
|
|
|
251
257
|
function digest() {
|
|
252
|
-
return { language: { brief: briefLanguage, game: gameLanguage, report }, kind: genre.digest(), controls: book.digest(), memory: memory.digest(), sound: sound ? sound.summary() : null, soundControl, stats: { ...stats } };
|
|
258
|
+
return { language: { brief: briefLanguage, game: gameLanguage, report }, kind: genre.digest(), timing: { continuous: continuousTime, source: continuousTime ? 'native driver capability' : 'not asserted by this runner' }, controls: book.digest(), memory: memory.digest(), sound: sound ? sound.summary() : null, soundControl, stats: { ...stats } };
|
|
253
259
|
}
|
|
254
260
|
|
|
255
261
|
return { systemText, seeScreen, afterAction, afterNote, aside, notebook, soundAvailable, afterSound, soundFindings, capabilityNotes, reportLines, digest, memory, book, genre, get report() { return report; } };
|