vectorbench 0.0.0-stage → 3.0.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/.env.example +9 -0
- package/LICENSE +201 -0
- package/NOTICE +49 -0
- package/README.md +163 -2
- package/bench.config.mjs +255 -0
- package/bin/vectorbench.mjs +68 -0
- package/harness/Dockerfile +104 -0
- package/harness/adapters/chat.mjs +192 -0
- package/harness/adapters/index.mjs +77 -0
- package/harness/adapters/interactions.mjs +212 -0
- package/harness/adapters/messages.mjs +190 -0
- package/harness/adapters/responses.mjs +179 -0
- package/harness/box/README.md +46 -0
- package/harness/box/check.mjs +18 -0
- package/harness/box/tools.py +638 -0
- package/harness/box/vb3d.py +556 -0
- package/harness/claude-code.mjs +581 -0
- package/harness/codex-account.mjs +122 -0
- package/harness/codex.mjs +933 -0
- package/harness/loop.mjs +114 -0
- package/harness/prices.mjs +30 -0
- package/harness/request.mjs +155 -0
- package/harness/sandbox.mjs +77 -0
- package/package.json +76 -4
- package/scripts/doctor.mjs +111 -0
- package/scripts/harness.mjs +538 -0
- package/scripts/partner.mjs +129 -0
- package/scripts/zip.mjs +77 -0
- package/src/model-apis.js +516 -0
- package/worker/svg.js +350 -0
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
// Asks models for drawings with tools: each model works in a sandbox through
|
|
2
|
+
// our own harness (harness/), can look at what it has drawn, and hands in a
|
|
3
|
+
// file. Beside `npm run generate`, which asks with one plain request; nothing
|
|
4
|
+
// here writes to drawings/ unless --out says so.
|
|
5
|
+
//
|
|
6
|
+
// node scripts/harness.mjs --prompt pelican-bicycle,chessboard every model, those prompts
|
|
7
|
+
// node scripts/harness.mjs --model gpt-6-astra --prompt chessboard
|
|
8
|
+
// node scripts/harness.mjs --probe check each model can use the tool and see an image (cheap)
|
|
9
|
+
// node scripts/harness.mjs --dry-run ... show what would be asked
|
|
10
|
+
// node scripts/harness.mjs --force ... ask again where there is an answer
|
|
11
|
+
// node scripts/harness.mjs --sheet --prompt ... only rebuild compare.html and index.html
|
|
12
|
+
// --out <dir> where to write (default harness/trial)
|
|
13
|
+
// --api ask Anthropic models on paid API credits; by default they go through
|
|
14
|
+
// Claude Code on the Claude subscription, with the same tool and sandbox
|
|
15
|
+
// --codex ask OpenAI models through Codex CLI on the ChatGPT subscription
|
|
16
|
+
// (harness/codex.mjs), with the same request, tool, sandbox and budget,
|
|
17
|
+
// instead of on paid API credits. CODEX_BIN picks the Codex
|
|
18
|
+
// install: it has to list the model (`codex debug models`)
|
|
19
|
+
// --effort <level> ask at this effort instead of each model's own
|
|
20
|
+
// --replies <n> --minutes <n> another budget than harness/request.mjs's
|
|
21
|
+
// --concurrency <n> runs at once per provider (default 3)
|
|
22
|
+
// --paid also ask models that would run on paid API credits. Without it
|
|
23
|
+
// only plan routes run (Claude Code, and Codex with --codex): the
|
|
24
|
+
// owner's rule from 19 November 2026 is to draw on the Claude and
|
|
25
|
+
// ChatGPT plans only, so pass it only when the owner says to
|
|
26
|
+
// --harness 1 ask the way version 1 did (its request, budget and sandbox
|
|
27
|
+
// image 3), to set a run beside the current version's
|
|
28
|
+
// --summaries ask OpenAI models for reasoning summaries too, to read how a
|
|
29
|
+
// run went (diagnostic: the log says so; not for the arena)
|
|
30
|
+
//
|
|
31
|
+
// Needs Docker, the sandbox image (the build command is in harness/Dockerfile)
|
|
32
|
+
// and the keys `npm run generate` uses. Writes the same layout as generate.mjs:
|
|
33
|
+
//
|
|
34
|
+
// <prompt>/<model>.svg, log/<prompt>/<model>.json, manifest.json, index.html
|
|
35
|
+
// runs/<prompt>/<model>/ the conversation, every image the model looked at, the provider's replies
|
|
36
|
+
// (for a Codex run that failed, what it got to, with failed.json, and no log)
|
|
37
|
+
// compare.html each drawing beside the same model's plain-request drawing
|
|
38
|
+
//
|
|
39
|
+
// One run per model per prompt, and the file as it stood at the end is kept.
|
|
40
|
+
// A run whose API failed isn't an answer and is asked again next time.
|
|
41
|
+
//
|
|
42
|
+
// The first trial (16-17 November 2026) ran on mini-swe-agent and is why this
|
|
43
|
+
// harness is our own: it lost every top-effort reply to connections closed
|
|
44
|
+
// after a silent minute until its requests were streamed, neither Gemini
|
|
45
|
+
// model could finish a run through it, and six of 17 drawings came back over
|
|
46
|
+
// the site's 200 KB limit, which nothing in the sandbox checked.
|
|
47
|
+
|
|
48
|
+
import { spawn } from 'node:child_process';
|
|
49
|
+
import { existsSync } from 'node:fs';
|
|
50
|
+
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
51
|
+
import { join, relative, resolve } from 'node:path';
|
|
52
|
+
import { fileURLToPath } from 'node:url';
|
|
53
|
+
import { maxOutputTokens, models as lineup, prompts, upcomingModels } from '../bench.config.mjs';
|
|
54
|
+
|
|
55
|
+
// The lineup and the models being drawn before they join it, and any a
|
|
56
|
+
// partner names that we don't list (scripts/partner.mjs puts them in
|
|
57
|
+
// VB_EXTRA_MODELS, as rows shaped like bench.config.mjs's).
|
|
58
|
+
const extraModels = process.env.VB_EXTRA_MODELS ? JSON.parse(process.env.VB_EXTRA_MODELS) : [];
|
|
59
|
+
const models = [...lineup, ...upcomingModels, ...extraModels];
|
|
60
|
+
import { PRICE_RATIO, VIA_CHECKED, keyOf, open } from '../harness/adapters/index.mjs';
|
|
61
|
+
import { draw } from '../harness/loop.mjs';
|
|
62
|
+
import { estimate } from '../harness/prices.mjs';
|
|
63
|
+
import { readLimits, resetsLeft, useReset } from '../harness/codex-account.mjs';
|
|
64
|
+
import { HARNESS, firstLimits, firstRequest, limits, request, tool } from '../harness/request.mjs';
|
|
65
|
+
import { IMAGE, imageId as sandboxImageId, openSandbox } from '../harness/sandbox.mjs';
|
|
66
|
+
import { ProviderError } from '../src/model-apis.js';
|
|
67
|
+
import { cleanSvg } from '../worker/svg.js';
|
|
68
|
+
import { findChrome } from './doctor.mjs';
|
|
69
|
+
|
|
70
|
+
const ROOT = fileURLToPath(new URL('../', import.meta.url));
|
|
71
|
+
const CONCURRENCY = Number(process.argv.includes('--concurrency') ? process.argv[process.argv.indexOf('--concurrency') + 1] : 3); // per provider
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
process.loadEnvFile(join(ROOT, '.env'));
|
|
75
|
+
} catch {}
|
|
76
|
+
|
|
77
|
+
const args = process.argv.slice(2);
|
|
78
|
+
const flag = (name) => args.includes(`--${name}`);
|
|
79
|
+
const option = (name) => (args.includes(`--${name}`) ? args[args.indexOf(`--${name}`) + 1] : undefined);
|
|
80
|
+
const list = (name) => option(name)?.split(',').filter(Boolean);
|
|
81
|
+
const fail = (message) => {
|
|
82
|
+
console.error(message);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const probe = flag('probe');
|
|
87
|
+
|
|
88
|
+
// Each version as it was: the request, the budget and the sandbox image.
|
|
89
|
+
const VERSIONS = {
|
|
90
|
+
1: { harness: { ...HARNESS, version: 1 }, request: firstRequest, limits: firstLimits, image: 'vectorbench-sandbox:3' },
|
|
91
|
+
[HARNESS.version]: { harness: HARNESS, request, limits, image: IMAGE },
|
|
92
|
+
};
|
|
93
|
+
const version = VERSIONS[option('harness') ?? HARNESS.version];
|
|
94
|
+
if (!version) fail(`There is no harness version "${option('harness')}"; there are ${Object.keys(VERSIONS).join(' and ')}.`);
|
|
95
|
+
const summaries = flag('summaries');
|
|
96
|
+
const OUT = resolve(option('out') ?? join(ROOT, 'harness', probe ? 'probe' : 'trial'));
|
|
97
|
+
const onlyModels = list('model');
|
|
98
|
+
const onlyPrompts = list('prompt');
|
|
99
|
+
for (const id of onlyModels ?? []) if (!models.some((m) => m.id === id)) fail(`There is no model "${id}" in bench.config.mjs.`);
|
|
100
|
+
for (const id of onlyPrompts ?? []) if (!prompts.some((p) => p.id === id)) fail(`There is no prompt "${id}" in bench.config.mjs.`);
|
|
101
|
+
if (!probe && !onlyPrompts) fail('Name the prompts to ask: --prompt pelican-bicycle,chessboard');
|
|
102
|
+
|
|
103
|
+
// The probe: a picture with a number in it. A model that writes the number
|
|
104
|
+
// down was shown the picture; one that can't see it has nothing to copy.
|
|
105
|
+
const PROBE = {
|
|
106
|
+
id: 'probe',
|
|
107
|
+
text: 'tool check',
|
|
108
|
+
request: (budget) => `This is a check of your tools, not a drawing contest. You have one tool, bash, in a Linux sandbox; each command runs in a fresh shell in /work. Do these in order:
|
|
109
|
+
1. Run \`view probe.png\`. The image shows a number. Write that number, and nothing else, to /work/answer.txt.
|
|
110
|
+
2. Save a small SVG of a red circle on a blue square as /work/drawing.svg, then run \`view drawing.svg\`.
|
|
111
|
+
3. Write one sentence saying what that second image shows to /work/seen.txt.
|
|
112
|
+
4. Run \`submit\`.
|
|
113
|
+
If an image does not reach you, write "no image" to the file instead of guessing. You have ${budget.replies} replies.`,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Anthropic models run on the Claude subscription through Claude Code unless
|
|
117
|
+
// --api says to use paid API credits, as in `npm run generate`.
|
|
118
|
+
const viaSubscription = (model) => model.via === 'anthropic' && !flag('api');
|
|
119
|
+
// OpenAI models run on the ChatGPT subscription through Codex when --codex says so.
|
|
120
|
+
const viaCodex = (model) => model.via === 'openai' && flag('codex');
|
|
121
|
+
// --via <route>: the OpenAI models named go through a harness-only route
|
|
122
|
+
// (harness/adapters/index.mjs), each only if it was checked for that model.
|
|
123
|
+
const via = option('via');
|
|
124
|
+
if (via && !VIA_CHECKED[via]) fail(`There is no route "${via}"; there are ${Object.keys(VIA_CHECKED).join(', ')}.`);
|
|
125
|
+
if (via && flag('codex')) fail('Give --via or --codex, not both.');
|
|
126
|
+
const routed = (model) => {
|
|
127
|
+
if (!via || model.via !== 'openai') return model;
|
|
128
|
+
if (!VIA_CHECKED[via].includes(model.id)) fail(`${model.name} was not checked for ${via}; it runs only for ${VIA_CHECKED[via].join(', ')}.`);
|
|
129
|
+
return { ...model, via };
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Waits while the ChatGPT plan is at (or within a run of) its usage limit, so a
|
|
134
|
+
* Codex run is not started only to be cut off by it: a run cut off is not an
|
|
135
|
+
* answer and its work is lost. Sleeps until the fullest window resets.
|
|
136
|
+
*/
|
|
137
|
+
// A run takes about a fifth of the 5-hour window, so one started above 80% is
|
|
138
|
+
// likely to be cut off partway (a sleeping-fox run was, 18 Nov); a week's
|
|
139
|
+
// window is only a few percent per run.
|
|
140
|
+
// VB_CODEX_WEEK_STOP raises the week's stop, e.g. to 100 to use the plan up before it resets.
|
|
141
|
+
// VB_CODEX_SPEND_RESETS=1 spends an earned rate-limit reset, if there is one,
|
|
142
|
+
// once the week's window is used up, instead of waiting days for it.
|
|
143
|
+
let resetSpent = false; // at most one per run of this script
|
|
144
|
+
async function waitForPlan(say, nearlyFull = { short: 80, week: Number(process.env.VB_CODEX_WEEK_STOP) || 95 }) {
|
|
145
|
+
for (;;) {
|
|
146
|
+
let windows = [];
|
|
147
|
+
let limits;
|
|
148
|
+
try {
|
|
149
|
+
limits = await readLimits();
|
|
150
|
+
windows = Object.values(limits?.rateLimitsByLimitId ?? {})
|
|
151
|
+
.flatMap((b) => [b?.primary, b?.secondary])
|
|
152
|
+
.filter((w) => w?.resetsAt && w.usedPercent >= (w.windowDurationMins > 1440 ? nearlyFull.week : nearlyFull.short));
|
|
153
|
+
} catch (error) {
|
|
154
|
+
say(`could not read the plan's usage (${error.message}); going ahead`);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (!windows.length) return;
|
|
158
|
+
const weekUsedUp = windows.some((w) => w.windowDurationMins > 1440 && w.usedPercent >= 100);
|
|
159
|
+
if (weekUsedUp && !resetSpent && process.env.VB_CODEX_SPEND_RESETS === '1' && resetsLeft(limits) > 0) {
|
|
160
|
+
resetSpent = true;
|
|
161
|
+
const outcome = await useReset().catch((error) => `failed (${error.message})`);
|
|
162
|
+
say(`the week's usage is used up; spent an earned reset: ${outcome}`);
|
|
163
|
+
if (outcome === 'reset') continue;
|
|
164
|
+
}
|
|
165
|
+
const until = Math.max(...windows.map((w) => w.resetsAt * 1000)) + 60_000;
|
|
166
|
+
say(`the ChatGPT plan is nearly at its limit; waiting until ${new Date(until).toLocaleString()}`);
|
|
167
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(60_000, until - Date.now())));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const shown = (path) => (relative(ROOT, path).startsWith('..') ? path : relative(ROOT, path) || '.');
|
|
171
|
+
const logPath = (prompt, model) => join(OUT, 'log', prompt.id, `${model.id}.json`);
|
|
172
|
+
const svgPath = (prompt, model) => join(OUT, prompt.id, `${model.id}.svg`);
|
|
173
|
+
const runPath = (prompt, model) => join(OUT, 'runs', prompt.id, model.id);
|
|
174
|
+
const escape = (s) => String(s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[c]);
|
|
175
|
+
|
|
176
|
+
async function readJson(path) {
|
|
177
|
+
try {
|
|
178
|
+
return JSON.parse(await readFile(path, 'utf8'));
|
|
179
|
+
} catch {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function run(command, commandArgs, { log } = {}) {
|
|
185
|
+
return new Promise((done) => {
|
|
186
|
+
const child = spawn(command, commandArgs, { cwd: ROOT, env: process.env, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
187
|
+
let out = '';
|
|
188
|
+
child.stdout.on('data', (chunk) => (out += chunk));
|
|
189
|
+
child.stderr.on('data', (chunk) => (out += chunk));
|
|
190
|
+
child.on('error', (error) => done({ code: -1, out: String(error) }));
|
|
191
|
+
child.on('close', async (code) => {
|
|
192
|
+
if (log) await writeFile(log, out);
|
|
193
|
+
done({ code, out });
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Chromium on this machine: the last word on whether the file draws. */
|
|
199
|
+
async function openRenderer() {
|
|
200
|
+
const { chromium } = await import('playwright-core');
|
|
201
|
+
const browser = await chromium.launch({ executablePath: findChrome() ?? '/usr/bin/google-chrome' });
|
|
202
|
+
const page = await browser.newPage();
|
|
203
|
+
return {
|
|
204
|
+
draws: (svg) =>
|
|
205
|
+
page.evaluate(async (source) => {
|
|
206
|
+
const url = URL.createObjectURL(new Blob([source], { type: 'image/svg+xml' }));
|
|
207
|
+
const image = new Image();
|
|
208
|
+
image.src = url;
|
|
209
|
+
try {
|
|
210
|
+
await image.decode();
|
|
211
|
+
return true;
|
|
212
|
+
} catch {
|
|
213
|
+
return false;
|
|
214
|
+
} finally {
|
|
215
|
+
URL.revokeObjectURL(url);
|
|
216
|
+
}
|
|
217
|
+
}, svg),
|
|
218
|
+
close: () => browser.close(),
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** The conversation without megabytes of base64: each picture becomes a file. */
|
|
223
|
+
async function saveRun(folder, result) {
|
|
224
|
+
let count = 0;
|
|
225
|
+
const transcript = [];
|
|
226
|
+
for (const entry of result.transcript) {
|
|
227
|
+
if (entry.role !== 'results') {
|
|
228
|
+
transcript.push(entry);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
const results = [];
|
|
232
|
+
for (const item of entry.results) {
|
|
233
|
+
const images = [];
|
|
234
|
+
for (const image of item.images) {
|
|
235
|
+
count += 1;
|
|
236
|
+
const name = `views/${String(count).padStart(2, '0')}.${image.mime === 'image/jpeg' ? 'jpg' : image.mime.split('/')[1]}`;
|
|
237
|
+
await mkdir(join(folder, 'views'), { recursive: true });
|
|
238
|
+
await writeFile(join(folder, name), Buffer.from(image.data, 'base64'));
|
|
239
|
+
images.push(name);
|
|
240
|
+
}
|
|
241
|
+
results.push({ ...item, images });
|
|
242
|
+
}
|
|
243
|
+
transcript.push({ ...entry, results });
|
|
244
|
+
}
|
|
245
|
+
await writeFile(join(folder, 'conversation.json'), JSON.stringify(transcript, null, 1) + '\n');
|
|
246
|
+
await writeFile(join(folder, 'replies.jsonl'), result.raw.map((reply) => JSON.stringify(reply)).join('\n') + '\n');
|
|
247
|
+
if (result.svg != null) await writeFile(join(folder, 'drawing.svg'), result.svg);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** One model, one prompt, one sandbox. Throws ProviderError if the API failed: that isn't an answer. */
|
|
251
|
+
async function ask(prompt, model, renderer, imageId) {
|
|
252
|
+
const folder = runPath(prompt, model);
|
|
253
|
+
await rm(folder, { recursive: true, force: true });
|
|
254
|
+
await mkdir(folder, { recursive: true });
|
|
255
|
+
const cap = Math.min(maxOutputTokens, model.maxOutputTokens ?? maxOutputTokens);
|
|
256
|
+
const effort = option('effort') ?? model.effort;
|
|
257
|
+
const budget = {
|
|
258
|
+
...version.limits,
|
|
259
|
+
...(probe && { replies: 12, minutes: 15 }),
|
|
260
|
+
...(option('replies') && { replies: Number(option('replies')) }),
|
|
261
|
+
...(option('minutes') && { minutes: Number(option('minutes')) }),
|
|
262
|
+
};
|
|
263
|
+
const text = probe ? PROBE.request(budget) : version.request(prompt.text, budget);
|
|
264
|
+
const number = String(1000 + Math.floor(Math.random() * 9000));
|
|
265
|
+
const askedAt = new Date().toISOString();
|
|
266
|
+
|
|
267
|
+
const say = (line) => console.log(` ${model.name}, ${prompt.id}: ${line}`);
|
|
268
|
+
if (viaCodex(model)) await waitForPlan(say);
|
|
269
|
+
let sandbox;
|
|
270
|
+
let result;
|
|
271
|
+
try {
|
|
272
|
+
sandbox = await openSandbox({ image: version.image, commandSeconds: budget.commandSeconds });
|
|
273
|
+
if (probe) {
|
|
274
|
+
await sandbox.run(
|
|
275
|
+
`python3 -c "from PIL import Image, ImageDraw, ImageFont; i = Image.new('RGB', (480, 200), 'white'); ImageDraw.Draw(i).text((110, 40), '${number}', fill='black', font=ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf', 110)); i.save('probe.png')"`,
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
if (viaSubscription(model)) {
|
|
279
|
+
// Claude Code runs the same tool in the same sandbox on the Claude subscription (harness/claude-code.mjs).
|
|
280
|
+
const { drawWithClaudeCode } = await import('../harness/claude-code.mjs');
|
|
281
|
+
result = await drawWithClaudeCode({ model: model.model, effort, maxOutputTokens: cap, text, tool, sandbox, limits: budget });
|
|
282
|
+
} else if (viaCodex(model)) {
|
|
283
|
+
// Codex runs the same tool in the same sandbox on the ChatGPT subscription (harness/codex.mjs).
|
|
284
|
+
const { drawWithCodex } = await import('../harness/codex.mjs');
|
|
285
|
+
try {
|
|
286
|
+
result = await drawWithCodex({ model: model.model, effort, text, tool, sandbox, limits: budget, summaries });
|
|
287
|
+
} catch (error) {
|
|
288
|
+
// Not an answer (no log is written, so it is asked again), but the run folder keeps what it got to.
|
|
289
|
+
if (error.partial) {
|
|
290
|
+
await saveRun(folder, error.partial);
|
|
291
|
+
await writeFile(join(folder, 'failed.json'), JSON.stringify({ askedAt, error: error.message, limit: Boolean(error.limit), replies: error.partial.replies, seconds: error.partial.seconds, usage: error.partial.usage, session: error.partial.session }, null, 2) + '\n');
|
|
292
|
+
}
|
|
293
|
+
throw error;
|
|
294
|
+
}
|
|
295
|
+
} else {
|
|
296
|
+
// Summaries are written beside the reasoning, from it; the model doesn't see them.
|
|
297
|
+
const extraBody = summaries && open.styleOf(model) === 'responses' ? { reasoning: { summary: 'auto' } } : undefined;
|
|
298
|
+
const conversation = open(model, { effort, maxOutputTokens: cap, text, tool, extraBody });
|
|
299
|
+
result = await draw({ conversation, sandbox, limits: budget });
|
|
300
|
+
result.route = conversation.route;
|
|
301
|
+
}
|
|
302
|
+
if (probe) result.probe = { sent: number, answer: (await sandbox.read('answer.txt'))?.trim() ?? null, seen: (await sandbox.read('seen.txt'))?.trim() ?? null };
|
|
303
|
+
} finally {
|
|
304
|
+
await sandbox?.close();
|
|
305
|
+
}
|
|
306
|
+
await saveRun(folder, result);
|
|
307
|
+
|
|
308
|
+
let svg = null;
|
|
309
|
+
let problem = null;
|
|
310
|
+
if (result.svg == null) problem = 'No drawing.svg was saved.';
|
|
311
|
+
else {
|
|
312
|
+
try {
|
|
313
|
+
svg = cleanSvg(result.svg).svg;
|
|
314
|
+
if (!(await renderer.draws(svg))) {
|
|
315
|
+
svg = null;
|
|
316
|
+
problem = 'The SVG is malformed and does not render.';
|
|
317
|
+
}
|
|
318
|
+
} catch (error) {
|
|
319
|
+
problem = error.message;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
const outcome = result.exit === 'refused' ? 'refused' : svg ? 'drawn' : 'invalid';
|
|
323
|
+
// Dollars as the provider reports them, or worked out from list prices.
|
|
324
|
+
// The subscription pays for a Claude Code or Codex run, so its figure is what the API would have charged.
|
|
325
|
+
const usage = {
|
|
326
|
+
...result.usage,
|
|
327
|
+
cost: result.usage.cost ?? (estimate(model.id, result.usage) == null ? null : estimate(model.id, result.usage) * (PRICE_RATIO[model.via] ?? 1)),
|
|
328
|
+
costIs: result.usage.cost ? 'reported' : result.route.via === 'claude-code' || result.route.via === 'codex' ? 'subscription' : 'estimated',
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
await mkdir(join(OUT, 'log', prompt.id), { recursive: true });
|
|
332
|
+
await writeFile(
|
|
333
|
+
logPath(prompt, model),
|
|
334
|
+
JSON.stringify(
|
|
335
|
+
{
|
|
336
|
+
prompt: prompt.id,
|
|
337
|
+
model: model.id,
|
|
338
|
+
via: model.via,
|
|
339
|
+
harness: { ...version.harness, image: version.image, imageId, limits: budget, tool },
|
|
340
|
+
...(summaries && { diagnostic: 'reasoning summaries were asked for' }),
|
|
341
|
+
route: result.route.via,
|
|
342
|
+
baseUrl: result.route.url,
|
|
343
|
+
apiModel: model.model,
|
|
344
|
+
effort: effort ?? null,
|
|
345
|
+
// Codex sends no output cap: ChatGPT's own applies.
|
|
346
|
+
maxOutputTokens: viaCodex(model) ? null : cap,
|
|
347
|
+
servedModel: result.servedModel,
|
|
348
|
+
responseIds: result.responseIds,
|
|
349
|
+
askedAt,
|
|
350
|
+
request: text,
|
|
351
|
+
outcome,
|
|
352
|
+
problem,
|
|
353
|
+
ended: result.exit,
|
|
354
|
+
replies: result.replies,
|
|
355
|
+
views: result.looks,
|
|
356
|
+
seconds: result.seconds,
|
|
357
|
+
usage,
|
|
358
|
+
...(result.probe && { probe: result.probe }),
|
|
359
|
+
// What a Codex run had: Codex's version, what was changed in the model's catalog entry, and the first request as Codex sent it.
|
|
360
|
+
...(result.session && { session: result.session }),
|
|
361
|
+
run: relative(join(OUT, 'log', prompt.id), folder),
|
|
362
|
+
answer: result.svg,
|
|
363
|
+
},
|
|
364
|
+
null,
|
|
365
|
+
2,
|
|
366
|
+
) + '\n',
|
|
367
|
+
);
|
|
368
|
+
if (svg) {
|
|
369
|
+
await mkdir(join(OUT, prompt.id), { recursive: true });
|
|
370
|
+
await writeFile(svgPath(prompt, model), svg + '\n');
|
|
371
|
+
}
|
|
372
|
+
return { outcome, result: { ...result, usage }, seen: result.probe };
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Marks a drawing as being made by this process, so another runner on the
|
|
377
|
+
* same folder skips it. Returns a function that removes the mark, or null if
|
|
378
|
+
* a runner that is still alive holds it.
|
|
379
|
+
*/
|
|
380
|
+
async function claim(prompt, model) {
|
|
381
|
+
const file = join(OUT, 'claims', `${prompt.id}.${model.id}`);
|
|
382
|
+
await mkdir(join(OUT, 'claims'), { recursive: true });
|
|
383
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
384
|
+
try {
|
|
385
|
+
await writeFile(file, String(process.pid), { flag: 'wx' });
|
|
386
|
+
return () => rm(file, { force: true });
|
|
387
|
+
} catch {
|
|
388
|
+
const holder = Number(await readFile(file, 'utf8').catch(() => ''));
|
|
389
|
+
try {
|
|
390
|
+
if (holder && holder !== process.pid) process.kill(holder, 0);
|
|
391
|
+
if (holder) return null;
|
|
392
|
+
} catch {}
|
|
393
|
+
// Left behind by a runner that has gone: take it over.
|
|
394
|
+
await rm(file, { force: true });
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
async function pool(tasks, limit) {
|
|
401
|
+
let next = 0;
|
|
402
|
+
await Promise.all(
|
|
403
|
+
Array.from({ length: Math.min(limit, tasks.length) }, async () => {
|
|
404
|
+
while (next < tasks.length) await tasks[next++]();
|
|
405
|
+
}),
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/** Each drawing made with tools beside the same model's plain-request drawing. */
|
|
410
|
+
async function writeComparison(asked) {
|
|
411
|
+
const plain = join(ROOT, 'drawings');
|
|
412
|
+
const sections = [];
|
|
413
|
+
for (const prompt of asked) {
|
|
414
|
+
const rows = [];
|
|
415
|
+
for (const model of models) {
|
|
416
|
+
const log = await readJson(logPath(prompt, model));
|
|
417
|
+
if (!log) continue;
|
|
418
|
+
const before = join(plain, prompt.id, `${model.id}.svg`);
|
|
419
|
+
const cell = (path, missing) => (existsSync(path) ? `<img src="${escape(relative(OUT, path))}" alt="" loading="lazy">` : `<p>${escape(missing)}</p>`);
|
|
420
|
+
const tokens = log.usage ? `${Math.round(log.usage.input / 1000)}K in, ${Math.round(log.usage.output / 1000)}K out${log.usage.cost ? `, $${log.usage.cost.toFixed(2)}` : ''}` : '';
|
|
421
|
+
// A file the site would not take (too big, say) is still shown here, marked, as it was handed in.
|
|
422
|
+
let made = svgPath(prompt, model);
|
|
423
|
+
let refused = '';
|
|
424
|
+
if (!existsSync(made) && log.answer) {
|
|
425
|
+
made = join(runPath(prompt, model), 'drawing.svg');
|
|
426
|
+
await mkdir(runPath(prompt, model), { recursive: true });
|
|
427
|
+
await writeFile(made, log.answer);
|
|
428
|
+
refused = `<strong>Not accepted: ${escape(log.problem ?? log.outcome)}</strong> `;
|
|
429
|
+
}
|
|
430
|
+
rows.push(
|
|
431
|
+
`<section><h3>${escape(model.name)} <small>${escape(log.effort ?? '')}</small></h3><div class="pair">` +
|
|
432
|
+
`<figure>${cell(before, 'no plain-request drawing')}<figcaption>Plain request</figcaption></figure>` +
|
|
433
|
+
`<figure>${cell(made, `${log.outcome}: ${log.problem ?? ''}`)}<figcaption>${refused}With tools: ${log.replies} replies, ${log.views} looks, ${Math.round(log.seconds / 60)} min, ${tokens}, ended ${escape(log.ended)}</figcaption></figure>` +
|
|
434
|
+
`</div></section>`,
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
if (rows.length) sections.push(`<h2>${escape(prompt.text)}</h2>\n${rows.join('\n')}`);
|
|
438
|
+
}
|
|
439
|
+
await mkdir(OUT, { recursive: true });
|
|
440
|
+
await writeFile(
|
|
441
|
+
join(OUT, 'compare.html'),
|
|
442
|
+
`<!doctype html>
|
|
443
|
+
<meta charset="utf-8">
|
|
444
|
+
<title>VectorBench: plain request and with tools</title>
|
|
445
|
+
<style>
|
|
446
|
+
body { margin: 32px; background: #000; color: #eef2fa; font: 15px/1.4 system-ui, sans-serif; }
|
|
447
|
+
h1 { font-weight: 300; }
|
|
448
|
+
h2 { margin: 48px 0 8px; font-size: 20px; font-weight: 500; }
|
|
449
|
+
h3 { margin: 28px 0 8px; font-size: 16px; font-weight: 500; }
|
|
450
|
+
small { color: #8c95a8; font-weight: 400; }
|
|
451
|
+
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 520px)); gap: 16px; }
|
|
452
|
+
figure { margin: 0; }
|
|
453
|
+
img, figure p { display: block; width: 100%; aspect-ratio: 1; margin: 0; background: #fff; object-fit: contain; }
|
|
454
|
+
figure p { display: grid; place-items: center; padding: 16px; box-sizing: border-box; background: #1a1f2b; color: #ffb4a2; text-align: center; }
|
|
455
|
+
figcaption { padding: 6px 0; color: #8c95a8; }
|
|
456
|
+
strong { color: #ffb4a2; font-weight: 500; }
|
|
457
|
+
</style>
|
|
458
|
+
<h1>Plain request beside the same model with tools</h1>
|
|
459
|
+
${sections.join('\n')}
|
|
460
|
+
`,
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/* Run --------------------------------------------------------------------- */
|
|
465
|
+
|
|
466
|
+
const asked = probe ? [PROBE] : prompts.filter((p) => onlyPrompts.includes(p.id));
|
|
467
|
+
if (flag('sheet')) {
|
|
468
|
+
await run('node', ['scripts/generate.mjs', '--sheet', '--out', OUT]);
|
|
469
|
+
await writeComparison(asked);
|
|
470
|
+
console.log(`Rebuilt ${shown(OUT)}/compare.html and index.html.`);
|
|
471
|
+
process.exit(0);
|
|
472
|
+
}
|
|
473
|
+
const wanted = [];
|
|
474
|
+
for (const model of models.filter((m) => !onlyModels || onlyModels.includes(m.id)).map(routed)) {
|
|
475
|
+
// Owner's rule, 19 Nov 2026: drawings are made on the Claude and ChatGPT plans only.
|
|
476
|
+
if (!viaSubscription(model) && !viaCodex(model) && !flag('paid')) {
|
|
477
|
+
console.log(`Skipping ${model.name}: it would run on paid API credits${model.via === 'openai' ? ' (--codex puts it on the ChatGPT plan)' : ''}. --paid allows that, billed to your own key.`);
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
if (!viaSubscription(model) && !viaCodex(model) && !process.env[keyOf(model)]) {
|
|
481
|
+
console.log(`Skipping ${model.name}: ${keyOf(model)} is not set.`);
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
for (const prompt of asked) {
|
|
485
|
+
if (!flag('force') && (await readJson(logPath(prompt, model)))) continue;
|
|
486
|
+
wanted.push({ prompt, model });
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (!wanted.length) {
|
|
490
|
+
console.log('Nothing to ask.');
|
|
491
|
+
if (!probe) await writeComparison(asked);
|
|
492
|
+
process.exit(0);
|
|
493
|
+
}
|
|
494
|
+
console.log(`${wanted.length} runs to make, into ${shown(OUT)}/:`);
|
|
495
|
+
for (const { prompt, model } of wanted) console.log(` ${model.name.padEnd(22)} ${prompt.id}`);
|
|
496
|
+
if (flag('dry-run')) process.exit(0);
|
|
497
|
+
|
|
498
|
+
const imageId = await sandboxImageId(version.image);
|
|
499
|
+
if (!imageId) fail(`The sandbox image ${version.image} is missing. \`npm run partner\` (or \`vectorbench draw\`) builds it; the build command itself is in harness/Dockerfile.`);
|
|
500
|
+
|
|
501
|
+
const renderer = await openRenderer();
|
|
502
|
+
const queues = new Map();
|
|
503
|
+
const lines = [];
|
|
504
|
+
for (const job of wanted) {
|
|
505
|
+
const via = job.model.via.split('-')[0];
|
|
506
|
+
if (!queues.has(via)) queues.set(via, []);
|
|
507
|
+
queues.get(via).push(async () => {
|
|
508
|
+
const label = `${job.model.name.padEnd(22)} ${job.prompt.id.padEnd(18)}`;
|
|
509
|
+
// Several runners can share one folder (to add capacity to a long batch):
|
|
510
|
+
// a drawing another one has made since we started, or is making now, is left to it.
|
|
511
|
+
if (!flag('force') && (await readJson(logPath(job.prompt, job.model)))) return;
|
|
512
|
+
const release = await claim(job.prompt, job.model);
|
|
513
|
+
if (!release) return;
|
|
514
|
+
try {
|
|
515
|
+
const { outcome, result, seen } = await ask(job.prompt, job.model, renderer, imageId);
|
|
516
|
+
const u = result.usage;
|
|
517
|
+
const sight = seen ? ` saw ${seen.answer === seen.sent ? 'the number' : `"${seen.answer}" for ${seen.sent}`}; ${seen.seen}` : '';
|
|
518
|
+
const line = `${outcome === 'drawn' ? '✓' : '✗'} ${label} ${outcome.padEnd(8)} ${result.exit.padEnd(11)} ${String(result.replies).padStart(2)} replies ${String(result.looks).padStart(2)} looks ${String(Math.round(result.seconds / 60)).padStart(3)} min ${Math.round(u.input / 1000)}K in (${Math.round(u.cached / 1000)}K cached) ${Math.round(u.output / 1000)}K out${u.cost != null ? ` $${u.cost.toFixed(2)}${u.costIs === 'estimated' ? ' est.' : u.costIs === 'subscription' ? ' at list, on the subscription' : ''}` : ''}${sight}`;
|
|
519
|
+
lines.push(line);
|
|
520
|
+
console.log(line);
|
|
521
|
+
} catch (error) {
|
|
522
|
+
const line = `! ${label} not answered: ${error instanceof ProviderError ? error.message : (error.stack ?? error)}`;
|
|
523
|
+
lines.push(line);
|
|
524
|
+
console.log(line);
|
|
525
|
+
} finally {
|
|
526
|
+
await release();
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
await Promise.all([...queues.values()].map((tasks) => pool(tasks, CONCURRENCY)));
|
|
531
|
+
await renderer.close();
|
|
532
|
+
|
|
533
|
+
if (!probe) {
|
|
534
|
+
await run('node', ['scripts/generate.mjs', '--sheet', '--out', OUT]);
|
|
535
|
+
await writeComparison(asked);
|
|
536
|
+
console.log(`\nLook them over in ${shown(OUT)}/compare.html (beside the plain-request drawings) or ${shown(OUT)}/index.html.`);
|
|
537
|
+
}
|
|
538
|
+
await writeFile(join(OUT, 'summary.txt'), lines.join('\n') + '\n');
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// A partner's one command: draws every VectorBench prompt with one model,
|
|
2
|
+
// through the same harness, sandbox and budget as our own drawings, and
|
|
3
|
+
// leaves a zip to send at https://vectorbench.ai/partners.
|
|
4
|
+
//
|
|
5
|
+
// npx vectorbench@latest draw --model gpt-6.2-astra no clone needed
|
|
6
|
+
// npm run partner -- --model gpt-6.2-astra the same, in a clone; a model in bench.config.mjs
|
|
7
|
+
// npm run partner -- --model gpt-6.2-astra --prompt chessboard one prompt first, to see the cost
|
|
8
|
+
// npm run partner -- --model grok-5 --via xai --api-model grok-5 --effort high --name "Grok 5"
|
|
9
|
+
// a model we don't list yet
|
|
10
|
+
// --via <provider> anthropic | openai | gemini | xai | openrouter: whose API answers
|
|
11
|
+
// --api-model <id> the model's id at that API (default: the --model id)
|
|
12
|
+
// --effort <level> its highest reasoning setting, up to max
|
|
13
|
+
// --codex an OpenAI model through the Codex CLI on your ChatGPT plan
|
|
14
|
+
// --api a Claude model on API credits; without it, through Claude Code on your Claude plan
|
|
15
|
+
// --dry-run show what would be asked and what is missing, and ask nothing
|
|
16
|
+
// --out <dir> where to write (default harness/trial-partner/<model> in a clone,
|
|
17
|
+
// ./vectorbench-drawings/<model> when run with npx)
|
|
18
|
+
// --concurrency <n> drawings at once (default 3)
|
|
19
|
+
//
|
|
20
|
+
// It checks Node, Docker and Chrome, builds the sandbox image the first time
|
|
21
|
+
// (a few minutes), then runs scripts/harness.mjs. The API key comes from the
|
|
22
|
+
// environment or a .env file where the command is typed (.env.example has the
|
|
23
|
+
// names), and the run is billed to it. A drawing that has an answer is not asked again, so the same command
|
|
24
|
+
// picks up where a stopped run left off: the first answer stands.
|
|
25
|
+
|
|
26
|
+
import { spawnSync } from 'node:child_process';
|
|
27
|
+
import { copyFileSync, existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
28
|
+
import { join, relative, resolve } from 'node:path';
|
|
29
|
+
import { models as lineup, prompts, upcomingModels } from '../bench.config.mjs';
|
|
30
|
+
import { KEYS } from '../harness/adapters/index.mjs';
|
|
31
|
+
import { HARNESS } from '../harness/request.mjs';
|
|
32
|
+
import { IMAGE } from '../harness/sandbox.mjs';
|
|
33
|
+
import { INSTALLED, PROVIDERS, ROOT, check, findChrome, loadEnv, works } from './doctor.mjs';
|
|
34
|
+
import { zipFolder } from './zip.mjs';
|
|
35
|
+
|
|
36
|
+
const SITE = 'https://vectorbench.ai';
|
|
37
|
+
// How this was called, for the examples it prints: bin/vectorbench.mjs says `vectorbench draw`.
|
|
38
|
+
const COMMAND = process.env.VB_COMMAND || 'npm run partner --';
|
|
39
|
+
|
|
40
|
+
loadEnv();
|
|
41
|
+
|
|
42
|
+
const args = process.argv.slice(2);
|
|
43
|
+
const flag = (name) => args.includes(`--${name}`);
|
|
44
|
+
const option = (name) => (args.includes(`--${name}`) ? args[args.indexOf(`--${name}`) + 1] : undefined);
|
|
45
|
+
const dryRun = flag('dry-run');
|
|
46
|
+
const stop = (message) => {
|
|
47
|
+
console.error(message);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/* The model ---------------------------------------------------------------- */
|
|
52
|
+
|
|
53
|
+
const id = option('model');
|
|
54
|
+
if (!id || id.startsWith('--') || id.includes(',')) stop(`Name one model: ${COMMAND} --model <id>\nThe ones we list: ${[...lineup, ...upcomingModels].map((m) => m.id).join(', ')}.\nAny other: add --via <${PROVIDERS.join('|')}> --effort <its highest reasoning setting>.`);
|
|
55
|
+
|
|
56
|
+
let model = [...lineup, ...upcomingModels].find((m) => m.id === id);
|
|
57
|
+
let extra = null;
|
|
58
|
+
if (!model) {
|
|
59
|
+
const via = option('via');
|
|
60
|
+
const effort = option('effort');
|
|
61
|
+
if (!/^[a-z0-9][a-z0-9.-]*$/.test(id)) stop(`"${id}" can't be a model id here: use lower-case letters, digits, dots and hyphens, like gpt-6.2-astra. --api-model takes the id the API knows it by.`);
|
|
62
|
+
if (!PROVIDERS.includes(via)) stop(`"${id}" isn't in bench.config.mjs. To draw with it anyway, say whose API answers: --via <${PROVIDERS.join('|')}>, with --api-model <its id there> if that differs.`);
|
|
63
|
+
if (!effort) stop('Say the reasoning setting to ask at: --effort <level>. The rule is the highest the model has, up to max.');
|
|
64
|
+
model = extra = { id, name: option('name') ?? id, provider: via, via, model: option('api-model') ?? id, effort };
|
|
65
|
+
} else if (option('via') || option('effort') || option('api-model')) {
|
|
66
|
+
stop(`${model.name} is in bench.config.mjs, which already says how it is asked (${model.via}, effort ${model.effort}): leave out --via, --effort and --api-model.`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const wantedPrompts = option('prompt')?.split(',').filter(Boolean) ?? prompts.map((p) => p.id);
|
|
70
|
+
for (const p of wantedPrompts) if (!prompts.some((x) => x.id === p)) stop(`There is no prompt "${p}". The prompts: ${prompts.map((x) => x.id).join(', ')}.`);
|
|
71
|
+
|
|
72
|
+
/* What it runs on ---------------------------------------------------------- */
|
|
73
|
+
|
|
74
|
+
const route = model.via === 'anthropic' && !flag('api') ? 'Claude Code' : model.via === 'openai' && flag('codex') ? 'Codex' : 'API';
|
|
75
|
+
const keyName = KEYS[model.via];
|
|
76
|
+
const chrome = findChrome();
|
|
77
|
+
const missing = check({ model, route });
|
|
78
|
+
|
|
79
|
+
if (missing.length) {
|
|
80
|
+
console.error(`Missing:\n${missing.map((line) => ` - ${line}`).join('\n')}`);
|
|
81
|
+
if (!dryRun) process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// From a clone the drawings stay in it; run with npx, they land where the command was typed.
|
|
85
|
+
const OUT = resolve(option('out') ?? (INSTALLED ? join('vectorbench-drawings', model.id) : join(ROOT, 'harness', 'trial-partner', model.id)));
|
|
86
|
+
const shown = (path) => relative(process.cwd(), path) || '.';
|
|
87
|
+
console.log(`${model.name} (${model.model}, effort ${model.effort}) on ${route === 'API' ? `${model.via}'s API, billed to your ${keyName}` : `${route}, on your plan`}: ${wantedPrompts.length} prompt${wantedPrompts.length === 1 ? '' : 's'}, into ${shown(OUT)}/.`);
|
|
88
|
+
|
|
89
|
+
if (!dryRun && !works('docker', ['image', 'inspect', IMAGE])) {
|
|
90
|
+
console.log(`\nBuilding the sandbox image ${IMAGE}. This happens once and takes a few minutes.`);
|
|
91
|
+
const built = spawnSync('docker', ['build', '--network', 'host', '--build-context', 'site=worker', '-t', IMAGE, 'harness/'], { cwd: ROOT, stdio: 'inherit', env: { ...process.env, DOCKER_BUILDKIT: '1' } });
|
|
92
|
+
if (built.status !== 0) stop('The sandbox image did not build; the lines above say why.');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Draw --------------------------------------------------------------------- */
|
|
96
|
+
|
|
97
|
+
// --paid: the partner's own key pays, which is what a partner run is.
|
|
98
|
+
const harnessArgs = ['scripts/harness.mjs', '--model', model.id, '--prompt', wantedPrompts.join(','), '--out', OUT, '--paid'];
|
|
99
|
+
for (const name of ['codex', 'api', 'dry-run']) if (flag(name)) harnessArgs.push(`--${name}`);
|
|
100
|
+
if (option('concurrency')) harnessArgs.push('--concurrency', option('concurrency'));
|
|
101
|
+
const ran = spawnSync(process.execPath, harnessArgs, {
|
|
102
|
+
cwd: ROOT,
|
|
103
|
+
stdio: 'inherit',
|
|
104
|
+
env: { ...process.env, ...(chrome && { CHROME_PATH: chrome }), ...(extra && { VB_EXTRA_MODELS: JSON.stringify([extra]) }) },
|
|
105
|
+
});
|
|
106
|
+
if (dryRun) process.exit(ran.status ?? 1);
|
|
107
|
+
|
|
108
|
+
/* Hand over ---------------------------------------------------------------- */
|
|
109
|
+
|
|
110
|
+
// The site takes drawings named after their prompt: drawings/<prompt id>.svg.
|
|
111
|
+
const DRAWINGS = join(OUT, 'drawings');
|
|
112
|
+
rmSync(DRAWINGS, { recursive: true, force: true });
|
|
113
|
+
mkdirSync(DRAWINGS, { recursive: true });
|
|
114
|
+
const drawn = wantedPrompts.filter((p) => existsSync(join(OUT, p, `${model.id}.svg`)));
|
|
115
|
+
for (const p of drawn) copyFileSync(join(OUT, p, `${model.id}.svg`), join(DRAWINGS, `${p}.svg`));
|
|
116
|
+
const notDrawn = wantedPrompts.filter((p) => !drawn.includes(p));
|
|
117
|
+
|
|
118
|
+
console.log(`\n${drawn.length} of ${wantedPrompts.length} drawn.`);
|
|
119
|
+
if (notDrawn.length) console.log(`Not drawn: ${notDrawn.join(', ')}. ${shown(join(OUT, 'summary.txt'))} says how each run ended. One the API failed on is asked again by the same command; one the model answered badly is its answer, and stays out.`);
|
|
120
|
+
if (!drawn.length) process.exit(1);
|
|
121
|
+
|
|
122
|
+
const ZIP = join(OUT, 'vectorbench-drawings.zip');
|
|
123
|
+
rmSync(ZIP, { force: true });
|
|
124
|
+
writeFileSync(ZIP, zipFolder(OUT, 'drawings'));
|
|
125
|
+
|
|
126
|
+
console.log(`
|
|
127
|
+
Look them over: ${shown(join(OUT, 'index.html'))}
|
|
128
|
+
Send them: ${SITE}/partners, sign in, choose the model, and drop in ${shown(ZIP)}
|
|
129
|
+
Made with: VectorBench harness ${HARNESS.version} (sandbox ${IMAGE}), ${route === 'API' ? `${model.via} API` : route}, effort ${model.effort}`);
|