vectorbench 0.0.0-stage → 3.0.2
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 +10 -0
- package/LICENSE +201 -0
- package/NOTICE +49 -0
- package/README.md +164 -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 +629 -0
- package/harness/codex-account.mjs +122 -0
- package/harness/codex.mjs +933 -0
- package/harness/grok-build.mjs +233 -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 +113 -0
- package/scripts/harness.mjs +547 -0
- package/scripts/partner.mjs +140 -0
- package/scripts/zip.mjs +77 -0
- package/src/model-apis.js +516 -0
- package/worker/svg.js +350 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# The sandbox, in short
|
|
2
|
+
|
|
3
|
+
Your entry is `/work/drawing.svg`. Under 200 KB, passing `check`.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
view drawing.svg [SIZE] the drawing as voters see it (128 is a thumbnail)
|
|
8
|
+
zoom drawing.svg X Y W H [SIZE] one region close up, in the drawing's own coordinates
|
|
9
|
+
compare a.svg b.svg [c.svg] versions side by side
|
|
10
|
+
frames drawing.svg [SECONDS...] an animated drawing at several moments
|
|
11
|
+
render IN.svg OUT.png [SIZE] the same picture saved as a PNG
|
|
12
|
+
check drawing.svg would the site accept it?
|
|
13
|
+
weigh drawing.svg where the bytes go
|
|
14
|
+
shrink IN.svg OUT.svg [DIGITS] smaller with SVGO, and whether the picture changed
|
|
15
|
+
submit hand in drawing.svg (final)
|
|
16
|
+
|
|
17
|
+
## Drawing a solid object in 3D: vb3d
|
|
18
|
+
|
|
19
|
+
Build the parts as meshes, light them, and get shaded SVG with hidden
|
|
20
|
+
surfaces removed, cast shadows and exact outlines. `python3 -c 'import vb3d; help(vb3d)'`
|
|
21
|
+
has the whole guide.
|
|
22
|
+
|
|
23
|
+
import trimesh, vb3d
|
|
24
|
+
body = trimesh.creation.capsule(height=60, radius=20)
|
|
25
|
+
cap = trimesh.creation.cylinder(radius=9, height=6).apply_translation((0, 0, 22))
|
|
26
|
+
scene = vb3d.Scene(frame=(0, 0, 1024, 1024))
|
|
27
|
+
scene.camera(eye=(80, -160, 140), target=(0, 0, 0))
|
|
28
|
+
scene.light(direction=(-0.4, -0.5, 1))
|
|
29
|
+
scene.add('body', body, color='#ece9e2', gloss=0.35)
|
|
30
|
+
scene.add('cap', cap, color='#55595c')
|
|
31
|
+
svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">' + scene.render() + '</svg>'
|
|
32
|
+
open('drawing.svg', 'w').write(svg)
|
|
33
|
+
|
|
34
|
+
Mix it with your own drawing: `scene.outline(name)` and `scene.edges(name)`
|
|
35
|
+
give path data to draw over, `scene.project(points)` puts 3D points in 2D.
|
|
36
|
+
manifold3d (`from manifold3d import Manifold`) adds booleans, hulls,
|
|
37
|
+
smoothing and shapes from signed-distance functions.
|
|
38
|
+
|
|
39
|
+
## Import names
|
|
40
|
+
|
|
41
|
+
import pathops # skia-pathops: boolean operations on curved paths
|
|
42
|
+
import cv2 # OpenCV
|
|
43
|
+
import opensimplex # noise
|
|
44
|
+
from coloraide import Color # perceptual colour (OKLCH)
|
|
45
|
+
import trimesh, manifold3d, vb3d
|
|
46
|
+
fc-list : family file # every typeface, with its file, for fontTools
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The site's own acceptance check (worker/svg.js, copied into the image as
|
|
2
|
+
// svg.js when it is built), so a model in the sandbox gets the verdict the
|
|
3
|
+
// site would give.
|
|
4
|
+
//
|
|
5
|
+
// node check.mjs IN.svg CLEANED.svg prints { ok, message, kb, limit }
|
|
6
|
+
|
|
7
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { MAX_SVG_BYTES, cleanSvg } from './svg.js';
|
|
9
|
+
|
|
10
|
+
const [source, cleaned] = process.argv.slice(2);
|
|
11
|
+
const limit = MAX_SVG_BYTES / 1024;
|
|
12
|
+
try {
|
|
13
|
+
const { svg, bytes } = cleanSvg(readFileSync(source, 'utf8'));
|
|
14
|
+
writeFileSync(cleaned, svg);
|
|
15
|
+
console.log(JSON.stringify({ ok: true, kb: Math.ceil(bytes / 1024), limit }));
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.log(JSON.stringify({ ok: false, message: error.message, limit }));
|
|
18
|
+
}
|