ravensight-playtest 0.11.0 → 0.11.1

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
@@ -202,7 +202,7 @@ to be returned after cleanup. The server’s isolated validator remains
202
202
  authoritative. A passing local check does not establish engine, GPU or license
203
203
  compatibility.
204
204
 
205
- A ZIP of up to 300 MB is sent as one streamed presigned PUT. A larger one, up
205
+ A ZIP of up to 300 MB is sent as one streamed PUT to a signed upload URL. A larger one, up
206
206
  to 4 GB, is sent in 64 MB parts, in order, each streamed from disk with its
207
207
  exact length; a part that fails is sent again, and a part address that has
208
208
  expired is signed again by the server. Parts are not resumed across separate
@@ -1330,15 +1330,15 @@ matched, never the value.
1330
1330
  ### The 90 day artifacts
1331
1331
 
1332
1332
  The session video and the transcript expire after 90 days; everything else lives
1333
- for the life of the game. That is enforced as an S3 object tag rather than as a
1333
+ for the life of the game. That is enforced as a storage object tag rather than as a
1334
1334
  filename rule, because a lifecycle rule can filter on a tag or a key prefix and
1335
1335
  the filename is at the end of the key.
1336
1336
 
1337
1337
  The tag is a contract between three parties, and the CLI is one of them: the
1338
- presign response hands back the exact `x-amz-tagging` value that was signed, and
1338
+ upload response hands back the exact tag value that was signed, and
1339
1339
  the CLI sends it **verbatim** on the PUT. Changing it, or dropping it, is a
1340
- `SignatureDoesNotMatch` rather than an untagged object, which is the failure you
1341
- want: an untagged 200 MB video would sit in the bucket forever and nothing would
1340
+ signature mismatch rather than an untagged object, which is the failure you
1341
+ want: an untagged 200 MB video would sit in storage forever and nothing would
1342
1342
  say so. The CLI never computes the value itself.
1343
1343
 
1344
1344
  ## Offline
@@ -1401,7 +1401,7 @@ Resume preserves the playtester recorded in the job journal.
1401
1401
 
1402
1402
  The `0.5.0` candidate adds local recording and explicit comparisons. It requires a
1403
1403
  matching server release for playtester plans; an older server is refused before
1404
- purchase. These commands do not activate graphical AWS hosting.
1404
+ purchase. These commands do not activate graphical cloud hosting.
1405
1405
 
1406
1406
  To keep one playthrough's video on your computer:
1407
1407
 
@@ -471,7 +471,7 @@ GDScript.
471
471
  refused, an unknown method and a bad param get the right codes), the author hook,
472
472
  typing a space, and the export strip. It drives the fixture project at
473
473
  `test/fixtures/godot-project/` and **skips itself** when no Godot 4.2+ binary is
474
- found, the same way the Ravensight repo's ClickHouse integration tests skip
474
+ found, the same way the Ravensight server's datastore integration tests skip
475
475
  without a server. A skip there is expected, not a failure to fix, but it does
476
476
  mean a change to `driver.gd` is unverified until it has run on a machine with
477
477
  Godot installed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ravensight-playtest",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Local AI playtests and seeded game simulations with reports in Ravensight.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://ravensight.io/docs/#playtest",
package/src/api/README.md CHANGED
@@ -316,13 +316,13 @@ belong to a job are `capability-report.json`, `aggregate-report.md` and
316
316
  `aggregate-report.json`.
317
317
 
318
318
  `runDir` is a directory on disk. Files are matched against the upload
319
- allowlist compiled into the CLI (the same list as the server's
320
- `src/playtest/limits.js`); anything else is reported in `skipped` and never
319
+ allowlist compiled into the CLI (the same list the server
320
+ enforces); anything else is reported in `skipped` and never
321
321
  sent. Source code is not on the list and is never uploaded.
322
322
 
323
323
  Each file is sha256'd and sized locally, presigned in one request, then PUT
324
324
  with the `Content-Type` the server signed and, for `session.webm`,
325
- `session.mp4` and `transcript.jsonl`, the `x-amz-tagging` value the presign
325
+ `session.mp4` and `transcript.jsonl`, the tag value the presign
326
326
  response handed back, sent verbatim. Dropping that header is a signature
327
327
  mismatch, not an untagged object.
328
328
 
