vibedgames 0.5.0 → 0.6.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/LICENSE +21 -0
- package/dist/commands/completions.d.ts +1 -1
- package/dist/commands/completions.js +21 -20
- package/dist/commands/credits.d.ts +5 -5
- package/dist/commands/credits.js +43 -33
- package/dist/commands/deploy.d.ts +10 -10
- package/dist/commands/deploy.js +155 -139
- package/dist/commands/factory.d.ts +1 -1
- package/dist/commands/factory.js +18 -15
- package/dist/commands/fork.d.ts +14 -14
- package/dist/commands/fork.js +51 -46
- package/dist/commands/generate.js +318 -264
- package/dist/commands/init.d.ts +8 -8
- package/dist/commands/init.js +31 -24
- package/dist/commands/login.js +12 -12
- package/dist/commands/logout.js +2 -2
- package/dist/commands/new.d.ts +16 -16
- package/dist/commands/new.js +153 -142
- package/dist/commands/playtest-run.d.ts +62 -0
- package/dist/commands/playtest-run.js +258 -0
- package/dist/commands/playtest.d.ts +41 -6
- package/dist/commands/playtest.js +114 -101
- package/dist/commands/update.d.ts +7 -7
- package/dist/commands/update.js +20 -17
- package/dist/commands/whoami.d.ts +5 -5
- package/dist/commands/whoami.js +8 -7
- package/dist/index.js +21 -11
- package/dist/lib/api.d.ts +4 -4
- package/dist/lib/api.js +6 -12
- package/dist/lib/archive.d.ts +4 -4
- package/dist/lib/archive.js +121 -104
- package/dist/lib/codex.d.ts +45 -15
- package/dist/lib/codex.js +175 -106
- package/dist/lib/config-file.d.ts +6 -6
- package/dist/lib/config-file.js +28 -26
- package/dist/lib/config.d.ts +8 -8
- package/dist/lib/config.js +31 -33
- package/dist/lib/manifest.d.ts +3 -3
- package/dist/lib/manifest.js +42 -38
- package/dist/lib/media-args.d.ts +7 -7
- package/dist/lib/media-args.js +113 -95
- package/dist/lib/media-download.d.ts +9 -9
- package/dist/lib/media-download.js +148 -134
- package/dist/lib/media-poll.d.ts +8 -8
- package/dist/lib/media-poll.js +32 -27
- package/dist/lib/media-upload.d.ts +2 -2
- package/dist/lib/media-upload.js +27 -27
- package/dist/lib/output.d.ts +27 -12
- package/dist/lib/output.js +26 -26
- package/dist/lib/package-manager.d.ts +3 -3
- package/dist/lib/package-manager.js +27 -22
- package/dist/lib/playtest/agent.d.ts +188 -0
- package/dist/lib/playtest/agent.js +610 -0
- package/dist/lib/playtest/browser.d.ts +109 -0
- package/dist/lib/playtest/browser.js +219 -0
- package/dist/lib/playtest/controls.d.ts +47 -0
- package/dist/lib/playtest/controls.js +218 -0
- package/dist/lib/playtest/errors.d.ts +9 -0
- package/dist/lib/playtest/errors.js +12 -0
- package/dist/lib/playtest/keys.d.ts +41 -0
- package/dist/lib/playtest/keys.js +157 -0
- package/dist/lib/playtest/run.d.ts +193 -0
- package/dist/lib/playtest/run.js +408 -0
- package/dist/lib/run.d.ts +4 -4
- package/dist/lib/run.js +7 -4
- package/dist/lib/strict-args.d.ts +4 -4
- package/dist/lib/strict-args.js +28 -18
- package/dist/lib/types.d.ts +5 -5
- package/dist/lib/types.js +9 -12
- package/dist/lib/update.d.ts +4 -4
- package/dist/lib/update.js +41 -32
- package/dist/lib/upload.d.ts +4 -4
- package/dist/lib/upload.js +14 -9
- package/package.json +16 -16
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export declare const playtestRunCommand: import("citty").CommandDef<{
|
|
2
|
+
readonly field: {
|
|
3
|
+
readonly description: "Print a single value from the JSON result, e.g. --field request_id or --field images[0].url. Prints scalars bare for shell capture.";
|
|
4
|
+
readonly type: "string";
|
|
5
|
+
};
|
|
6
|
+
readonly json: {
|
|
7
|
+
readonly description: "Print structured JSON to stdout.";
|
|
8
|
+
readonly type: "boolean";
|
|
9
|
+
};
|
|
10
|
+
readonly controls: {
|
|
11
|
+
readonly description: `Control scheme: a preset (${string}) or a JSON file. Default: the game's window.__GAME_PLAYTEST__ if it publishes one, else wasd.`;
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
};
|
|
14
|
+
readonly expectProgress: {
|
|
15
|
+
readonly description: "Assert the objective advances (score rises) during the run.";
|
|
16
|
+
readonly type: "boolean";
|
|
17
|
+
};
|
|
18
|
+
readonly game: {
|
|
19
|
+
readonly description: "Deployed game slug to playtest (mutually exclusive with --url).";
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
};
|
|
22
|
+
readonly goal: {
|
|
23
|
+
readonly description: "What the playtester is trying to do — what wins, what kills, which way is progress. Overrides the scheme's goal.";
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
};
|
|
26
|
+
readonly headed: {
|
|
27
|
+
readonly description: "Show the browser.";
|
|
28
|
+
readonly type: "boolean";
|
|
29
|
+
};
|
|
30
|
+
readonly keepOpen: {
|
|
31
|
+
readonly description: "Leave the page open afterwards.";
|
|
32
|
+
readonly type: "boolean";
|
|
33
|
+
};
|
|
34
|
+
readonly minDisplacement: {
|
|
35
|
+
readonly description: "Per-decision movement that proves input works, in the units of the game's player.x/y (default 5 — pixels; a game in world units needs far less). Overrides the scheme's.";
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
};
|
|
38
|
+
readonly model: {
|
|
39
|
+
readonly default: "jev-latest";
|
|
40
|
+
readonly description: "Decision model id.";
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
};
|
|
43
|
+
readonly seed: {
|
|
44
|
+
readonly default: "12345";
|
|
45
|
+
readonly description: "Seed for the game's RNG.";
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
};
|
|
48
|
+
readonly tickMs: {
|
|
49
|
+
readonly default: string;
|
|
50
|
+
readonly description: `Minimum time each decision's inputs stay held (ms). The default caps the playtester near a fast player's cadence; 0 = as fast as decisions arrive.`;
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
readonly ticks: {
|
|
54
|
+
readonly default: "60";
|
|
55
|
+
readonly description: "Decisions to make.";
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
};
|
|
58
|
+
readonly url: {
|
|
59
|
+
readonly description: "Where the game is served (mutually exclusive with --game).";
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import { consola } from "consola";
|
|
3
|
+
import { authErrorCode, createClient } from "../lib/api.js";
|
|
4
|
+
import { getBaseUrl, getToken } from "../lib/config.js";
|
|
5
|
+
import { outputArgs, writeStructured } from "../lib/output.js";
|
|
6
|
+
import { GameBrowser } from "../lib/playtest/browser.js";
|
|
7
|
+
import { DEFAULT_PRESET, PRESETS, PRESET_NAMES, parseControls, readControlsArg, } from "../lib/playtest/controls.js";
|
|
8
|
+
import { HarnessError } from "../lib/playtest/errors.js";
|
|
9
|
+
import { buildReport, runInPage, verdict } from "../lib/playtest/run.js";
|
|
10
|
+
import { assertKnownFlags } from "../lib/strict-args.js";
|
|
11
|
+
import { ensureAgentBrowser, projectSessionId, resolveGameUrl } from "./playtest.js";
|
|
12
|
+
/**
|
|
13
|
+
* `vg playtest run` — let a model play the game, and report how it went.
|
|
14
|
+
*
|
|
15
|
+
* The loop runs inside the game's page: several times a second it reads
|
|
16
|
+
* `window.__GAME_DIAGNOSTICS__`, asks the decision model (via
|
|
17
|
+
* `/api/playtest/decide` with a short-lived token; the server holds the
|
|
18
|
+
* provider key) which movement to hold and which actions to take, dispatches
|
|
19
|
+
* them as real held input, and repeats — with a per-frame reflex where the
|
|
20
|
+
* game's `__GAME_PLAYTEST__` provides one. Code does perception and
|
|
21
|
+
* keystrokes; the model only decides.
|
|
22
|
+
*
|
|
23
|
+
* Exit 0 = the game plays under the model. Exit 1 = it doesn't (the report
|
|
24
|
+
* says why). Exit 2 = the harness itself failed (bad flags, no browser, the
|
|
25
|
+
* game never booted, the model unreachable).
|
|
26
|
+
*/
|
|
27
|
+
const HARNESS_FAILURE = 2;
|
|
28
|
+
/**
|
|
29
|
+
* Floor on the hold, so a fast model doesn't play at a jittery superhuman
|
|
30
|
+
* rate: ~6 decisions a second is a quick human's cadence. A real decision
|
|
31
|
+
* round trip is usually longer than this, in which case it never binds.
|
|
32
|
+
*/
|
|
33
|
+
const DEFAULT_TICK_MS = 150;
|
|
34
|
+
const runArgs = {
|
|
35
|
+
controls: {
|
|
36
|
+
description: `Control scheme: a preset (${PRESET_NAMES.join(", ")}) or a JSON file. Default: the game's window.__GAME_PLAYTEST__ if it publishes one, else ${DEFAULT_PRESET}.`,
|
|
37
|
+
type: "string",
|
|
38
|
+
},
|
|
39
|
+
expectProgress: {
|
|
40
|
+
description: "Assert the objective advances (score rises) during the run.",
|
|
41
|
+
type: "boolean",
|
|
42
|
+
},
|
|
43
|
+
game: {
|
|
44
|
+
description: "Deployed game slug to playtest (mutually exclusive with --url).",
|
|
45
|
+
type: "string",
|
|
46
|
+
},
|
|
47
|
+
goal: {
|
|
48
|
+
description: "What the playtester is trying to do — what wins, what kills, which way is progress. Overrides the scheme's goal.",
|
|
49
|
+
type: "string",
|
|
50
|
+
},
|
|
51
|
+
headed: { description: "Show the browser.", type: "boolean" },
|
|
52
|
+
keepOpen: { description: "Leave the page open afterwards.", type: "boolean" },
|
|
53
|
+
minDisplacement: {
|
|
54
|
+
description: "Per-decision movement that proves input works, in the units of the game's player.x/y (default 5 — pixels; a game in world units needs far less). Overrides the scheme's.",
|
|
55
|
+
type: "string",
|
|
56
|
+
},
|
|
57
|
+
model: { default: "jev-latest", description: "Decision model id.", type: "string" },
|
|
58
|
+
seed: { default: "12345", description: "Seed for the game's RNG.", type: "string" },
|
|
59
|
+
tickMs: {
|
|
60
|
+
default: String(DEFAULT_TICK_MS),
|
|
61
|
+
description: `Minimum time each decision's inputs stay held (ms). The default caps the playtester near a fast player's cadence; 0 = as fast as decisions arrive.`,
|
|
62
|
+
type: "string",
|
|
63
|
+
},
|
|
64
|
+
ticks: { default: "60", description: "Decisions to make.", type: "string" },
|
|
65
|
+
url: {
|
|
66
|
+
description: "Where the game is served (mutually exclusive with --game).",
|
|
67
|
+
type: "string",
|
|
68
|
+
},
|
|
69
|
+
...outputArgs,
|
|
70
|
+
};
|
|
71
|
+
const numberArg = (raw, flag, check, hint) => {
|
|
72
|
+
// `Number("")` is 0, not NaN, so an empty value would slip past otherwise.
|
|
73
|
+
const value = raw.trim() === "" ? Number.NaN : Number(raw);
|
|
74
|
+
if (!check(value)) {
|
|
75
|
+
throw new HarnessError(`\`${flag}\` must be ${hint}.`);
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
};
|
|
79
|
+
const settingsFrom = (args) => {
|
|
80
|
+
if (!args.url && !args.game) {
|
|
81
|
+
throw new HarnessError("Pass --url <url> or --game <slug>.");
|
|
82
|
+
}
|
|
83
|
+
if (args.url && args.game) {
|
|
84
|
+
throw new HarnessError("Pass either --url or --game, not both.");
|
|
85
|
+
}
|
|
86
|
+
if (args.goal !== undefined && args.goal.trim() === "") {
|
|
87
|
+
throw new HarnessError("`--goal` must not be empty.");
|
|
88
|
+
}
|
|
89
|
+
if (args.model.trim() === "") {
|
|
90
|
+
throw new HarnessError("`--model` must not be empty.");
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
expectProgress: args.expectProgress === true,
|
|
94
|
+
explicitControls: args.controls === undefined ? null : readControlsArg(args.controls),
|
|
95
|
+
goal: args.goal ?? null,
|
|
96
|
+
headed: args.headed === true,
|
|
97
|
+
keepOpen: args.keepOpen === true,
|
|
98
|
+
minDisplacement: args.minDisplacement === undefined
|
|
99
|
+
? null
|
|
100
|
+
: numberArg(args.minDisplacement, "--min-displacement", (n) => Number.isFinite(n) && n > 0, "a positive number"),
|
|
101
|
+
model: args.model,
|
|
102
|
+
seed: numberArg(args.seed, "--seed", Number.isFinite, "a finite number"),
|
|
103
|
+
target: args.game ? `game:${args.game}` : (args.url ?? ""),
|
|
104
|
+
tickMs: numberArg(args.tickMs, "--tick-ms", (n) => Number.isFinite(n) && n >= 0 && n <= 5000, "between 0 and 5000 milliseconds"),
|
|
105
|
+
ticks: numberArg(args.ticks, "--ticks", (n) => Number.isInteger(n) && n > 0, "a positive integer"),
|
|
106
|
+
url: args.url ?? resolveGameUrl(args.game ?? null),
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Which scheme drives this run: an explicit `--controls`, else the game's
|
|
111
|
+
* own manifest, else the wasd preset. `--goal` wins over all of them.
|
|
112
|
+
*/
|
|
113
|
+
const chooseControls = (settings, manifest) => {
|
|
114
|
+
let controls = settings.explicitControls;
|
|
115
|
+
if (!controls) {
|
|
116
|
+
controls =
|
|
117
|
+
manifest === null
|
|
118
|
+
? PRESETS.get(DEFAULT_PRESET)
|
|
119
|
+
: parseControls(manifest, "window.__GAME_PLAYTEST__");
|
|
120
|
+
}
|
|
121
|
+
if (!controls) {
|
|
122
|
+
throw new HarnessError("no control scheme available.");
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
...controls,
|
|
126
|
+
goal: settings.goal ?? controls.goal,
|
|
127
|
+
minDisplacement: settings.minDisplacement ?? controls.minDisplacement,
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
const isLoopback = (url) => {
|
|
131
|
+
const host = URL.canParse(url) ? new URL(url).hostname : null;
|
|
132
|
+
return host === "localhost" || host === "127.0.0.1" || host === "[::1]";
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* The page calls the API itself, and Chrome refuses a public page a request
|
|
136
|
+
* to a loopback address. Said up front, because in the page it is only ever
|
|
137
|
+
* "Failed to fetch".
|
|
138
|
+
*/
|
|
139
|
+
const assertReachable = (gameUrl) => {
|
|
140
|
+
if (isLoopback(getBaseUrl()) && !isLoopback(gameUrl)) {
|
|
141
|
+
throw new HarnessError(`the game at ${gameUrl} is a public page and the API (${getBaseUrl()}) is on localhost — the browser blocks that request. Serve the game locally, or point VG_API_URL at a deployed API.`);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* A token for this run, from `playtest.session`, and where the page should
|
|
146
|
+
* send decisions. The token is all the (untrusted) game page ever holds.
|
|
147
|
+
*/
|
|
148
|
+
const mintSession = async (client) => {
|
|
149
|
+
try {
|
|
150
|
+
const { token } = await client.playtest.session();
|
|
151
|
+
return { decideUrl: new URL("/api/playtest/decide", getBaseUrl()).toString(), token };
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
const code = authErrorCode(error);
|
|
155
|
+
if (code === "UNAUTHORIZED" || code === "FORBIDDEN") {
|
|
156
|
+
throw new HarnessError("Not authenticated. Run `vg login`, or check your VG_TOKEN / API key.");
|
|
157
|
+
}
|
|
158
|
+
throw new HarnessError(`couldn't start a playtest session: ${error instanceof Error ? error.message : String(error)}`);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const summarize = (report, failures, warnings) => {
|
|
162
|
+
const rate = report.decisionsPerSecond === null ? "" : ` at ${report.decisionsPerSecond}/s`;
|
|
163
|
+
consola.log(`The model made ${report.ticksRun} decisions${rate} (mean ${report.model.meanDecisionMs ?? "?"} ms each) on ${report.target}`);
|
|
164
|
+
consola.log(` frames +${report.framesAdvanced} moved ${report.distanceTravelled} (peak ${report.maxTickDisplacement}/tick) score ${report.scoreBefore} → ${report.scoreAfter} stuck ${report.stuckTicks} (longest run ${report.longestStuckRun})`);
|
|
165
|
+
const moves = Object.entries(report.decisions.moves)
|
|
166
|
+
.map(([label, count]) => `${label}×${count}`)
|
|
167
|
+
.join(" ");
|
|
168
|
+
const { progress } = report.decisions;
|
|
169
|
+
const judged = progress === null ? "n/a" : `${progress.first} → ${progress.last}`;
|
|
170
|
+
consola.log(` moves: ${moves || "none"} confidence ${report.decisions.meanConfidence ?? "n/a"} progress ${judged} tokens ${report.model.inputTokens}`);
|
|
171
|
+
for (const warning of warnings) {
|
|
172
|
+
consola.warn(warning);
|
|
173
|
+
}
|
|
174
|
+
if (failures.length > 0) {
|
|
175
|
+
consola.error(`FAILED — ${failures.join("; ")}`);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
consola.success("PASSED");
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
export const playtestRunCommand = defineCommand({
|
|
182
|
+
args: runArgs,
|
|
183
|
+
meta: {
|
|
184
|
+
description: "Let a model play the game and report how it went — reads the game's diagnostics each tick, decides what to hold, drives real input. Needs the diagnostics contract (see the playtest skill).",
|
|
185
|
+
name: "run",
|
|
186
|
+
},
|
|
187
|
+
run: async ({ args, rawArgs }) => {
|
|
188
|
+
assertKnownFlags(rawArgs, runArgs);
|
|
189
|
+
let settings;
|
|
190
|
+
try {
|
|
191
|
+
settings = settingsFrom(args);
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
consola.error(error instanceof Error ? error.message : String(error));
|
|
195
|
+
process.exit(HARNESS_FAILURE);
|
|
196
|
+
}
|
|
197
|
+
if (!getToken()) {
|
|
198
|
+
consola.warn("Not logged in. Run `vg login` to authenticate.");
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
const client = createClient();
|
|
202
|
+
const { bin } = ensureAgentBrowser();
|
|
203
|
+
const browser = new GameBrowser(bin, process.env.AGENT_BROWSER_SESSION ?? projectSessionId());
|
|
204
|
+
// Ctrl-C mid-hold leaves the key down and the sampler running in a daemon
|
|
205
|
+
// page that outlives this process — the same poison an early exit causes.
|
|
206
|
+
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
207
|
+
process.on(signal, () => {
|
|
208
|
+
browser.stopAgent();
|
|
209
|
+
process.exit(HARNESS_FAILURE);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
let opts;
|
|
213
|
+
let payload;
|
|
214
|
+
try {
|
|
215
|
+
assertReachable(settings.url);
|
|
216
|
+
const session = await mintSession(client);
|
|
217
|
+
const launched = browser.launch({
|
|
218
|
+
headed: settings.headed,
|
|
219
|
+
seed: settings.seed,
|
|
220
|
+
url: settings.url,
|
|
221
|
+
});
|
|
222
|
+
opts = {
|
|
223
|
+
controls: chooseControls(settings, launched.manifest),
|
|
224
|
+
expectProgress: settings.expectProgress,
|
|
225
|
+
model: settings.model,
|
|
226
|
+
tickMs: settings.tickMs,
|
|
227
|
+
ticks: settings.ticks,
|
|
228
|
+
};
|
|
229
|
+
const run = await runInPage(browser, opts, session);
|
|
230
|
+
const report = buildReport(opts, {
|
|
231
|
+
before: launched.before,
|
|
232
|
+
consoleErrors: browser.consoleErrors(),
|
|
233
|
+
gpu: browser.gpuInfo(),
|
|
234
|
+
pageErrors: browser.pageErrors(),
|
|
235
|
+
run,
|
|
236
|
+
seed: settings.seed,
|
|
237
|
+
seedApplied: launched.seedApplied,
|
|
238
|
+
target: settings.target,
|
|
239
|
+
});
|
|
240
|
+
payload = { ...report, ...verdict(report, opts) };
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
browser.stopAgent();
|
|
244
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
245
|
+
consola.error(error instanceof HarnessError ? message : `playtest harness failed: ${message}`);
|
|
246
|
+
process.exit(HARNESS_FAILURE);
|
|
247
|
+
}
|
|
248
|
+
if (!settings.keepOpen) {
|
|
249
|
+
browser.close();
|
|
250
|
+
}
|
|
251
|
+
if (!writeStructured(payload, args)) {
|
|
252
|
+
summarize(payload, payload.failures, payload.warnings);
|
|
253
|
+
}
|
|
254
|
+
if (payload.failures.length > 0) {
|
|
255
|
+
process.exit(1);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
});
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
export interface Binary {
|
|
2
|
+
bin: string;
|
|
3
|
+
version: string;
|
|
4
|
+
}
|
|
5
|
+
/** The agent-browser binary to use. VG_AGENT_BROWSER_BIN overrides (dev). */
|
|
6
|
+
export declare const resolveBinary: () => Binary | null;
|
|
7
|
+
/**
|
|
8
|
+
* Install agent-browser globally, then provision its browser. Upstream ships
|
|
9
|
+
* these as two steps (`npm i -g` puts the Rust binary in place; `install`
|
|
10
|
+
* fetches Chrome for Testing and reuses an existing Chrome/Brave/Playwright
|
|
11
|
+
* install when it finds one), so a first run pays for both.
|
|
12
|
+
*/
|
|
13
|
+
export declare const bootstrap: () => Binary;
|
|
14
|
+
/**
|
|
15
|
+
* Bring an agent-browser older than the minimum up to it.
|
|
16
|
+
*
|
|
17
|
+
* The floor exists because agent-browser is pre-1.0: the playtest skill teaches
|
|
18
|
+
* a command surface, and the bot script depends on response shapes, both of
|
|
19
|
+
* which a minor bump can move. Installing the spec only on first use would
|
|
20
|
+
* leave an older global install — already on PATH from some earlier project —
|
|
21
|
+
* driving every run, which is how a documented contract silently stops holding.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ensureMinimum: (resolved: Binary) => Binary;
|
|
1
24
|
/**
|
|
2
25
|
* The URL a game is served at: a per-slug subdomain of whatever host this CLI
|
|
3
26
|
* is pointed at, so `VG_API_URL=…staging vg playtest --game x` playtests
|
|
4
27
|
* staging rather than silently hitting production the way a hardcoded apex
|
|
5
28
|
* would. Mirrors the derivation the deploy router does server-side.
|
|
6
29
|
*/
|
|
7
|
-
declare
|
|
30
|
+
export declare const resolveGameUrl: (slug: string | null) => string;
|
|
8
31
|
/**
|
|
9
32
|
* The tokens in `args` that aren't flags or flag values — agent-browser's verb
|
|
10
33
|
* and its positional arguments, in order.
|
|
@@ -21,8 +44,8 @@ declare function resolveGameUrl(slug: string | null): string;
|
|
|
21
44
|
* a grammar that moves every release. This catches the shapes people actually
|
|
22
45
|
* type; anything past it reaches agent-browser as before.
|
|
23
46
|
*/
|
|
24
|
-
export declare
|
|
25
|
-
export declare
|
|
47
|
+
export declare const bareTokens: (args: string[]) => string[];
|
|
48
|
+
export declare const expandGameFlag: (args: string[], resolveUrl?: typeof resolveGameUrl) => string[];
|
|
26
49
|
/**
|
|
27
50
|
* agent-browser's session defaults to the literal name `default`, which is
|
|
28
51
|
* shared by every caller on the machine. Two `vg playtest` runs — two projects
|
|
@@ -34,8 +57,20 @@ export declare function expandGameFlag(args: string[], resolveUrl?: typeof resol
|
|
|
34
57
|
* environment, or is asking about sessions themselves (`session list` must see
|
|
35
58
|
* every session, not just this project's).
|
|
36
59
|
*/
|
|
37
|
-
export declare
|
|
60
|
+
export declare const withScopedSession: (args: string[], sessionId: () => string) => string[];
|
|
61
|
+
/**
|
|
62
|
+
* A stable per-project session name. Keyed on the project root when there is
|
|
63
|
+
* one so every command run from anywhere inside the project shares a browser,
|
|
64
|
+
* and on the cwd otherwise. Hashed because the name lands in a socket path.
|
|
65
|
+
*/
|
|
66
|
+
export declare const projectSessionId: () => string;
|
|
67
|
+
/**
|
|
68
|
+
* The agent-browser to drive: installed on first use, upgraded to the floor
|
|
69
|
+
* when older. Bootstrap covers `install` too: on a fresh machine that's the
|
|
70
|
+
* most natural first command, and re-running the provision step it just did
|
|
71
|
+
* is harmless.
|
|
72
|
+
*/
|
|
73
|
+
export declare const ensureAgentBrowser: () => Binary;
|
|
38
74
|
/** Resolve (installing on first use) and exec agent-browser. Never returns. */
|
|
39
|
-
export declare
|
|
75
|
+
export declare const runPlaytest: (rawArgs: string[]) => never;
|
|
40
76
|
export declare const playtestCommand: import("citty").CommandDef<import("citty").ArgsDef>;
|
|
41
|
-
export {};
|