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.
@@ -0,0 +1,255 @@
1
+ // The benchmark itself: what the models are asked to draw, and which models
2
+ // are asked. `npm run generate` reads this; so do the site's pages and the
3
+ // partner kit, so partners give a model the same words we do.
4
+
5
+ /**
6
+ * The whole request a model receives for one prompt. Nothing else is sent:
7
+ * no system prompt, so a producer pasting it into a chat app asks exactly
8
+ * what we ask. It's the same for every model and every prompt. It asks for
9
+ * the model's best, says how the drawing will be judged and shown, and warns
10
+ * that a cut-off answer counts as nothing, which is fair to all and spares
11
+ * the models that think longest at their top setting.
12
+ *
13
+ * In use for drawings made from 18 November 2026, when animation was first
14
+ * welcomed for subjects that move. Drawings made from 16 November were
15
+ * asked with `secondInstruction`, and before then with `firstInstruction`;
16
+ * their logs record the exact words.
17
+ */
18
+ export const instruction = (prompt) => `Draw this as an SVG: ${prompt}
19
+
20
+ This drawing is your entry in VectorBench, a blind contest between AI models. People will see it next to another model's drawing of the same subject, without being told which model made which, and vote for the better one. Make it as good as you possibly can. Go all out.
21
+
22
+ What wins votes:
23
+ - It shows exactly what was asked. Every part of the request is there and correct: the subject, what it is doing, and any number, time, words or arrangement the request names.
24
+ - It is beautifully made: a strong composition that fills the frame, a setting that suits the subject, a deliberate colour palette, and depth, light and shadow, with gradients and texture where they help.
25
+ - It holds up when looked at closely: true proportions, anatomy and mechanics, and fine detail that rewards a second look.
26
+
27
+ How it will be shown:
28
+ - In a square frame, anywhere from a phone thumbnail to most of a screen. Give it a square viewBox (for example 0 0 1024 1024) and make it read well at every size.
29
+ - In a browser's <img> tag: no scripts or links, and nothing loaded from outside the file. Draw with vector shapes only, not embedded bitmaps. For any words, use a generic font family such as sans-serif or serif.
30
+ - Animation is welcome where the subject has motion of its own: wings beating, water rippling, smoke rising, light pulsing, something turning. SVG animation plays in the <img> tag: SMIL elements such as <animate> and <animateTransform>, or CSS animation in a <style> element. Make it a smooth, seamless loop, animate transforms and opacity rather than filters so it plays smoothly on a phone, and keep every moment a complete picture, the first included. A subject with no motion of its own is better left still.
31
+
32
+ Everything you write, including any thinking before the answer, has to fit within your output limit, and an SVG that gets cut off counts as no drawing. Leave room to write the whole file.
33
+
34
+ Reply with only the SVG code, from <svg to </svg>.`;
35
+
36
+ /** The request from 16 to 18 November 2026: drawings were asked to be still. */
37
+ export const secondInstruction = (prompt) => `Draw this as an SVG: ${prompt}
38
+
39
+ This drawing is your entry in VectorBench, a blind contest between AI models. People will see it next to another model's drawing of the same subject, without being told which model made which, and vote for the better one. Make it as good as you possibly can. Go all out.
40
+
41
+ What wins votes:
42
+ - It shows exactly what was asked. Every part of the request is there and correct: the subject, what it is doing, and any number, time, words or arrangement the request names.
43
+ - It is beautifully made: a strong composition that fills the frame, a setting that suits the subject, a deliberate colour palette, and depth, light and shadow, with gradients and texture where they help.
44
+ - It holds up when looked at closely: true proportions, anatomy and mechanics, and fine detail that rewards a second look.
45
+
46
+ How it will be shown:
47
+ - In a square frame, anywhere from a phone thumbnail to most of a screen. Give it a square viewBox (for example 0 0 1024 1024) and make it read well at every size.
48
+ - As a still image in a browser's <img> tag: no scripts, animation or links, and nothing loaded from outside the file. Draw with vector shapes only, not embedded bitmaps. For any words, use a generic font family such as sans-serif or serif.
49
+
50
+ Everything you write, including any thinking before the answer, has to fit within your output limit, and an SVG that gets cut off counts as no drawing. Leave room to write the whole file.
51
+
52
+ Reply with only the SVG code, from <svg to </svg>.`;
53
+
54
+ /** The request as it read until 16 November 2026. */
55
+ export const firstInstruction = (prompt) => `Create an SVG of the following: ${prompt}\n\nReply with only the SVG code.`;
56
+
57
+ // Room for the answer plus the reasoning the model does first, which at
58
+ // maximum effort can run past 30K tokens for one drawing. Each model gets
59
+ // the most its API allows, up to this; an answer that runs into its cap is
60
+ // logged as cut off.
61
+ export const maxOutputTokens = 128000;
62
+
63
+ // `id` is permanent (it names files and database rows); the text can't change
64
+ // once drawings exist for it, or old and new drawings would answer different
65
+ // questions. To reword a prompt, retire it and add a new one.
66
+ export const prompts = [
67
+ { id: 'pelican-bicycle', text: 'A pelican riding a bicycle' },
68
+ { id: 'lighthouse', text: 'A lighthouse on a rocky headland at night' },
69
+ { id: 'bonsai', text: 'A bonsai tree in a ceramic pot' },
70
+ { id: 'octopus-tea', text: 'An octopus pouring a cup of tea' },
71
+ { id: 'sleeping-fox', text: 'A fox curled up asleep in the snow' },
72
+ { id: 'chess-knight', text: 'A chess knight' },
73
+ { id: 'balloon', text: 'A hot-air balloon drifting over hills' },
74
+ { id: 'skyline', text: 'A city skyline reflected in a river at dusk' },
75
+ { id: 'bakery-logo', text: 'A logo for a bakery called Crumb' },
76
+ { id: 'dragon-tower', text: 'A dragon coiled around a stone tower' },
77
+ // Added 16 November 2026, first asked with the fuller request: things
78
+ // that can be counted or checked, diagrams and lettering, as well as
79
+ // animals, machines and scenes.
80
+ { id: 'hummingbird', text: 'A hummingbird drinking from a red flower' },
81
+ { id: 'chessboard', text: 'A chessboard set up for the start of a game' },
82
+ { id: 'steam-train', text: 'A steam locomotive crossing a stone viaduct' },
83
+ { id: 'jellyfish', text: 'Three jellyfish glowing in deep water' },
84
+ { id: 'treehouse', text: 'A treehouse with a rope ladder in an old oak tree' },
85
+ { id: 'tiger-face', text: 'A tiger’s face, close up' },
86
+ // Added 18 November 2026 by the owner's choice: subjects people already
87
+ // test new models with on X, so a visitor can hold ours against the ones
88
+ // they've seen. The Xbox 360 controller is the most common of them. Real,
89
+ // well-known products, checkable against the real thing: the controllers'
90
+ // stick and button layout and the colours and symbols on their face
91
+ // buttons; the Game Boy's power light, screen and Start/Select; the
92
+ // cube's 3×3 faces, its six colours and the one solved face; the
93
+ // unicorn's single horn and its weight on two hind legs.
94
+ { id: 'xbox-controller', text: 'An Xbox 360 controller, seen from above' },
95
+ { id: 'playstation-controller', text: 'A PlayStation 5 DualSense controller, seen from above' },
96
+ { id: 'game-boy', text: 'An original Nintendo Game Boy, switched on, seen from the front' },
97
+ { id: 'rubiks-cube', text: 'A Rubik’s Cube with one face solved, seen from a corner' },
98
+ { id: 'unicorn', text: 'A unicorn rearing up on its hind legs' },
99
+ ];
100
+
101
+ // Taken out on 17 November 2026, by the owner's choice: no new drawings are
102
+ // asked for, and `npm run arena -- prompt off <id>` keeps them out of the
103
+ // arena. Their drawings and logs stay under drawings/ and their votes stay
104
+ // in the record.
105
+ export const retiredPrompts = [
106
+ { id: 'road-bike', text: 'A road bicycle seen from the side' },
107
+ { id: 'wall-clock', text: 'A wall clock showing twenty to four' },
108
+ { id: 'subway-map', text: 'A subway map with three lines and one interchange station' },
109
+ { id: 'weather-icons', text: 'A set of four weather icons: sun, cloud, rain and snow' },
110
+ // 17 November 2026, by the owner's choice when the old prompts were redrawn
111
+ // with tools: the less common subjects, and the ones most models drew worst
112
+ // or ran out of room on.
113
+ { id: 'cutaway-house', text: 'An isometric cutaway of a two-story house' },
114
+ { id: 'handshake', text: 'Two hands shaking' },
115
+ { id: 'espresso-machine', text: 'An espresso machine pulling a shot' },
116
+ { id: 'typewriter', text: 'A vintage typewriter' },
117
+ { id: 'moon-guitar', text: 'An astronaut playing a guitar on the moon' },
118
+ // 19 November 2026, by the owner's choice: taken out of the site, the
119
+ // partner kit and the redraw queues.
120
+ { id: 'monarch', text: 'A monarch butterfly with its wings open' },
121
+ { id: 'piano-keys', text: 'Two octaves of a piano keyboard, seen from above' },
122
+ { id: 'tea-flowchart', text: 'A flowchart for making a cup of tea, with one yes/no decision' },
123
+ { id: 'honey-label', text: 'A label for a jar of honey from a farm called Larkspur' },
124
+ // Taken out on the owner's instruction, the same way as the rest: no new
125
+ // drawings are asked for, and the drawings and votes stay in the record.
126
+ { id: 'solar-system', text: 'The eight planets of the solar system in order from the Sun' },
127
+ { id: 'pulsar', text: 'A pulsar in space: a spinning neutron star with its magnetic field lines and a beam of light from each pole' },
128
+ ];
129
+
130
+ // `id`, `name` and `provider` are what the leaderboard shows. `via` picks the
131
+ // adapter in scripts/providers.mjs and `model` is the id that API expects.
132
+ //
133
+ // Every model runs at the highest reasoning setting its API offers
134
+ // (`effort`), because the leaderboard compares each model at its best,
135
+ // unless that setting can't finish a drawing: Opus 5.5 at max ran past the
136
+ // 128K output cap on most prompts, so it is asked at xhigh (16 Nov 2026; its
137
+ // cut-off max answers are kept in drawings/superseded/). Sonnet 5.5 followed
138
+ // the same day: at max it was cut off on 12 of the first 20 prompts and on
139
+ // every one of the 8 new prompts it reached, so it too is asked at xhigh, and
140
+ // its cut-off answers are kept the same way. The site shows each drawing's
141
+ // effort next to the model's name.
142
+ //
143
+ // The lineup is the frontier: every public model whose score at that
144
+ // setting is within FRONTIER_MARGIN points of the leader's on the
145
+ // Artificial Analysis Intelligence Index. Recheck the index monthly and
146
+ // when a model launches; models that fall out stay on the leaderboard
147
+ // with the drawings they have, they just aren't asked for new ones. A model
148
+ // switched off with `arena -- model off` is not shown anywhere.
149
+ // Scores below are from the live v5.0.1 leaderboard on 16 November 2026
150
+ // (leader: Claude Fable 5.2 at 64.6, so the cutoff is 54.6). Nothing has
151
+ // entered the margin since the 14 November snapshot.
152
+ //
153
+ // Beyond the frontier, the owner added the strongest model from each US lab
154
+ // that has a public API (16 Nov 2026): Claude Sonnet 5.5, Gemini 4 Hydrogen,
155
+ // Grok 4.7 and Meta's Muse Spark 1.3. They are asked the same way, at their
156
+ // own highest setting.
157
+ //
158
+ // The same day the rule was widened to every lab: the strongest model from
159
+ // each lab not yet in the lineup, if a stranger can call it through a public
160
+ // API and it scores at least as high as the weakest model already here
161
+ // (Grok 4.7, 35.5). That added Moonshot's Kimi K3.1 Pro and Alibaba's Qwen4
162
+ // Max, which was released that day. Both were taken out again on 30 November
163
+ // 2026 (retiredModels).
164
+ // Taken out of the lineup on 17 November 2026 by the owner's choice: they
165
+ // drew too far below the rest to be worth a place in the benchmark. No new
166
+ // drawings are asked for, and `npm run arena -- model off <id>` takes them off
167
+ // the site entirely (leaderboard and model pages too). Their drawings, logs
168
+ // and votes stay in the record.
169
+ export const retiredModels = [
170
+ // xAI `reasoning.effort`: low | medium | high | xhigh (max is refused).
171
+ { id: 'grok-4-7', name: 'Grok 4.7', provider: 'xAI', via: 'xai', model: 'grok-4.7', effort: 'xhigh' }, // 35.5
172
+ // Meta has no public API of its own; OpenRouter passes `reasoning.effort` on.
173
+ { id: 'muse-spark-1-3', name: 'Muse Spark 1.3', provider: 'Meta', via: 'openrouter', model: 'meta/muse-spark-1.3', effort: 'max' }, // 37 on 14 Nov; since marked deprecated by the index and unscored
174
+ // Taken out on 30 November 2026, by the owner's choice: off the arena and
175
+ // the site (`arena -- model off`). Their drawings (harness v1), logs and
176
+ // votes stay in the record, and src/model-apis.js keeps the OpenRouter
177
+ // presets held to each maker's endpoint.
178
+ // Moonshot `reasoning_effort`: low | high | max. The weights are open, so
179
+ // OpenRouter is held to Moonshot's own endpoint (see the preset).
180
+ { id: 'kimi-k3-1-pro', name: 'Kimi K3.1 Pro', provider: 'Moonshot AI', via: 'openrouter-moonshot', model: 'moonshotai/kimi-k3.1-pro', effort: 'max' }, // 46.5 (16 Nov 2026)
181
+ // Alibaba `reasoning_effort`: low | high | xhigh (max is read as xhigh).
182
+ // Held to Alibaba's endpoint too: a reseller appeared on OpenRouter the
183
+ // day it launched. Its first 28 drawings were asked through plain
184
+ // OpenRouter and each was served by Alibaba (checked by response id).
185
+ { id: 'qwen4-max', name: 'Qwen4 Max', provider: 'Alibaba', via: 'openrouter-alibaba', model: 'qwen/qwen4-max', effort: 'xhigh' }, // 42.9 (16 Nov 2026)
186
+ ];
187
+
188
+ // Being drawn (harness v3, on the ChatGPT plan through Codex) before they
189
+ // join the lineup, by the owner's choice on 30 November 2026: what is left of
190
+ // each week's Codex usage once GPT-6.2 Astra and the Sols reach 80% of it,
191
+ // GPT-6 Luna first (it joined `models` the same day, once its 23 were drawn),
192
+ // then GPT-6.1 Terra (it joined `models` on 1 December 2026, once the week's
193
+ // share was used). scripts/harness.mjs draws these as well as `models`;
194
+ // nothing on the site names them until they move there.
195
+ export const upcomingModels = [];
196
+
197
+ export const FRONTIER_MARGIN = 10;
198
+ export const models = [
199
+ // Anthropic `output_config.effort`: low | medium | high | xhigh | max.
200
+ { id: 'claude-fable-5-2', name: 'Claude Fable 5.2', provider: 'Anthropic', via: 'anthropic', model: 'claude-fable-5-2', effort: 'max' }, // 64.6
201
+ { id: 'claude-opus-5-5', name: 'Claude Opus 5.5', provider: 'Anthropic', via: 'anthropic', model: 'claude-opus-5-5', effort: 'xhigh' }, // 59.1
202
+
203
+ // Google `thinking_level`: Carbon goes up to high (only Hydrogen has xhigh).
204
+ // Output is capped at 64K tokens on Gemini 4.
205
+ { id: 'gemini-4-carbon', name: 'Gemini 4 Carbon', provider: 'Google', via: 'gemini', model: 'gemini-4-carbon', effort: 'high', maxOutputTokens: 65536 }, // 60.0
206
+
207
+ // OpenAI `reasoning.effort`: low | medium | high | xhigh | max.
208
+ { id: 'gpt-6-astra', name: 'GPT-6 Astra', provider: 'OpenAI', via: 'openai', model: 'gpt-6-astra', effort: 'max' }, // 56.9
209
+ { id: 'gpt-6.1-sol', name: 'GPT-6.1 Sol', provider: 'OpenAI', via: 'openai', model: 'gpt-6.1-sol', effort: 'max' }, // 54.6
210
+ // Added by the owner on 18 November 2026, the day they reached the API
211
+ // (both take effort max).
212
+ { id: 'gpt-6.2-sol', name: 'GPT-6.2 Sol', provider: 'OpenAI', via: 'openai', model: 'gpt-6.2-sol', effort: 'max' },
213
+ { id: 'gpt-6.2-astra', name: 'GPT-6.2 Astra', provider: 'OpenAI', via: 'openai', model: 'gpt-6.2-astra', effort: 'max' },
214
+
215
+ // Added by name, outside the margin.
216
+ { id: 'claude-sonnet-5-5', name: 'Claude Sonnet 5.5', provider: 'Anthropic', via: 'anthropic', model: 'claude-sonnet-5-5', effort: 'xhigh' }, // 54.5
217
+ { id: 'gemini-4-hydrogen', name: 'Gemini 4 Hydrogen', provider: 'Google', via: 'gemini', model: 'gemini-4-hydrogen', effort: 'xhigh', maxOutputTokens: 65536 }, // 53.9
218
+
219
+
220
+ // Added by the owner on 18 November 2026, outside the margin: Anthropic's
221
+ // current Haiku. It draws with tools from the start, with harness version
222
+ // 2, which the rest of the lineup moves to next, through Claude Code on the
223
+ // Claude subscription like the other Claude models.
224
+ { id: 'claude-haiku-5-5', name: 'Claude Haiku 5.5', provider: 'Anthropic', via: 'anthropic', model: 'claude-haiku-5-5', effort: 'max' }, // 36.5
225
+
226
+ // Added by the owner on 30 November 2026. Drawn with harness version 3 from
227
+ // the start, through Codex on the ChatGPT plan, like the other GPT models.
228
+ { id: 'gpt-6-luna', name: 'GPT-6 Luna', provider: 'OpenAI', via: 'openai', model: 'gpt-6-luna', effort: 'max' },
229
+
230
+ // First added on 18 November 2026 and taken out the same day; its 27
231
+ // harness-v2 drawings and their votes stay in the record, retired. Joined
232
+ // again from 30 November 2026 onward by the owner's choice, drawn on harness
233
+ // v3 through Codex on the ChatGPT plan at max; its v3 drawings go live as
234
+ // each week's Codex share is used.
235
+ { id: 'gpt-6.1-terra', name: 'GPT-6.1 Terra', provider: 'OpenAI', via: 'openai', model: 'gpt-6.1-terra', effort: 'max' }, // 51.3
236
+ ];
237
+
238
+ // A guest in the arena since 19 November 2026, by the owner's choice: Gemini 4
239
+ // Neon, drawn in Antigravity by @long_longVN on X, who sent nine of the first
240
+ // prompts' drawings (drawings/community/long_longVN/, added with `npm run
241
+ // arena -- import`). They meet every other model's drawings in the one pool,
242
+ // and the site shows them as "Gemini 4 Neon" with the credit. We don't ask it
243
+ // for drawings ourselves, so it is not in `models`.
244
+
245
+ // Outside the margin and not added (live leaderboard, 16 Nov 2026): Gemini 4
246
+ // Argon (50.4), Muse Wonder Full (50.1; no public price or endpoint), Muse
247
+ // Wonder (43.6; Meta is already represented, by a weaker model), Muse Ember
248
+ // (36.0). Claude Haiku 5.5 (36.5) was added by the owner on 18 November 2026,
249
+ // and GPT-6.1 Terra (51.3) added and retired the same day.
250
+ // Labs whose strongest model falls short of Grok 4.7's 35.5: Tencent (Hy4,
251
+ // 34.6), DeepSeek (V4.1 Flash 1017, 32.6), Z AI (GLM-5.3, 31.7), Thinking
252
+ // Machines (Inkling 2 Small, 30.6), Xiaomi (MiMo-V2.6-Pro, 29.9),
253
+ // InclusionAI (Ling 3.1 Flash, 29.6), MiniMax (M3.1 Flash, 29.1), StepFun
254
+ // (Step 5 Preview, 28.5), Mistral (Large 4, 26.1). Amazon's Nova and
255
+ // Microsoft's Phi models have no score on the index.
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ // The `vectorbench` command: the same scripts as the npm scripts, under one name.
3
+ //
4
+ // npx vectorbench@latest draw --model gpt-6.2-astra no clone needed
5
+ // npx vectorbench@latest doctor
6
+ //
7
+ // In a clone of the repository: `npx vectorbench <command>` or `node bin/vectorbench.mjs <command>`.
8
+
9
+ import { existsSync, readFileSync } from 'node:fs';
10
+ import { join } from 'node:path';
11
+ import { fileURLToPath, pathToFileURL } from 'node:url';
12
+
13
+ const ROOT = fileURLToPath(new URL('../', import.meta.url));
14
+ const { version } = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf8'));
15
+
16
+ const HELP = `vectorbench ${version}: draw VectorBench's prompts with your own model (https://vectorbench.ai)
17
+
18
+ vectorbench draw --model <id> draw every prompt with one model and zip the drawings to send
19
+ (--prompt <id> for one first; \`vectorbench draw\` alone lists the options)
20
+ vectorbench doctor check this machine has what a drawing run needs
21
+ vectorbench prompts list the prompts
22
+ vectorbench dev run the site locally with made-up data (in a clone of the repository)
23
+
24
+ Drawings go to https://vectorbench.ai/partners.`;
25
+
26
+ // Each command is a script that reads its own arguments from process.argv.
27
+ const run = (script, args) => {
28
+ const path = join(ROOT, 'scripts', script);
29
+ process.argv = [process.argv[0], path, ...args];
30
+ return import(pathToFileURL(path).href);
31
+ };
32
+
33
+ const [command, ...rest] = process.argv.slice(2);
34
+ switch (command) {
35
+ case 'draw':
36
+ process.env.VB_COMMAND = 'vectorbench draw';
37
+ await run('partner.mjs', rest);
38
+ break;
39
+ case 'doctor':
40
+ await run('doctor.mjs', rest);
41
+ break;
42
+ case 'prompts': {
43
+ const { prompts } = await import(pathToFileURL(join(ROOT, 'bench.config.mjs')).href);
44
+ const width = Math.max(...prompts.map((p) => p.id.length));
45
+ for (const { id, text } of prompts) console.log(`${id.padEnd(width)} ${text}`);
46
+ break;
47
+ }
48
+ case 'dev':
49
+ if (!existsSync(join(ROOT, 'scripts', 'dev.mjs')) || !existsSync(join(ROOT, 'wrangler.jsonc'))) {
50
+ console.error('`vectorbench dev` runs the site from a clone of the repository:\n\n git clone https://github.com/vectorbench/vectorbench.git\n cd vectorbench\n npm install\n npm run dev');
51
+ process.exit(1);
52
+ }
53
+ await run('dev.mjs', rest);
54
+ break;
55
+ case '--version':
56
+ case '-v':
57
+ console.log(version);
58
+ break;
59
+ case undefined:
60
+ case 'help':
61
+ case '--help':
62
+ case '-h':
63
+ console.log(HELP);
64
+ break;
65
+ default:
66
+ console.error(`There is no "${command}" command.\n\n${HELP}`);
67
+ process.exit(1);
68
+ }
@@ -0,0 +1,104 @@
1
+ # The sandbox every model draws in when it is given tools: one container per
2
+ # drawing, no network, the same image for every model. Whatever is installed
3
+ # here is the whole toolset, so the list below is part of the method.
4
+ #
5
+ # docker build --network host --build-context site=worker -t vectorbench-sandbox:7 harness/
6
+ #
7
+ # Bump the tag when anything here changes; the tag is written to each log.
8
+ #
9
+ # 4 (18 November 2026): more to draw with and more to look with. Libraries
10
+ # for path booleans, noise, perceptual colour, 3D meshes, graph layout and
11
+ # raster-to-vector tracing; Graphviz; SVGO; a shelf of open-licence fonts to
12
+ # outline lettering in; and the `zoom`, `compare`, `weigh` and `shrink`
13
+ # commands (box/tools.py). Most entries were pressed against the 200 KB
14
+ # limit (120 of the 287 drawn with image 3 were over 180 KB), which `weigh`
15
+ # and `shrink` are for.
16
+ #
17
+ # 5 (18 November 2026): `frames`, which shows an animated drawing at several
18
+ # moments, now that the request welcomes motion where the subject has it.
19
+ #
20
+ # 6 (18 November 2026), from an A/B run of GPT-6.2 Astra on image 3: below
21
+ # about 150 pixels headless Chromium drew a blank white square, so the
22
+ # thumbnail check the request suggests (`view FILE 128`) showed nothing;
23
+ # four renders started at once timed out and left 56 browser processes
24
+ # running for the rest of the run; and `python` was not a command. Now every
25
+ # picture is laid out at its exact size in a larger window and cut out, one
26
+ # browser runs at a time and is killed with its children when it overruns,
27
+ # leftovers are cleared after each command, and `python` is python3.
28
+ #
29
+ # 7 (18 November 2026), from the first harness 2 runs (Haiku 5.5, GPT-6.1
30
+ # Terra, GPT-6.2 Astra): `vb3d`, a module that renders trimesh meshes as
31
+ # shaded SVG (hidden surfaces removed, cast shadows, exact outlines and
32
+ # crease lines), since no run modelled its subject in 3D although the request
33
+ # suggests it; OpenCV, which two runs reached for; and `submit drawing.svg`
34
+ # now works (it was refused for its argument, once at reply 37 of 40); and
35
+ # /work/README.md, a one-page guide to the commands, import names and vb3d,
36
+ # since every model starts with `ls /work` and none found vb3d from the
37
+ # request alone.
38
+
39
+ # SVGO, the standard SVG minifier, is plain JavaScript: install it with npm
40
+ # here and copy it in, so the sandbox doesn't need npm itself.
41
+ FROM node:22-bookworm-slim AS svgo
42
+ RUN npm install --prefix /opt/svgo --omit=dev --no-audit --no-fund svgo@4.0.0
43
+
44
+ FROM debian:trixie-slim
45
+
46
+ RUN apt-get update && apt-get install -y --no-install-recommends \
47
+ # The renderer: the same engine most voters' browsers use.
48
+ chromium \
49
+ # Languages.
50
+ python3 python3-pip python-is-python3 nodejs \
51
+ # Python libraries for geometry, colour, paths and XML.
52
+ python3-numpy python3-scipy python3-pil python3-lxml python3-shapely \
53
+ python3-fonttools python3-matplotlib python3-skimage python3-cairosvg \
54
+ # Exact maths, and graphs with their layouts.
55
+ python3-sympy python3-networkx \
56
+ # Vector and raster tools. Graphviz lays out diagrams (dot -Tsvg).
57
+ inkscape imagemagick librsvg2-bin potrace libxml2-utils graphviz scour \
58
+ # Fonts behind the generic families (sans-serif, serif, monospace).
59
+ fonts-dejavu-core fonts-liberation2 fonts-noto-core fonts-noto-color-emoji \
60
+ # Open-licence typefaces to turn lettering into outlines with
61
+ # (inkscape --export-text-to-path, or fontTools); fc-list lists them.
62
+ fonts-dejavu-extra fonts-ebgaramond fonts-lato fonts-open-sans fonts-roboto-unhinted \
63
+ fonts-cantarell fonts-urw-base35 fonts-texgyre fonts-firacode fonts-inter \
64
+ fonts-comic-neue fonts-lobster fonts-crosextra-carlito fonts-crosextra-caladea \
65
+ fonts-league-spartan fonts-montserrat fonts-bebas-neue fontconfig \
66
+ # Everyday shell tools.
67
+ bc jq less file ca-certificates \
68
+ && pip install --no-cache-dir --break-system-packages \
69
+ svgpathtools svgwrite svgelements \
70
+ # Boolean operations on curved paths (union, difference, intersection).
71
+ skia-pathops \
72
+ # Smooth noise for organic shapes and texture.
73
+ opensimplex \
74
+ # Perceptual colour: OKLCH mixing, gradients, contrast.
75
+ coloraide \
76
+ # 3D meshes and solids to model a subject in, then project to 2D.
77
+ trimesh manifold3d mapbox-earcut \
78
+ # Colour raster-to-vector tracing (potrace does one colour).
79
+ vtracer \
80
+ # Image processing that models reach for by name (cv2).
81
+ opencv-python-headless \
82
+ && rm -rf /var/lib/apt/lists/*
83
+
84
+ COPY --from=svgo /opt/svgo /opt/svgo
85
+ RUN ln -s /opt/svgo/node_modules/.bin/svgo /usr/local/bin/svgo
86
+
87
+ # The sandbox's own commands, and the site's acceptance check they run
88
+ # (worker/svg.js, brought in by the build command above).
89
+ COPY box/tools.py box/check.mjs /opt/vb/
90
+ # vb3d: 3D meshes drawn as shaded SVG, importable from anywhere.
91
+ COPY box/vb3d.py /opt/vb/lib/
92
+ RUN echo /opt/vb/lib > "$(python3 -c 'import site; print(site.getsitepackages()[0])')/vectorbench.pth"
93
+ COPY --from=site svg.js /opt/vb/svg.js
94
+ RUN chmod 755 /opt/vb/tools.py \
95
+ && for name in view zoom compare frames render check weigh shrink submit; do ln -s /opt/vb/tools.py /usr/local/bin/$name; done \
96
+ && echo '{"type":"module"}' > /opt/vb/package.json \
97
+ && useradd --create-home --shell /bin/bash artist \
98
+ && mkdir /work && chown artist:artist /work
99
+ # A short guide where every model looks first (`ls /work`).
100
+ COPY --chown=artist:artist box/README.md /work/README.md
101
+
102
+ USER artist
103
+ ENV HOME=/home/artist PYTHONDONTWRITEBYTECODE=1
104
+ WORKDIR /work
@@ -0,0 +1,192 @@
1
+ // Chat Completions with the one tool, streamed: OpenRouter (Muse Spark, Kimi,
2
+ // Qwen) and anything that copies OpenAI's chat API.
3
+ //
4
+ // Each request is the plain run's (`bodies.chat` in src/model-apis.js: the
5
+ // same model, effort, output cap and provider pin) with the tool added and
6
+ // the conversation so far as its messages. No system message, no
7
+ // tool_choice. OpenRouter reports tokens and dollars in the last chunk of
8
+ // every stream without being asked (`usage: { include: true }` is
9
+ // deprecated and does nothing).
10
+ //
11
+ // What was found by asking the three models (17 November 2026):
12
+ // - The model's reasoning goes back in its assistant message as
13
+ // `reasoning_details`. Muse Spark's is one encrypted item, and only that
14
+ // item reaches the model again: a `reasoning` string is dropped. Kimi's
15
+ // and Qwen's is plain text, streamed in fragments that have to be joined:
16
+ // sent back as fragments they come to more tokens than the model wrote.
17
+ // None of the three refuses a turn whose reasoning is left out; it is sent
18
+ // so each keeps its own thinking from reply to reply.
19
+ // - Encrypted reasoning can only be read by the host that wrote it, and
20
+ // OpenRouter routes a request that carries it back to that host. That
21
+ // keeps a Muse Spark conversation on the host that gave its first reply
22
+ // (Meta or Google Vertex) without a pin.
23
+ // - All three see an image in a user message that follows the tool
24
+ // messages, and in the tool message itself. The user message is used: it
25
+ // is the form every chat API takes.
26
+ // - Muse Spark answers 400 to a conversation holding a tool call whose
27
+ // arguments are not valid JSON, so a call that can't be read is kept in
28
+ // the conversation with `{}` for its arguments.
29
+
30
+ import { ProviderError, eachEvent, request, requestBody } from '../../src/model-apis.js';
31
+
32
+ const textOf = (content) => (Array.isArray(content) ? content.map((part) => part.text ?? '').join('') : (content ?? ''));
33
+ const isObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
34
+
35
+ // The parts of a reasoning item that arrive in pieces.
36
+ const JOINED = new Set(['text', 'summary', 'data']);
37
+
38
+ /** Adds one streamed piece of reasoning: more of the last item (same type and index), or a new item. */
39
+ function addReasoning(details, piece) {
40
+ const last = details.at(-1);
41
+ const continues = last && piece.index != null && last.index === piece.index && last.type === piece.type && (piece.id == null || last.id == null || piece.id === last.id);
42
+ if (!continues) {
43
+ details.push({ ...piece });
44
+ return;
45
+ }
46
+ for (const [key, value] of Object.entries(piece)) {
47
+ if (JOINED.has(key) && typeof value === 'string' && typeof last[key] === 'string') last[key] += value;
48
+ else if (value != null) last[key] = value;
49
+ }
50
+ }
51
+
52
+ /** A call's arguments as an object, or null if they aren't one. */
53
+ function argumentsOf(call) {
54
+ try {
55
+ const parsed = JSON.parse(call.function.arguments);
56
+ return isObject(parsed) ? parsed : null;
57
+ } catch {
58
+ return null;
59
+ }
60
+ }
61
+
62
+ /** What the loop gets for one call: the command, or why there is none. */
63
+ function readCall(call, tool, cutShort) {
64
+ const id = call.id;
65
+ if (call.function.name !== tool.name) return { id, error: `This call was not run: there is no tool "${call.function.name}". The one tool is ${tool.name}.` };
66
+ const given = argumentsOf(call);
67
+ if (!given) {
68
+ const why = cutShort ? ' The reply reached your output limit, which can cut a call short: write a long file in several commands.' : '';
69
+ return { id, error: `This call was not run: its arguments were not a JSON object. Call ${tool.name} with {"command": "..."}.${why}` };
70
+ }
71
+ if (typeof given.command !== 'string') return { id, error: `This call was not run: its arguments had no "command" string. Call ${tool.name} with {"command": "..."}.` };
72
+ return { id, command: given.command };
73
+ }
74
+
75
+ const usageOf = (usage) => ({
76
+ input: usage?.prompt_tokens ?? 0,
77
+ output: usage?.completion_tokens ?? 0,
78
+ cached: usage?.prompt_tokens_details?.cached_tokens ?? 0,
79
+ reasoning: usage?.completion_tokens_details?.reasoning_tokens ?? 0,
80
+ // OpenRouter's `cost` is in dollars; other servers don't send one.
81
+ ...(typeof usage?.cost === 'number' && { cost: usage.cost }),
82
+ });
83
+
84
+ /** The reply as it is kept in the conversation for the turns after it. */
85
+ function kept(message) {
86
+ const calls = message.tool_calls?.map((call) => (argumentsOf(call) ? call : { ...call, function: { ...call.function, arguments: '{}' } }));
87
+ // The reasoning goes back under the name it came by, unchanged.
88
+ const reasoning = message.reasoning_details
89
+ ? { reasoning_details: message.reasoning_details }
90
+ : message.reasoning
91
+ ? { reasoning: message.reasoning }
92
+ : message.reasoning_content
93
+ ? { reasoning_content: message.reasoning_content }
94
+ : {};
95
+ return { role: 'assistant', content: message.content || (calls ? null : ''), ...(calls && { tool_calls: calls }), ...reasoning };
96
+ }
97
+
98
+ export function open({ url, headers, model, effort, maxOutputTokens, effortField, extraBody, text, tool, signal, retries }) {
99
+ const host = new URL(url).host;
100
+ const tools = [{ type: 'function', function: { name: tool.name, description: tool.description, parameters: tool.parameters } }];
101
+ // Every message sent or received so far. A reply is added only once it
102
+ // has arrived whole, so a failed ask() leaves this as it was.
103
+ const messages = [{ role: 'user', content: text }];
104
+
105
+ return {
106
+ async ask() {
107
+ const body = { ...requestBody('chat', { model, text, maxOutputTokens, effort, effortField, stream: true, extraBody }), messages, tools };
108
+ const { response } = await request('POST', url, headers, body, { signal, retries, timeoutMs: 0 });
109
+
110
+ const message = { role: 'assistant', content: '' };
111
+ const reply = { id: null, model: null, provider: null, finish_reason: null, native_finish_reason: null, usage: null, message };
112
+ const calls = [];
113
+ const take = (chunk) => {
114
+ const choice = chunk.choices?.[0];
115
+ // OpenRouter reports a failure inside a 200, at the start or mid-answer.
116
+ if (chunk.error || choice?.finish_reason === 'error') {
117
+ throw new ProviderError(`${host} gave no answer: ${JSON.stringify(chunk.error ?? choice?.error ?? chunk).slice(0, 300)}`);
118
+ }
119
+ reply.id ??= chunk.id ?? null;
120
+ if (chunk.model) reply.model = chunk.model;
121
+ if (chunk.provider) reply.provider = chunk.provider;
122
+ if (chunk.usage) reply.usage = chunk.usage;
123
+ if (!choice) return;
124
+ if (choice.finish_reason) {
125
+ reply.finish_reason = choice.finish_reason;
126
+ reply.native_finish_reason = choice.native_finish_reason ?? null;
127
+ }
128
+ const delta = choice.delta ?? choice.message ?? {};
129
+ message.content += textOf(delta.content);
130
+ for (const field of ['reasoning', 'reasoning_content']) {
131
+ if (typeof delta[field] === 'string') message[field] = (message[field] ?? '') + delta[field];
132
+ }
133
+ for (const piece of delta.reasoning_details ?? []) addReasoning((message.reasoning_details ??= []), piece);
134
+ // A call's id and name arrive once, its arguments in pieces, all under its index.
135
+ (delta.tool_calls ?? []).forEach((piece, position) => {
136
+ const call = (calls[piece.index ?? position] ??= { id: '', type: 'function', function: { name: '', arguments: '' } });
137
+ if (piece.id) call.id = piece.id;
138
+ if (piece.function?.name) call.function.name = piece.function.name;
139
+ call.function.arguments += piece.function?.arguments ?? '';
140
+ });
141
+ };
142
+
143
+ if ((response.headers.get('content-type') ?? '').includes('event-stream')) {
144
+ await eachEvent(response, url, signal, take);
145
+ } else {
146
+ // A server that ignores `stream` answers with one JSON body: its message is read as one piece.
147
+ take(await response.json().catch(() => ({})));
148
+ }
149
+ if (calls.some(Boolean)) message.tool_calls = calls.filter(Boolean);
150
+
151
+ const made = message.tool_calls ?? [];
152
+ const reason = reply.finish_reason;
153
+ // No finish reason means the stream stopped early. Text that stops
154
+ // early is a cut-off answer; nothing at all, or half a call, is a
155
+ // lost reply, to be asked for again.
156
+ if (!reason && !made.length && !message.content) throw new ProviderError(`${host} closed the stream without an answer`);
157
+ if (!reason && made.some((call) => !argumentsOf(call))) throw new ProviderError(`${host} closed the stream in the middle of a tool call`);
158
+
159
+ messages.push(kept(message));
160
+ return {
161
+ calls: made.map((call) => readCall(call, tool, reason === 'length')),
162
+ text: message.content,
163
+ ended: made.length || reason === 'tool_calls' ? 'calls' : reason === 'stop' ? 'complete' : reason === 'content_filter' ? 'refused' : 'truncated',
164
+ id: reply.id,
165
+ servedModel: reply.model ?? model,
166
+ usage: usageOf(reply.usage),
167
+ raw: reply,
168
+ };
169
+ },
170
+
171
+ answer(results) {
172
+ for (const result of results) messages.push({ role: 'tool', tool_call_id: result.id, content: result.text });
173
+ // Many chat APIs take only text in a tool message, so the pictures
174
+ // follow in one user message, each set under the command it came from.
175
+ const parts = [];
176
+ results.forEach((result, at) => {
177
+ if (!result.images?.length) return;
178
+ const what = result.images.length > 1 ? 'images' : 'image';
179
+ parts.push({ type: 'text', text: results.length > 1 ? `The ${what} from command ${at + 1} of ${results.length}:` : `The ${what} from your command:` });
180
+ for (const image of result.images) parts.push({ type: 'image_url', image_url: { url: `data:${image.mime};base64,${image.data}` } });
181
+ });
182
+ if (parts.length) messages.push({ role: 'user', content: parts });
183
+ },
184
+
185
+ say(said) {
186
+ messages.push({ role: 'user', content: said });
187
+ },
188
+
189
+ // Nothing is stored by the provider.
190
+ async close() {},
191
+ };
192
+ }