@@ -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://s3.test/x', tagging: null })) };
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 });
@@ -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 Anthropic key is involved at any point, and none is ever stored: model
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/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`, which is what
8
- * `.env.ravensight.prod.example` records as `DASHBOARD_URL`. A localhost API
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/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 S3 needs on its own side.
56
+ * base64 storage needs on its own side.
57
57
  * @param {string} file
58
58
  * @returns {Promise<string>}
59
59
  */
@@ -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
- || !/^[a-z0-9.-]+\.s3\.[a-z0-9-]+\.amazonaws\.com$/.test(url.hostname)) fail('The server did not return a supported private S3 upload destination. Preserve the original upload journal.');
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 S3 URL. */
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 S3 upload destination. Preserve the original upload journal.'); }
56
- if (part.partNumber !== number || part.bytes !== bytes || url.protocol !== 'https:' || url.username || url.password || url.hash || !S3_HOST.test(url.hostname)
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; S3 keeps the last), and a part
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 } = {}) {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Two independent ceilings:
5
5
  *
6
- * 1. **Images.** `routing.json`'s `persona_playtest.act` sets
6
+ * 1. **Images.** The server routing table's `persona_playtest.act` sets
7
7
  * `max_images: 1`, and the proxy counts image blocks across the WHOLE
8
8
  * `messages` array and answers 400 `too_many_images` past that. So the
9
9
  * ceiling is on the context, not on the newest turn: exactly one image
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * The brief asked for at most two images per call. One is what the
16
16
  * server actually allows on this step, and a body with two comes back
17
- * 400 with nothing played, so this file follows routing.json. It is a
17
+ * 400 with nothing played, so this file follows the server routing table. It is a
18
18
  * constant rather than a literal so that a routing change is a one line
19
19
  * change here, and `shrinkImages` exists so a caller that meets
20
20
  * `too_many_images` anyway can retry smaller instead of failing the run.
@@ -183,7 +183,7 @@ export function holdWallMs(holdMs, scale = 1) {
183
183
  *
184
184
  * Godot needs a real environment to start, but it is also running the
185
185
  * customer's game code, and that code has no business seeing the developer's
186
- * ANTHROPIC_API_KEY, RAVENSIGHT_TOKEN, cloud credentials or CI secrets. So the
186
+ * model provider API keys, RAVENSIGHT_TOKEN, cloud credentials or CI secrets. So the
187
187
  * environment is built from this list rather than inherited wholesale. Names are
188
188
  * matched case insensitively, because Windows environment blocks are.
189
189
  */
package/src/run/model.js CHANGED
@@ -1,18 +1,18 @@
1
- import Anthropic from '@anthropic-ai/sdk';
1
+ import ModelClient from '@anthropic-ai/sdk';
2
2
 
3
3
  /**
4
4
  * Every model call this CLI makes goes through here, and every one of them
5
- * goes to Ravensight's proxy rather than to the Anthropic API.
5
+ * goes to Ravensight's proxy rather than to a model provider's API.
6
6
  *
7
7
  * What that means concretely, and why:
8
8
  *
9
- * - **No Anthropic key exists on the developer's machine.** The client is
9
+ * - **No model provider key exists on the developer's machine.** The client is
10
10
  * built with `authToken` (the `gt_cli_...` token from the device-code
11
- * flow) and an explicitly null `apiKey`, so a stray `ANTHROPIC_API_KEY`
11
+ * flow) and an explicitly null `apiKey`, so a stray provider API key
12
12
  * in the developer's environment is never picked up and never sent
13
13
  * anywhere.
14
14
  * - **No `model` field, ever.** Routing is the server's decision
15
- * (`src/playtest/packs/routing.json`, server-only). The proxy rebuilds
15
+ * (the server's own routing table, server-only). The proxy rebuilds
16
16
  * the body from an allowlist and supplies the model itself; a body that
17
17
  * names a real routed model id is refused 403 `model_not_allowed`. The
18
18
  * CLI cannot know which model a step resolves to, which is the point.
@@ -40,7 +40,7 @@ import Anthropic from '@anthropic-ai/sdk';
40
40
  /** Where the proxy lives under the API host. */
41
41
  export const MODEL_BASE_PATH = '/api/v1/playtest/model';
42
42
 
43
- /** Step names, from routing.json by way of `clientRouting()`. */
43
+ /** Step names, from the server routing table by way of `clientRouting()`. */
44
44
  export const STEPS = Object.freeze({
45
45
  personaAct: 'persona_playtest.act',
46
46
  personaReport: 'persona_playtest.report',
@@ -142,7 +142,7 @@ export function headerValue(headers, name) {
142
142
  /**
143
143
  * Normalise the two error envelopes the playtest surface uses.
144
144
  *
145
- * The router's own refusals are the Anthropic envelope the SDK already
145
+ * The router's own refusals are the error envelope the model client SDK already
146
146
  * parses, `{ error: { type, message, ...figures } }`. The two middleware
147
147
  * refusals (no `gt_cli_` credential, an ingest key) keep the repo's flat
148
148
  * `{ error: 'code', message }` shape, because they come from the shared CLI
@@ -196,16 +196,16 @@ export function withProviderReason(message, figures = {}) {
196
196
  * @param {string} opts.token the gt_cli_ token
197
197
  * @param {number} [opts.timeoutMs]
198
198
  * @param {Function} [opts.fetch] test seam
199
- * @returns {Anthropic}
199
+ * @returns {ModelClient}
200
200
  */
201
201
  export function createModelClient({ apiUrl, token, timeoutMs = 300000, fetch: fetchImpl } = {}) {
202
202
  if (!apiUrl) throw new Error('createModelClient needs an apiUrl');
203
203
  if (!token) throw new Error('createModelClient needs a gt_cli_ token');
204
- return new Anthropic({
204
+ return new ModelClient({
205
205
  baseURL: `${String(apiUrl).replace(/\/+$/, '')}${MODEL_BASE_PATH}`,
206
206
  authToken: token,
207
207
  // Explicitly null so the SDK never falls back to a local
208
- // ANTHROPIC_API_KEY. This CLI has no business holding one.
208
+ // provider API key. This CLI has no business holding one.
209
209
  apiKey: null,
210
210
  // Retries are ours: the proxy's 429s carry a code and a retry_after
211
211
  // that decide whether waiting will help at all, and the SDK cannot see
@@ -238,10 +238,10 @@ export function mergeUsage(accumulator, usage) {
238
238
  * One model turn.
239
239
  *
240
240
  * @param {Object} args
241
- * @param {Anthropic} args.client
241
+ * @param {ModelClient} args.client
242
242
  * @param {string} args.jobId
243
243
  * @param {string} args.runId
244
- * @param {string} args.step a routing.json step name
244
+ * @param {string} args.step a step name from the server routing table
245
245
  * @param {Array} args.messages
246
246
  * @param {string|Array} [args.system]
247
247
  * @param {Array} [args.tools]
package/src/run/paths.js CHANGED
@@ -18,7 +18,7 @@ import path from 'node:path';
18
18
  *
19
19
  * The basenames are load-bearing: the upload presign keys are derived from
20
20
  * the path relative to the run directory, and the server's own allowlist
21
- * and lifecycle rules (the S3 lifecycle expires every `session.webm` and
21
+ * and lifecycle rules (the storage lifecycle expires every `session.webm` and
22
22
  * `transcript.jsonl` at 90 days) are written against exactly these names.
23
23
  */
24
24
 
@@ -9,7 +9,7 @@ import { MAX_SCAN_BYTES, scanForSecrets } from './secretScan.js';
9
9
  /**
10
10
  * The read-only source tools for `game_profile`: `read_file`, `glob` and
11
11
  * `grep`, which are exactly the three names
12
- * `routing.json`'s `game_profile.triage` allows (and `read_file` alone on
12
+ * the server routing table's `game_profile.triage` allows (and `read_file` alone on
13
13
  * `game_profile.synthesis` and `aggregate.synthesis`).
14
14
  *
15
15
  * `fix.apply` is the one step that also gets `write_file`, and it gets it
package/src/run/tools.js CHANGED
@@ -12,7 +12,7 @@ export { STALE_REF_MESSAGE };
12
12
  /**
13
13
  * The client tool set for `persona_playtest.act`.
14
14
  *
15
- * **The names are not ours to choose.** `routing.json`'s
15
+ * **The names are not ours to choose.** The server routing table's
16
16
  * `persona_playtest.act` lists `allowed_client_tools: ["snapshot", "click",
17
17
  * "type", "key", "navigate", "wait", "screenshot"]`, and the proxy answers
18
18
  * 400 `tool_not_allowed` for anything else. Two consequences worth knowing
package/src/run/usage.js CHANGED
@@ -10,8 +10,8 @@ import { assertNoSecrets } from './secretScan.js';
10
10
  * `message_delta` carry them, and the proxy re-emits both verbatim.
11
11
  *
12
12
  * **Dollars are not counted locally, and cannot be.** Per-token prices live
13
- * in `routing.json`, which is server-only by design (CLAUDE.md: no model id
14
- * or price anywhere in the API's `src/**`, and the client subset
13
+ * in the server's routing table, which is server-only by design (no model id
14
+ * or price is ever sent to a client, and the client subset
15
15
  * `clientRouting()` deliberately carries neither). So `total_usd` is taken
16
16
  * from the server, which prices every call as it makes it: the run's
17
17
  * `usage.total_usd` comes back on every heartbeat answer
@@ -45,8 +45,8 @@ export const VIDEO_PATHS = Object.freeze(['session.webm', 'session.mp4']);
45
45
  export const TRACE_PATH = 'trace.jsonl';
46
46
 
47
47
  /**
48
- * The paths whose objects carry the `retention=90d` S3 tag, from W8's
49
- * `RETENTION_TAGGED_PATHS`. The CLI never computes the tag value itself: the
48
+ * The paths whose objects carry the `retention=90d` storage tag, mirroring the
49
+ * server's `RETENTION_TAGGED_PATHS`. The CLI never computes the tag value itself: the
50
50
  * presign response hands back the exact string that was signed. This list is
51
51
  * only used to explain, in `--dry-upload` output, which files expire.
52
52
  */
@@ -119,14 +119,14 @@ export async function planRunDir(runDir, opts = {}) {
119
119
  }
120
120
 
121
121
  /**
122
- * The verbatim `x-amz-tagging` value for a presigned entry.
122
+ * The verbatim storage tagging header value for a presigned entry.
123
123
  *
124
124
  * The presign response is the authority: it carries back exactly what was
125
125
  * signed, so the CLI never computes the tag itself. Two shapes are accepted
126
- * because the two server tasks that meet here spell it differently: W8's
127
- * `presignPut` returns the encoded string, and W4b's upload route currently
128
- * passes the tag object through. Either is normalized to the string S3 wants;
129
- * a mismatch would be a SignatureDoesNotMatch rather than an untagged object,
126
+ * because server versions spell it differently: one returns the encoded
127
+ * string, another passes the tag object through. Either is normalized to the
128
+ * string storage wants; a mismatch would be a signature mismatch rather than
129
+ * an untagged object,
130
130
  * so guessing is not an option and accepting both is.
131
131
  *
132
132
  * @param {unknown} tagging
@@ -148,13 +148,13 @@ export function taggingHeader(tagging) {
148
148
  * PUT one file at a presigned URL.
149
149
  *
150
150
  * The headers are exactly the ones the URL was signed with: the content type,
151
- * `x-amz-tagging` when the presign said so, and `x-amz-checksum-sha256` with
151
+ * the tagging header when the presign said so, and the checksum header with
152
152
  * the base64 digest the presign echoed back. The checksum header is what
153
- * makes S3 hash the body it receives and refuse one that differs, and what
153
+ * makes storage hash the body it receives and refuse one that differs, and what
154
154
  * lets the server's `complete` read the checksum back; a presign that names
155
155
  * none is an older server, and the header is simply not sent. An extra
156
156
  * signed header that is missing, or a value that differs by one character,
157
- * is a SignatureDoesNotMatch from S3 and not a retryable failure, so nothing
157
+ * is a signature mismatch from storage and not a retryable failure, so nothing
158
158
  * is added here on a guess.
159
159
  *
160
160
  * @param {Object} options
@@ -206,7 +206,7 @@ export async function putFile(options) {
206
206
  const text = await response.text().catch(() => '');
207
207
  lastError = new ApiError({
208
208
  status: response.status,
209
- code: response.status === 403 ? 'presign_expired' : `s3_${response.status}`,
209
+ code: response.status === 403 ? 'presign_expired' : `storage_${response.status}`,
210
210
  message: `PUT ${entry.path} answered ${response.status}: ${text.slice(0, 300)}`,
211
211
  method: 'PUT',
212
212
  path: entry.path